Skip to content

Instantly share code, notes, and snippets.

View mikong's full-sized avatar

Michael Galero mikong

  • Singapore
View GitHub Profile
# I found this code I wrote in an old project of mine (written around Sept 2008). The project upgraded to a new Rails version and I had to find the routes with errors.
# core extensions
class Array
def bsearch_lower_boundary(key)
range = 0 ... self.length
lower = range.first - 1
upper = range.last
while lower + 1 != upper
<div>
<div class="markItUp" id="markItUpPage_content">
<div class="markItUpContainer">
<div class="markItUpHeader">
<ul>
<li class="markItUpButton markItUpButton1 "><a title="Header [Ctrl+H]" accesskey="H" href="">Header</a></li>
<li class="markItUpButton markItUpButton2 "><a title="Bold [Ctrl+B]" accesskey="B" href="">Bold</a></li>
<li class="markItUpButton markItUpButton3 "><a title="Italic [Ctrl+I]" accesskey="I" href="">Italic</a></li>
<li class="markItUpButton markItUpButton4 "><a title="Link [Ctrl+L]" accesskey="L" href="">Link</a></li>
</ul>
uby(3959,0x7fff70768c20) malloc: *** mmap(size=1125878398349312) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
ruby(3959,0x7fff70768c20) malloc: *** mmap(size=1125878398349312) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
<internal:lib/rubygems/custom_require>:29:in `require': failed to allocate memory (NoMemoryError)
from <internal:lib/rubygems/custom_require>:29:in `require'
from /Users/mikong/.rvm/gems/ruby-1.9.2-p0@global/gems/ruby-debug-base19-0.11.23/lib/ruby-debug-base.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
@mikong
mikong / Importing posts from Wordpress into Jekyll.rb
Created September 5, 2011 12:24 — forked from vitobotta/Importing posts from Wordpress into Jekyll.rb
The script I used to import posts from my Wordpress blog into a new Jekyll one.
%w(rubygems sequel fileutils yaml active_support/inflector).each{|g| require g}
require File.join(File.dirname(__FILE__), "downmark_it")
module WordPress
def self.import(database, user, password, table_prefix = "wp_2", host = 'localhost')
db = Sequel.mysql(database, :user => user, :password => password, :host => host, :encoding => 'utf8')
FileUtils.mkdir_p "_posts"
<html>
<head>
<script src="https://raw.github.com/mbostock/d3/master/d3.js"></script>
<script src="https://raw.github.com/mbostock/d3/master/d3.geom.js"></script>
<script src="https://raw.github.com/mbostock/d3/master/d3.layout.js"></script>
<style>
#area { background: #ddd; }
circle { stroke-width: 2px; stroke: #fff; }
</style>
</head>
@mikong
mikong / gist:1947753
Created March 1, 2012 06:22
D3 Force Test
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js?2.8.0"></script>
</head>
<body>
<div id="chart"></div>
<script type="text/javascript">
var width = 400,
height = 300;
@mikong
mikong / gist:2292645
Created April 3, 2012 14:54
phone numbers
250-0662
482-5490
348-7063
@mikong
mikong / gist:3743568
Created September 18, 2012 14:56
fontawesome icons to use
icon-chevron-left/icon-caret-left
icon-chevron-right/icon-caret-right
icon-th-large
icon-list
icon-share
icon-envelope-alt
icon-trash
icon-check
icon-check-empty
icon-pencil
@mikong
mikong / infinite_duties.md
Last active December 22, 2015 00:00
This lists all the chores and duties people must do according to some or all people. This is one sure way to overwhelm yourself with all the responsibilities.

Infinite List of Duties, Chores, Responsibilities

Note: Not for the faint of heart.

According to your dentist:

  • Brush your teeth 3 times a day.
  • Mouthwash (optional?)
  • Clean your tongue every day.
  • Floss!
@mikong
mikong / changetip_monikers.txt
Created January 19, 2015 08:20
ChangeTip monikers
chocnut: $0.05
pandesal: $0.05
monay: $0.1
isaw: $0.15
taho: $0.25
balut: $0.3
pancit canton: $0.35
chicharon: $0.50
halo-halo: $2