Skip to content

Instantly share code, notes, and snippets.

View qmmr's full-sized avatar

Marcin Kumorek qmmr

View GitHub Profile
@qmmr
qmmr / animLoopX.js
Created April 3, 2012 08:01 — forked from louisremi/animLoopX.js
Animation loop with requestAnimationFrame
// Cross browser, backward compatible solution
(function( window, Date ) {
// feature testing
var raf = window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame ||
window.oRequestAnimationFrame;
window.animLoop = function( render, element ) {
var running, lastFrame = +new Date;
@qmmr
qmmr / uri.js
Created September 6, 2012 18:57 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@qmmr
qmmr / update-emacs-ppa.sh
Created October 20, 2012 18:40 — forked from DamienCassou/update-emacs-ppa.sh
Emacs-snapshot build script for Ubuntu PPA
#!/bin/bash
# Author: Damien Cassou
#
# This is the script I use to build https://launchpad.net/~cassou/+archive/emacs/
# from http://emacs.naquadah.org/.
MAIN_VERSION=20120911
SUB_VERSION=1
@qmmr
qmmr / callouts.css
Created December 1, 2012 19:22
Boilerplate code for form example
::-webkit-validation-bubble-message{
background-color: #434343;
padding: 20px;
color: whitesmoke;
text-shadow: -2px -2px 2px rgba(0,0,0,0.4);
font-size: 34px;
font-family: "Lobster";
border: none;
border: 3px solid rgba(255,255,255,0.8);
top: 49px;
$lightgray : #819090;
$gray : #708284;
$mediumgray : #536870;
$darkgray : #475B62;
$darkblue : #0A2933;
$darkerblue : #042029;
$paleryellow : #FCF4DC;
$paleyellow : #EAE3CB;
$yellow : #A57706;
$orange : #BD3613;
function dedent(callSite, ...args) {
function format(str) {
let size = -1;
return str.replace(/\n(\s+)/g, (m, m1) => {
if (size < 0)
size = m1.replace(/\t/g, " ").length;
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
@qmmr
qmmr / app.js
Last active August 31, 2015 22:20 — forked from sogko/app.js
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@qmmr
qmmr / ElementFactoriesAndJSX.md
Last active September 5, 2015 10:59 — forked from sebmarkbage/ElementFactoriesAndJSX.md
New React Element Factories and JSX

New React Element Factories and JSX

In React 0.12, we're making a core change to how React.createClass(...) and JSX works.

If you're using JSX in the typical way for all (and only) React components, then this transition will be seamless. Otherwise there are some minor breaking changes described below.

The Problem

@qmmr
qmmr / transferring-props.md
Last active September 5, 2015 10:59 — forked from sebmarkbage/transferring-props.md
Deprecating transferPropsTo

Deprecating transferPropsTo

It's a common pattern in React to wrap a component in an abstraction. The outer component exposes a simple property to do something that might have more complex implementation details.

We used to have a helper function called transferPropsTo. We no longer support this method. Instead you're expected to use a generic object helper to merge props.

render() {
 return Component(Object.assign({}, this.props, { more: 'values' }));