Skip to content

Instantly share code, notes, and snippets.

View jcsalterego's full-sized avatar

Jerry Chen jcsalterego

View GitHub Profile
@jcsalterego
jcsalterego / how-to-fix-on-mac.sh
Created December 12, 2017 18:45 — forked from Gedrovits/how-to-fix-on-mac.sh
How to fix 'dyld: lazy symbol binding failed: Symbol not found: _yajl_set_static_value'
# Copy the gem location to clipboard
bundle show yajl-ruby | pbcopy
# Example: /Users/gedrovits/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/yajl-ruby-0.8.2
cd <cmd + v>
cd ext/yajl
# Now we need to replace 'inline void' to 'static void'. This will also create backup of old files.
sed -i '.bak' 's/inline void/static void/g' yajl_ext.h yajl_ext.c
# Now we must rebuild changed extension
make clean all
# After this you should not have any problems with yajl-ruby
@jcsalterego
jcsalterego / book.rb
Last active December 15, 2015 15:29 — forked from zachgersh/book.rb
class Book
attr_reader :title
DONT_CAPITALIZE = %w(and or the an of in a)
def title=(title)
@title = title.capitalize.split.map do |word|
if DONT_CAPITALIZE.include?(word.downcase)
word
else
def translate(phrase)
phrase.split.inject([]) do |final_pigs, word|
char = word.split(//)
if char[0].match(/[aeiou]/)
final_pigs << "#{word}ay"
else
new_string = char
until new_string[0].match(/[aeio]/)
new_string << new_string.shift
end
options.addOption("h", "help", false, "Print this help message");
options.addOption("v", "version", false, "Print version and exit");
options.addOption("c", "config", false,
"Path to topology config file");
#!/bin/bash
CHEF_ROLE=$1
apt-get update;
# install ruby and other pre-requisites
apt-get install -y \
build-essential \
emacs23-nox \
#!/bin/bash
#
############################################################
# BEGIN CONFIG
#
ZIP_CODE=90210
TIMEOUT=600 # seconds
# END CONFIG
# put this in ~/.bash_profile or whatever
python_or_python () {
if [ "$1" == "" ]; then
python
else
python "$@"
fi
}
alias python="python_or_python"
from pprint import pprint
import re
import sys
import urllib2
URL = "http://www.modifiedcartrader.com/information/newestCars.aspx"
TRANSLATIONS = {(1, "Label1"): "mileage",
(1, "Label2"): "hp",
(1, "Panel1"): "make",
(2, "Label1"): "hp",
<?php
class URLConf
{
private $_conf = array();
private $_controller;
private $_method;
private $_args;
private $_default_controller;
#!/bin/sh
# first you'll want to create a gist then `git clone` the private url
# second you'll want to run this script in the gist's directory
while [ 1 ]; do
git commit -a -m save && git push origin master;
sleep $(echo "60 * 4" | bc);
done;