Skip to content

Instantly share code, notes, and snippets.

View Swaagie's full-sized avatar
🦀
rusty

Martijn Swaagman Swaagie

🦀
rusty
View GitHub Profile
@Swaagie
Swaagie / gist:3d61aa64cee82b5adf68
Last active December 2, 2015 15:23
Bad React event pattern
import React, { Component } from 'react';
class Eventer extends React.Component {
constructor(props) {
super(props);
this.state = {
something: 'test'
};
}
@Swaagie
Swaagie / gist:e1d47644c4a4642056c4
Last active August 29, 2015 14:24
React-europe conf

Opening: Christopher Chedeau (Vjeux)

React-router
Innovation around react-router happened in Ember, copied router concepts.

Compilation
Advise against browserify/webpack -> don't wait for compilation. In stead do incremental updates and code splitting (still needs a lot of work)

UX/DX
Developer experience matters in React (native). One of the goals is to improve the DX. Call to work together.

pipe
.before(serveStatic(path.join(__dirname, 'public1')))
.before(serveStatic(path.join(__dirname, 'public2')))
.before(serveFavicon(path.join(__dirname, 'public', 'favicon.png')));
var fs = require('fs')
, path = require('path')
, request = require('request')
, cheerio = require('cheerio');
//
// Create target directory
//
if (!fs.existsSync(__dirname + '/target')) fs.mkdirSync(__dirname + '/target');
swaagie ~ xrandr
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 1024 x 768, current 1024 x 768, maximum 1024 x 768
default connected primary 1024x768+0+0 0mm x 0mm
1024x768 76.0*
------------------------------------------
@Swaagie
Swaagie / visibly.js
Last active December 21, 2015 00:39 — forked from addyosmani/visibly.js
Updated visibly against firefox native API
/*!
* isVis - v0.5.5 Aug 2011 - Page Visibility API Polyfill
* Copyright (c) 2011 Addy Osmani
* Dual licensed under the MIT and GPL licenses.
*/
(function () {
window.visibly = {
b: null,
q: document,
@Swaagie
Swaagie / gist:4346059
Created December 20, 2012 15:43
This will break user experience in IE8/9 badly, somehow storing a session cookie alongside large data sets in sessionStorage will block the UI on page reload/just before unload
// Create random value for key and value purposes, ignore the globals...
test = Math.round(Math.random()+1);
// Prepare data to be written
kilo = [];
lol = (function () {for(var i = 0; i < 100000; i++) { kilo.push({test: test}); }})();
// Write to sessionstorage
sessionStorage.setItem('lol' + test, JSON.stringify(kilo));
@Swaagie
Swaagie / gist:4153431
Last active October 13, 2015 06:27
Stylus CSS arrows made easy
/**
* Create an arrow on the element using before and after pseudo selectors.
*
* Example:
*
* .tooltip
* arrow('right', 20px, 15px, #CCC, #FFF, 1)
*
* Display an arrow right of the element 20 pixels from the top. The border
* is grey colored and 1 pixel wide. If the background color matches the