Skip to content

Instantly share code, notes, and snippets.

View rosylilly's full-sized avatar
🕊️
Happy Hacking

Sho Kusano rosylilly

🕊️
Happy Hacking
View GitHub Profile
@rosylilly
rosylilly / gist:3401612
Created August 20, 2012 06:40
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。
@rosylilly
rosylilly / css-specificity.html
Created August 10, 2012 06:25
CSS の優先順位付けについて
<!DOCTYPE html>
<html>
<head>
<style>
p.a.b.c.d.e.f.g.h.i.j.k {
color: red;
}
p#a {
color: blue;
#!/usr/bin/env bash
exit 1
@rosylilly
rosylilly / gist:2730475
Created May 19, 2012 11:02
schemeでrgb->hex hex->rgb変換
(define-module color-convert
(export hex->rgb)
(export rgb->hex)
(export rgb->hls))
(select-module color-convert)
(use srfi-13)
(define (hex->rgb hex)
@rosylilly
rosylilly / .gitignore
Created May 18, 2012 05:33
Bundlerでローカルだけで使うgemを書く
Gemfile.local
@rosylilly
rosylilly / ZeroFix.user.js
Created May 2, 2012 09:42 — forked from miyukki/ZeroFix.user.js
ZeroFix is ZeroWatch of niconico fixer. ZeroWatchが改良するまでの暫定的なユーザースクリプトです。 タイトルの縮小、タグの複数段表示、市場エリアを投稿者情報に、コメント入力エリアを下に、フェードを無効化などの機能があります。
// ==UserScript==
// @name ZeroFix
// @namespace applest.net
// @version 0.5
// @description ZeroFix is ZeroWatch of niconico fixer. ZeroWatchが改良するまでの暫定的なユーザースクリプトです。 市場エリアに投稿者情報を表示、コメント投稿エリアの修正、フェード防止の機能があります。
// @include http://www.nicovideo.jp/watch/*
// ==/UserScript==
/****************************************
* 右上の[raw]をクリックしてダウンロード開始 *
@rosylilly
rosylilly / phantomjs-helloworld.coffee
Created March 24, 2012 16:45
phantomjsでハローワールド
fs = require('fs')
printfln = (text) =>
text += "\n"
fs.write('/dev/stdout', text, 'w')
printfln "Hello, World!"
phantom.exit()
fs = require('fs')
fs.write('/dev/stdout', 'test!!', 'w')
phantom.exit()
@rosylilly
rosylilly / typeCheck.js
Created December 11, 2011 13:48
適当にJavascriptで型チェック
function TypeCheck(func) {
var argumentTypes = [];
var functionString = func.toString().replace(/\n/g, ' ');
var argumentString = functionString.replace(/^function.*?\(/, '').replace(/\).*$/,'');
var argumentTypes = argumentString.split(',');
for(var i=0,l=argumentTypes.length; i<l; i++) {
var match = argumentTypes[i].match(/\/\*\*(.*)\*\//);
if(match) {
argumentTypes[i] = match[1].replace(/^ *| *$/g,'').toLowerCase();
@rosylilly
rosylilly / growlnotify.zshrc
Created August 19, 2011 08:49
Growl Notify for zsh
# 時間がかかったらgrowlで終了通知
local COMMAND=""
local COMMAND_TIME=""
precmd() {
if [ "$COMMAND_TIME" -ne "0" ] ; then
local d=`date +%s`
d=`expr $d - $COMMAND_TIME`
if [ "$d" -ge "30" ] ; then
COMMAND="$COMMAND "
echo -ne "\a"