Skip to content

Instantly share code, notes, and snippets.

@yuheiy
yuheiy / index.html
Last active December 9, 2015 17:44
snow canvas
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Snow Canvas</title>
<style>
body {
background-color: #2c3e50;
}
const getCssUnitsVal = value => {
const tester = document.createElement('div');
let size;
tester.style.width = value;
document.body.appendChild(tester);
size = tester.offsetWidth;
document.body.removeChild(tester);
return size;
};
@yuheiy
yuheiy / index.html
Last active December 9, 2015 17:43
vertical center
<!DOCTYPE html>
<html lang="en">
<head>
<meta charaset="utf-8">
<title>vertical center</title>
<style>
body {
margin: 0;
}
.wrapper {
@yuheiy
yuheiy / index.html
Created December 10, 2015 12:50
Element in the vertical center where you can scroll. Raw
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Element in the vertical center where you can scroll</title>
<style>
.center {
position: fixed;
right: 50%;
@yuheiy
yuheiy / velocity.js
Created February 5, 2016 09:57
add `easeOutBounce` to velocity.js
'use strict';
import Velocity from 'velocity-animate';
let baseEasings = {};
baseEasings.Bounce = p => {
let pow2;
let bounce = 4;
while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) {}
Array.prototype.slice.call(
document.querySelectorAll('.fbPhotoStarGridElement')
).filter(function (el) {
return el.querySelector('.uiMediaThumb');
}).map(function (el) {
return el.dataset.fbid;
}).forEach(function (id, i) {
setTimeout(function () {
var url = 'https://www.facebook.com/photo/download/?fbid=' + id;
location.href= url;
array.reduce((obj, val, i) => {
obj[i] = val;
return obj;
}, {});
var Promise = require('bluebird')
Promise.map(arr, fn, { concurrency: n })
javascript:[].slice.call(document.querySelectorAll('.fbPhotoStarGridElement')).filter(function(el){return el.querySelector('.uiMediaThumb')!==null}).map(function(el){return el.dataset.fbid}).forEach(function(id,i){setTimeout(function(){location.href='https://www.facebook.com/photo/download/?fbid='+id},1000*i)})
function filter (array, cb) {
var i;
var l = array.length;
var item;
var matched = [];
var unmatched = [];
for (i = 0; i < l; i++) {
item = array[i];