Skip to content

Instantly share code, notes, and snippets.

View seven1m's full-sized avatar

Tim Morgan seven1m

View GitHub Profile
@seven1m
seven1m / abbr.rb
Created December 20, 2010 06:30
bible book abbreviations and chapter/verse numbers
# (semi) official book name as hash key
# abbreviations in array as value
ABBR = {
"Genesis" => [
"Gen",
"Ge",
"Gn"
],
"Exodus" => [
# this has NOT been tested!
require 'net/http'
require 'uri'
uri = URI("http://google.com")
content = ''
Net::HTTP.get_response(uri) do |res|
return if res.header['Content-Type'].split(';').first != 'text/html'
@seven1m
seven1m / build_winexe.sh
Created February 24, 2011 22:45
Install winexe on Ubuntu
# This works as of Feb 2011 on Ubuntu Maverick
sudo apt-get install build-essential autoconf checkinstall
svn co http://dev.zenoss.org/svn/trunk/wmi/Samba/source
cd source
wget https://gist.github.com/raw/843062/5bb87c4fa13688f65ca8b1e54fc42676aee42e5a/fix_winexe_service.diff
patch -p0 -i fix_winexe_service.diff
./autogen.sh
./configure
make proto bin/winexe
@seven1m
seven1m / sass_with_jammit.rb
Created April 13, 2011 20:59
SASS with Jammit
# hack to auto compile sass when Jammit runs in Dev/Test mode
require 'haml/util'
require 'sass/engine'
module Jammit
module Helper
SASS_TIMESTAMPS = {}
def include_stylesheets_with_sass(*packages)
@seven1m
seven1m / templates.js.coffee.erb
Created May 24, 2011 22:24
Render ERB JS templates with Underscore.js and Sprockets and Tilt in Rails 3.1
# creates a global JST object containing all the templates
# 1. install Tilt in your Gemspec
# 2. Paste this in a file at app/assets/javascripts/templates.js.coffee.erb
# 3. `require` the templates file from your main js include file.
# 4. Put your templates at app/views/whatever/my_template.html.jst
window.JST =
<% Dir[Rails.root.join('app/views/**/*.jst')].each do |path| %>
<%= path.match(%r{/([^/]+)\.html\.jst$})[1] %>: _.template(<%= File.read(path).inspect.gsub(/\r?\n/, '') %>)
<% end %>
@seven1m
seven1m / solarized.patch
Created May 27, 2011 03:39
More visible cursor color in visual selection mode.
diff --git a/colors/solarized.vim b/colors/solarized.vim
index 81c2c99..8085e7c 100644
--- a/colors/solarized.vim
+++ b/colors/solarized.vim
@@ -667,7 +667,7 @@ exe "hi StatusLine" . s:fg_base0 .s:bg_base02 .s:fmt_none
exe "hi StatusLineNC" . s:fg_base1 .s:bg_base02 .s:fmt_none
exe "hi VertSplit" . s:fg_base0 .s:bg_base02 .s:fmt_none
exe "hi Title" . s:fg_orange .s:bg_none .s:fmt_bold
-exe "hi Visual" . s:fg_none .s:bg_base02 .s:fmt_stnd
+exe "hi Visual" . s:fg_none .s:bg_base0 .s:fmt_stnd
@seven1m
seven1m / gist:1005465
Created June 2, 2011 22:22
dwm startup script
We couldn’t find that file to show.
@seven1m
seven1m / robot.rb
Created June 10, 2011 05:07
Solution to PuzzleNode problem #4 - Robots vs. Lasers
#!/usr/bin/env ruby
class Enumerator
def count_with_index
count = 0
each_with_index do |item, index|
count += yield(item, index) ? 1 : 0
end
count
end
@seven1m
seven1m / .bashrc
Created June 14, 2011 16:03
install rvm in .bashrc
# If not running interactively, don't do anything
if [[ -n "$PS1" ]]; then
...
fi
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
@seven1m
seven1m / fuzzyfinder.vim.diff
Created July 1, 2011 03:09
FIXED: FuzzyFinder in Vim 7.3 setting nobuflisted on some buffers
diff --git a/plugin/fuzzyfinder.vim b/plugin/fuzzyfinder.vim
index a717bfd..f5d42fa 100644
--- a/plugin/fuzzyfinder.vim
+++ b/plugin/fuzzyfinder.vim
@@ -872,6 +872,7 @@ endfunction
"
function! g:FuzzyFinderMode.Buffer.on_buf_enter()
call self.update_buf_times()
+ setlocal buflisted
endfunction