Skip to content

Instantly share code, notes, and snippets.

View wadackel's full-sized avatar
🐶

tsuyoshi wada wadackel

🐶
View GitHub Profile
set nocompatible
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,cp932,ico-2022-jp,sjis,euc-jp,latin1
if has('termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
endif
@wadackel
wadackel / echo.ts
Created April 10, 2017 03:12
Simple debugging for node.js. (use TypeScript)
import { inspect } from 'util';
const echo = (...args: any[]) => (
args.forEach(val => console.log(inspect(val, { showHidden: false, depth: Infinity, colors: true })))
);
@wadackel
wadackel / easings.css
Created February 4, 2017 04:50
CSS Easings variables
/* Reference by: http://easings.net/ */
:root {
/* sine */
--ease-in-sine: cubic-bezier(.47, 0, .745, .715);
--ease-out-sine: cubic-bezier(.39, .575, .565, 1);
--ease-in-out-sine: cubic-bezier(.445, .05, .55, .95);
/* quad */
--ease-in-quad: cubic-bezier(.55, .085, .68, .53);
--ease-out-quad: cubic-bezier(.25, .46, .45, .94);
@wadackel
wadackel / _positions.scss
Created November 8, 2016 07:44
Mixin for positioning API.
@mixin position($type, $top: null, $right: null, $bottom: null, $left: null, $z-index: null) {
position: $type;
top: $top;
right: $right;
bottom: $bottom;
left: $left;
z-index: $z-index;
}
@mixin fixed($args...) {
@wadackel
wadackel / gh-abstime.js
Last active September 15, 2016 01:44
Convert absolute time from relative time in GitHub, for Chrome. (Example: 15 minutes ago -> 2016-09-15 10:06:20)
// Original
(() => {
"use strict";
const el = document.querySelectorAll("time-ago,relative-time") || [];
const pad = s => `0${s}`.slice(-2);
Array.prototype.forEach.call(el, o => {
const d = new Date(o.getAttribute("datetime"));
o.textContent = [
`${d.getFullYear()}-`, `${pad(d.getMonth() + 1)}-`, `${pad(d.getDate())} `,
`${pad(d.getHours())}:`, `${pad(d.getMinutes())}:`, `${pad(d.getSeconds())}`
@wadackel
wadackel / git_diff_archive.sh
Last active February 19, 2016 02:11
gitで差分ファイルの抽出用関数
#!/bin/sh
function git_diff_archive()
{
local OPTIND OPTARG OPT
local dateTime=`date '+%Y%m%d%H%M'`
local mode="AMCRD"
local diff=""
local h="HEAD"
@wadackel
wadackel / easings.scss
Last active October 25, 2016 09:18
Sassのイージング変数一覧
// Custom easing functions.
// http://easings.net/ja
// sine
$ease-in-sine: cubic-bezier(0.47, 0, 0.745, 0.715);
$ease-out-sine: cubic-bezier(0.39, 0.575, 0.565, 1);
$ease-in-out-sine: cubic-bezier(0.445, 0.05, 0.55, 0.95);
// quad
$ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
@wadackel
wadackel / request-animation-frame.js
Created December 14, 2015 14:55
ES6 ModulesでrequestAnimationFrameのpolyfill
let lastTime = 0;
const raf =
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function(callback){
const currentTime = Date.now();
const timeToCall = Math.max(0, 16 - (currentTime - lastTime));
const id = window.setTimeout(() => { callback(currentTime + timeToCall) }, timeToCall);
@wadackel
wadackel / spacer-factory.scss
Last active December 3, 2015 04:07
Margin and Padding helper classes.
// Margin and Padding helper classes.
@mixin spacer-factory($prop, $alias, $start: 0, $end: 5, $unit: rem, $use-important: true){
$directions: (
top: t,
right: r,
bottom: b,
left: l
);
$important: if($use-important == true, " !important", "");
@wadackel
wadackel / bem-mixins.scss
Last active September 30, 2015 15:20
BEMのElement、Modifierの入力をmixinで。
// BEM Helper mixins.
// Supports multiple arguments.
// for Sass v3.3 ~
// Elements
@mixin e($names...) {
@each $name in $names {
&__#{$name} {
@content;
}