Skip to content

Instantly share code, notes, and snippets.

View nordfjord's full-sized avatar

Einar Norðfjörð nordfjord

View GitHub Profile
@nordfjord
nordfjord / Æfiingaplan
Last active August 29, 2015 14:02
Æfingaplan
o-----------------------------------------------------------------------------------------------------------------------------------------o
| Æfingaplan út júní |
o-----------------------------------------------------------------------------------------------------------------------------------------o
| | Mánudagar | Þriðjudagar | Miðvikudagar | Fimmtudagar | Föstudagar | Laugardagar | Sunnudagar |
o--------o---------------------o-------------o---------------------o-------------o---------------------o---------------------o------------o
| Hvað | 3. Skref / Pushaway | Ræktin | 3. Skref / Pushaway | Ræktin | 3. Skref / Pushaway | 3. Skref / Pushaway | fríí |
| Hvenær | 19:00 | | 19:00 | | 19:00 | 19:00 | |
o--------o---------------------o------------
@nordfjord
nordfjord / SteamGuide.ahk
Created June 27, 2014 09:50
My Autohotkeys
/*
* SteamGuide starts steam big picture when the guide button is pressed for 3 seconds
*/
#SingleInstance force
#NoTrayIcon
WaitKey()
{
KeyWait, Joy7, T3
return ErrorLevel
@nordfjord
nordfjord / .jshintrc
Last active August 29, 2015 14:13
Basic browserify Gulpfile
{
"browser": true,
"esnext": true,
"globals": {
"require": true,
"exports": true,
"console": true,
"module": true,
"define": true,
"process": true
@nordfjord
nordfjord / reductio_json.coffee
Last active October 1, 2015 17:03
Reductio JSON
reductio = require 'reductio'
_ = require 'lodash'
makeTemplate = (config)->
if !type.call(config) == '[object String]'
return ()-> 'unknown'
if ~config.indexOf '<%'
templ = _.template config
tpl = (d)-> templ d:d
else
@nordfjord
nordfjord / readme.md
Created October 3, 2015 21:08
Mithril element remove animation

Parameters

param type description
accessor function accessor for the element whose style should be modified
style Object or Function styles to apply
rm Function function to remove element from view (usually from an array)

#Usage

@nordfjord
nordfjord / comment-model.js
Last active November 9, 2015 18:58 — forked from gilbert/comment-model.js
Mithril-friendly Model Layer
var Comment = {}
Comment.store = Store('Comment', {idprop: 'id'});
Comment.fetchForPost = function (postId) {
return m.request({ method: 'GET', url: '/api/post/' + postId + '/comments' })
.then(Comment.store.syncAll)
}
@nordfjord
nordfjord / workflow.md
Created March 3, 2016 08:54
Git workflow comparison

GitHub flow

  • Anything on master is deployable
  • To work on something new, create a descriptively named branch off of master (i.e. stream-item-margins)
  • Commit to that branch locally and regularly push your work to the same named branch on the server
  • When you need feedback or help, or you think the branch is ready for merging, open a pull request
  • After someone else has reviewed and signed off on the feature, you can merge it into master
  • Once it is merged and pushed to ‘master’ on the origin, you can and should deploy immediately

All to master

Introduction

You've been sat at this delightful little café for the best part of an hour and a half. You've not had a sip of coffee, but the pot plant next to you has been remarkably well fed as you keep asking for refills. The pastry in front of you has not entered your mouth, but you've occupied yourself peeling off the thin layers of its skin, flicking them away in the breeze.

Your attention here isn't on the patisserie, it's on that church on the other side of the piazza, that magnificent stone building, that edifice of religion, that monument to faith. In your breathing days you used to attend regularly, you took the sacrament, you spoke the words, but you weren't there because you were a believer, you were there because of a woman, as you so often were in life.

@nordfjord
nordfjord / mithril-ga.js
Created March 22, 2016 15:47
Google Analytics integration for mithril
var m = require('mithril');
var _mroute = m.route;
var type = {}.toString;
m.route = function(arg0, arg1){
var res = m_route.apply(this, [].slice.call(arguments));
if (type.call(arguments[0]) === '[object String]' || (arguments.length === 3 && type.call(arg1) === '[object String]')) {
ga('send', 'pageview', _mroute());
@nordfjord
nordfjord / example.js
Created September 6, 2016 15:00
Subtree retain flyd streams
import m from 'mithril';
import f from 'flyd';
import retain from './flyd-retain';
function myComponent(){
let username = f.stream('');
let username_header = username.map(name => m('h1', name));
let username_input = username.map(name => m('input', {value: name, oninput: m.withAttr('value', username)}));
return retain(f.combine(function(h, i){