Skip to content

Instantly share code, notes, and snippets.

View qmmr's full-sized avatar

Marcin Kumorek qmmr

View GitHub Profile
// === 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];
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;
$lightgray : #819090;
$gray : #708284;
$mediumgray : #536870;
$darkgray : #475B62;
$darkblue : #0A2933;
$darkerblue : #042029;
$paleryellow : #FCF4DC;
$paleyellow : #EAE3CB;
$yellow : #A57706;
$orange : #BD3613;
@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;
@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 / 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 / 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;