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
/* | |
Usage: | |
_.occurrences(['Foo', 'Bar', 'Foo']) | |
=> {'Foo': 2, 'Bar': 1} | |
_.occurrences(['Foo', 'Bar', 'Foo'], 'Foo') | |
=> {'Foo': 2} | |
*/ | |
_.mixin({ |
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
// Convert base64 encoded string to UTF8 | |
var base64ToUTF8 = function(str) { | |
return decodeURIComponent(escape(window.atob(str))) | |
} | |
// Micro templating | |
var render = function(string, data) { | |
for(var s in data) { | |
string = string.replace(new RegExp('{'+s+'}', 'g'), data[s]) | |
} |
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
#!/usr/bin/env bash | |
echo "** Misspelled English words **" | |
cat sections/*.tex abstracts/abstract_english.tex \ | |
| aspell \ | |
--personal ./wordlist \ | |
-W 3 \ | |
-d en \ | |
list \ |
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 _ = require('underscore') | |
/** | |
* Takes an key-value hash and returns an array with | |
* the following structure: | |
* | |
* {key: 'val', foo: 'bar'} | |
* => ['--key', 'val', '--foo', 'bar'] | |
*/ | |
var toArgumentArray = function(src) { |
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
=> Booting Thin | |
=> Rails 4.0.2 application starting in development on http://0.0.0.0:3000 | |
=> Run `rails server -h` for more startup options | |
=> Ctrl-C to shutdown server | |
Thin web server (v1.6.2 codename Doc Brown) | |
Maximum connections set to 1024 | |
Listening on 0.0.0.0:3000, CTRL+C to stop | |
Invalid request: Invalid HTTP format, parsing fails. | |
/Users/Johan/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/request.rb:84:in `execute' | |
/Users/Johan/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thin-1.6.2/lib/thin/request.rb:84:in `parse' |
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
Hej Christina! | |
Kul att du ville veta lite mer om mig! Jag heter Anna Brook, är 19 år, och tar studenten från samhällsprogrammet till sommaren. Jag är uppvuxen i Österfärnebo, ett litet samhälle några mil utanför Gävle. Jag är en glad och positiv tjej som har haft en önskan att bo och jobba i London i många år. | |
Jag bor på lite av en bondgård och har genom det blivit van vid stress. Vi har många och olika djur, så att ta snabba beslut när det är ont om tid är jag bra på. Då jag bland annat haft egen i häst i 8 år har jag bra koll på eget ansvar och rutiner. | |
Vidare ser jag mig som uppmärksam, energisk, kreativ och har bra hand om barn. Hur många barn har ni och hur gamla är dom? | |
Engelska som språk är inget problem för mig, då min farfar härstammar från Yorkshire, och att våra släktingar finns i bland annat Kanada och Pakistan. På så vis har engelskan varit en stor del av min uppväxt, och något jag både behärskar bra och gärna lär mig mer av. Jag har även studerat franska och spanska. | |
Jag älskar musik! Att |
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
doSomething(func).then(function(res) { | |
res.title = "hej"; | |
return Q.fcall(function() { | |
return res; | |
}) | |
}) |
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
{ | |
"name": "private-npm-modules", | |
"version": "0.0.1", | |
"dependencies": { | |
"indexeddbstore": "git://github.com/datx02/data-storage.git#master" | |
}, | |
"author": "Johan Brook" | |
} |
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
#!/usr/bin/env node | |
/* | |
Quick script for downloading a bunch of wallpapers from a given | |
array of URLs, in a special resolution. | |
Call script: | |
node download.js [pathToUrlFile, resolution, destination] |
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 ApplicationController < ActionController::Base | |
# Prevent CSRF attacks by raising an exception. | |
# For APIs, you may want to use :null_session instead. | |
protect_from_forgery with: :null_session | |
# protect_from_forgery with: :exception # FIXME: Shouldn't need to uncomment this, but getting csrf exception when POST:ing to comments.json... even if sending "Content-Type: application/json" in header | |
layout proc {|c| pjax_request? ? pjax_layout : "application"} | |
helper_method :pjax_request? | |
helper_method :current_user, :is_loggedin? |