I like code that doesn’t leave the left margin for long because it’s easier for me to see chunks of code. It also allows me to interleave code, which sometimes makes a lot of sense.
Using OOP, Grunt can be made to have this style. I took the Gruntfile for jquery and made it stay to the left margin while working the same way.
I won’t be sending a pull request, but I may do this on one of my own projects.
I’ve started playing with Component again after finding some neat devs/projects/companies that use it. I also checked out ES6 generators in the development version of node and Koa which uses generators. Pretty neat stuff!
I created an example app that uses both Koa and Component but doesn’t do anything server-side. A possible future project is to make my example app use a server-side JSON API to do something.
Update: I got it to animate all of the divs. My mistake was that I had the divs changing their position in the DOM, in addition to changing the CSS properties. Some of the divs didn’t change position in the DOM because their index was the same both alphabetically and by population, and these were animated.
I played with React some more, this time loading it from a CDN with the jsx compiler. I set the CSS properties on the divs and tried animating them using CSS3 transitions. Some are animated while some move to their new position instantaneously.
I made a little sign-up form example with React.
I built it in RequireBin. The main react model in isn’t working in RequireBin and I’m working to get it fixed. In the meantime I’ve published benatkin-react to npm which makes the minimal changes needed to get it to work (none to the code, just to the packaging).
The sign-up form I made has validation which highlights invalid fields with red after an attempt has been made to enter it in correctly.
I used these resources to help me get it done:
I recently came up with a couple of pipeable perl one-liners.
perl -pechop is a shortened form of
perl -p -e chop. Here are the parts of it, explained:
perl– the perl executable, here for completeness. to learn about the options, type
man perlruninto your terminal.
-p– perl assumes a loop around the program where it reads each line from the standard input and prints the output. since it’s a single character option that doesn’t take a parameter, it can be grouped with other options.
-e– evaluates (runs) the string that’s passed to it. the way perl’s option parser works, when an option takes data, it uses the rest of the command line parameter. so it can be shortened from
perl -p -e chopto
perl -pechop. This makes it short enough that typing it in often shouldn’t be a problem.
chop– the perl subroutine
choptakes the current input and chops the last character off it. It’s handy for chopping the newline. For example
pwd | perl -pechopwill print the current directory to standard output. It can then be piped to the command to save the current directory to the clipboard (
pbcopyon mac os x.
Another perl subroutine,
chomp, removes the last character of a line but only if it’s the newline character. It’s useful when you don’t know if there’s a newline. The corresponding perl one-liner is
life is the variety of spice (life is about the variety of spice)
spice is the variety of life (spices, and things analogous to it, are what makes life interesting)
variety is the life of spice (spice may not be able to observe itself, but during the life of cumin various things happen to it)
variety is the spice of life (original)