Skip to content

Instantly share code, notes, and snippets.

View hrstt's full-sized avatar

sato hiroyuki hrstt

View GitHub Profile
@hrstt
hrstt / select_operation_test.html
Created June 14, 2012 06:41
select 要素 の操作(隠したりdisableにしたり
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script>
$(function(){
var target = $("select#test");
/** 単純に操作不可にする方法
target.change(function() {
target.attr("disabled","disabled");
SELECT * FROM INFORMATION_SCHEMA.TABLES
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
Option Explicit
Function nslookup(ip As String) As String
Dim wsh, exec, cmd, res As String, i As Integer
Dim buf() As String
Set wsh = CreateObject("WScript.Shell")
cmd = "nslookup " & ip
@hrstt
hrstt / hash_memorize_sample.rb
Created March 22, 2012 07:17
hash memorize
# recursive call with hash
# calcuation procedure define in block of constractor.
# this hash return response first, but its key size is limited about 1,000 keys
# => occur SystemStackError
h = Hash.new{|hash, value| hash[value] = 1 + hash[value -1] + hash[value -2]}
h[0] = 1
h[1] = 1
puts h[3] #=> 5
puts h[100] #=> 1146295688027634168201
@hrstt
hrstt / jquery_indices_object_reverse.js
Created March 8, 2012 02:00
複数オブジェクトの逆順並べ ref: http://qiita.com/items/3062
$(function(){
// same class name jQuery object
$('div.some_class');
// these reverse indices jQuery object
// Once get indexed objects to array,
// Then use Array.reverse() to descending order.
// At last, convert array object to jQuery object.
$($('div.some_class').get().reverse());
});
# Array#transpose
a = [[1,2,3],[4,5,6],[7,8,9]]
a.transpose
#=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
# same return
a[0].zip(*a[1..-1])
#=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
@hrstt
hrstt / .sh
Created February 16, 2012 00:58
Ubuntu 11.10 でsynapticを使うと出てくるアレ. ref: http://qiita.com/items/2537
$ sudo apt-get install gtk2-engines-pixbuf
@hrstt
hrstt / .sh
Created February 16, 2012 00:52
redmine でgem のバージョンが高すぎるときの対応 ref: http://qiita.com/items/2536
$ gem install -v 1.3.7 rubygems-update
$ update_rubygems
@hrstt
hrstt / ubuntu_tweak.sh
Created November 25, 2011 00:03
Ubuntu tweak (11.10)
# gnome-tweak
sudo add-apt-repository ppa:tualatrix/next
sudo apt-get update
sudo apt-get install ubuntu-tweak
# icon set
sudo add-apt-repository ppa:tiheum/equinox
sudo apt-get update
sudo apt-get install faenza-icon-theme
@hrstt
hrstt / rmagick_bench_mark_test.rb
Created November 14, 2011 07:34
rmagick bench mark test
#-*- coding: utf-8 -*-
require 'benchmark'
# When you convert a jpg image using ImageMagick,
# convert command options combination make a big difference in performance.
# so i try to do a benchmark test about parameter combination.
#
# Fastest combination : when given define option with width and height.
# Secondary combination : when given define with either width or height, debug option make faster.