Skip to content

Instantly share code, notes, and snippets.

@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)
#include <stdlib.h>
#include <GL/glew.h>
#ifdef __APPLE__
# include <GLUT/glut.h>
#else
# include <GL/glut.h>
#endif
#include <math.h>
#include <stdio.h>
#include "util.h"
@clooth
clooth / resizyr.coffee
Created October 17, 2013 20:48
WebGL Photo resizer example
#
# Resizyr - WebGL Image Resizer
#
# Extensions
# This allows us to do for example the following:
# 5.times () -> console.log "foo"
#
Number::times = (fn) ->
do fn for [1..@valueOf()]
@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 / places.json
Created August 15, 2012 10:09
PK-seudun baarit
[{"phonenumber": "(09) 7533 100", "name": "3. linja", "address": "Kolmas linja 6", "latitude": 60.1817299628, "tags": ["olutravintola"], "homepage": "", "longitude": 24.9509723639, "description": "Minikokoinen kivijalkapubi 3:nnella linjalla, jota Fredikin kulki takaisin. Baarissa kaksi televisiota. Halpa tuoppi."}, {"phonenumber": "(09) 343 2814", "name": "4 Vuodenaikaa", "address": "Rusthollarintie 2", "latitude": 60.2122766079, "tags": [""], "homepage": "", "longitude": 25.0960335589, "description": ""}, {"phonenumber": "0400 211 921", "name": "A21", "address": "Annankatu 21", "latitude": 60.1662143231, "tags": ["cocktail", "drinkkej\u00e4", "drinkkibaari", "juhlapaikka", "kokoustila"], "homepage": "http://www.a21.fi/", "longitude": 24.9378044239, "description": "Cocktail Lounge A21 keskittyy hyviin drinkkeihin eli ns. \"Fine Drinkingiin\". Cocktail-lista on jaettu nelj\u00e4\u00e4n kategoriaan, joiden kautta cocktailien laaja kirjo aukeaa maallikollekin. Tarjolla on makuja suomalaisesta luonnosta, kauden
@clooth
clooth / Macros.h
Created November 12, 2013 02:52
Objective-C Macros
// Constants
#define APP_VERSION [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
#define APP_NAME [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]
#define APP_DELEGATE [[UIApplication sharedApplication] delegate]
#define USER_DEFAULTS [NSUserDefaults standardUserDefaults]
#define APPLICATION [UIApplication sharedApplication]
#define BUNDLE [NSBundle mainBundle]
#define MAIN_SCREEN [UIScreen mainScreen]
#define FILE_MANAGER [NSFileManager defaultManager]
#define DOCUMENTS_DIR [[FILE_MANAGER URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]
@clooth
clooth / widgets.py
Created August 15, 2012 20:34
GoogleMapsWidget
from django import forms
from django.conf import settings
from django.utils.safestring import mark_safe
class GoogleMapsWidget(forms.HiddenInput):
# Media to be includes with the widget
class Media:
js = (
// Import sensate
import Sensate, { Event, Message } from 'sensate'
// Import wanted gateways
import SlackGateway from 'sensate-gateway-slack'
// Logging
const log = () => console.log.apply(console, arguments)
// Create a new sensate instance that connects to slack
// Create dummy click event for automation
var click = new MouseEvent('click', { 'clientX': 1,'clientY': 1 });
// Create button boilerplate
function createButton(title, action) {
var button = document.createElement('button');
button.innerText = title;
button.onclick = function(e) {
e.preventDefault();
action(e);
newQuad.bl.textureVertex = CGPointMake(0, 0);
newQuad.br.textureVertex = CGPointMake(1, 0);
newQuad.tl.textureVertex = CGPointMake(0, 1);
newQuad.br.textureVertex = CGPointMake(1, 1);