Skip to content

Instantly share code, notes, and snippets.

<?php
$array = file("./sample.xml");
foreach ($array as $line) {
echo $line;
}
<?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');
#! /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
// 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) {
// 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) {
// ==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
<?php
// 再帰的に置換をする
$baseDir = './hoge';
foreach (glob($baseDir . '/*/*.txt') as $fileName) {
copy($fileName, $fileName . '.tmp');
$string = file_get_contents($fileName . '.tmp');
$pattern = '/ip4:/';
#!/usr/bin/env ruby
# encoding: utf-8
require 'fileutils'
def is_mac
RUBY_PLATFORM =~ /darwin/ ? true : false
end
# Change Paths as you like
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 は、同期化せずにどのスレッドからも更新ができる
#!/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?}