This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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()); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM INFORMATION_SCHEMA.TABLES | |
SELECT * FROM INFORMATION_SCHEMA.COLUMNS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git status | grep deleted: | awk '{print $3}' | xargs git rm | |
# ただしカラースキーム付きの場合は保証しない. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package jp.hrst.sample; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
public class Mastermind { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------ | |
# > sudo cabal install hscolour | |
# > vi ~/.profile | |
if [ -f "$HOME/.profile" ]; then | |
. $HOME/.profile | |
fi | |
alias ghci='ghci 2>&1 | HsColour -tty ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Settings in here override those in "Default/Preferences.sublime-settings", and | |
// are overridden in turn by file type specific settings. | |
{ | |
"draw_white_space" : "all", | |
"highlight_line": true, | |
"tab_size": 4, | |
"line_padding_top": 4, | |
"font_size": 12, | |
"font_face": "Consolas", | |
"word_wrap" : true, |