Skip to content

Instantly share code, notes, and snippets.

View statianzo's full-sized avatar
🎯
Focusing

Jason Staten statianzo

🎯
Focusing
View GitHub Profile
if File.exists? '.env'
File.readlines('.env').
map{|l| l.chomp }.
reject{|l| l.empty?}.
map{|l| l.split '='}.
each {|k,v| ENV[k] ||= v}
end
IRB.conf[:USE_READLINE] = true
IRB.conf[:AUTO_INDENT] = false
@statianzo
statianzo / MyLockingStream.cs
Created December 13, 2012 19:33
Canan Kasaci's wrapper
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace Fleck
set t_Co=16
call pathogen#runtime_append_all_bundles()
syntax on
"let g:solarized_termcolors=256
colorscheme solarized
set background=dark
filetype plugin indent on
set nocompatible " We don't want vi compatibility.
@statianzo
statianzo / update_bundles.rb
Created October 17, 2012 17:29
Rebuilds pathogen bundle folder
#!/usr/bin/env ruby
git_bundles = [
"git://github.com/msanders/snipmate.vim.git",
#"git://github.com/scrooloose/nerdtree.git",
#"git://github.com/tpope/vim-haml.git",
"git://github.com/tpope/vim-markdown.git",
#"git://github.com/tpope/vim-rails.git",
#"git://github.com/tpope/vim-repeat.git",
#"git://github.com/tpope/vim-surround.git",
@statianzo
statianzo / selectable_queue.rb
Created September 10, 2012 19:02 — forked from garybernhardt/selectable_queue.rb
A queue that you can pass to IO.select. This is for use in a GUI application. I'm not turning into a Node programmer.
# A queue that you can pass to IO.select.
#
# NOT THREAD SAFE: Only one thread should write; only one thread should read.
#
# Purpose:
# Allow easy integration of data-producing threads into event loops. The
# queue will be readable from select's perspective as long as there are
# objects in the queue.
#
# Implementation:
@statianzo
statianzo / error_handler.rb
Created August 27, 2012 17:25 — forked from bdotdub/error_handler.rb
Hoptoad notifier for Sinatra
error do
exception = request.env['sinatra.error']
Hoptoad::Notifier.send_error exception, params, request.env if %w(staging production).include?(ENV['RACK_ENV'])
erb :five_hundred
end
@statianzo
statianzo / decode.rb
Created July 9, 2012 09:03
URUG Decoding
# {"1"=>"a", "2"=>"b" ... }
CHARS = Hash[('a'..'z').each_with_index.map{|char, i| [i.succ.to_s, char]}]
def decode(encoded, cur=[])
return cur.join if encoded.nil? || encoded.empty?
h1 = CHARS[encoded[0]]
h2 = CHARS[encoded[0,2]]
result = []
result << decode(encoded[1..-1], cur+[h1]) if h1 && encoded[1] != '0'
gem: --no-rdoc --no-ri
#!/bin/sh
FORMAT=$(echo -e "\033[1;33m%w%f\033[0m written")
"$@"
while inotifywait -qre close_write --exclude "/\." --format "$FORMAT" .
do
"$@"
done
@statianzo
statianzo / config
Created March 13, 2012 14:18
Put in ~/.bundle/config to prevent global gem installs
---
BUNDLE_BIN: vendor/bundle/bin
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'