Skip to content

Instantly share code, notes, and snippets.

/*! normalize-all-you-really-need-tho.css v1.0.0 | MIT License */
html {
font-family: sans-serif; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
-ms-text-size-adjust: 100%; /* 2 */
}
body {
margin: 0;
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@bultas
bultas / router.html
Last active October 29, 2023 23:19 — forked from joakimbeng/router.html
A Javascript router in 20 lines
<!-- http://joakimbeng.eu01.aws.af.cm/a-javascript-router-in-20-lines/ -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Building a router</title>
<script>
// Put John's template engine code here...
var copyProperties = require('react/lib/copyProperties'),
Dispatcher = require('flux').Dispatcher,
util = require('util');
function AppDispatcher() {
Dispatcher.call(this);
this._queue = [];
}
util.inherits(AppDispatcher, Dispatcher);
@bultas
bultas / Enhance.js
Last active August 29, 2015 14:24 — forked from sebmarkbage/Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Dynamic Gist Embedding</title>
</head>
<body>
<p>
@bultas
bultas / pre-commit
Last active March 4, 2016 08:22 — forked from jhartikainen/commit-msg
Pre-commit to check tracked/commited js/jsx files with ESlint (node_modules)
#!/bin/bash
files=$(git diff --diff-filter=ACMRT --cached --name-only | grep '\.jsx\|\.js\?$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
failed=0
@bultas
bultas / 01_readme.md
Last active August 29, 2015 14:25 — forked from vslinko/01_readme.md
Experimental Relay Implementation

Experimental Relay Implementation

Features:

  • Relay.fetch(graphqlQuery) returns subscribtion that could change over time by mutation queries.
  • Relay.update(m: UpdateMutation) optimistically updates resource in all previous queries that contains updated resource.
  • Relay.update(m: DeleteMutation) optimistically deletes resource from all previous queries that contains deleted resource.
  • Relay.update(m: CreateMutation) pessimistically creates resource and executes again all previous queries.
  • All objects with id key in graphql response explained as resources. Arrays, objects without id and scalars explained as static properties.
@bultas
bultas / gist:6f4fccc1bb7d21cab9be4eec7c8cb843
Created August 25, 2016 16:47 — forked from n00neimp0rtant/gist:9515611
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@bultas
bultas / children-as-function.js
Created November 20, 2017 15:44 — forked from iammerrick/children-as-function.js
Which API do you prefer? Passing a function into the Ratio component or making a higher order component called Ratio you can use to configure a component.
<Ratio width={Ratio.OPTIONS.FLUID} x={3} y={4}>
{(width, height) => (
<Chart id={this.props.id} width={width} height={height} />
)}
</Ratio>