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
# Credits: | |
# Jason Pirkey, Táve Corporation, http://www.tave.com/ | |
# Jeremy Mickelson, https://github.com/CyborgMaster | |
# See http://help.papertrailapp.com/kb/hosting-services/amazon-elastic-beanstalk | |
packages: | |
yum: | |
rubygems: [] | |
ruby-devel: [] |
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/bash | |
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/ | |
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server | |
############################################### | |
# To use: | |
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh | |
# chmod 777 install-redis.sh | |
# ./install-redis.sh | |
############################################### | |
echo "*****************************************" |
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
var http = require('http'), | |
fs = require('fs'), | |
url = require('url'), | |
mime = require('mime'), | |
domain = require('domain'); | |
var server = http.createServer(function (req, res) { | |
var uri = url.parse(req.url, true), | |
filename = __dirname + '/public' + uri.pathname; |
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 | |
# | |
# 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 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
var url = require('url'); | |
var test = function(url) { | |
console.log(url); | |
// ここで url をパースして何かやりたい | |
var options = url.parse(url); // これは当然エラー | |
}; | |
test('http://localhost'); |
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
var calc = function(n, callback) { | |
var sum = function(i, res) { | |
var func = (n>i) ? sum_tick : function(j,k) {callback(k);}; | |
func(i+1, res+i); | |
}; | |
var sum_tick = function(i, res) { | |
process.nextTick(function() { sum(i,res); }); | |
}; | |
sum(1,0); | |
}; |
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
CPU: AMD Phenom(tm) II X6 1090T | |
MEM: 16GB | |
OS: CentOS 5.5 | |
* test1.js | |
real 0m4.813s | |
user 0m4.790s | |
sys 0m0.011s |
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
/* | |
* node-dataurl-proxy | |
* | |
* This code can run in Clound Foundry (http://cloudfoundry.com) | |
* You can see example: http://dataurlproxy.cloudfoundry.com/?url=[url] | |
*/ | |
require.paths.unshift('./node_modules'); | |
var express = require('express'), |