Skip to content

Instantly share code, notes, and snippets.

View puffnfresh's full-sized avatar

Brian McKenna puffnfresh

View GitHub Profile
@puffnfresh
puffnfresh / fact.il
Created February 18, 2010 01:40
Hand coded factorial program in CIL assembly
.assembly 'fact'
{
}
.namespace Factorial
{
.class public Factorial
{
.method public static void Main(string[] argv)
{
@puffnfresh
puffnfresh / google_prediction.py
Created May 20, 2010 02:42
Python library for the Google Prediction API
#!/usr/bin/env python
"""
This module provides an interface to the Google Prediction API.
"""
import json
import numbers
import urllib
import urllib2
@puffnfresh
puffnfresh / node_cygwin_extensions.patch
Created June 11, 2010 05:19
Adds addon support for node.js on Cygwin
diff --git a/tools/wafadmin/Tools/node_addon.py b/tools/wafadmin/Tools/node_addon.py
index 9462b60..72748c9 100644
--- a/tools/wafadmin/Tools/node_addon.py
+++ b/tools/wafadmin/Tools/node_addon.py
@@ -41,6 +41,9 @@ def detect(conf):
found = os.path.exists(join(prefix, "bin/node"))
conf.check_message('node prefix', '', found, prefix)
+ ## On Cygwin we need to link to the generated symbol definitions
+ if Options.platform.startswith('cygwin'): conf.env['LIB_NODE'] = 'node'
@puffnfresh
puffnfresh / TweetHTML.hs
Created July 6, 2010 03:01
Haskell module to convert a Twitter message (tweet) to HTML
{- |
Module : TweetHTML
Description : Convert a Twitter message (tweet) to HTML
Copyright : (c) Brian McKenna
License : MIT
-}
module TweetHTML (tweetHTML) where
import Data.Char
From 57ae2bf86e269702ae417edc03565c1f0b3ed7d0 Mon Sep 17 00:00:00 2001
From: Brian McKenna <brian@brianmckenna.org>
Date: Wed, 21 Jul 2010 09:56:09 +1000
Subject: [PATCH] Making install task recognise npm config. Fixes issue #522
---
Cakefile | 8 ++++++++
package.json | 2 +-
2 files changed, 9 insertions(+), 1 deletions(-)
@puffnfresh
puffnfresh / HelloWorld.js
Created November 16, 2010 08:20
Disassembled LLVM bitcode of a C++ "hello world"
// LLVM_STYLE: old
// Solving Intertyper...
// Cycle start, items:
// Processing using LineSplitter: 1
// New results: 0 out of 0
// Processing using Tokenizer: 102
// New results: 0 out of 0
// Processing using Triager: 102
// New results: 0 out of 0
// Processing using Global: 37
<!--================== Content models for exclusions =====================-->
<!-- a elements use %Inline; excluding a -->
<!ENTITY % a.content
"(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
<!-- pre uses %Inline excluding img, object, applet, big, small,
font, or basefont -->
@puffnfresh
puffnfresh / core.cljs
Created July 22, 2011 12:27
ClojureScript macros
(ns puffnfresh.core
(:require-macros [puffnfresh.timeout :as timeout]))
(defn -main [& args]
(timeout/timeout-macro
(prn "Hello")
(prn "World")
(prn "!")))
(set! *main-cli-fn* -main)
@puffnfresh
puffnfresh / HelloWorld.scala
Created September 9, 2011 23:47
[xsbt] AssertionError when trying to compile (#176)
import org.parboiled.scala.Parser
object HelloWorld extends Parser {
def main(args: Array[String]) = {}
}
@puffnfresh
puffnfresh / iswitchb-persp-curr-only.el
Created September 27, 2011 06:29
Emacs hook to only show current perspective's buffers in iswitchb
;; For perspective.el:
;; https://github.com/nex3/perspective-el
(defun iswitchb-persp-curr-only ()
(let* ((names (remq nil (mapcar 'buffer-name (persp-buffers persp-curr))))
(matches (remove-if-not (lambda (x) (member x names)) iswitchb-temp-buflist)))
(setf iswitchb-temp-buflist matches)))
(add-hook 'iswitchb-make-buflist-hook 'iswitchb-persp-curr-only)