This file contains 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 append(arg){ | |
if(typeof arg === "string"){ | |
this.innerHTML = arg; | |
}else{ | |
var df = document.createDocumentFragment(); | |
for(var i=0, l=arguments.length; i<l; i++){ | |
if(arguments[i].nodeType == 1){ | |
alert(111); | |
df.appendChild(arguments[i]); | |
} |
This file contains 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
var express = require("express"), | |
app = express.createServer(), | |
port = process.env.PORT || 3000; | |
app.configure(function(){ | |
app.use(app.router); | |
}); | |
app.get("/", function(req, res){ |
This file contains 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 | |
class Hit | |
def initialize | |
loop do | |
generate_answer | |
valid_answer? && break | |
end | |
puts "game start\n" | |
end |
This file contains 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
#http://vipprog.net/wiki/exercise.html#h54a0395 | |
class Caesar | |
def initialize(str, hint) | |
@key = nil | |
@str = str | |
@base = "abcdefghijklmnopqrstuvwxyz .,-" | |
@hint = hint | |
end |
This file contains 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
# -*- coding: utf-8 -*- | |
# ncursesw(とその後にruby入れ直し)が必要 | |
# sudo apt-get install libncursesw5-dev | |
require "curses" | |
include Curses | |
def set_red | |
init_pair 1, COLOR_RED, COLOR_BLACK |
This file contains 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
#coding: utf-8 | |
module ActionView | |
module Helpers | |
module FormHelper | |
def text_field_tag_for_date(object_name, method, options ={}) | |
# インスタンスの取得 | |
object = options[:object] | |
original_value = object.send(method) |
This file contains 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 | |
OLD_PACKAGES=removed/ | |
IS_UPDATE=1 | |
replace_package(){ | |
mv $1 $ORIG_PACKAGES | |
mv $2 $OLD_PACKAGES | |
IS_UPDATE=0 | |
} |
This file contains 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/bash | |
EX=".html.erb" | |
SP="_smart_phone" | |
FP="_mobile" | |
for dir in `ls`; do | |
if [ -d $dir ]; then | |
for file in `ls $dir`; do | |
if [ `echo $file | egrep '\.html\.erb$'` ]; then |
This file contains 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/bash | |
INSTANCE_ID=xxxxx | |
ELASTIC_IP=xxxxx | |
RUNNING_STATUS=1 | |
NOT_RUNNING_STATUS=0 | |
function is_not_instance_running() { | |
status=$(aws ec2 describe-instance-status --instance-ids $INSTANCE_ID | ~/jq '.InstanceStatuses[].InstanceState.Name') | |
if [ "${status}" = '"running"' ]; then |
This file contains 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
yum update -y | |
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel openssl-devel make bzip2 autoconf automake libtool bison git | |
MY_GROUP="rbenv" | |
if [ "$MY_GROUP" = "" ] ; then | |
echo '!!! undefined variable MY_GROUP.' | |
echo '!!!' | |
echo '!!! ex.) MY_GROUP=staff' | |
echo '!!!' | |
exit 1 |