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
| <?php | |
| $array = file("./sample.xml"); | |
| foreach ($array as $line) { | |
| echo $line; | |
| } |
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
| <?php | |
| /** | |
| * @dependency Zend/Json.php - http://framework.zend.com/ | |
| * | |
| * This file is modifying JSON-RPC PHP which depends on `Zend/Json.php`. | |
| * The original file - http://jsonrpcphp.org/ | |
| */ | |
| require_once('Zend/Json.php'); |
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
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: mongodb | |
| # Required-Start: $all | |
| # Required-Stop: $all | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: starts the mongodb data-store | |
| # Description: starts mongodb using start-stop-daemon |
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
| // cackPHP cake_1.2.3.8166/cake/libs/socket.php | |
| 96 /** | |
| 97 * Connect the socket to the given host and port. | |
| 98 * | |
| 99 * @return boolean Success | |
| 100 * @access public | |
| 101 */ | |
| 102 function connect() { | |
| 103 if ($this->connection != null) { |
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
| // cackPHP cake_1.2.3.8166/cake/libs/socket.php | |
| 96 /** | |
| 97 * Connect the socket to the given host and port. | |
| 98 * | |
| 99 * @return boolean Success | |
| 100 * @access public | |
| 101 */ | |
| 102 function connect() { | |
| 103 if ($this->connection != null) { |
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
| // ==UserScript== | |
| // @name ALC test | |
| // @namespace http://d.hatena.ne.jp/bannyan/ | |
| // @include http://www.alc.co.jp/* | |
| // @include http://eow.alc.co.jp/*/UTF-8/* | |
| // @require http://zend.mi.nu/js/jquery-1.3.2.min.js | |
| // @require http://svn.coderepos.org/share/lang/javascript/jsdeferred/trunk/jsdeferred.js | |
| // @resource normal http://zend.mi.nu/images/alchook.png |
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
| <?php | |
| // 再帰的に置換をする | |
| $baseDir = './hoge'; | |
| foreach (glob($baseDir . '/*/*.txt') as $fileName) { | |
| copy($fileName, $fileName . '.tmp'); | |
| $string = file_get_contents($fileName . '.tmp'); | |
| $pattern = '/ip4:/'; |
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 | |
| # encoding: utf-8 | |
| require 'fileutils' | |
| def is_mac | |
| RUBY_PLATFORM =~ /darwin/ ? true : false | |
| end | |
| # Change Paths as you like |
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
| import java.util.concurrent.atomic.{AtomicReference => AtomR, AtomicLong} | |
| import java.util.Random | |
| import scala.collection.immutable.TreeHashMap | |
| object Multics { | |
| // MT 型の定義。type を定義することで、タイピングの量が減らせる | |
| type MT = Map[String, Int] | |
| // 変数 info は イミュータブルな Map を保持する AtomicReference | |
| // AtomicReference は、同期化せずにどのスレッドからも更新ができる |
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 | |
| # encoding: utf-8 | |
| require 'fileutils' | |
| def directories(path = Dir.pwd) | |
| Dir.entries(path).map do |f| | |
| expand_path = File.expand_path(f, path) | |
| expand_path if File.directory?(expand_path) | |
| end[2..-1].delete_if {|v| v.nil?} |