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
| enum = Enumerator.new do |yielder| | |
| yielder << "a" | |
| yielder << "b" | |
| yielder << "c" | |
| end | |
| enum.next # "a" | |
| enum.next # "b" | |
| enum.next # "c" | |
| enum.next # StopIteration: iteration reached an end |
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
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| type User struct { | |
| name string | |
| } |
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
| import java.util.ArrayList; | |
| import java.util.Collections; | |
| import java.util.Comparator; | |
| import java.util.List; | |
| public class App { | |
| public static class Person { | |
| private String name; | |
| private int weight; |
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
| Prelude> let sum x y = x + y | |
| Prelude> :type sum | |
| sum :: Num a => a -> a -> a |
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
| fs = require 'fs' | |
| describe '#readFile', -> | |
| content = null | |
| done = false | |
| beforeEach -> | |
| runs -> | |
| fs.readFile __filename, (error, data) -> | |
| throw error if error? |
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
| $ cd sample | |
| $ ant debug install | |
| $ cd ../sampletest | |
| $ ant test | |
| test: | |
| [echo] Running tests ... | |
| [exec] | |
| [exec] com.sample.GreeterTest: | |
| [exec] Failure in testExpectAGreetingAfterSubmittingAName: |
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
| $ export | |
| PATH=$PATH:~/Downloads/android-sdk-macosx/tools:~/Downloads/android-sdk-macosx/platform-tools |
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
| # What is your preferred formatting? | |
| # a.) | |
| if bar | |
| foo = 'baz' | |
| else | |
| foo = 'bax' | |
| end | |
| # b.) |
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
| >> Time.zone | |
| => (GMT+00:00) UTC | |
| >> Time.use_zone('America/Los_Angeles') { puts Time.zone } | |
| (GMT-08:00) America/Los_Angeles | |
| => nil | |
| >> Time.zone | |
| => (GMT+00:00) UTC |
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
| # started at | |
| create :up_vote_activity, created_at: 1.day.from_now | |
| create :comment_activity, created_at: 1.day.from_now | |
| # introduce local | |
| created_at = 1.day.from_now | |
| create :up_vote_activity, created_at: created_at | |
| create :comment_activity, created_at: created_at | |
| # Object#tap to scope local |