Skip to content

Instantly share code, notes, and snippets.

View taybenlor's full-sized avatar

Ben Taylor taybenlor

View GitHub Profile
RAC(self, property) = RACObserve(self.model, property);
@taybenlor
taybenlor / NicerDates.swift
Created July 20, 2015 08:28
Make dates nicer, very quick hack
//
// NicerDates.swift
//
// Created by Ben Taylor on 20/07/2015.
//
import Foundation
extension Int {
/**
* A class to parse colour values. Updated by Ben to support colour conversions.
* @author Stoyan Stefanov <sstoo@gmail.com>
* @author Ben Taylor <taybenlor@gmail.com>
* @link http://www.phpied.com/rgb-color-parser-in-javascript/
* @license Use it if you like it
*/
function Colour(colour_string)
{
this.ok = false;
/**
* A class to parse colour values. Updated by Ben to support colour conversions.
* @author Stoyan Stefanov <sstoo@gmail.com>
* @author Ben Taylor <taybenlor@gmail.com>
* @link http://www.phpied.com/rgb-color-parser-in-javascript/
* @license Use it if you like it
*/
function Colour(colour_string)
{
this.ok = false;
from pymt import *
from glob import glob
from random import randint
root = MTScatterPlane()
width = int(pymt_config.get('graphics', 'width'))
height = int(pymt_config.get('graphics', 'height'))
for fname in glob('pictures/*.jpg'):
x, y = randint(0,width), randint(0,height)
function getArgs(){
var url = window.location.href;
var qparts = url.split("?");
if (qparts.length == 1){
return {};
}
var query = qparts[1];
var vars = $A(query.split("&"));
var args = {}
<script>
function get_count(data){
$("lol").html(data.count);
}
</script>
<script src="http://urls.api.twitter.com/1/urls/count.json?url=http://google.com&callback=get_count">
@taybenlor
taybenlor / gist:1136354
Created August 10, 2011 08:14
Too Many Pixies Enemy Update
update: ->
if @converting
this.convert() if ((ticks - @started_converting) > CONVERT_TIME)
else if (ticks - @moved_at) > SPEED[@type]
this.move()
@taybenlor
taybenlor / gist:1136267
Created August 10, 2011 06:53
Too Many Pixies Model
class Model
@id: ->
@_id = 1 unless @_id?
@_id += 1
@_id-1
constructor: ->
@id = Model.id()
@attributes = _([])
@taybenlor
taybenlor / gist:1136269
Created August 10, 2011 06:54
Too Many Pixies Enemy Model
class Enemy extends Model
constructor: (tile, type, health) ->
this.attr "health", {default: health}
this.attr "type", {default: type}
this.attr "attacking", {default: false}
this.attr "hit", {default: false}
this.attr "converting", {default: false}
this.attr "tile", {default: tile}
this.attr "destroyed", {default: false}