This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ago($time) | |
{ | |
$periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade"); | |
$lengths = array("60","60","24","7","4.35","12","10"); | |
$now = time(); | |
$difference = $now - $time; | |
$tense = "ago"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asyncRandom() { | |
return function (fn) { | |
setTimeout(function () { | |
fn(Math.random()); | |
}, 10); | |
}; | |
} | |
function *gen1() { | |
var a = yield asyncRandom(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Drupal", | |
"members": [ | |
{ | |
"name": "Wang Qiu", | |
"role": "Team Lead", | |
"motto": "", | |
"avatar": "https://2.gravatar.com/avatar/7ed23c4532204410539c551c405ce213?d=https%3A%2F%2Fidenticons.github.com%2Fe66953f95ec27b59aab57b32b630cfda.png&r=x&s=460" | |
} | |
/*, others */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1 | |
function Car () {} | |
function Ticket () {} | |
function ParkingLot(capacity) { | |
this.capacity = capacity; | |
this.cars = []; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" don't bother with vi compatibility | |
set nocompatible | |
" vundle start | |
filetype off " required | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($, ShowDown, CodeMirror) { | |
"use strict"; | |
$(function() { | |
if (!document.getElementById('entry-markdown')) | |
return; | |
//var delay; | |
var converter = new ShowDown.converter(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function run(element, cssProperty, value, duration) { | |
var initalValue = parseFloat(window.getComputedStyle(element)[cssProperty]); | |
var start = new Date().getTime(); | |
window.requestAnimationFrame(function step() { | |
var progress = new Date().getTime() - start; | |
var newValue = bounce(progress, initalValue, parseFloat(value) - initalValue, duration); | |
element.style[cssProperty] = newValue + 'px'; | |
if (progress < duration) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let obj = { | |
data: [ 'hello', 'world' ], | |
[Symbol.iterator]() { | |
const self = this; | |
let index = 0; | |
return { | |
next() { | |
if (index < self.data.length) { | |
return { | |
value: self.data[index++] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore } from 'reflux' | |
// if you don't mind | |
import { pipe, of } from 'ramda' | |
import GalleryActions from '../actions/GalleryActions' | |
export default createStore({ | |
init(){ | |
this.galleryMap = {} |