alias focus="sudo sh -c \"echo '127.0.0.1 www.facebook.com twitter.com mail.google.com # aab6de513ab5de9359809f3cdb62d352' >> /etc/hosts\"" | |
alias unfocus='sudo sed -i "" "/aab6de513ab5de9359809f3cdb62d352/d" /etc/hosts' |
/* | |
* Use with grunt-exec command: 'open -a "/Applications/Google Chrome.app" file://localhost/reload' | |
*/ | |
chrome.webRequest.onBeforeRequest.addListener(hook, {urls: ['file://localhost/reload*']}); | |
function hook(details) { | |
console.log('reloading all dev extensions'); | |
chrome.management.getAll(function(extensions){ | |
for(var i in extensions){ | |
extension = extensions[i]; |
try { | |
function foo() { | |
foo(); | |
} | |
foo(); | |
} catch(e) { | |
window.location.href="http://stackoverflow.com/search?q=[js]+" + e.message || e; | |
} |
namespace('App.data') | |
### | |
Meteor pagination class | |
Usage | |
UsersController = RouteController.extend | |
waitOn: -> | |
@page = @params.query.page || 1 | |
@pagination = new App.data.Pagination(Users, selector, {page: @page}) |
extern crate ssb_keys; | |
extern crate ssb; | |
extern crate mio; | |
#[macro_use] | |
extern crate pull; | |
const pathToSecret: String = "/tmp/ssb1-secret"; | |
const pathToDB: String = "/tmp/ssb1/"; |
data Model = Model | |
{ name :: String | |
, gender :: String | |
, loading :: Bool | |
, homeworld :: String | |
} deriving (Show) | |
data PersonResponse = PersonResponse | |
{ personName :: String |
Someone in the Elm slack channel threw out this idea of naming Msg
in the past tense, and not imperatively. I thought it was an interesting idea and I adopted the practice, just to try it out. I forgot who it was, I wish I could give them credit.
Anyway, the ramifications were more than I expected, and not simply the same Msg
with different names. What I started doing is naming Msg
as if they were saying "This happened". So where I would say "HandleUsernameField" I might instead say "UsernameFieldChanged" or instead of "Close" I would do "XClicked". What I didnt account for was that Msg
and functionality dont map one to one. So for example, if you have a Msg
named Navigate
, its going to be the one Msg
you use whenever you want to navigate. But if you are naming Msg
as paste-tense descriptions, then several different things could happen that could cause a navigation. Since many things should cause a navigation, naming Msg
in the past tense leads to lots of Msg
which do the same thing.
"use strict"; | |
// Make predicate funtions more convenient. | |
// Works like Ruby's Symbol#to_proc, which is usually called with the unary & operator and a Symbol literal: | |
// (ruby) %w[one two three].map(&:upcase) # returns ["ONE", "TWO", "THREE"] | |
// (js) ['one', 'two', 'three'].map(toFn('toUpperCase')); // returns ["ONE", "TWO", "THREE"] | |
// (js) ['one', 'two', 'three'].map(toFn`toUpperCase`); // same as above, but called via tagged string literal | |
// @param name {String} Name of method | |
// @param ...bound_args Arguments to bind NOTE: Args cannot be bound when calling as a tagged-template | |
// @return {Function} Function to call named method with bound args on any object given at time of invocation | |
module.exports = function toFn( name, ...bound_args ){ |
/** | |
* Goes through the given directory to return all files and folders recursively | |
* @author Ash Blue ash@blueashes.com | |
* @example getFilesRecursive('./folder/sub-folder'); | |
* @requires Must include the file system module native to NodeJS, ex. var fs = require('fs'); | |
* @param {string} folder Folder location to search through | |
* @returns {object} Nested tree of the found files | |
*/ | |
// var fs = require('fs'); | |
function getFilesRecursive (folder) { |