Skip to content

Instantly share code, notes, and snippets.

@aftdotleo
aftdotleo / easing.js
Created January 11, 2019 07:05 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@aftdotleo
aftdotleo / string_to_buffer.js
Created April 16, 2018 04:23 — forked from kawanet/string_to_buffer.js
String と ArrayBuffer の相互変換 JavaScript
// 文字列から ArrayBuffer への変換
function string_to_buffer(src) {
return (new Uint16Array([].map.call(src, function(c) {
return c.charCodeAt(0)
}))).buffer;
}
// ArrayBuffer から文字列への変換
@aftdotleo
aftdotleo / mixin.less
Last active August 29, 2015 14:00
LESS mixin
.clearfix () {
zoom: 1;
&:before,
&:after {
content: "\0020";
display: block;
height: 0;
overflow: hidden;
}
# mode 0: old style sleep / 3: new (save to disk style)
# show the hibernatemode
pmset -g | grep hibernatemode
# change the hibernate mode
sudo pmset -a hibernatemode 0
# check the sleepimage size
ls -lh /private/var/vm/sleepimage

常用的 HTML 头部标签

详细介绍参见原文:yisibl/blog#1

<!DOCTYPE html> <!-- 使用 HTML5 doctype,不区分大小写 -->
<html lang="zh-cmn-Hans"> <!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->
<head>
    <meta charset='utf-8'> <!-- 声明文档使用的字符编码 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- 优先使用 IE 最新版本和 Chrome -->