This file contains 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 Foundation | |
import UIKit | |
extension UIColor { | |
convenience init(hex: String) { | |
let scanner = Scanner(string: hex) | |
scanner.scanLocation = 1 | |
var rgb: UInt64 = 0 | |
scanner.scanHexInt64(&rgb) | |
self.init(rgb: Int(rgb)) |
This file contains 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
#!/usr/bin/env ruby | |
require "yaml" | |
CONFIG = "~/database.yml" | |
CONFIG_PARAMS = %w(protocol host port database username password).map(&:to_sym) | |
def say(channel=:info, msg) | |
puts "[#{channel.to_s.upcase}] #{msg}" | |
end |
This file contains 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
if [ "$1" = "" ]; then | |
echo Missing params: heroku-app-name | |
exit 1 | |
fi | |
if [ "$2" = "" ]; then | |
echo Missing params: dump-prefix | |
exit 1 | |
fi |
This file contains 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
var http = require("http"); | |
var url = require("url"); | |
var path = require("path"); | |
var fs = require("fs"); | |
var port = process.argv[2] || 8000; | |
http.createServer(function(request, response) { | |
console.log(request["method"] + " " + request["url"]); | |
var uri = url.parse(request.url).pathname; |
This file contains 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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
</head> | |
<body> | |
<style> | |
#progress_bar { | |
margin: 10px 0; | |
padding: 3px; | |
border: 1px solid #000; |
This file contains 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
<html> | |
<head> | |
<title>S3 POST Form</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<script> | |
var bucketName = 'MY_BUCKET_NAME'; | |
var AWSKeyId = 'MY_AWS_KEY_ID'; | |
var policy = 'MY_POLICY'; | |
var signature = 'MY_SIGNATURE'; |
This file contains 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
<html> | |
<head> | |
<title>S3 POST Form</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
</head> | |
<script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
<script type="text/javascript"> | |
function canAccessIFrame(iframe) { | |
var html = null; | |
try { |
This file contains 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
// angle of a vector (defined as AB) | |
float R2Point::angle(R2Point A, R2Point B) | |
{ | |
// tg(o) = y / x | |
float diffy = B.y - A.y; | |
float diffx = B.x - A.x; | |
float ang = 0; | |
// special case; | |
if ((diffy == 0) & (diffx == 0)) |