Skip to content

Instantly share code, notes, and snippets.

Avatar

Masato Igarashi migrs

View GitHub Profile
@dapepe
dapepe / TextTable.php
Last active Oct 24, 2022
Class to generate a Markdown-style table from a PHP array
View TextTable.php
<?php
/**
* Creates a markdown document based on the parsed documentation
*
* @author Peter-Christoph Haider <peter.haider@zeyon.net>
* @package Apidoc
* @version 1.00 (2014-04-04)
* @license GNU Lesser Public License
*/
@TooTallNate
TooTallNate / repl-client.js
Created Mar 26, 2012
Running a "full-featured" REPL using a net.Server and net.Socket
View repl-client.js
var net = require('net')
var sock = net.connect(1337)
process.stdin.pipe(sock)
sock.pipe(process.stdout)
sock.on('connect', function () {
process.stdin.resume();
process.stdin.setRawMode(true)
@jugyo
jugyo / memcache_memoize.rb
Created Mar 2, 2012
memoize with memcache store in Rails
View memcache_memoize.rb
# Usage:
#
# module ApplicationHelper
# extend MemcacheMemoize
#
# def bar(count = 10)
# "BAR" * count
# end
# memcache_memoize :bar, :expires_in => 10
# end
@twittoru
twittoru / cmigemo.rb
Created Jan 18, 2011 — forked from lapis25/gist:583235
C/Migemo のconfigureがprefixをうまく受けいれてくれず、/usr/local 直下に作ろうとするので改変。これでsudoしないでもinstallできる。 prefixを変更したらMakefileの解釈がおかしいのかディレクトリつくるまえにinstallしようとするので先にディレクトリつくるように。
View cmigemo.rb
require 'formula'
class Cmigemo <Formula
url 'http://www.kaoriya.net/dist/var/cmigemo-1.3c.tar.bz2'
homepage 'http://www.kaoriya.net/#CMIGEMO'
md5 '0b9d2feff4cfdc673cc1947fe54191ed'
version '1.3c'
depends_on 'nkf'
@jugyo
jugyo / force_require.rb
Created Oct 27, 2010
force_require for bundler
View force_require.rb
# force_require.rb
#
# == Usage
#
# require 'bundler/setup'
# require './force_require'
#
# force_require 'g'
# g 'foo'
#
View oshi.rb
require 'rubygems'
require 'eventmachine'
require 'em-websocket'
require 'json'
class Connection
attr_accessor :socket, :user_id
def initialize(socket, user_id)
@socket = socket
View migemo.el
;; -*- mode: Emacs-Lisp; coding: utf-8-unix -*-
;;; migemo.el - Japanese incremental search trough dynamic pattern expansion
;; $Id: migemo.el.in,v 1.8 2006/09/22 08:43:33 shirai Exp $
;; Copyright (C) Satoru Takabayashi
;; Author: Satoru Takabayashi <satoru-t@is.aist-nara.ac.jp>
;; Keywords:
;; This file is free software; you can redistribute it and/or modify
View example_init_d_script.sh
#!/bin/sh
# Author: Carl Youngblood, 2010
# Based on http://www.novell.com/coolsolutions/feature/15380.html
### BEGIN INIT INFO
# Provides: bluepill
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
View gist:256916
config.plugins.stdout.colors = '555'.to_i(6).times.map{|i| "f#{('00'+i.to_s(6))[-3,3]}"}.
select{|s|s.count('0') < 2} + [31, 32, 33, 35, 36, 91, 92, 93, 94, 95, 96] +
(12..24).map{|i| "f#{i}"}