Skip to content

Instantly share code, notes, and snippets.

@oldergod
oldergod / animation-based-trigger.js
Created June 30, 2016 13:58
Animation based trigger
const el = document.querySelector('.el');
elA.addEventListener('animationend', () => {
elA.classList.remove('.animating');
}):
// triggers CSS animation which time varies
elA.classList.add('.animating');
// How to check that the class `animating` is rightly removed when the animation finishes?
@oldergod
oldergod / dabblet.css
Created June 30, 2016 05:12
CSS Coding Tips: Trust your eyes
/**
* CSS Coding Tips: Trust your eyes
*/
div {
position: absolute;
top: 100px;
}
span {
@oldergod
oldergod / dabblet.css
Created June 30, 2016 05:06
CSS Coding Tips: Inheritance
/**
* CSS Coding Tips: Inheritance
*/
div {
margin-top: 50px;
position: relative;
border: 1px solid black;
background: pink;
}
@oldergod
oldergod / dabblet.css
Last active June 30, 2016 05:00
CSS Coding Tips: Maintainability versus brevity
/**
* CSS Coding Tips: Maintainability versus brevity
*/
div {
position: absolute;
top: calc(50% - 25px);
left: calc(50% - 25px);
height: 50px;
width: 50px;
@oldergod
oldergod / dabblet.css
Last active June 29, 2016 09:46
CSS Coding Tips : Minimize code duplication
/**
* CSS Coding Tips : Minimize code duplication
*/
button {
padding: 6px 16px;
border: 1px solid #446d88;
background: #58a linear-gradient(#77a0bb, #58a);
border-radius: 4px;
box-shadow: 8 1px 5px gray;
@oldergod
oldergod / ruby_inline.sh
Last active August 29, 2015 14:09
Ruby inline with before and after blocks
ls | ruby -ne 'BEGIN{puts("lets go");$array = []};$array << $_.chomp;END{puts $array.inspect;puts "finished"}'
@oldergod
oldergod / count_access_per_user.sh
Last active August 29, 2015 14:07
アクセスログから月単位でユーザID(整数5桁)毎にアクセス数をCSV形式提出
#!/bin/bash
# アクセス数を抽出するスクリプト
# yyyy/dd/*.log.bz2 しか対応しない
# アクセスログから月単位でユーザID(整数5桁)毎にアクセス数をCSVファイルに提出
declare -A USERS
# 6月から8月まで
months=( 6 7 8 )
output=~/access_count_per_user.csv
for month in ${months[@]};do
@oldergod
oldergod / trees.go
Last active August 29, 2015 14:06
Tour of Go Binary Trees
package main
import (
"code.google.com/p/go-tour/tree"
"fmt"
)
func Walk(t *tree.Tree, ch chan int) {
if t.Left != nil {
Walk(t.Left, ch)
@oldergod
oldergod / rot13.go
Created September 16, 2014 08:00
Tour of Go Rot13
package main
import (
"io"
"os"
"strings"
"unicode"
)
type rot13Reader struct {
@oldergod
oldergod / image.go
Last active August 29, 2015 14:06
Tour of Go Image
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
const DIM = 1024