Skip to content

Instantly share code, notes, and snippets.

@fgnass
fgnass / styled-components.js
Last active April 20, 2017 07:03
Pattern for styled components with lots of states
import styled, { css } from 'styled-components';
const Button = styled.button`
font-size: 1em;
margin: 1em;
border: 2px solid palevioletred;
border-radius: 3px;
@fgnass
fgnass / README.md
Created July 20, 2016 08:53
Ideas for JSSX

JSSX

Ideas for https://github.com/fgnass/jssx

Attribute or class?

Currently JSSX follows a simple rule to decide whether a prop is class name or a regular HTML attribute:

For any given prop, if a JSS class with the same name exits, it is interpreted as className, otherwise as attribute.

@fgnass
fgnass / index.js
Created April 3, 2015 10:33
Making node-dev work with JSX
// install node-jsx in a separate module
require('./install-jsx')
// require a jsx file
require('./test')
// keep node running ...
setInterval(function() {}, 100000)
@fgnass
fgnass / index.js
Created January 15, 2015 16:06
requirebin sketch
var debug = require('debug')
debug.enable('*')
var log = debug('test')
log('Hello world', window)
@fgnass
fgnass / stacktrace
Last active August 29, 2015 14:06
tap/difflet/charm error
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at Stream.EventEmitter.addListener (events.js:179:15)
at Stream.pipe (stream.js:99:8)
at module.exports .../node_modules/tap/node_modules/difflet/node_modules/charm/index.js:38:15)
at difflet .../node_modules/tap/node_modules/difflet/index.js:41:17)
at Function.fn.compare .../node_modules/tap/node_modules/difflet/index.js:20:9)
at diffObject .../node_modules/tap/lib/tap-assert.js:398:50)
at assert .../node_modules/tap/lib/tap-assert.js:55:18)
at Function.equivalent .../node_modules/tap/lib/tap-assert.js:182:12)
@fgnass
fgnass / JSXTransformer.js
Last active August 29, 2015 14:05
React + Picturefill
/**
* JSXTransformer v0.11.0-rc1
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.JSXTransformer=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
@fgnass
fgnass / README.md
Last active August 29, 2015 14:01
neteye.js

NETEYE JavaScript Code Style

This is JavaScript code style used at NETEYE. It's derived from the npm coding style which has been designed to reduce visual clutter and make bugs more apparent.

Indentation

Two-spaces. Tabs are better, but they look like hell in web browsers. And node uses 2 spaces, so that's that.

@fgnass
fgnass / ipalias.plist
Created February 26, 2013 09:05
Add 10.0.2.2 as alias for the loopback interface upon startup.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ipalias</string>
<key>ProgramArguments</key>
<array>
<string>ifconfig</string>
<string>lo0</string>
@fgnass
fgnass / download.php
Created September 5, 2012 11:29
HTTP download without curl or fopen wrappers
function download($url, $timeout=10) {
$host;
$path = '/';
$port = 80;
extract(parse_url($url));
if (isset($query)) $path .= '?'.$query;
$req = array(
"GET $path HTTP/1.1",
"Host: $host",
@fgnass
fgnass / LICENSE.txt
Created October 4, 2011 08:44 — forked from 140bytes/LICENSE.txt
The Mandelbro™
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Felix Gnass <http://twitter.com/fgnass>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE