This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Astar do | |
# When the frontier is empty, we're done | |
def traverse_graph({[], came_from}, _, _), do: {[], came_from} | |
# Otherwise get the next lowest scored frontier and visit it | |
def traverse_graph({frontier, came_from}, graph, target) do | |
{current_node_name, frontier} = PriorityQueue.get(frontier) | |
current_node = graph |> Graph.get_node(current_node_name) | |
visit({frontier, came_from}, graph, target, current_node) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Experience our solar system at the speed of light (it's not as exciting as it sounds) | |
Step 1) Visit http://joshworth.com/dev/pixelspace/pixelspace_solarsystem.html. | |
Step 2) Open the JS console and paste in the following code. | |
Step 3) Watch the solar system "fly" by (BTW it'll take more than 5 hours to get to Pluto) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'chunky_png' | |
require 'nbtfile' | |
COLOR_MAP = %q{ | |
255,255,255 | |
255,255,255 | |
255,255,255 | |
255,255,255 | |
89,125,39 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YAML::load(%{ | |
hello: | |
world: | |
id: 1 | |
value: #{@foo.bar} | |
everyone_else: | |
id: 2 | |
value: "Yazoo!" | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let(:state1) { | |
FactoryGirl.build(:workflow) | |
} | |
let(:state2) { | |
state1.run_step1 | |
state1 | |
} | |
let(:state3) { | |
state2.run_step2 | |
state2 |

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SNMPKEY="public" | |
HOMEPATH="/Users/username" | |
SSH_CONFIG="$HOMEPATH/Dropbox/dotfiles/.ssh/config" | |
if [ $# = 1 ] ; then | |
SNMPKEY="$1" | |
fi | |
IFS=" " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To get this code to work, simply add a placeholder attribute to any of your inputs. | |
// This code requires no-conflict jQuery (var $j = jQuery.noConflict();) and Modernizr. | |
// Also you should add something similar to the following to your stylesheets. | |
// | |
// .placeholder{ | |
// color: #666; | |
// } | |
jQuery.fn.set_placeholder = function() { | |
if ($j(this).attr('placeholder') && ($j(this).val() == '' || $j(this).val() == $j(this).attr('placeholder'))) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nokogiri_find_header: checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... -------------------- yes | |
"gcc -E -I. -I/usr/local/lib/ruby/1.8/i686-darwin10.0.0 -I. -I/opt/local/include/ -I/opt/local/include/libxml2 -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE=1 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -I/opt/local/include/ conftest.c -o conftest.i" | |
checked program was: | |
/* begin */ | |
1: #include <iconv.h> | |
/* end */ | |
-------------------- |