Skip to content

Instantly share code, notes, and snippets.

$.holdReady(true);
var imgNum = 0;
$('img.loadImg').load(function(){
if($(this).height()>1){
imgNum+=1;
if(imgNum==6){
$.holdReady(false);
}
}
});
@danvine
danvine / wait_until.rb
Created October 5, 2012 15:47 — forked from metaskills/wait_until.rb
Never sleep() using Capybara!
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
click_link 'My HomeMarks'
within '#login_area' do
fill_in 'email', with: 'will@not.work'
fill_in 'password', with: 'test'
# CLOSURES IN RUBY     Paul Cantrell    http://innig.net
# Email: username "cantrell", domain name "pobox.com"
 
# I recommend executing this file, then reading it alongside its output.
#
# Alteratively, you can give yourself a sort of Ruby test by deleting all the comments,
# then trying to guess the output of the code!
 
# A closure is a block of code which meets three criteria:
#
@danvine
danvine / gist:3428138
Created August 22, 2012 18:24
ooh fun
ừ̴̵̶̷̸̡̢̧̨̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼͇͈͉͍͎́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌̕̚ͅ͏͓͔͕͖͙͚͐͑͒͗͛ͣ͘͜͟͢͝͞͠͡
@danvine
danvine / capybara cheat sheet
Created August 14, 2012 11:36 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@danvine
danvine / call_me_baby.rb
Created August 9, 2012 12:25
Cron job to call and connect you to your daily scrum via Twilio
require 'twilio-ruby'
require 'yaml'
account_sid = 'AC--------------------------------'
auth_token = '--------------------------------'
config = {
:from => '+15555555555', # your twilio verified phone number
:to => '+15558675309', # your phone number
:url => 'http://yourdomain.com/scrum/?call=18886191583&pass=555555555' # where the Twiml XML file below is hosted
<?xml version="1.0" encoding="UTF-8"?>
<Hello>World</Hello>
@danvine
danvine / proxy.php
Created July 11, 2012 02:23
Simple php cacheing proxy for url2png.com
<?php
function url2png_v6($url, $args) {
# Get your apikey from http://url2png.com/plans
$URL2PNG_APIKEY = "PXXXX";
$URL2PNG_SECRET = "SXXXX";
# urlencode request target
@danvine
danvine / gist:3019133
Created June 29, 2012 16:48
Mobile Redirect using htaccess
# via http://stackoverflow.com/questions/3680463/mobile-redirect-using-htaccess
RewriteEngine on
RewriteBase /
# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
# Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:www.website.com]
# Check if this looks like a mobile device
# (You could add another [OR] to the second one and add in what you
@danvine
danvine / hack.sh
Created March 31, 2012 19:02 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#