Skip to content

Instantly share code, notes, and snippets.

View eiriklv's full-sized avatar
🤒
Out sick - I may be slow to respond.

Eirik L. Vullum eiriklv

🤒
Out sick - I may be slow to respond.
View GitHub Profile
@eiriklv
eiriklv / app.js
Last active October 19, 2015 15:55
Simple express example with body parsing
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
var tokenChallenge = 'XXX';
/**
* Add automatic body parsing,
* so that you have req.body
* available inside the route handler
@eiriklv
eiriklv / bloop.js
Created October 15, 2015 18:49 — forked from jlongster/bloop.js
bloop
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
@eiriklv
eiriklv / on-jsx.markdown
Created October 15, 2015 14:45 — forked from chantastic/on-jsx.markdown
JSX, a year in

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 lead 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'

@eiriklv
eiriklv / Enhance.js
Created October 10, 2015 10:38 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@eiriklv
eiriklv / .txt
Created September 21, 2015 10:56
Xcode developer tools
http://adcdownload.apple.com/Developer_Tools/Command_Line_Tools_OS_X_10.10_for_Xcode_7/Command_Line_Tools_OS_X_10.10_for_Xcode_7.dmg
@eiriklv
eiriklv / .zshrc
Created September 14, 2015 11:38
zsh alias and autocomplete
# Aliases
alias up='itermocil'
compctl -g '~/.teamocil/*(:t:r)' itermocil
compctl -g '~/.teamocil/*(:t:r)’ up
@eiriklv
eiriklv / fix.sh
Last active September 14, 2015 12:33
Fix permissions
sudo chown -R $USER /usr/local/lib
sudo chown -R $USER /usr/local/bin
@eiriklv
eiriklv / frag32.py
Last active September 10, 2015 18:19 — forked from ryancdotorg/frag32.py
A FAT32 fragmenter, because I am a horrible person.
#!/usr/bin/env python
import random
import struct
import sys
# Most of the Fat32 class was cribbed from https://gist.github.com/jonte/4577833
def ppNum(num):
return "%s (%s)" % (hex(num), num)
// That variant actually works with 1.0.0-beta4
// Link to the previous (1.0.0-beta3) version:
// https://github.com/cdebotton/react-universal/blob/master/src/server.js#L49
import createLocation from 'history/lib/createLocation';
import createHistory from 'history/lib/createMemoryHistory';
import ReactDOM from 'react-dom/server';
import {Router} from 'react-router';
import Layout from './views/Layout';
import Application from './containers/Application';
@eiriklv
eiriklv / how-to-view-source-of-chrome-extension.md
Last active August 28, 2015 15:01 — forked from paulirish/how-to-view-source-of-chrome-extension.md
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=unknown&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.