Skip to content

Instantly share code, notes, and snippets.

View HerringtonDarkholme's full-sized avatar

Herrington Darkholme HerringtonDarkholme

View GitHub Profile
/**
* Copyright (C) 2011 Hakim El Hattab, http://hakim.se
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
""""""""""""""""""""""""""""""""""""""""""""""""
" => configuration
""""""""""""""""""""""""""""""""""""""""""""""""
set encoding=utf-8
set hidden
set foldlevel=99
set foldmethod=indent
let tabsize=4
""""""""""""""""""""""""""""""""""""""""""""""""
" => highlight help
@keyframes pace-bounce {
0% {
top: 0;
animation-timing-function: ease-in;
}
50% {
top: 140px;
height: 140px;
animation-timing-function: ease-out;
}
@HerringtonDarkholme
HerringtonDarkholme / poj1013.c
Created November 2, 2013 10:09
ヒマ(´・ω・`)
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define swap(a, b) (a)^=(b); (b)^=(a); (a)^=(b);
struct balance {
uint16_t real;
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#define MAX 50
int find_solution(int size, int consumed, int min, int max, int *len, int *num);
void start(int);
int distinct;
@HerringtonDarkholme
HerringtonDarkholme / dabblet.css
Created November 15, 2013 16:27
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
html {
background: #f06;
background: linear-gradient(-45deg, #bd9999,#282828);
min-height: 100%;
}
.container {
'use strict';
// middlewares: array of generator function
function compose(middlewares) {
return function *() {
var i = middlewares.length;
var prev = function *(){};
var current;
while (i--) {
current = middlewares[i];
// bad
function Curry(fn) {
var args = Array.prototype.slice.call(arguments, 1);
var len = fn.length - args.length;
var partial = function () {
var partialArg = Array.prototype.slice.call(arguments);
args = args.concat(partialArg);
if (args.length > len) {
throw new Error('wrong argument lenth: Expected ' + len + '; Receive ' + args.length);
@HerringtonDarkholme
HerringtonDarkholme / from-py.js
Created April 25, 2014 18:24
Infinite default dictionary in Javascript ES6
function handlerMaker(obj) {
return {
getOwnPropertyDescriptor: function(name) {
var desc = Object.getOwnPropertyDescriptor(obj, name);
// a trapping proxy's properties must always be configurable
if (desc !== undefined) { desc.configurable = true; }
return desc;
},
getPropertyDescriptor: function(name) {
var desc = Object.getPropertyDescriptor(obj, name); // not in ES5
{isArray, isFunc} = require('./util')
class Extractor
FN_ARGS = ///
^function # function
\s* # optional white
[^\(]* # function name
\( # left paren
\s*
([^\)]*) #params
\) # right paren