Skip to content

Instantly share code, notes, and snippets.

>> a = 4
=> 4
>> defined? a
=> "local-variable"
Io 20080120
Io> Notes C
==> C
Io> Notes C fifth
==> G
Io> Notes C minorSecond
==> C#
Io> Chords C maj notes
==> list(Note_0x376480, Note_0x42e090, Note_0x416d40)
Io> Chords C maj notes map(inSharps)
[1,2,5,6,8,9,11].inject([-2,[]]){|d,i|(i==d[0]+1)? (d[-1][-1]<<i;d):[i,d[-1]<<[i]]}[-1]
#!/usr/bin/env ruby -w
require 'pp'
require 'rubygems'
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
require 'dust'
# {Constant => {Method => [Warnings]}}
$warnings = Hash.new {|h,k| h[k] = Hash.new {|_h,_k| _h[_k] = [] }}
-------------------------------------------------------- Class#inherited
inherited(subclass)
------------------------------------------------------------------------
Callback invoked whenever a subclass of the current class is
created.
Example:
class Foo
def self.inherited(subclass)
class AbstractScraper
def initialize
@agent = WWW::Mechanize.new
@agent.user_agent_alias = "Windows Mozilla"
@agent.keep_alive = false
end
end
class AuthenticatedScraper < AbstractScraper
def initialize(username, password)
#ifndef POINT_H
#define POINT_H
#include <tr1/tuple>
class Point
{
public:
Point(double x, double y, double z)
: _point(x,y,z)
data CellState = Alive | Dead deriving (Eq, Show)
type Time = Integer
-- Status of a cell at a time t
cell :: Int -> Int -> Time -> CellState
-- Initial Board setup
cell 0 (-1) 0 = Alive
cell 0 0 0 = Alive
cell 0 1 0 = Alive
nth_prime.hpp:17: instantiated from ‘nth_prime_impl<23, 401>’
nth_prime.hpp:25: instantiated from ‘nth_prime_impl<23, 399>’
nth_prime.hpp:25: instantiated from ‘nth_prime_impl<24, 397>’
nth_prime.hpp:25: instantiated from ‘nth_prime_impl<24, 395>’
nth_prime.hpp:25: instantiated from ‘nth_prime_impl<24, 393>’
nth_prime.hpp:25: instantiated from ‘nth_prime_impl<24, 391>’
nth_prime.hpp:25: instantiated from ‘nth_prime_impl<25, 389>’
nth_prime.hpp:25: instantiated from ‘nth_prime_impl<25, 387>’
nth_prime.hpp:25: instantiated from ‘nth_prime_impl<25, 385>’
nth_prime.hpp:25: instantiated from ‘nth_prime_impl<26, 383>’
>>> b = 0
>>> def incB():
... b += 1
...
>>> c = []
>>> def addC():
... c.append(1)
...
>>> b
0