Skip to content

Instantly share code, notes, and snippets.

View johnbintz's full-sized avatar

John Bintz johnbintz

View GitHub Profile
@johnbintz
johnbintz / scss.lang
Created May 4, 2011 20:19
Super-basic SCSS formatting for SHJS
# language definition for scss style sheets
include "c_comment.lang"
string = '#[a-f0-9]{3,6}'
keyword = '[\#\.]+(?=\{)'
selector = '[#\.][[:word:]]+'
keyword = '\$([^ :;]+)'
@johnbintz
johnbintz / Running watchr.sh
Created May 10, 2011 18:42
Running RSpec and jasmine-headless-webkit using watchr
# all tests, run all at start
ACCEPTANCE=true watchr test.watchr
# all tests, don't run at start
ACCEPTANCE=true watchr test.watchr -- -f
# skip acceptance (the slow ones)
watchr test.watchr
@johnbintz
johnbintz / script-hooks-pre-commit.sh
Created May 10, 2011 20:54
A way to distribute git hooks with a Rails app and have them easily installed
#!/bin/bash
rspec spec
if [ $? -ne 0 ]; then exit 1; fi
@johnbintz
johnbintz / guard-rails.rb
Created May 27, 2011 18:24
Use Guard to restart Rails development server when important things change
def rails
system %{sh -c '[[ -f tmp/pids/development.pid ]] && kill $(cat tmp/pids/development.pid)'}
system %{rails s -d}
end
guard 'shell' do
watch(%r{config/(.*)}) { rails }
watch(%r{lib/(.*)}) { rails }
end
@johnbintz
johnbintz / my_spec.coffee
Created June 6, 2011 21:07
Modular extensions to Jasmine specs using CoffeeScript & Underscore
describe 'A thing', ->
it 'should make an other thing', ->
this.utilityFunction("test")
expect(this.otherThing).toEqual("test")
@johnbintz
johnbintz / assets.yml
Created June 8, 2011 19:57
Using haml-js with Jammit
compress_assets: off
gzip_assets: off
template_function: Haml
template_extension: js.haml
javascripts:
common:
- public/javascripts/haml.js
- app/views/**/*.js.haml
@johnbintz
johnbintz / helper.coffee
Created June 14, 2011 20:32
Make Backbone report validation errors, much like @model.save! in Rails
class Backbone.ValidatingModel extends Backbone.Model
_performValidation: (attrs, options = {}) ->
_options = _.clone(options)
_options.error = (model, error, opts) ->
throw new Error(error)
super(attrs, _options)
+++ bind.c 2010-10-28 23:09:12.788260925 +0200
@@ -1508,6 +1508,9 @@
static int sv_histsize PARAMS((const char *));
static int sv_isrchterm PARAMS((const char *));
static int sv_keymap PARAMS((const char *));
+static int sv_vi_insert_prompt PARAMS((const char *));
+static int sv_vi_command_prompt PARAMS((const char *));
+static int sv_vi_mode_changed_bin PARAMS((const char *));
static const struct {
@johnbintz
johnbintz / gist:1092247
Created July 19, 2011 13:09
Install new Ruby using RVM and with require patch
file="/tmp/ruby-1.9.2p290.patch"
curl https://raw.github.com/gist/1008945/4edd1e1dcc1f0db52d4816843a9d1e6b60661122/ruby-1.9.2p290.patch > $file
rvm install 1.9.2 --patch $file
rvm 1.9.2
gem install bundler
@johnbintz
johnbintz / Guardfile.rb
Created August 3, 2011 22:33
Guard::Hydra to use Hydra for run_all
require 'guard'
require 'guard/guard'
require 'guard/rspec'
module ::Guard
class ::Guard::Hydra < ::Guard::RSpec
def start
UI.info "Guard::Hydra is giving Guard::RSpec super run_all powers. Whoa!"
super
end