Skip to content

Instantly share code, notes, and snippets.

View ryuone's full-sized avatar

Ryuichi Maeno ryuone

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
var socketio = require("socket.io");
io.sockets.on("connection", function (socket) {
// Get client's ip address.
console.dir(socket.manager.handshaken[socket.id].address.address)
// Get client's user-agent.
console.dir(socket.manager.handshaken[socket.id].headers['user-agent'])
}

Create

brunch new gh:damassi/Coffeescript-App-Skeleton urlLists
brunch new gh:brunch/simple-coffee-skeleton urllist
brunch new gh:paulmillr/brunch-with-chaplin urllist

Get skelton from

https://github.com/brunch/brunch/wiki/Skeletons

Document

brunch : https://github.com/brunch/brunch/tree/stable/docs

@ryuone
ryuone / math_random.js
Last active December 21, 2015 08:09
Math.random duplicate check.
var store = {}
for(var i=0, imax=60000; i<imax; i++){
var mRandom = Math.random() + "";
if(!store[mRandom]){
store[mRandom] = true;
continue;
}else{
console.log("Duplicate : " + mRandom + " -> " + i);
}
}
url = "http://www.yahoo.co.jp/"
qrcode = :qrcode.encode(url)
{:ok, fd} = :file.open('./yahoo.qr.png', [:write, :raw, :binary])
:file.write(fd, :qrcode_demo.simple_png_encode(qrcode))
:file.sync(fd)
:file.close(fd)
@ryuone
ryuone / tmuxDev.sh
Created June 6, 2013 16:14
Create Tabs and Panes for tmux.
#!/bin/bash
SESSION_NAME="TmuxSession"
TMUX_TABS=2
TMUX_PANES=16
tmux start-server
if ! $(tmux has-session -t "${SESSION_NAME}"); then
cd ~/
@ryuone
ryuone / .zshrc.sample
Last active December 13, 2015 21:28
.zshrc
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
autoload -Uz compinit
compinit
autoload colors
colors
@ryuone
ryuone / gist:4570750
Created January 19, 2013 04:32
こんな感じ
iptables -F
iptables -X
iptables -Z
iptables -P INPUT DROP # 受信はすべて破棄
iptables -P OUTPUT ACCEPT # 送信はすべて許可
iptables -P FORWARD DROP # 通過はすべて破棄
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
@ryuone
ryuone / buster-test-apis.txt
Created July 12, 2012 15:18
buster-test apis
* autoRun -> function
* envOptions -> function
* run -> function
* reporters -> object
* dots -> object
* create -> function
* endContext -> function
* focusMode -> function
* listen -> function
* log -> function
@ryuone
ryuone / debuglog.php
Created June 6, 2012 05:17
PHP LOG出力
function debuglog($data)
{
$destination = "/tmp/debug.log";
@ob_start();
var_dump($data);
$output = @ob_get_contents();
@ob_end_clean();
@error_log($output."\n", 3 , $destination);
}