Skip to content

Instantly share code, notes, and snippets.

Avatar

Eirik L. Vullum eiriklv

View GitHub Profile
@HenrikJoreteg
HenrikJoreteg / README.md
Last active Sep 20, 2021
Minimalist routing in Redux
View README.md

Why would you want to do this? Because you often don't need more. It's nice to not have to think about your "router" as this big special thing.

Instead, with this approch, your app's current pathname is just another piece of state, just like anything else.

This also means that when doing server-side rendering of a redux app, you can just do:

var app = require('your/redux/app')
var React = require('react')
@geowarin
geowarin / index-template.html
Created Aug 5, 2015
Template index for the html-webpack-plugin and react
View index-template.html
<!DOCTYPE html>
<html{% if(o.htmlWebpackPlugin.files.manifest) { %} manifest="{%= o.htmlWebpackPlugin.files.manifest %}"{% } %}>
<head>
<meta charset="UTF-8">
<title>{%=o.htmlWebpackPlugin.options.title || 'Webpack App'%}</title>
{% if (o.htmlWebpackPlugin.files.favicon) { %}
<link rel="shortcut icon" href="{%=o.htmlWebpackPlugin.files.favicon%}">
{% } %}
{% for (var css in o.htmlWebpackPlugin.files.css) { %}
<link href="{%=o.htmlWebpackPlugin.files.css[css] %}" rel="stylesheet">
@donspaulding
donspaulding / pooFlinger.js
Created Jul 13, 2015
Continually fling poo at someone...
View pooFlinger.js
'use strict';
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
function flingPoo(){
res.write("&#x1f4a9;");
setTimeout(flingPoo, 1000);
}
flingPoo();
anonymous
anonymous / blockerList.json
Created Jun 25, 2015
Testing Safari Content Blocker on iMore.com
View blockerList.json
[
{
"action": {
"type": "block"
},
"trigger": {
"url-filter": ".*",
"resource-type": ["script"],
"load-type": ["third-party"],
"if-domain": ["imore.com"]
View FBAnimationPerformanceTracker.h
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@ohanhi
ohanhi / frp.md
Last active Nov 6, 2021
Learning FP the hard way: Experiences on the Elm language
View frp.md

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@rmoriz
rmoriz / howto.md
Last active Jun 7, 2017
Build an OSX 10.10 base-box for test-kitchen and VirtualBox
View howto.md
View on-jsx.markdown

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@branneman
branneman / pair.js
Last active Sep 27, 2016
Pairs (length 2 tuples) in JavaScript
View pair.js
/**
* Pair
* @todo Implement algebraic structures: Setoid, Functor
*/
var Pair = function(fst, snd) {
if (this instanceof Pair) {
if (Array.isArray(fst) && fst.length === 2 && typeof snd == 'undefined') {
this[0] = fst[0];
this[1] = fst[1];
} else {