Skip to content

Instantly share code, notes, and snippets.

@cj
cj / helpers.rb
Created March 8, 2012 21:05 — forked from ogredude/helpers.rb
module Helpers
def sign_in(user)
@user_session = UserSession.create user
end
def fill_in_autocomplete(selector, value)
page.execute_script %Q{$('#{selector}').val('#{value}').keydown()}
end
def choose_autocomplete(text)
module Helpers
def sign_in(user)
@user_session = UserSession.create user
end
def fill_in_autocomplete(selector, value)
page.execute_script %Q{$('#{selector}').val('#{value}').keydown()}
end
def choose_autocomplete(text)
@cj
cj / gemspec-usage.md
Created March 3, 2012 03:56 — forked from holman/gemspec-usage.md
test/spec/mini

Just install this in your apps like so:

gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'

@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@cj
cj / gist:1234672
Created September 22, 2011 12:44
Node.js Campfire bot
// main app.js
var client = require('ranger').createClient('ROOM',
'SECRET');
var timestamp = require('./timestamp').timestamp;
var getWeatherWrapper = require('./weather').getWeatherWrapper;
var showMap = require('./map').showMap;
var getTweets = require('./tweets').getTweets;
client.room(ROOMID, function(room) {
@andreaseger
andreaseger / config-initializers-resque.rb
Created September 6, 2011 14:17
carrierwave resque background image processing foo
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'
resque_config = YAML.load_file(rails_root + '/config/resque.yml')
Resque.redis = resque_config[rails_env]
#secure the admin view of resque
Resque::Server.use(Rack::Auth::Basic) do |user, password|
password == "secret"
end
@cj
cj / express_app.coffee
Created September 3, 2011 21:31 — forked from tanepiper/express_app.coffee
CoffeeScript version of the default expressjs application generated by express
# Module Dependencies
express = require 'express'
app = module.exports = express.createServer();
# Configuration
app.configure () ->
app.set 'views', "#{__dirname}/views"
app.set 'view engine', 'jade'
@cj
cj / readme.md
Created August 10, 2011 13:11
hifi ajax-form snippet

Examples

Basic example, replace .ajax-form with whatever form you want to select:

$('.ajax-form').snippet_ajax_form();

Example using options:

$.fn.snippet_ajax_form.defaults= { hide_on_success: true };

@cj
cj / index.html
Created July 14, 2011 12:36 — forked from jonalter/index.html
Titanium Desktop file upload example
<html>
<head></head>
<body style="background-color:#ffffff;margin:10px">
<script>
var uploadFile = function(){
var text = document.getElementById('txt');
var dir = Titanium.Filesystem.getResourcesDirectory();
sep = Titanium.Filesystem.getSeparator(),
// filename = 'test.txt',
" by CJ Lazell github.com/cj
" based on - http://github.com/solars/github-vim/
if exists("loaded_github") || &cp
finish
endif
" --- main functions --- "