Skip to content

Instantly share code, notes, and snippets.

Avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
@tomdunning
tomdunning / application.rhtml
Created Mar 6, 2010
Growl for rails helper method. Growl flash[:notice] or flash[:error] in rails
View application.rhtml
<% if flash[:notice] %>
<%= growl_a_flash("Thanks", flash[:notice]) %>
<% end %>
<% if flash[:error] %>
<%= growl_a_flash("Error", flash[:error]) %>
<% end %>
@ofan
ofan / lisp.cpp
Last active Oct 6, 2021
Lisp interpreter in 90 lines of C++
View lisp.cpp
Lisp interpreter in 90 lines of C++
I've enjoyed reading Peter Norvig's recent articles on Lisp. He implements a Scheme interpreter in 90 lines of Python in the first, and develops it further in the second.
Just for fun I wondered if I could write one in C++. My goals would be
1. A Lisp interpreter that would complete Peter's Lis.py test cases correctly...
2. ...in no more than 90 lines of C++.
Although I've been thinking about this for a few weeks, as I write this I have not written a line of the code. I'm pretty sure I will achieve 1, and 2 will be... a piece of cake!
@zliuva
zliuva / gist:1084476
Last active Nov 18, 2021
A minimal Mach-o x64 executable for OS X
View gist:1084476
; A minimal Mach-o x64 executable for OS X (also see below Mountain Lion version)
;
; $ nasm -f bin -o tiny_hello tiny_hello.s
; $ chmod +x tiny_hello
; $ ./tiny_hello
; Hello World!
; $
; c.f.
; http://osxbook.com/blog/2009/03/15/crafting-a-tiny-mach-o-executable/ ( the original tiny mach-o executable )
@nyuichi
nyuichi / 90-min-scc.scm
Created Jul 31, 2011
The 90 Minute Scheme to C Compiler
View 90-min-scc.scm
#!/usr/local/Gambit-C/bin/gsi
; Copyright (C) 2004 by Marc Feeley, All Rights Reserved.
; This is the "90 minute Scheme to C compiler" presented at the
; Montreal Scheme/Lisp User Group on October 20, 2004.
; Usage with Gambit-C 4.0:
;
; % ./90-min-scc.scm test.scm
@bytesource
bytesource / csv_parser_csv_gem_benchmark.rb
Created Sep 4, 2011
Simple CSV Parser vs. CSV Gem Benchmark
View csv_parser_csv_gem_benchmark.rb
require 'open-uri'
require 'nokogiri'
require 'parslet'
require 'csv'
# --------------------------------------------------
# Auxiliary code
class String
@tonious
tonious / hash.c
Last active Jan 23, 2022
A quick hashtable implementation in c.
View hash.c
/* Read this comment first: https://gist.github.com/tonious/1377667#gistcomment-2277101
* 2017-12-05
*
* -- T.
*/
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
@metacritical
metacritical / gist:1404985
Created Nov 29, 2011 — forked from seanlilmateus/gist:1386468
Macruby Face Detection in Mac OS X Lion
View gist:1404985
framework 'Cocoa'
framework 'QuartzCore'
class NSColor
def toCGColor
colorRGB = self.colorUsingColorSpaceName NSCalibratedRGBColorSpace
components = Array.new(4){Pointer.new(:double)}
colorRGB.getRed components[0], green:components[1], blue:components[2], alpha:components[3]
@traeblain
traeblain / batman.py
Created Dec 16, 2011
Batman Equation (Python)
View batman.py
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 16 09:30:30 2011
Python Batman Equation
@author: Trae Blain
"""
from __future__ import division
import matplotlib.pyplot as plt
@aemkei
aemkei / LICENSE.txt
Last active Dec 20, 2021 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
View LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
View student_progress.md

Continued from Results from the January 2012 Core Skills Course, by Gregory Brown

For our integration exercise we had students build multi-user email based applications. All ten students who completed the course worked on this exercise, and we ended up with everything from an email-based wiki to a system for sharing funny stories and jokes.

For our academic exercise, we asked students to make use of Markov Chains to do something interested. Seven of our students participated in this exercise, and we ended up all sorts of cool results, including a jazz chart generator and a tool which predicts movements in currency exchange rates.

For our [modeling e