Playing with TextMate is fun, but I can't find any bundle that can make running a single-file unit test or functional test easily.
So I want to custom a command:
alias base64="openssl base64" | |
alias aes="openssl aes-256-cbc" |
require "mongo" | |
class Pager | |
db = Mongo::Connection.new.db 'pager' | |
DOCS = db.collection 'docs' | |
INDEX = db.collection 'index' | |
STATE = db.collection 'state' | |
THRESHOLD = 1000 | |
STATE_LOCK = Mutex.new |
require "eventmachine" | |
module SSLHandler | |
# an SSLHandler is created for every request | |
def initialize | |
@state = :head | |
end | |
def receive_data data | |
case @state |
# mac port installs bash_completion in /opt/local | |
if [ -f /opt/local/etc/bash_completion ]; then | |
. /opt/local/etc/bash_completion | |
# * | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
# $ | |
export GIT_PS1_SHOWSTASHSTATE=1 | |
# % | |
# export GIT_PS1_SHOWUNTRACKEDFILES=1 | |
export PS1='\[\e[32m\]λ \w\[\e[36m\]$(__git_ps1 " (%s)") [$(~/.rvm/bin/rvm-prompt i v)]\[\e[0m\]\n\[\e[32m\]→\[\e[0m\] ' |
Playing with TextMate is fun, but I can't find any bundle that can make running a single-file unit test or functional test easily.
So I want to custom a command:
user system total real | |
rsec result: 32918.38 | |
0.109000 0.000000 0.109000 ( 0.107006) | |
rsec rpn: 32918.38 | |
0.140000 0.000000 0.140000 ( 0.154009) | |
treetop result: 32918.38 | |
1.638000 0.000000 1.638000 ( 1.638094) |
"\xae\xd3\x8f" | |
['AED38F'].pack('H*') | |
"\u4e2d" | |
['4e2d'].pack('H*').force_encoding('utf-16be').encode!('gbk') |
require 'rdoc/text' | |
require 'rdoc/code_objects' | |
require 'rdoc/generator' | |
require 'rdoc/markup/to_html_crossref' | |
## | |
# Handle common RDoc::Markup tasks for various CodeObjects | |
module RDoc::Generator::Markup |
# mixing imperative and functional code | |
sum = 0 | |
(1..10).map do |i| | |
sum += i | |
end |
# coding: utf-8 | |
# Short code to explain the AES128 (Rijndael) cipher | |
# Some array operations require Ruby 1.9.2+ | |
# Steps defined by http://en.wikipedia.org/wiki/Advanced_Encryption_Standard | |
class AES128 | |
# Mix Rows coefficients | |
MIX = [ | |
[2, 3, 1, 1], |