This file contains hidden or 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
| extern mod std; | |
| fn is_three(num: int) -> bool { | |
| num % 3 == 0 | |
| } | |
| #[test] | |
| fn test_is_three_with_not_three() { | |
| if is_three(1) { | |
| fail ~"One is not three"; |
This file contains hidden or 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
| trait Monster { | |
| fn attack(&self); | |
| static fn new() -> self; | |
| } | |
| struct IndustrialRaverMonkey { | |
| life: int, | |
| strength: int, | |
| charisma: int, | |
| weapon: int, |
This file contains hidden or 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 'nokogiri' | |
| require 'open-uri' | |
| class CardGenerator | |
| def initialize(format) | |
| @format = format | |
| end | |
| def random_card | |
| html = "" |
This file contains hidden or 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
| $ ack -ri "Test::Unit" * | |
| actionpack/lib/action_controller/test_case.rb | |
| 308: # Test::Unit::TestCase and define @controller, @request, @response in +setup+.) | |
| activesupport/lib/active_support/inflector/methods.rb | |
| 205: # 'Test::Unit'.constantize # => Test::Unit | |
| 249: # 'Test::Unit'.safe_constantize # => Test::Unit | |
| activesupport/lib/active_support/test_case.rb | |
| 20: class TestCase < ::MiniTest::Unit::TestCase |
This file contains hidden or 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 io::{Reader,ReaderUtil}; | |
| use core::rand::{Rng}; | |
| use core::int::abs; | |
| fn generate_secret_number() -> int { | |
| abs(Rng().gen_int() % 100) + 1 | |
| } | |
| fn process_guess(secret:int, guess: int, guesses: &mut int) { | |
| io::println(fmt!("You guessed: %d", guess)); |
This file contains hidden or 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
| $ vulcan build -s ~/src/rust -p /tmp/rust -c "./configure --prefix=/tmp/rust && make && make install" --verbose | |
| Packaging local directory... done | |
| Uploading source package... done | |
| Building with: ./configure --prefix=/tmp/rust && make && make install | |
| configure: looking for configure programs | |
| configure: found cmp | |
| configure: found mkdir | |
| configure: found printf | |
| configure: found cut | |
| configure: found head |
This file contains hidden or 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
| irb(main):008:0> p = :nil?.to_proc | |
| => #<Proc:0x007ff4a5078158> | |
| irb(main):009:0> [1,nil].reject(p) | |
| ArgumentError: wrong number of arguments(1 for 0) | |
| from (irb):9:in `reject' | |
| from (irb):9 | |
| from /usr/local/ruby-1.9.3-p327/bin/irb:12:in `<main>' | |
| irb(main):010:0> [1,nil].reject(&p) | |
| => [1] |
This file contains hidden or 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
| set nocompatible " We're running Vim, not Vi! | |
| set guifont=Bitstream\ Vera\ Sans\ Mono:h24 | |
| let g:molokai_original = 1 | |
| colorscheme molokai | |
| syntax on " Enable syntax highlighting | |
| filetype on " Enable filetype detection | |
| filetype indent on " Enable filetype-specific indenting |
This file contains hidden or 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
| $pointsz = Hash.new(0) | |
| class Class | |
| method_blacklist = [:method_added, :===, :to_s, :send, :public_methods, :new] | |
| methods_to_redefine = public_methods.reject{|m| method_blacklist.include? m } | |
| methods_to_redefine.each do |m| | |
| new_name = "__lol_omg_#{m}" | |
| define_method m do |*args, &blk| |
This file contains hidden or 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
| text = `curl https://raw.github.com/gSchool/submissions/master/writing/index.markdown` | |
| text.split("\n").each do |line| | |
| next unless line =~ /\*/ | |
| line =~ /\* (?:\w|\s)+: (.*)/ | |
| puts $1 + "/feed.xml" | |
| end |