Skip to content

Instantly share code, notes, and snippets.

View ruevaughn's full-sized avatar

Chase Jensen ruevaughn

View GitHub Profile
<?xml version="1.0" encoding="ISO-8859-1" ?>
<grammar version="1.0" xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-us" mode="dtmf" root="___ROOT___">
<rule id="___ROOT___" scope="public">
<one-of>
<item>
<item repeat="10">
<ruleref uri="#DIGITS" />
</item>
</item>
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
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')
URL Page_Title Date Transcript Img_Title Img_URL Keywords from http://www.andromedayelton.com/dckx.php
http://xkcd.com/1 Barrel - Part 1 [[A boy sits in a barrel which is floating in an ocean.]] Boy: I wonder where I'll float next? [[The barrel drifts into the distance. Nothing else can be seen.]] {{Alt: Don't we all.}} Don't we all. http://imgs.xkcd.com/comics/barrel_cropped_(1).jpg
http://xkcd.com/2 Petit Trees (sketch) [[Two trees are growing on opposite sides of a sphere.]] {{Alt-title: 'Petit' being a reference to Le Petit Prince, which I only thought about halfway through the sketch}} 'Petit' being a reference to Le Petit Prince, which I only thought about halfway through the sketch http://imgs.xkcd.com/comics/tree_cropped_(1).jpg
http://xkcd.com/3 Island (sketch) [[A sketch of an Island]] {{Alt:Hello, island}} Hello, island http://imgs.xkcd.com/comics/island_color.jpg
http://xkcd.com/4 Landscape (sketch) [[A sketch of a landscape with sun on the horizon]] {{Alt: There's a river flowing through the ocea
/* The world's smallest Brainfuck interpreter in C, by Kang Seonghoon
* http://j.mearie.org/post/1181041789/brainfuck-interpreter-in-2-lines-of-c */
s[99],*r=s,*d,c;main(a,b){char*v=1[d=b];for(;c=*v++%93;)for(b=c&2,b=c%7?a&&(c&17
?c&1?(*r+=b-1):(r+=b-1):syscall(4-!b,b,r,1),0):v;b&&c|a**r;v=d)main(!c,&a);d=v;}
@calvincorreli
calvincorreli / sorting_nested_set_children.rb
Created November 2, 2010 11:55
Reordering children using Sortable with nested_set / Awesome nested_set, and similar
def reorder_children(ordered_ids)
ordered_ids = ordered_ids.map(&:to_i)
current_ids = children.map(&:id)
unless current_ids - ordered_ids == [] && ordered_ids - current_ids == []
raise ArgumentError, "Not ordering the same ids that I have as children. My children: #{current_ids.join(", ")}. Your list: #{ordered_ids.join(", ")}. Difference: #{(current_ids - ordered_ids).join(', ')} / #{(ordered_ids - current_ids).join(', ')}"
end
j = 0
transaction do
for new_id in ordered_ids
old_id = current_ids[j]
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@heisters
heisters / Solarized High Contrast Dark.itermcolors
Created June 8, 2011 21:49
Solarized High Contrast Dark theme for iTerm2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.15575926005840302</real>
@ghthor
ghthor / vimrc
Created October 20, 2011 12:18
Vimrc File
set nocompatible
set noedcompatible
set hidden
" Pathogen bundle manager
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
" Indention and Syntax
@jboner
jboner / latency.txt
Last active November 18, 2024 08:23
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@thebinarypenguin
thebinarypenguin / colorize.rb
Created June 29, 2012 14:09
A simple function to colorize console output of Ruby scripts using ANSI escape codes.
def colorize(value, color)
case color
when :black then "\e[30m" + value.to_s + "\e[0m"
when :red then "\e[31m" + value.to_s + "\e[0m"
when :green then "\e[32m" + value.to_s + "\e[0m"
when :yellow then "\e[33m" + value.to_s + "\e[0m"
when :blue then "\e[34m" + value.to_s + "\e[0m"
when :magenta then "\e[35m" + value.to_s + "\e[0m"
when :cyan then "\e[36m" + value.to_s + "\e[0m"
when :white then "\e[37m" + value.to_s + "\e[0m"