project posts page 2

10k Apart

I have spent much of my free time the last 12 days working on a project for the 10k Apart challenge. 10k Apart is a challenge to make a compelling progressively enhanced, accessible site with 10 KB or less of initial payload per page (more can be lazy-loaded). I decided to build an implementation of Conway’s Game of Life, which I had wanted to do since going to a Code Retreat a while back.

Continue reading post "10k Apart"

GiveCamp 2016 done

GiveCamp 2016 is over. Another successful year. The new Cleveland Garlic Festival site is live. I didn’t do much on the site the final day besides for fix some URLs and move some files to help with the launch. I did break away to help another team fix some issues with image sliders on the homepage. Not just any team, but one doing some updates to the Cleveland GiveCamp website. I don’t believe those changes are live yet though. During this, I got to work a little while with my cousin’s friend Dara for the first time.

As usual this year, I recognized a number of people from previous years. My project manager was a project manager from a couple years ago. I talked to several of the people I’ve worked with in the past and have seen multiple years. There is definitely a networking aspect to the event. Some of the people I see at meetups and other events.

Continue reading post "GiveCamp 2016 done"

GiveCamp 2016 day 2

Day 2 of GiveCamp is complete. My team is in quite good shape. We shed one member early on. I too left to be re-purposed, but that didn’t last long. I briefly helped one team determine that, after my attempt to help them hack a plugin, it was time to jump ship to another. They didn’t need my further assistance, and the organizers couldn’t find another place for me, so I went back to my original team. Another of our members went home early. Even at a relaxed pace and searching for things to do, we were able to complete their nice-to-haves and improve some things from their quick-setup state. Tomorrow should be easy.

The event of the day more present on my mind at the moment is that my tent pole broke. When I first lay down in it, I saw the pole going at a weird angle. I got out and pulled the fly partly off to find the pole split and rather sharp. The tent was standing alright, but, not wanting the pole to poke through the fly, I attempted to fix it. I spent like an hour between working on and thinking of a field repair. In the end, nothing really got the broken pieces to stay together when the pole was arched. Now I lay in a slightly tilted, wonky tent, tired My tent is a Eureka Midori, and this is the second Eureka I’ve had the pole break on. Neither had I used very many times, maybe a handful each. Disappointing.


Givecamp 2016 day 1

First day of GiveCamp 2016. Working on the Cleveland Garlic Festival website. Seems like it’s going to be another relatively easy one, as I think the last few have been. We are rebuilding the site to run on WordPress and be responsive, plus other general improvements as we go. I’m on a team of four plus one organization representative. Things are going smoothly.


Givecamp 2014: Lake Erie Ink

Lake Erie Ink mobile home page
Slightly over a week ago, I finished my fourth Cleveland GiveCamp. GiveCamp is a weekend of developing websites and other things for area nonprofits. As usual, it was a good time. My project this year was an update to Lake Erie Ink’s site. They had actually had their site built at the GiveCamp two years prior (I was not on that project, but know someone who was). They just wanted a map added to their site that showed where kids were writing or writing about. With six developers and a developing project manager, along with a WordPress plugin, we were able to get the basic functionality working rather quickly. So quickly that we had something working Friday night and started shedding developers to other projects. By Sunday it was basically down to just me and the project manager (plus the Lake Erie Ink people, of course). We added in some extra improvements in addition to the map. We brought in a couple of designers for brief stints to help us with some design issues.

For my part, I did help some with the map, but spent most of my time making their site responsive and tweaking the home page to include a callout for the map page. The site had not been designed with responsiveness in mind at all. It had nested divs with fixed pixel widths that accommodated padding of the parents’ even when width: 100% would’ve done the same thing. In addition, id’s were used a lot, even multiple times per page, there was a lot of unnecessary redundancy and extra CSS in the styles (such as repeated blocks and things like margin: 0px 0px 0px 0px), and extra heading elements were made up to provide extra heading styles (h7, h8, and h9). The templates were confusing at times and some had different versions or nearly identical related templates.

Continue reading post "Givecamp 2014: Lake Erie Ink"

Working with Composer ‘scripts’ and ‘extra’ from Non-Root Package

