Skip to content

Instantly share code, notes, and snippets.

View larzconwell's full-sized avatar

Larz Conwell larzconwell

View GitHub Profile
#!/usr/bin/env bash
if [[ "${APP_FILE}" == "" ]]; then
APP_FILE="app3.js"
fi
echo "TTNRT : about to forever start ${APP_FILE}"
if [[ "${1}" == "start" ]]; then
echo "Starting: ${APP_FILE}"
var async = require('async');
function some (items, iterator) {
var ret = -1,
v;
for (var i in items) {
v = iterator(items[i]);
if (v) {
@larzconwell
larzconwell / gist:6076307
Last active December 20, 2015 05:09
A new shell language reference/specification

Hive

Comments

# Single-line comments

##
  Multi-line comments
##
@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}]%}'