Skip to content

Instantly share code, notes, and snippets.

I help developers craft their best work, achieve goals, and never stop growing.

Jonathan Lee Martin nybblr

I help developers craft their best work, achieve goals, and never stop growing.
View GitHub Profile
iamvery /
Created June 3, 2014 18:59
Game of Life WIP with @nybblr
# Live cells with < 2 living neighbors dies to underpop
# > 3 living neighbors dies to overpop
# Otherwise, lives!
# Dead cells with exactly 3 living neighbors is born
# . 0 .
# . 0 .
# . 0 .
ef4 / gist:82f37eb5dae4e56467b6
Created June 16, 2014 21:13
Example Application Cache "Bootloader"
View gist:82f37eb5dae4e56467b6
function useManifest(content){
var tag;
var stylesheets = content.match(/\/css\/.*\.css/g);
for (var i=0; i<stylesheets.length; i++){
tag = document.createElement('link');
tag.href = stylesheets[i];
tag.rel = "stylesheet";
oivoodoo / nested_attributes_parameters.rb
Created July 25, 2013 14:12
Enabled not numeric ids for the nested attributes using strong parameters
View nested_attributes_parameters.rb
require 'delegate'
# Because of using guid ids for the nested attributes we should define
# custom permit method. By default strong_parameters accept only numeric
# keys for the nested attributes in the fields_for form.
# Usage:
# params[:app][:nested_attributes] =[:app][:nested_attributes](
# params.require(:app).permit(:nested_attributes => [:id, :attribute1, :attribute2] => { '51e52eb101790c31ba000001' => { 'id' => '51e52eb101790c31ba000001', 'attribute1' => 'value1', 'attribute2' => 'value2' } } }
stevenharman / bin-puma
Last active December 21, 2015 04:39
A wrapper script that will start a local SSH tunnel (only in development environment), and then start Puma as normal. I use this with foreman from a Procfile.
View bin-puma
#!/usr/bin/env sh
# For the payment gateway callback URL
if [ "$CURRENT_ENV" == "development" ]; then
PORT_SSL=$(expr $PORT + 1)
echo "starting an SSL tunnel from :$PORT_SSL --(--)--> :$PORT"
bundle exec tunnels $PORT_SSL$PORT &
View multimethod.rb
class Module
def dispatch(*klasses, last)
last_klass, mid = last.first
klasses << last_klass
__dispatch_list << [klasses, instance_method(mid)]
define_method(mid, __dispatch_proc(__dispatch_list))
def __dispatch_list
@__dispatch_list ||= []
jarrodhroberson / CalcMD5Worker.js
Created November 26, 2013 00:09
Reading a File in chunks with the HTML5 FileReader API and calculating MD5 hash codes of the contents with the spark-md5 library in a WebWorker.
View CalcMD5Worker.js
function calcMD5(f) {
var blobSlice = Blob.prototype.slice;
var chunkSize = 2097152;
var chunks = Math.ceil(f.size/chunkSize);
var spark = new SparkMD5.ArrayBuffer();
var currentChunk = 0;
var fr = new FileReader();
pouriaalmassi / ios-bootcamp-resources.markdown
Last active January 4, 2016 06:58 — forked from owen-bnr/ios-bootcamp-resources
iOS & OS X Developer Resources
View ios-bootcamp-resources.markdown


  • ASCII WWDC - WWDC session transcripts.
  • NSHipster - Cocoa weekly from Mattt Thompson. Creator of AFNetworking.
  • - Great resource where each issue consists of a collection posts that all focus on one over arching topic such as testing, Auto Layout, Swift, etc.
  • Mike Ash - Self described as "Wizard without portfolio" Mike Ash is very widely read in the Cocoa community.
  • Bill Bumgarner's Stack Overflow answers - Long time Apple developer who provides well written answers to some of the hairier questions on ObjC and iOS.
  • iOS Dev Weekly - Excellent and widely read weekly that aggregates some of the best writing in the Cocoa developer community.
  • Stable Kernel - Joe Conway, one of the original authors of BNR's Beginning iOS book and former BNR engineer and instructor.
  • [Big Nerd Ran
iamvery / Chat.elm
Last active July 11, 2017 15:54
Elm with a React head, cause why not?
View Chat.elm
port module Chat exposing (main)
import Json.Decode
import WebSocket
port messages : List String -> Cmd msg
visnup / listenOnPortOrSocketFile.js
Last active May 17, 2019 11:57
Listen on a TCP port or a UNIX socket file in node.js. Handle EADDRINUSE for the socket file by deleting it and re-listening.
View listenOnPortOrSocketFile.js
var fs = require('fs')
, net = require('net')
, http = require('http')
, port = process.env.PORT;
var app = function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
rf- / validator.rb
Created April 6, 2012 19:57
Demonstrate validation of arbitrary fields (e.g., hstore)
View validator.rb
#!/usr/bin/env ruby
require 'active_record'
:adapter => 'sqlite3',
:database => ':memory:'
ActiveRecord::Schema.define do