Skip to content

Instantly share code, notes, and snippets.

View ronny's full-sized avatar

Ronny Haryanto ronny

View GitHub Profile
>> "en–em—“double”‘single’".tr('<>–—“”‘’', '()--""' + "''")
=> "en'',em''\"'''double''''''single'''"
@ronny
ronny / utmstrip.user.js
Created May 20, 2011 22:40 — forked from paulirish/utmstrip.user.js
userscript: Drop the UTM params from a URL when the page loads
// ==UserScript==
// @name UTM param stripper
// @author Paul Irish
// @namespace http://github.com/paulirish
// @version 1.1
// @description Drop the UTM params from a URL when the page loads.
// @extra Cuz you know they're all ugly n shit.
// @include http://*
// ==/UserScript==
@ronny
ronny / gist:1037040
Created June 21, 2011 01:30
`rescue => e` defaults to StandardError and its descendants
begin
raise NotImplementedError, "this will not be rescued"
puts "this will never be printed"
rescue => e
puts "A #{e.inspect} has been rescued."
end
# Would result in:
# in `<main>': this will not be rescued (NotImplementedError)
# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
# Config is in /etc/nginx/sites-available/default or somewhere like that
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;
@ronny
ronny / gist:1290343
Created October 16, 2011 00:13
Stevey's Google Platforms Rant
Stevey's Google Platforms Rant
I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.
I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't really have SREs and they make engi
@ronny
ronny / backbone-0.5.3-with-update.js
Created March 19, 2012 22:41
Backbone 0.5.3 with Collection.update and options.index on add/remove callbacks — originally from https://github.com/documentcloud/backbone/pull/446
// Backbone.js 0.5.3
// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://documentcloud.github.com/backbone
(function(){
// Initial Setup
// -------------
@ronny
ronny / async-images-loader.js
Created September 17, 2012 01:09
Async image loading
// Loads images asynchronously so that the page would be displayed quicker.
//
// Define images with <img class="async" data-src="http://example.com/img.jpg">,
// and when load is called, all of the images' src attribute will be set from
// their data-src attribute.
var AsyncImagesLoader = {
init: function() {
AsyncImagesLoader.timeout = setTimeout(AsyncImagesLoader.load, 0);
},
@ronny
ronny / Gemfile
Last active December 11, 2015 04:28
A simple jQuery lightbox plugin that works with Turbolinks (https://github.com/rails/turbolinks)
source :rubygems
# Turbolinks and jQuery.turbolinks without Rails dependencies
gem 'turbolinks', :git => 'git://github.com/ronny/turbolinks.git', :branch => 'lite'
gem 'jquery-turbolinks', :git => 'git://github.com/ronny/jquery.turbolinks.git', :branch => 'lite'
@ronny
ronny / gist:5035800
Last active February 10, 2016 19:05
Nokogiri with libxml2 installed via homebrew -- should fix "WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.9.0"
brew install libxml2 libxslt libiconv
brew link --force libxml2 libxslt libiconv
gem install nokogiri -v 1.6.2 -- --use-system-libraries
brew unlink libiconv libxml2 libxslt
@ronny
ronny / ants.clj
Last active December 18, 2015 12:19 — forked from michiakig/ants.clj
Ant colony simulation written in Clojure by Rich Hickey, from his presentation on Clojure Concurrency – http://www.youtube.com/watch?v=dGVqrGmwOAw – modified by me to work in Clojure 1.5, and also to make it look nicer.
(ns ants)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.