Skip to content

Instantly share code, notes, and snippets.

@hitode909
hitode909 / blog-retina.js
Created August 9, 2012 11:31
はてなブログを小刻みに揺らす.js
(function() {
var requestAnimationFrame = (function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback, element) {
return window.setTimeout(function() {
return callback();
}, 1000 / 60);
};
})();
var i=0;
@hitode909
hitode909 / hotserif.rb
Created July 29, 2012 02:58
はてなブックマーク人気の台詞
# -*- coding: utf-8 -*-
require 'open-uri'
require 'nokogiri'
require 'haml'
engine = Haml::Engine.new(DATA.read, {
:escape_html => true,
:escape_attrs => true
})
@hitode909
hitode909 / jehnkins_build.rb
Created July 17, 2012 12:40
Jenkinsで指定したジョブを実行
#! /usr/bin/env ruby
require 'open-uri'
open("#{ARGV.first}/build").read
warn 'build scheduled'
@hitode909
hitode909 / jenkins_register_branch.rb
Created July 17, 2012 12:34
Jenkinsにブランチを登録するスクリプト
#! /usr/bin/env ruby
# -*- coding: utf-8 -*-
# Jenkinsにブランチを登録するスクリプト
#
# 現在のブランチを追加
# jenkins_register_branch http://jenkins.example.com/job/Project1
# 現在のブランチにstagingブランチを追加
# jenkins_register_branch http://jenkins.example.com/job/Project1 staging
echo 'Hello, World!'
@hitode909
hitode909 / magit-status
Created June 22, 2012 04:54
ターミナルからmagit-statusする
#!/bin/sh
emacsclient -e "(magit-status \"./$(git rev-parse --show-cdup)\")" &
osascript -e 'tell application "Emacs" to activate'
# perl plot_use_graph.pl ~/Plack/lib/**/**.pm
package Parser::Package {
use Class::Accessor::Lite(
new => 1,
ro => [ qw (name includes) ],
);
}
package Parser {
require 'wav-file'
def cut
f = open("input.wav")
format = WavFile::readFormat(f)
dataChunk = WavFile::readDataChunk(f)
f.close
bit = 's*' if format.bitPerSample == 16 # int16_t
bit = 'c*' if format.bitPerSample == 8 # signed char
# -*- coding: utf-8 -*-
queue = ['マークザッカーバーグ']
chars = queue.first.split(//)
for i in 0...chars.length-1
for j in 0...chars.length-1-i
chars[j+1],chars[j]=chars[j],chars[j+1] if chars[j] > chars[j+1]
now = chars.join('')
# nginx -p . -c server.conf
error_log /dev/stderr debug;
daemon off;
events {
worker_connections 48;
}
http {