Skip to content

Instantly share code, notes, and snippets.

@dapepe
dapepe / TextTable.php
Last active December 20, 2023 20:45
Class to generate a Markdown-style table from a PHP array
<?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 March 26, 2012 20:09
Running a "full-featured" REPL using a net.Server and net.Socket
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 March 2, 2012 04:56
memoize with memcache store in Rails
# Usage:
#
# module ApplicationHelper
# extend MemcacheMemoize
#
# def bar(count = 10)
# "BAR" * count
# end
# memcache_memoize :bar, :expires_in => 10
# end
@twittoru
twittoru / cmigemo.rb
Created January 18, 2011 14:30 — forked from lapis25/gist:583235
C/Migemo のconfigureがprefixをうまく受けいれてくれず、/usr/local 直下に作ろうとするので改変。これでsudoしないでもinstallできる。 prefixを変更したらMakefileの解釈がおかしいのかディレクトリつくるまえにinstallしようとするので先にディレクトリつくるように。
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 October 27, 2010 01:38
force_require for bundler
# force_require.rb
#
# == Usage
#
# require 'bundler/setup'
# require './force_require'
#
# force_require 'g'
# g 'foo'
#
anonymous
anonymous / oshi.rb
Created July 8, 2010 08:18
require 'rubygems'
require 'eventmachine'
require 'em-websocket'
require 'json'
class Connection
attr_accessor :socket, :user_id
def initialize(socket, user_id)
@socket = socket
;; -*- 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
#!/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
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}"}