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
| var randomHcl; | |
| randomHcl = function() { | |
| d3.scale.linear().domain(d3.range(100)).interpolate(d3.interpolateHcl).range(['blue', 'green']) | |
| }; | |
| randomHcl(30); |
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
| class @Beany extends Array | |
| constructor: (@souffle = true) -> console.log @souffle | |
| beany = new Beany |
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
| { | |
| "tab_size": 2, | |
| "translate_tabs_to_spaces": true | |
| } |
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 'minitest/autorun' | |
| require 'minitest/pride' | |
| class WithInterest | |
| def initialize amount, interest, years = 1 | |
| @amount = amount | |
| @interest = interest | |
| @years = years | |
| 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
| class Download | |
| constructor: (@source) -> | |
| @iframe = document.createElement 'iframe' | |
| @iframe.style.display = 'none' | |
| @iframe.src = @source | |
| perform: -> document.body.appendChild @iframe | |
| Download.Perform = (src) -> (new Download(src)).perform() |
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 'minitest/autorun' | |
| class Origin | |
| attr_accessor :name | |
| def set_name name | |
| self.name = name | |
| end | |
| 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
| def measure(method_name) | |
| result = nil | |
| time = Benchmark.measure do | |
| result = yield if block_given? | |
| end | |
| puts "== DEBUG: #{method_name} benchmark time: #{time}" | |
| return result | |
| 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
| expectCall = (object, methodName, action) -> | |
| spyOn object, methodName | |
| action() | |
| expect(object[methodName]).toHaveBeenCalled() | |
| expectCall HE.Modal, 'modalDisplay', -> HE.Modal.InitDomPresence() |
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
| SingletonExample = | |
| do -> | |
| privateFunction = -> "I'm so hidden" | |
| publicFunction = -> alert privateFunction() | |
| publicFunction: publicFunction | |
| SingletonExample.publicFunction() | |
| alert SingletonExample.privateFunction() |