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 %>
@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
@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]
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

View string_goals.markdown

String

Concepts
  • Creating / Definition
  • Single vs. Double Quoted Strings
  • Combining Strings and Other Data
    • Concatenation with +
    • Wrapping in an Array and using join
    • Interpolating
@hajimes
hajimes / logsumexp-asm.js
Last active Jan 29, 2017
handwritten asm.js code for logsumexp
View logsumexp-asm.js
// MIT License. Copyright (c) 2016 Hajime Senuma.
/**
* asm.js module for logsumexp
*/
function asmModule(stdlib, foreign, heap) {
'use asm';
var exp = stdlib.Math.exp;
var log = stdlib.Math.log;
@benolee
benolee / 00-creating-a-ruby-extension.md
Last active Aug 6, 2017
how easy it is to create and load a C extension in ruby
View 00-creating-a-ruby-extension.md

create a new dir

$ mkdir /tmp/ruby
$ cd /tmp/ruby

create extconf.rb

@gdevanla
gdevanla / y-combinator-clojure.clj
Last active Jan 30, 2018
Y-Combinator in Clojure based on Jim Weirich's talk Y-NOT
View y-combinator-clojure.clj
;; This gist roughly transribes the demo
;; by Jim Weirich during his talk on Y-Combinator
;; called Y-Not.
;; http://www.infoq.com/presentations/Y-Combinator
;; Jim does a phenomenal job of explaining in the demo.
;; Therefore, this gist only attempts to provide
;; the code example from the poor quality video
;; The examples are simplified at some places
;; based on how I tried to understand it
View bad-codegen.md

The following code should evaluate to true:

((or int? string?) 1)

But instead it evaluates to the int? function. In other words this evaluates to true:

(= int? ((or int? string?) 1))