Wednesday, October 18, 2017

Appearances in October

Hi all! I love helping people.  For this month I'll be at these locations:

- 10/18: Mentorship Night with Girl Develop It LA!

This event helps intro developers gain confidence and industry knowledge, so they can make awesome stuff and/or get jobs.  I've had great fun volunteering for Girl Develop It the last two years, and am curious about extending my time to the Learn Teach Code group.

- 10/24: October meetup at Coding Dojo in Burbank

I've been attending to and speaking at the Socal Python group for years. As of this year I'm also coordinating. The people are so friendly and open! It's fun just to hang out with such easy and mellow people month after month, even when discussing esoteric technical topics.

This month one talk is on Bokeh, a cool Python visualization framework. This is great for the Data Science people, as Python is the dominant platform, so a graphical package is very helpful.  And, one of my projects Shotglass is using Bokeh in a modest way, to visually understand large collections of source code.

I hope to see you there, at Burbank and Culver City!

Friday, September 15, 2017

NPM package tip

FYI the only way to install and save Node/Javascript libraries is like this:

npm install mongoose@"~4.0.8" --save

This installs anything 4.0.x — major and minor are respected.  The option “@4.0.8” would be only 4.0.8, which is fine, but probably too picky.  The default “^4.0" is terrible and will install anything with major version 4. Don’t ever do this.  It’s also the default. Programmer emptor.

For Python, I generally do "pip install package" to install the latest version of a module, then "pip freeze mypackage >> requirements.txt" to capture the exact version number.

Sunday, August 13, 2017

TIP: draw plots directly in terminal! (with iTerm2)

Example: your data is already in CSV format in "z.plt", this one-line command will render a plot and show it in the terminal:

gnuplot -e 'set terminal png ; set output "plot.png"; plot "z.plt" using 0:7 with lines' && imgcat plot.png

This is great for testing web site performance. The previous one line ran Apache Bench to beat the crap out of my local server, and write the output into a Gnuplot-compatible CSV file:

ab -n10000 -c100 -g z.plt

Tuesday, July 25, 2017

slides: Design Patterns in Python

(this page is

Slides in Google Docs, or just buy the book: "Design Patterns Explained Simply", via Sourcemaking. The have a lot of material online so check it out!

Wednesday, July 12, 2017

show all project code (a find-git-xargs example)

The following command finds all your project's Javascript files that aren't installed via NPM. It then does a "git blame" so you can see who wrote which bits of code, and how old the code is.

find . -path ./node_modules -prune -o -name '*.js' | xargs -n1 git blame --date=short --

If you're using OSX, install the GNU versions of the Unix tools

gfind . -path ./node_modules -prune -o -name '*.js' | gxargs -n1 git blame --date=short --

Those who don't understand Unix will be doomed to reimplement it. Poorly. :)

Tuesday, July 11, 2017

OSX: control-left/right moves by words in terminal

I use the three-finger-swipe to move viewports on OSX. Using control-left and -right to move by words in the terminal is VERY helpful!  Here's how to do it:

1) go into Preferences and disable control-left/right

2) add this to your ~/.bashrc file:

# control-left/right = skip by word in terminals
bind '"\e[5C": forward-word'
bind '"\e[5D": backward-word'
bind '"\e[1;5C": forward-word'

bind '"\e[1;5D": backward-word'

3) log out and back in to enable control-left/right to skip by words

hack day THIS SATURDAY in Santa Monica!

Next John Tells All Hack Day is this Saturday!
Bring a project (yours or open source), I'll talk about Python Iterators and Functional Programming for a while, then we'll work on stuff together.