This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> a = 4 | |
=> 4 | |
>> defined? a | |
=> "local-variable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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] = [] }} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------- Class#inherited | |
inherited(subclass) | |
------------------------------------------------------------------------ | |
Callback invoked whenever a subclass of the current class is | |
created. | |
Example: | |
class Foo | |
def self.inherited(subclass) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef POINT_H | |
#define POINT_H | |
#include <tr1/tuple> | |
class Point | |
{ | |
public: | |
Point(double x, double y, double z) | |
: _point(x,y,z) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>’ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> b = 0 | |
>>> def incB(): | |
... b += 1 | |
... | |
>>> c = [] | |
>>> def addC(): | |
... c.append(1) | |
... | |
>>> b | |
0 |
OlderNewer