カレントディレクトリを作業ツリーにする。 具体的には .gitディレクトリが生成される。 まったく何もない状態から始めるならここから。
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
#!/usr/bin/env ruby | |
# vim: fileencoding=utf-8 | |
require 'net/https' | |
require 'uri' | |
require 'json' | |
class GistIDNotFound < RuntimeError;end | |
def get(url) |
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
using System; | |
using System.Data; | |
using System.Linq; | |
class Program | |
{ | |
static void Main() | |
{ | |
// dataset 作成 | |
var db = new DataSet(); |
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
$('#drop_it_on_me') | |
.attr('dropzone', 'copy') | |
.on('dragenter', function(){event.preventDefault();return false}) | |
.on('dragover', function(){event.preventDefault();return false}) | |
.on('drop', function(event){ | |
event.preventDefault(); | |
var data = event.originalEvent.dataTransfer.items[0]; | |
if (data.kind === 'string') { | |
data.getAsString(function(str){ | |
aret(str); |
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
class Merger | |
def initialize(master, tran) | |
@master = master | |
@tran = tran | |
end | |
def match(master, tran) | |
puts " match: #{master}, #{tran}" | |
end |
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
<? | |
class Hoge | |
{ | |
private $message = 'hello, world!'; | |
function __get($var) | |
{ | |
switch ($var) { | |
case 'message': | |
print $this->message . PHP_EOL; | |
break; |
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
# Win32 FILETIMEとUNIX時間とを相互に変換する | |
class Time | |
WINDOWS_TICK = 10000000 | |
SEC_TO_UNIX_EPOCH = 11644473600 | |
def self.at_wtime(wtime) | |
self.at(wtime / WINDOWS_TICK - SEC_TO_UNIX_EPOCH) | |
end |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
if (php_sapi_name() === 'cli' || defined('STDIN')) | |
{ | |
set_time_limit(0); | |
} |
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
// # CodeIgniter のコントローラーをコマンドラインから起動する | |
// | |
// 1. `application/controllers/say.php` を作成(このファイル) | |
// 2. `localhost/say/hello` とかのURLでアクセスすると | |
// hello, world! とブラウザーで閲覧出来る。 | |
// 3. コマンドラインで `php index.php say hello "hoge"` と入力すると | |
// hello, hoge! と標準出力に出力される。 | |
<?php | |
class Say extends CI_Controller { |