Read the full blog post at: http://jcla1.com/blog/on-ulam-spirals-and-matrix-generation/.
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
package main | |
import ( | |
"encoding/json" | |
"net/http" | |
) | |
type Turn struct { | |
Stack []string `json:"stack"` | |
Hand []string `json:"hand"` |
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
import math | |
def total_cost(amount): | |
return int(math.ceil(amount + 0.5 + 0.01 * amount)) | |
def reduce_balance(balance, amount): | |
if amount < balance: | |
balance -= total_cost(amount) | |
return balance |
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<div id="main"> | |
<ul> | |
<li><b>Anteater</b></li> | |
<li><a href="b.html">Baobao</a></li> | |
<li><a href="c.html">Cuttlefish</a></li> | |
</ul> | |
Anteaters, also known as antbear, are the four mammal species of the suborder Vermilingua (meaning "worm tongue") commonly known for eating ants and termites. Together with the sloths, they compose the order Pilosa. The name "anteater" is also colloquially applied to the unrelated aardvark, numbat, echidna, and pangolin. |
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
SECOND = 1 | |
MINUTE = 60 * SECOND | |
HOUR = 60 * MINUTE | |
time = Time.new 0, 1, 1, 0, 0 | |
end_time = Time.new 0, 1, 2, 0, 0 | |
$coincidences = [] | |
class Time |
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
class Arrow | |
constructor: (x, y, w, h, rot)-> | |
@x = x | |
@y = y | |
@w = w | |
@h = h | |
@rot = rot | |
pointTo: (x, y) -> | |
m_y = @y - y |
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
function drawArrow(x, y, w, h, rot) { | |
ctx.save(); | |
ctx.translate((x + w / 2), (y + h / 2)); | |
ctx.rotate(rot); | |
ctx.translate(-(x + w / 2), -(y + h / 2)); | |
ctx.translate(x, y); | |
a = 0; |
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
# NAME: authinabox | |
# VERSION: 1.01 (Dec 27, 2008) | |
# AUTHOR: Peter Cooper [ http://www.rubyinside.com/ github:peterc twitter:peterc ] | |
# DESCRIPTION: An "all in one" Sinatra library containing a User model and authentication | |
# system for both session-based logins OR HTTP Basic auth (for APIs, etc). | |
# This is an "all in one" system so you will probably need to heavily tailor | |
# it to your own ideas, but it will work "out of the box" as-is. | |
# COMPATIBILITY: - Tested on 0.3.2 AND the latest rtomayko Hoboken build! (recommended for the latter though) | |
# - NEEDS DataMapper! | |
# - Less work needed if you use initializer library -- http://gist.github.com/40238 |
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 'sinatra' | |
require 'rest_client' | |
require 'uuid' | |
require 'json' | |
# For generating UUIDs | |
uuid = UUID.new | |
zipPleaseAPIEndpoint = "http://www.zipplease.com/api/zips" |
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
/* BASICS */ | |
.CodeMirror { | |
/* Set height, width, borders, and global font properties here */ | |
font-family: monospace; | |
height: 300px; | |
} | |
.CodeMirror-scroll { | |
/* Set scrolling behaviour here */ | |
overflow: auto; |