Skip to content

Instantly share code, notes, and snippets.

Siong siong1987

Block or report user

Report or block siong1987

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View personName.swift
func personName(firstName: String, lastName: String?) -> String {
guard let lastName = lastName else {
return "\(firstName)"
}
return "\(firstName) \(lastName)"
}
personName("Siong", lastName: "Ong") // prints "Siong Ong"
personName("Siong", lastName: nil) // prints "Siong"
@siong1987
siong1987 / mrr.rb
Created Oct 24, 2014
Stripe MRR Calculation
View mrr.rb
require 'stripe'
require 'ostruct'
# modified from: https://gist.github.com/jacobpatton/a68d228bf2414852d862
#
# puts Stripe::Mrr.new(api_key: 'api_key').mrr
#
module Stripe
class Mrr
attr_reader :api_key
@siong1987
siong1987 / country_codes.plist
Created Jun 23, 2014
Country - Country Code - Calling Code
View country_codes.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>all</key>
<array>
<dict>
<key>calling_code</key>
<string>+93</string>
<key>country</key>
View keybase.md

Keybase proof

I hereby claim:

  • I am siong1987 on github.
  • I am siong1987 (https://keybase.io/siong1987) on keybase.
  • I have a public key whose fingerprint is B417 9ED4 3C5B 752D 597C 1B37 CA86 BF84 658B E43B

To claim this, I am signing this object:

View calculator.rb
class Calculator
def evaluate statement
symbols = statement.split(' ')
puts calculate(symbols)
end
def calculate symbols
if symbols.length == 1
return symbols[0]
else
@siong1987
siong1987 / RestKit.podspec
Created Dec 17, 2012
pod spec for Restkit that enables array.
View RestKit.podspec
Pod::Spec.new do |s|
s.name = 'RestKit'
s.version = '0.10.3'
s.summary = 'RestKit is a framework for consuming and modeling RESTful web resources on iOS and OS X.'
s.homepage = 'http://www.restkit.org'
s.author = { 'Blake Watters' => 'blakewatters@gmail.com' }
s.source = { :git => 'https://github.com/siong1987/RestKit.git', :tag => 'v0.10.4' }
s.license = 'Apache License, Version 2.0'
s.source_files = 'Code/RestKit.h'
View benchmark.rb
require 'benchmark'
require 'yab62'
def generate_token(length)
(1..length).collect { (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }.join
end
def generate_mod_token(length)
(rand(62**length)).encode62.rjust(length,rand(62).encode62)
end
@siong1987
siong1987 / forkbin.routes.js.coffee
Created Sep 22, 2012
sample routes for forkbin
View forkbin.routes.js.coffee
$(document).ready ->
routes =
"":
"NavbarRouter": "index"
"ListsRouter": "index"
"lists/:id":
"NavbarRouter": "index"
"ListsRouter": "show"
@siong1987
siong1987 / db_copy.rake
Created Jul 29, 2012
copy db from mongo
View db_copy.rake
namespace :db do
namespace :copy do
def get_mongohq_url(env)
"mongohq_url"
end
def parse_mongodb_url(url)
uri = URI.parse(url)
[ uri, uri.path.gsub("/", "") ]
@siong1987
siong1987 / gist:3103567
Created Jul 13, 2012
sparrow crash report
View gist:3103567
Process: Sparrow [1271]
Path: /Applications/Sparrow.app/Contents/MacOS/Sparrow
Identifier: com.sparrowmailapp.sparrow
Version: 1.6.2 (1143.6)
App Item ID: 417250177
App External ID: 8850448
Code Type: X86-64 (Native)
Parent Process: launchd [129]
Date/Time: 2012-07-13 03:12:13.699 -0500
You can’t perform that action at this time.