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
:foo / :bar # => [:foo, :bar] | |
:foo / :bar / :fizz # => [:foo, :bar, :fizz] | |
:foo / :bar / :foo # => [:foo, :bar] | |
:foo / :bar / :fizz / :bizz # => [:foo, :bar, :fizz, :bizz] |
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
[12,3,4,5].map{|x| x * 2}.inspect |
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
include Enumerable | |
def each | |
return Enumerator.new(self,:each) unless block_given? | |
yield 1 | |
yield 2 | |
end | |
puts each.inject(:+).inspect | |
puts each{|x| x * x}.inject(:+).inspect | |
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
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6^(th) prime is 13. | |
# | |
# What is the 10001^(st) prime number? | |
require 'mathn' | |
puts Prime.instance.each.tap{ |x| 10000.times{ x.next} }.next #104743 |
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 'yaml' | |
Track = Struct.new :title, :duration | |
# An Album represents an audio medium which has title, | |
# interpret, a pause duration between tracks and a list | |
# of individual tracks. | |
class Album | |
attr_reader :title, :interpret, :pause |
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
#! ruby19 | |
require 'date' | |
class EndlessEnum | |
include Enumerable | |
def initialize(x, method = :succ) | |
@x = x | |
@method = method |
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
$(document).ready(function(){ | |
var searchIDs = $('input:checked').map(function(){ | |
return $(this).val(); | |
}); | |
console.log(searchIDs.get()); | |
$('input').on('change',function(){ |
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
<div id="wrapper"> | |
<div id="app"></div> | |
</div> |
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
module Main exposing (main) | |
import Html exposing (Html, text) | |
a = | |
[ 28, 6, 34, -99 ] | |
main : Html msg |
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
module Main exposing (main) | |
import Html exposing (Html, text) | |
a = | |
[ 2, 28, 6, 34, -9 ] | |
tuple = |
OlderNewer