Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
\. "${rvm_path}/scripts/functions/hooks/jruby"
export PROJECT_JRUBY_OPTS="-J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -X-C"
if [[ "${rvm_ruby_string}" =~ "jruby" ]]
then
jruby_options_append "${PROJECT_JRUBY_OPTS[@]}"
else
@rorcraft
rorcraft / gist:5854221
Last active December 18, 2015 22:19
Xiaomi Mi2s Android vs iPhone iOS.

Xiaomi

build:

  • feels like iPhone 3G - plastic back, thicker than iPhone4 and above.
  • sturdy enough, but I'm worried if its dropped into water. iPhone is better sealed out of the box.
  • sits well on one hand without a case. iPhone built for adding a case.
  • screen - some weird uneven chemical spots, probably need to use a protector.
  • camera produces pretty high quality photos, auto focus could be slow.
  • battery, similar to iPhone4, slightly better.
  • wifi range, similar to iPhone4, not any better.
@rorcraft
rorcraft / gist:5784318
Last active December 18, 2015 12:39
ruby heredoc

Heredoc

  • auto indent
  • auto new line
<<GROCERY_LIST
  1. Salad mix 
  2. Strawberries 
 3. Cereal

HTTP Caching

  1. Cache by expiration time.
  2. Conditional Get by versioning.

Cache by expiration time.

Tells the client and intermediary cache what to cache.

HTTP 1.0:

@rorcraft
rorcraft / .cane
Created May 2, 2013 01:04
Custom CaneLintSpec
--no-doc
--no-abc
--style-glob {app,lib}/**/*.rb
--require spec/cane_lint_spec.rb
--check CaneLintSpec
--lint-spec-glob {app,lib}/**/*.rb
require 'digest/md5'
require 'fileutils'
require 'leveldb'
# no_of_keys = 20_000_000
no_of_keys = 20_000_000
# 1.upto(no_of_keys) do |i|
# digest = Digest::MD5.hexdigest(i.to_s)
# head = digest[0..1]
# key = digest[2..-1]
@rorcraft
rorcraft / crawler.go
Created February 20, 2013 03:02
Golang Tutorial: Crawler
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@rorcraft
rorcraft / gist:4640854
Last active December 11, 2015 18:19
Golang Tutorial Exercies. http://tour.golang.org
/* #44 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(1)
@rorcraft
rorcraft / gist:3967583
Created October 28, 2012 04:56
rubymotion console methods
UIScreen.mainScreen
sessions
app = UIApplication.sharedApplication
delegate = app.delegate
repl(delegate)
quit
@rorcraft
rorcraft / gist:1644150
Created January 20, 2012 00:54
magic debug trace
# set_trace_func proc { |event,file,line,id,binding,classname| printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname }