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
require 'fileutils' | |
# Given a directory of files, sort them randomly then split into a training and | |
# test set | |
TEST_PERCENT = 20 | |
if ARGV.size < 1 | |
puts "Usage: #{$0} <path> (outdir)" | |
exit 0 |
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
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 14952 | 11972 | 128 | 834 | 6 | 12 | | |
| Helpers | 1984 | 1453 | 2 | 212 | 106 | 4 | | |
| Models | 19054 | 13238 | 186 | 1722 | 9 | 5 | | |
| Libraries | 4798 | 3385 | 27 | 357 | 13 | 7 | | |
| Model specs | 21536 | 17069 | 6 | 27 | 4 | 630 | | |
| View specs | 200 | 154 | 0 | 0 | 0 | 0 | | |
| Controller specs | 14980 | 11166 | 1 | 34 | 34 | 326 | |
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
def diff(a, b, file = "current.diff") | |
require 'rspec/expectations/differ' | |
differ = RSpec::Expectations::Differ.new | |
diff = differ.diff_as_object(a, b) | |
File.open(file, "w+") { |f| f.write diff } | |
system "mate", file | |
end |
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
Time.utc(1997, 8, 4, 7, 14) |
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
{-# LANGUAGE ExistentialQuantification #-} | |
module Main where | |
import qualified Data.List as L | |
import qualified Data.Map as Map | |
{- How to make a heteregenous list of showable items, taken from | |
- http://www.haskell.org/haskellwiki/Heterogenous_collections-} | |
data Showable = forall a . Show a => MkShowable a |
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
config.around(:each) do |example| | |
if timeout = example.metadata[:timeout] | |
Benchmark.realtime do | |
example.call | |
end.should <= timeout | |
else | |
example.call | |
end | |
end |
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
use std::util::swap; | |
#[deriving(Eq)] | |
pub enum Tree { | |
Text(~str), | |
Cons(~Tree, ~Tree), | |
Nil | |
} | |
pub fn first<'r>(tree: &'r Tree) -> &'r Tree { |
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
setTimeout(function(){ | |
$scope.$apply(function(){ | |
deferred.resolve(message); | |
}); | |
}, 5) |
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
struct Queue<T, size> { | |
items : [T] | |
} | |
impl<T, size> Queue<T, size> { | |
pub fn new() -> Queue<T, size> { | |
Queue { items : [T, ..size] } | |
} | |
} |
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
use std::default::Default; | |
struct Q<T> { | |
items : [T, ..10], | |
count : uint | |
} | |
impl<T : Default + Copy> Q<T> { | |
pub fn new() -> Box<Q<T>> { | |
box Q {items: [Default::default(), ..10], |
OlderNewer