Skip to content

Instantly share code, notes, and snippets.

View geta6's full-sized avatar

geta6 geta6

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.nginx</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
@geta6
geta6 / logger.coffee
Created April 30, 2013 06:40
logger for express(connect), triggered on end of response event (call res.end).
exports.logger = (options = {}) ->
_ = require 'underscore'
_.date = require 'moment'
util = require 'util'
options.format or= 'YY.MM.DD HH:mm:ss'
options.route or= null
return (req, res, next) ->
ini = Date.now()
end = res.end
res.end = ->
@geta6
geta6 / hooker.coffee
Last active December 16, 2015 19:39
メソッド実行にHookさせます
# 例えば res.end なら
end = res.end
res.end = ->
res.end = end
res.emit 'end'
res.end.apply @, arguments
res.on 'end', ->
@geta6
geta6 / .zshrc
Last active December 16, 2015 20:29
zshでCommandNotFoundにhookするスクリプトできたよー^O^ノ
preexec () {
[[ -z "`whence ${1%% *}`" ]] && echo "NOTFOUND!!! ${1%% *}"
}
# ---- #
preexec () {
cmd=${1%% *}
if [ -z "`whence ${cmd}`" ]; then
if [ $cmd = 'yabai' ]; then
BubbleSort = (arr) ->
for a, i in arr
for a, j in ([2..(arr.length - i + 1)])
if array[j] < array[j-1]
[array[j], array[j-1]] = [array[j-1], array[j]]
return arr
@geta6
geta6 / _example.styl
Last active December 17, 2015 08:39
Stylusで使用できる、after要素で吹き出しツールチップを実現するfunctionです
@import 'fukidashi'
.item1
fukidashi white 5px of 60px on left
// 親要素の左側、上から30px位置を中心とする「底辺10px、高さ5px」の白い三角形をつけます
.item2
fukidashi red 12px of auto on right
// 親要素の右側、上から50%位置を中心とする「底辺24px、高さ12px」の赤い三角形をつけます
@geta6
geta6 / web.js
Created May 28, 2013 12:37
nodejs initial hook script
#!/usr/bin/env node
require('coffee-script');
// Local Scope
var fs = require('fs')
, path = require('path')
, util = require('util')
, hooker = require('hooker')
, cluster = require('cluster')
@geta6
geta6 / catimg(bash)
Last active January 23, 2016 22:35
cat image on xterm256 terminal, zsh or bash
#!/bin/bash
# Modified by Yu-Jie Lin for Bash from zsh version
ORG="$1"
if [[ ${ORG##*.} =~ JPG|jpg|JPEG|jpeg|GIF|gif|PNG|png ]]; then
CATWIDTH=$(tput cols)
SRC=$(mktemp).png
@geta6
geta6 / clearfontcache.sh
Created June 19, 2013 09:22
OSXでフォントキャッシュをクリアするスクリプト
#!/bin/sh
echo 'remove database'
atsutil databases -removeUser 2>&1 > /dev/null
atsutil server -shutdown 2>&1 > /dev/null
echo 'restart cache server...'
sleep 2
atsutil server -ping
@geta6
geta6 / plusmata-generate.sh
Last active December 18, 2015 16:39
Pragmataをベースに日本語空間にMigu-1Mを合成します
#!/bin/zsh
#########################
# PLUSMATA
#########################
VERSION=0.0.3
FONT_FAMILY=Plusmata
FONT_ASCENT=860
FONT_DESCENT=200