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
var walk = function(obj, iterator) { | |
for(i in obj) { | |
if(_.isObject(obj[i]) && !_.isArray(obj[i]) && !_.isFunction(obj[i])) { | |
walk(obj[i], iterator); | |
continue; | |
} | |
iterator(obj[i]); | |
} | |
}; |
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
core] | |
quotepath = false | |
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol | |
[color] | |
ui = true | |
[color "branch"] | |
current = yellow black | |
local = yellow |
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
domo.route('!weather :city', function(res) { | |
var response = request.get('http://api.openweathermap.org/data/2.5/weather?q=' + res.params.city + ',FI&units=metric&lang=fi', function (error, response, body) { | |
if (error || response.statusCode !== 200) return; | |
var data = JSON.parse(body); | |
var saa = data.main.temp; | |
this.say(res.channel, 'Sää ' + res.params.city + ': ' + saa); |
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
class Base | |
constructor: -> | |
on: -> | |
console.log 'base:on', arguments | |
class Child extends Base | |
constructor: -> | |
on: -> | |
console.log 'child:on', arguments | |
super |
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
# -*- coding: utf-8 -*- | |
import sublime, sublime_plugin, json, codecs | |
class I18nCommand(sublime_plugin.TextCommand): | |
settings = sublime.load_settings('i18nHelper') | |
last_path = settings.get('default_path', '') | |
last_key = settings.get('default_chain', '') | |
def run(self, edit): |
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
throttleWrapper = (promiseTarget, args...) -> | |
isLoading = false | |
promiseToServe = null | |
return -> | |
return promiseToServe if isLoading | |
isLoading = true | |
promiseToServe = promiseTarget.apply promiseTarget, args... | |
promiseToServe.then (promiseResolved) -> |
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
fs = require 'fs' | |
es = require 'event-stream' | |
Transform = require('stream').Transform | |
PassThrough = require('stream').PassThrough | |
reverser = new Transform | |
reverser._transform = (data, encoding, done) -> | |
this.push data.toString().split('').reverse().join '' | |
done() |
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
function MyController($scope, $firebaseCollection) { | |
// "images" - contains for example >10 000 children and we don't want to fetch them all at once | |
var imagesRef = new Firebase("https://<my-firebase>.firebaseio.com/images"); | |
// Creates an empty collection for images | |
// Collection should now track changes in imagesRef. | |
// Example methods: | |
// $push( snapshot ) - Push new children to collection | |
$scope.images = $firebaseCollection(imagesRef); |
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
form(data-bind='submit: loadFoobar') | |
button(type='submit', data-bind='css: { loading: loadFoobar.loading }') |
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
phoneBook = | |
[("betty","555-2938") | |
,("bonnie","452-2928") | |
,("patsy","493-2928") | |
,("lucille","205-2928") | |
,("wendy","939-8282") | |
,("penny","853-2492") | |
] | |
getNumberByName :: (Eq a) => a -> [(a, c)] -> Maybe c |