Skip to content

Instantly share code, notes, and snippets.

@clooth
clooth / demo.coffee
Created March 18, 2013 03:27
Diesel demo source
#
# Vision of how Diesel works
#
# Initialize engine from singleton
game = D.Game.get
title: "Chain Reaction Game v1.0"
container: document.querySelector('#game')
@clooth
clooth / mobilepatterns.rb
Created April 25, 2013 09:15
mobile-patterns.com downloader
require 'nokogiri'
require 'open-uri'
require 'net/http'
# Patterns
patterns = {}
# Load first page
doc = Nokogiri::HTML(open('http://www.mobile-patterns.com/'))
@clooth
clooth / pttrns.rb
Created April 25, 2013 09:16
pttrns.com downloader
require 'nokogiri'
require 'open-uri'
require 'net/http'
# Patterns
patterns = {}
# Load first page
doc = Nokogiri::HTML(open('http://pttrns.com/'))
static inline double radians (double degrees) {return degrees * M_PI/180;}
CGImageRef CreateRotatedImage(CGImageRef imageRef, UIImageOrientation orientation)
{
CGRect bnds = CGRectZero;
CGImageRef copy = nil;
CGContextRef ctxt = nil;
CGRect rect = CGRectZero;
CGAffineTransform tran = CGAffineTransformIdentity;
@clooth
clooth / TimestampToDate.scpt
Created July 9, 2013 09:27
Applescript to display real date of selected timestamp
on run {input, parameters}
tell application "System Events"
set activeApp to name of first process whose frontmost is true
end tell
set _timestamp to (input as string)
tell application activeApp
set realDate to ((do shell script "date -r " & _timestamp) as string)
- (void)drawBevelArea
{
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect frame = self.frame;
CGRect bevelAreaRect = CGRectMake(0, 0, frame.size.width, frame.size.height);
UIBezierPath* bevelAreaPath = [UIBezierPath bezierPathWithRoundedRect:bevelAreaRect cornerRadius:_cornerRadius];
[_bevelBackgroundColor setFill];
@clooth
clooth / router.js.coffee
Created September 9, 2013 09:20
Ember Routes
Terrest.Router.reopen
location: 'history'
Terrest.Router.map ->
@resource "builds", path: "/builds/:build_race", ->
@resource "build", path: ":build_slug"
@clooth
clooth / gg.go
Created September 10, 2013 08:45
Enums
type Race string
const (
Protoss Race = "protoss"
Terran Race = "terran"
Zerg Race = "zerg"
)
@clooth
clooth / gg.go
Created September 10, 2013 08:52
// Build struct
type Build struct {
Name string // Short name for this build
Description []byte // Description explaining what the build is about
PlayerRace Race // The race this built is meant to be played with
OpposingRaces []Race // The target races this build works well against
}
@clooth
clooth / gg.go
Created September 10, 2013 08:57
// Available races
type Race string
const (
Protoss Race = "protoss"
Terran Race = "terran"
Zerg Race = "zerg"
)
func (r *Race) iconFileURL() string {
// TODO: