Skip to content

Instantly share code, notes, and snippets.

@bryanp
bryanp / pakyow-full.html
Last active August 29, 2015 14:02
Faster View Manip
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Pakyow - Ruby Web Framework</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" media="screen, projection" href="/stylesheets/screen.css">
<link rel="stylesheet" type="text/css" media="print" href="/stylesheets/print.css">
<link rel="shortcut icon" type="image/png" href="/favicon.png">
" by CJ Lazell github.com/cj
" based on - http://github.com/solars/github-vim/
if exists("loaded_github") || &cp
finish
endif
" --- main functions --- "
@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',
@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 / 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 / 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) {
@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'

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 / 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)
# I created this because the headless webkit doesn't handle click/mouse events very well
# so when using jquery events/binds like click/focus/mousedown etc... the tests weren't passing
# because the javascript wasn't being executed because no mosue event was triggered
# this gets around that and works just like fill_in
def jquery_fill_in(selector, options)
page.execute_script %Q{
$('body').focus;
if((selector = $('##{selector}')).length || ($selector = $('label:contains(#{selector})').parent().find(':input')).length) {
$selector.focus().click().val('#{options[:with]}').keydown();
} else {