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
# this is a dirty implementation of logger that | |
# compiles AR queries with trace into /last_request_log.html | |
# the snippet is useful when optimizing performance of the endpoint | |
class QueryLogSubscriber < ActiveSupport::LogSubscriber | |
TRACE_LEVEL = :app | |
LINES = 5 | |
IGNORE_CACHED_QUERIES = false | |
def initialize |
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
# Sample app that connects to a Greeter service. | |
# | |
# Usage: $ path/to/greeter_client.rb | |
this_dir = File.expand_path(File.dirname(__FILE__)) | |
lib_dir = File.join(this_dir, 'lib') | |
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir) | |
require 'grpc' | |
require 'helloworld_services' |
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
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'json' | |
begin | |
uri = URI('https://cdn.rawgit.com/github/gemoji/master/db/emoji.json') | |
resp = Net::HTTP.get_response(uri) | |
emoji = JSON.parse(resp.body) | |
num = [ARGV.first.to_i, 1].max |
OlderNewer