Skip to content

Instantly share code, notes, and snippets.

View larzconwell's full-sized avatar

Larz Conwell larzconwell

View GitHub Profile
@larzconwell
larzconwell / gist:5710523
Created June 4, 2013 23:34
Correlation between people who use tabs vs spaces and people use double vs single spacing after sentence (WIP)
var request = require('request'),
async = require('async');
// Gets the first >=1000 unique(not forked) repos from Github
function getRepos (callback) {
var repos = [],
lastId = 0,
reqOpts = {
uri: 'https://api.github.com/repositories',
qs: {since: 0},
@larzconwell
larzconwell / layout_state.js
Last active December 16, 2015 18:39
This is the state for one of the incorrectly rendered pages from lib/template/template_node.js in the handleLoaded function. Layouts and templates are split up and joined later via the yield function in layouts.
// Here if you look at the content field the template replaced
// from yield(in the adapter.template field), it's different
// than the content field from the template_state.js content field.
{ id: 0,
data:
{ registered: true,
file: 'app/views/layouts/application.html.ejs',
ext: '.ejs',
baseName: 'application',
baseNamePath: 'app/views/layouts/application' },
@larzconwell
larzconwell / file.rb
Created April 12, 2013 22:48
Go versioning
// In a package file, version only
// needs to be included in one
// source file
package test, "1.2.3-pre"
// In another program
import (
fmt fmt
test github.com/hey/test, "1.2.3-pre"
)
% ~ ✓ 0 › rvm install 1.9.3
Unrecognized command line argument: '1.9.3' ( see: 'rvm usage' )
% ~ × 1 ›
# Open node documentation in your browser.
# Usage: node-docs [module=all] [version=$(node --version)]
function node-docs() {
local version="$(node --version)"
local module="all"
local url="http://nodejs.org/docs/"
if [[ "$2" != "" ]]; then
version="v$2"
fi
@larzconwell
larzconwell / gist:4679121
Created January 31, 2013 01:30
ZSH: Call `ls -a` whenever we change directories(includes changing dirs when autocd is set)
function chpwd() {
emulate -L zsh
ls -a
}
# Display prompt
#PS1='%~:%# '
setopt prompt_subst
autoload colors
autoload -Uz vcs_info
colors
# Set colors for easier reading
for COLOR in RED GREEN YELLOW BLUE WHITE BLACK CYAN; do
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
@larzconwell
larzconwell / gist:4470370
Last active December 10, 2015 17:48
Handle asset compiling in Geddy, temp solution
/*
* Simple asset compiler for Geddy, should be okay to use in production as it
* creates on init, and only updates when files change.
* (though it would waste resources as it still watches the dirs)
*
* To use do the following in your shell:
* mkdir -p app/assets/{css,js}
* touch config/after_start.js
*
* after that just copy these contents into config/after_start.js
shopt -e nocaseglob
set -e
clear
#
# Variables
#
GoVersion="1.0.3"
RedisVersion="2.6.7"
# These $(pkg-config) commands don't expand when building objects and binaries
CFLAGS=-std=c99 -Wall -g $(pkg-config --cflags apr-1 apr-util-1)
LDFLAGS=$(pkg-config --libs apr-1 apr-util-1)
whatever: bstrlib.o