Skip to content

Instantly share code, notes, and snippets.

View alvinlai's full-sized avatar

Alvin Lai alvinlai

  • Mountain View, CA
View GitHub Profile
@alvinlai
alvinlai / liberate_sample_content.php
Created August 5, 2011 05:50
Liberate sample PHP embed code
<?php
// Add to the top of myfile.php
$page = '76cccf950451ad6e3329';
include('liberate.php');
$liberate = liberate($page);
?>
<p>
<?php
// Print your user-updatable content anywhere
@alvinlai
alvinlai / liberate_include.php
Created August 11, 2011 20:48
Liberate Include Code
<?php
$page = '76cccf950451ad6e3329';
include('liberate.php');
$liberate = liberate($page);
?>
@alvinlai
alvinlai / liberate_print.php
Created August 11, 2011 20:48
Liberate print code
<p>
<!-- Announcements -->
<?php $liberate->p("liberateapp_4gq24g");?>
</p>
American Idol
I lived most of my life comfortable in the belief that I was a ‘Christian’ and was on my way to heaven. I believed this because I went to church frequently, believed in Jesus and God, and knew a bit about what the Bible said.
I was brought up in America in a cheerful, fun, church with a very active youth program. I was in church 2-3 times a week, along with the rest of my family and most of my schoolmates. I sang in choirs, went to camps, and usually enjoyed being there. However, God’s word was not accurately taught in this church, and it was not revered or taught in our home, nor were hiscommandments practiced. So what we saw, heard and did at home (and at school, certainly) was very different from what we talked about at church. But at our (very liberal) church, we were taught a very watered-down gospel, with a great emphasis on Jesus being our ‘friend’. The result was most everyone assuming we were all Christians but living ungodly lives. Sure, I had prayed the sinner’s prayer several times
@alvinlai
alvinlai / will_paginate.rb
Created November 15, 2011 10:22 — forked from isaacbowen/will_paginate.rb
extends will_paginate to play well with Twitter's Bootstrap
# config/initializers/will_paginate.rb
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
@alvinlai
alvinlai / spark.rb
Created November 16, 2011 01:01 — forked from jcromartie/spark.rb
Sparklines in Ruby
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# prints a sparkline in the terminal using the supplied list of numbers
# examples:
# spark.rb 10 20 30 100 90 80
# spark.rb 1 2 0.4 0.1 1.3 0.7
@ticks = %w[▁ ▂ ▃ ▄ ▅ ▆ ▇]
values = ARGV.map { |x| x.to_f }
@alvinlai
alvinlai / hack.sh
Created March 31, 2012 15:10 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@alvinlai
alvinlai / uri.js
Created May 7, 2012 23:21 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@alvinlai
alvinlai / capybara cheat sheet
Created June 19, 2012 18:04 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@alvinlai
alvinlai / .gitignore
Created July 1, 2012 04:56 — forked from mybuddymichael/.gitignore
Starter Stasis project
/.sass-cache
/public