- ruby 1.9.2
- rails 3.2.1
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 url = require('url'); | |
var test = function(url) { | |
console.log(url); | |
// ここで url をパースして何かやりたい | |
var options = url.parse(url); // これは当然エラー | |
}; | |
test('http://localhost'); |
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
/** | |
* 指定した時間更新されていない画像キャッシュを削除する。 | |
* iOS にのみ対応。 | |
* | |
* @param {Number} expiredTime キャッシュ保持期限 (ms) | |
*/ | |
module.exports = function(expiredTime) { | |
var cachePath = Ti.Filesystem.applicationDataDirectory + '../Library/Caches/', | |
cacheDir = Ti.Filesystem.getFile(cachePath), | |
now = new Date().getTime(); |
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
package plugins.db; | |
import java.io.File; | |
import java.io.PrintWriter; | |
import java.io.StringWriter; | |
import java.lang.reflect.Method; | |
import java.sql.*; | |
import java.util.*; | |
import javax.naming.Context; | |
import javax.naming.InitialContext; |
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
Sun Feb 26 2012 09:01:27 GMT+0000 (UTC) req | |
{ host: 'http2http-617400151.ap-northeast-1.elb.amazonaws.com', | |
cookie: 'AWSELB=7F9F7D850E5DE5AC7D454A24960C4C2C71147A5EB4DC117C43E4A2F5C89B5C24AAD593E5CCA84459AFE8BC2C308EDDE0300BEA67E671DB4983ABF3D34AFD0F8CD0AF3FA02E', | |
origin: 'http://http2http-617400151.ap-northeast-1.elb.amazonaws.com', | |
'sec-websocket-key': 'vAouvpkKTmV0xVQ5NVzmTA==', | |
'sec-websocket-version': '13', | |
'x-forwarded-for': '202.248.249.26', | |
'x-forwarded-port': '80', | |
'x-forwarded-proto': 'http', | |
connection: 'keep-alive' } |
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
package util; | |
import java.io.InputStream; | |
import java.util.Collection; | |
import java.util.Iterator; | |
import java.util.Set; | |
import java.util.TreeSet; | |
import net.sf.jxls.util.Util; |
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 | |
# | |
# Originally written by http://redartisan.com/tags/csv | |
# Added and minor changes by Gavin Laking | |
# | |
# "id","name","mime_type","extensions","icon_url" | |
# "1","unknown","unknown/unknown","||","/images/icon/file_unknown.gif" | |
# "2","image/tiff","image/tiff","|tiff|tif|","/images/icon/blank.png" | |
# | |
# if you want to remove the id: "number" line from the resulting YAML file |
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 Router = require('router-line').Router, | |
http = require('http'), | |
url = require('uri'); | |
var router = new Router(); | |
router.add('GET', '/hello', function(req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
}); |
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 http = require('http'), | |
url = require('url'), | |
Router = require('router-line').Router; | |
var router = new Router(); | |
function send(res, status, contentType, body) { | |
res.writeHead(status, { 'Content-Type': contentType }); | |
res.end(body); | |
} |
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
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "CloudFormation Sample Template for Node.js application. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", | |
"Parameters": { | |
"InstanceType": { | |
"Description": "EC2 instance type", | |
"Type": "String", | |
"Default": "t1.micro", |