つづきはこちらで http://akkunchoi.github.com/git-ref.html
Git
$ git init hoge # git リポジトリを作成。または...
| #!/bin/sh | |
| # pearc: wrapped pear command to install a local directory | |
| # | |
| # 1) pearc init [dir] [config_file] | |
| # 2) pearc [pear_command..] | |
| # | |
| config=$(pwd)/.pearrc | |
| if [ $1 = "init" ]; then | |
| target=$(pwd) |
| <?php | |
| // The Difference between json_encode/json_decode and Zend_Json | |
| $arr = array('a' => 'b', 'c' => 'd'); | |
| $arrJson = json_encode($arr); | |
| var_dump(json_decode($arrJson)); // stdClass | |
| $arr = array('a' => 'b', 'c' => 'd'); | |
| $arrJson = Zend_Json::encode($arr); | |
| var_dump(Zend_Json::decode($arrJson)); // array |
| <?php | |
| interface Hoge{ | |
| const MOGE = 'moge'; | |
| } | |
| class HogeImpl implements Hoge{ | |
| public function __construct(){ | |
| var_dump(self::MOGE); | |
| } | |
| } | |
| new HogeImpl(); // "moge" |
| <?php | |
| class A{ | |
| public $obj; | |
| public function __destruct() { | |
| unset($this->obj); | |
| } | |
| } | |
| class B{ | |
| public $obj; | |
| public function __destruct() { |
つづきはこちらで http://akkunchoi.github.com/git-ref.html
Git
$ git init hoge # git リポジトリを作成。または...
| #!/usr/bin/ruby | |
| require 'time' | |
| list = `mysql -uroot -e "show full processlist"` | |
| print list | |
| list.split("\n").each { |line| | |
| d = line.split(" ", 8) | |
| if d[4] == "Query" and d[5].to_i >= 60 | |
| print "kill #{d[0]}\n" |
| // This script is modified from http://d.hatena.ne.jp/Griever/20100904/1283603283 | |
| // The original happens a error "TypeError: object is not a function" on chrome 14 | |
| javascript:(function(){ | |
| var regexp = /https?:\/\/[^&?#]+?\.(?:jpe?g|png|gif|bmp)(?:$|\b)/i; | |
| var array = Array.prototype.slice.call(document.querySelectorAll( | |
| 'a[href*=".png"], a[href*=".gif"], a[href*=".jpg"], a[href*=".jpeg"], a[href*=".bmp"],' + | |
| 'a[href*=".PNG"], a[href*=".GIF"], a[href*=".JPG"], a[href*=".JPEG"], a[href*=".BMP"]' | |
| )); | |
| for (var i = 0, l = array.length; i < l; i++) { |
| #!/usr/bin/env ruby | |
| list = %w( | |
| 部屋を掃除しろ! | |
| 部屋を片付けろ! | |
| 資料を整理しろ! | |
| タスクを整理しろ! | |
| メモを整理しろ! | |
| 「あとで読む」でも読んどけ! |
| require 'open-uri' | |
| def download_as_file(url) | |
| filename = File.basename(url) | |
| open(filename, 'wb') do |file| | |
| open(url) do |data| | |
| file.write(data.read) | |
| end | |
| end | |
| end |
| require 'rubygems' | |
| require 'watir-webdriver' | |
| browser = Watir::Browser.new | |
| browser.goto 'http://bit.ly/watir-example' | |
| browser.text_field(:name => 'entry.0.single').set 'Watir' | |
| browser.button(:name => 'submit').click | |
| puts browser.title == 'Thanks!' |