The goal of my Symfony StandardEditionBundle is to capture as much of the logic and configuration of the Symfony Standard Edition as possible to make it easy to upgrade between versions with as little modification to the in place application as possible. Among things I wanted to try to get into the bundle was as much as possible of the composer configuration file. It contains a ‘scripts’ key of scripts or functions from packages that are supposed to be run upon install / update by composer to set up the application (for instance, one script walks you through creating the ‘parameters.yml’ configuration file). There is also an ‘extra’ key used as configuration for these scripts.

Scripts

Composer only allows the ‘scripts’ to be defined in the root ‘composer.json’, ie the one in your application. The idea is that scripts will only run that the owner has explicitly given permission to, and thus trust. This prevented me from putting them directly in my bundle’s ‘composer.json’, as they would be ignored. My solution was to create functions in my bundle that run the ‘scripts’ from Symfony Standard Edition and can be placed in the root application’s ‘composer.json’. This way, the application wouldn’t have to change those scripts unless Symfony Standard added ‘scripts’ for more events (since they are specified with the composer event they are to be run for).

Continue reading post "Working with Composer ‘scripts’ and ‘extra’ from Non-Root Package"

Notes on Using PHP Class With Statics for Configuration

I will be talking about using namespaced PHP classes with static properties for configuration. Since my use was in relation to Symfony, it is important to note that the Config component should be used for everything possible, but that it can’t be used before it is instantiated.

Reasons to use namespaced static class properties for configuration:

  • A class can be defined in a file. When that file is included from elsewhere, the class is defined.
  • Once a class is defined, it is accessible anywhere after that point, regardless of scope. Like a superglobal.
  • Statics are variables set on a class rather than on an instance and can be accessed directly from the class. This means no variables outside of the class need to be set to work with the variables. Like a superglobal singleton.
  • Statics are not static and can be modified just like any other variables.
  • Static methods can control access and provide other behaviors you may want for working with your configuration.
  • Namespaces help prevent collisions of class names by essentially adding characters to a class name that make it less likely to be used elsewhere. With psr-0 / psr-4 autoloaders, the namespaces should be well controlled.
  • Variables can’t be namespaced, so classes (or constants or functions) are the only way to take advantage of their benefits.
  • Using constants and functions inside of a namespace is similar to static properties and methods of a class, except the constants are immutable and have limited data types, and there aren’t the niceties like self for the functions.
  • Being in PHP (as opposed to some config file format) allows use of __DIR__ (my primary need was for storing paths, and it wouldn’t be ideal to have to put in the full filesystem paths to things), string concatenation and other operations, and any other PHP behavior or values desired.
Continue reading post "Notes on Using PHP Class With Statics for Configuration"

Symfony Console

This passed weekend, I released a github project called sy-console. It is a starting point for building command line applications that takes the symfony console component and adds symfony’s dependency injection, configuration handling, plus some other niceties like automatically adding commands from configured directories. If you don’t want those features, you can use the console component directly, but if you do, this takes some of the pain out of setting those up.

Background

I spend a fair amount of time doing things on the command line. I’ve made plenty of command line scripts, mostly in bash. Bash is kind of a pain to work with for anything beyond simple command running scripts. The control structures are a bit limited and have a hard to remember syntax. Data structures are very limited. There’s no such thing as object orientation. Working with Symfony, I really liked the console component, how easy it was to add commands to app/console, how easy it was to work with arguments, how configuration and services were shared between commands, how it was PHP. I’ve been wanting to use the component for standalone CLI apps for a while now, but was struggling to find how to make it work independently from a full blown Symfony Standard Edition install. I finally found enough resources to get me started and had the requisite free time.

Continue reading post "Symfony Console"

WPThemeHelper, my helper for WordPress themes

In remaking my website using WordPress, I’ve been working on a base theme that I can use for other sites. I decided to take some of my experience from the Symfony world, such as organizing functionality into namespaced classes, grouped into “bundles” of functionality that can be (somewhat) independently installed as needed depending on the project. I already mentioned the PHP-BufferManager I’m using in a previous post. I’ve also created a more specific to WordPress project with more varied functionality, a theme helper called WPThemeHelper.

The theme helper has several classes to help make theme development cleaner and perhaps a bit easier. The readme on github has more details, but some of the more important ones are:

  • SettingHelper: Allows setting of WordPress settings with a map (associative array). It calls the appropriate WordPress function at the appropriate time in WordPress’s initialization cycle. Helps clean up the ‘functions.php’ file and makes remembering what functions to call for various theme settings easier.
Continue reading post "WPThemeHelper, my helper for WordPress themes"