Skip to content

Instantly share code, notes, and snippets.

View hideo55's full-sized avatar

Hideaki Ohno hideo55

View GitHub Profile
var spawn = require('child_process').spawn;
var ls = spawn('bash',['-c','ls','/*']);
ls.stdout.on('data', function(data){
console.log(data.toString());
});
let ff_table = {'dos' : 'CR+LF', 'unix' : 'LF', 'mac' : 'CR' }
set statusline=%F%m%r%h%w\ [%Y][%{ff_table[&ff]}][%{&fileencoding}]
" %{ff_table[&ff]} で改行コード表示
" %{&fileencoding} で文字エンコーディング表示
a = Hash[ *(<<EOS.split("\n").map {|e| [e,true]}.flatten()) ]
foo
bar
baz
EOS
p a # => {"foo"=>true, "bar"=>true, "baz"=>true}
@hideo55
hideo55 / heredoc.rb
Created July 17, 2012 11:27
Ruby here document
h = {
hoge: <<EOS,
Hey!
EOS
fuga: <<EOS
Yo!
EOS
}
p h
@hideo55
hideo55 / gist:2312264
Created April 5, 2012 16:15
Hachioji.pmで作るYet another IRCについての設計案

AP

  • サーバサイドはとにかくAPIに徹する感じ
  • レンダリングはクライアントで

フロント

@hideo55
hideo55 / v8_regexp_cache.js
Created December 23, 2011 03:14
V8 Engine cached target string of pattern match.
var assert = function(expr, msg){
var message = 'Assertion failed';
if(msg) message += ': ' + msg;
if(!expr) throw new Error(message);
};
var matchResultA;
(function(){
var A = RegExp('.');
@hideo55
hideo55 / uxmap_sample.cc
Created December 14, 2011 14:21
sample code of ux::Map
#include <map>
#include <string>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <ux/ux.hpp>
using namespace std;
int main(int argc, char** argv){
#!/bin/sh
NODE_VERSIONS=("v0.4.12" "v0.6.5")
VERSION_MANAGER="/usr/local/bin/nodebrew use"
for val in ${NODE_VERSIONS[@]}
do
$VERSION_MANAGER $val
npm run-script install
npm run-script test
@hideo55
hideo55 / jsmeterCMD.js
Created November 15, 2011 16:17
jsmeter command script
#!/usr/bin/env node
(function() {
var verbose = false;
var args = process.argv;
var fs = require("fs");
var jsmeter = require("jsmeter").jsmeter;
for(var a = 2; a < args.length; a++) {
if(args[a] === "--verbose") {
verbose = true;
@hideo55
hideo55 / google_reader_style.css
Created November 1, 2011 15:20
Google Reader StyleSheet for Stylist
#logo-container, #search-submit, /*#chrome-lhn-menu,*/ #viewer-footer, #mark-#viewer-refresh, #item-up-down-buttons, #search div[class="goog-inline-block jfk-button jfk-button-action"] {
display: none !important;
}
#gb, #top-bar {
visibility: collapse !important;
height: 0px !important;
border: none !important;
}
#gbg {
z-index: 20010 !important;