Skip to content

Instantly share code, notes, and snippets.

View statianzo's full-sized avatar
🎯
Focusing

Jason Staten statianzo

🎯
Focusing
View GitHub Profile
@statianzo
statianzo / musicmonday.rb
Created May 17, 2011 23:59
Scrobbles your latest last.fm song to twitter
require 'open-uri'
require 'xmlsimple'
require 'yaml'
config = YAML::load(File.open('musicmonday.yaml'))
lastfm_username = config['settings']['lastfm']['username']
lastfm_api = config['settings']['lastfm']['api']
recent_tracks_url = "http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=#{lastfm_username}&api_key=#{lastfm_api}&limit=1"
@statianzo
statianzo / jsonsttn.rb
Created May 17, 2011 23:57
A json parser
require "strscan"
class JSONParser
AST = Struct.new(:value)
def parse(input)
@input = StringScanner.new(input)
parse_value.value
ensure
@input.eos? or error("Unexpected data")
end
@statianzo
statianzo / ruby-openid-memcache.patch
Created May 18, 2011 00:15
[PATCH] Memcached store handles Memcached::NotFound and Memcached::NotStored
lib/openid/store/memcache.rb | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/lib/openid/store/memcache.rb b/lib/openid/store/memcache.rb
index bb4b106..8d6242b 100644
--- a/lib/openid/store/memcache.rb
+++ b/lib/openid/store/memcache.rb
@@ -30,10 +30,14 @@ module OpenID
# the one matching association is expired. (Is allowed to GC expired
# associations when found.)
using System;
using System.IO;
class Program {
public static void Main() {
var d = new DirectoryInfo("buzz");
Console.WriteLine("Exists:{0} Name:{1}\n", d.Exists, d.Name);
Console.WriteLine("Create()");
d.Create();
@statianzo
statianzo / about.md
Created August 11, 2011 03:34 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@statianzo
statianzo / gist:1239653
Created September 24, 2011 18:12
Fleck -> Behavior Chain
var allSockets = new List<IWebSocketConnection>();
var server = new WebSocketServer("ws://localhost:8181");
server.Start(socket =>
{
socket.OnOpen = () =>
{
allSockets.Add(socket);
};
socket.OnClose = () =>
{
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v2.0.50727
Missing method .ctor in assembly /Users/jstaten/bin/NuGet.exe, type System.Runtime.Versioning.TargetFrameworkAttribute
Can't find custom attr constructor image: /Users/jstaten/bin/NuGet.exe mtoken: 0x0a000746
Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'NuGet'.
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'NuGet'.
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v2.0.50727
Missing method .ctor in assembly /Users/jstaten/bin/NuGet.exe, type System.Runtime.Versioning.TargetFrameworkAttribute
Can't find custom attr constructor image: /Users/jstaten/bin/NuGet.exe mtoken: 0x0a000746

Aggregate

class Ship
  def load_cargo(name)
    apply :cargo_loaded, :name => name
  end

 def paint(color)
window['$'] = window['jquip'] = (function(){
var win = window,
queryShimCdn = "http://cdnjs.cloudflare.com/ajax/libs/sizzle/1.4.4/sizzle.min.js",
queryEngines = function(){ return win["Sizzle"] || win["qwery"]; },
doc = document, docEl = doc.documentElement,
scriptFns=[], load=[], sLoaded,
runtil = /Until$/, rmultiselector = /,/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
rtagname = /<([\w:]+)/,
rclass = /[\n\t\r]/g,