Lower numbers in the towers represent larger disks, so higher integers must always be to the right of smaller ones.
World:
0 [1]
1 [2]
2 [3 4 5 6]
---------------
San Francisco 4821 | |
London 1409 | |
Seattle, WA 1083 | |
New York, NY 2056 | |
Portland, OR 949 | |
Chicago, IL 930 | |
Tokyo, Japan 1518 | |
London, UK 894 | |
japan 880 | |
Germany 856 |
Test data is from http://apps.timwhitlock.info/emoji/tables/unicode
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
require 'stringio'
data = File.read(ARGV.first)
data.each_codepoint do |codepoint|
# Ruby's TSort requires that you implement | |
# tsort_each_node and tsort_each_child. I | |
# extend Array so that it knows how to | |
# TSort instances of Project, which has a | |
# child_project_id pointing to another | |
# Project. | |
require 'tsort' | |
class Array |
// query: select * from html where url="http://some.url.com" and xpath='//title' | |
var yql_url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22" + encodeURIComponent(url) + "%22%20and%0A%20%20%20%20%20%20xpath%3D'%2F%2Ftitle'&format=json&callback=?"; | |
$.getJSON(yql_url, function(json) { | |
if (json && json.query && json.query.results && json.query.results.title) { | |
$('#page_title').html(json.query.results.title); | |
} | |
}); |
#!/bin/sh | |
if [ ! `which rlwrap` ]; then | |
echo "Please sudo port install rlwrap" | |
exit | |
fi | |
rlwrap coffee -i |
<?xml version="1.0" encoding="UTF-8"?> | |
<filetype binary="false" default_extension="" description="CoffeeScript" name="CoffeeScript"> | |
<highlighting> | |
<options> | |
<option name="LINE_COMMENT" value="#" /> | |
<option name="COMMENT_START" value="`" /> | |
<option name="COMMENT_END" value="`" /> | |
<option name="HEX_PREFIX" value="" /> | |
<option name="NUM_POSTFIXES" value="" /> | |
<option name="HAS_BRACKETS" value="true" /> |
class Utilities | |
@findPos: (obj) -> | |
obj = obj.get(0) if obj.html? | |
curLeft = curTop = 0 | |
if obj.offsetParent | |
loop | |
curLeft += obj.offsetLeft | |
curTop += obj.offsetTop | |
break unless obj = obj.offsetParent | |
{ x: curLeft, y: curTop } |
#!/usr/bin/env ruby | |
require "rubygems" | |
require "my_obfuscate" | |
obfuscator = MyObfuscate.new({ | |
:people => { | |
:email => { :type => :email, :skip_regexes => [/^[\w\.\_]+@my_company\.com$/i] }, | |
:ethnicity => :keep, | |
:crypted_password => { :type => :fixed, :string => "SOME_FIXED_PASSWORD_FOR_EASE_OF_DEBUGGING" }, | |
:salt => { :type => :fixed, :string => "SOME_THING" }, |
package main | |
import "code.google.com/p/go-tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
pic := make([][]uint8, dx) | |
for i := range(pic) { | |
pic[i] = make([]uint8, dy) | |
for j := range(pic[i]) { | |
pic[i][j] = uint8((i + j)/2) |