Skip to content

Instantly share code, notes, and snippets.

View aaronmoodie's full-sized avatar
Coffee

Aaron Moodie aaronmoodie

Coffee
View GitHub Profile
@phatduckk
phatduckk / Gistson.php
Created December 7, 2009 08:54
Embed a Gist in Wordpress
<?php
/*
Plugin Name: Gistson - Embedded Gist WP Plugin
Plugin URI: http://arin.me/blog/tag/gistson
Description: Use a shortcode [gist id="12345"] to embed A Gist from http://gist.github.com into your blog
Version: 0.1
Author: Arin Sarkissian
Author URI: http://arin.me
Copyright 2009 Arin Sarkissian
@jeffrafter
jeffrafter / server.js
Created August 28, 2010 21:37
Twitter OAuth with node-oauth for node.js+express
var express = require('express');
var sys = require('sys');
var oauth = require('oauth');
var app = express.createServer();
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY";
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET";
function consumer() {
@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
@hackable
hackable / expressjs-base64-image.js
Created October 18, 2011 05:21
Node.js base64 encode a downloaded image for use in data URI
express = require("express")
request = require("request")
BufferList = require("bufferlist").BufferList
app = express.createServer(express.logger(), express.bodyParser())
app.get "/", (req, res) ->
if req.param("url")
url = unescape(req.param("url"))
request
uri: url
encoding: 'binary'
@andrewharvey
andrewharvey / bom-radar-fetch.pl
Created November 5, 2011 00:48
Fetches BOM.gov.au radar images giving us a local mirror, including historical data.
#!/usr/bin/perl -w
# Fetches BOM.gov.au radar images giving us a local mirror, including historical
# data.
#
# Radar images are updated every 10 minutes, but the BOM only keep the last
# hour and 10 minutes worth of radar images on their FTP server. With this in
# mind I would recommend running this script anywhere from minutely to hourly.
#
# This script is licensed CC0 by Andrew Harvey <andrew.harvey4@gmail.com>
@russelldb
russelldb / clojure.md
Created April 15, 2012 19:58
Setting Up Clojure on OS X

Setting Up Clojure on OS X

I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.

I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.

This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.

Step 1: Getting Clojure (1.3)

@swannodette
swannodette / gist:3217582
Created July 31, 2012 14:52
sudoku_compact.clj
;; based on core.logic 0.8-alpha2 or core.logic master branch
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
@leetreveil
leetreveil / gist:4647978
Created January 27, 2013 11:40
musicmetadata read from network
var http = require('https');
var musicmetadata = require('musicmetadata');
http.get('https://dl.dropbox.com/u/1269592/Into%20The%20Back%20%28WORNG%20Remix%29.mp3', function (res) {
var parser = new musicmetadata(res);
parser.on('metadata', function (result) {
console.log(result);
});
parser.on('done', function (err) {
if (err) throw err;
# app/models/foo.rb
# Keep in mind, this doesn't even factor in TimeZones.
class Foo
# Including this line gives your model two virtual
# attributes - `date` and `time` - which you can use as
# methods in your form_for / f.text_field calls, etc
attr_writer :date, :time
# returns the date component of starts_at, to ensure
@toolmantim
toolmantim / Makefile
Last active December 5, 2022 23:14
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch