This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#place this inside config/initializers/ | |
require 'oauth/request_proxy/typhoeus_request' | |
module OAuthFix | |
def self.included(base) | |
base.send :include, InstanceMethods | |
base.module_eval %q{ | |
alias_method :old_post_parameters, :post_parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mongo | |
module ControllerRuntime | |
extend ActiveSupport::Concern | |
protected | |
attr_internal :mongo_runtime | |
def cleanup_view_runtime | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MongoInstrumenter | |
class LogSubscriber < ActiveSupport::LogSubscriber | |
def self.runtime=(value) | |
Thread.current["mongoid_query_runtime"] = value | |
end | |
def self.runtime | |
Thread.current["mongoid_query_runtime"] ||= 0 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = "\"\n\nprint \"a = \\\"\"\nprint a.inspect[1..-2]\nprint a\n" | |
print "a = \"" | |
print a.inspect[1..-2] | |
print a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionDispatch::Callbacks.to_prepare do | |
Devise::Oauth2Providable::Client.class_eval do | |
attr_accessible :name, :website, :redirect_uri, :development_mode | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionDispatch::Callbacks.to_prepare do | |
# monkey patch here | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make a beatbox | |
import java.awt.*; | |
import javax.swing.*; | |
import javax.swing.event.ListSelectionEvent; | |
import javax.swing.event.ListSelectionListener; | |
import java.io.*; | |
import javax.sound.midi.*; | |
import java.util.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ServerName www.example.com:80 | |
DocumentRoot "/path/to/rails/app/public" | |
RewriteEngine On | |
<Proxy balancer://railsapp> | |
BalancerMember http://127.0.0.1:5000 | |
BalancerMember http://127.0.0.1:5001 | |
</Proxy> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "nokogiri" | |
require "open-uri" | |
require "uri" | |
urls = [ | |
"http://www.legco.gov.hk/general/chinese/counmtg/yr08-12/mtg_0809.htm", | |
"http://www.legco.gov.hk/general/chinese/counmtg/yr08-12/mtg_0910.htm", | |
"http://www.legco.gov.hk/general/chinese/counmtg/yr08-12/mtg_1011.htm", | |
"http://www.legco.gov.hk/general/chinese/counmtg/yr08-12/mtg_1112.htm", | |
"http://www.legco.gov.hk/general/chinese/counmtg/yr12-16/mtg_1213.htm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Coordinates.php | |
* An utility for converting HK80 to WGS84 coordinates | |
* | |
* Copyright (C) 2010, 2013 Kelvin Wong | |
* Licensed under the MIT License (http://opensource.org/licenses/MIT) | |
* | |
* Note: For the glossaries and conventions for coordinates convertion, please refer to | |
* the website of Geodetic Survey of Hong Kong. |
OlderNewer