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 'connection_pool' | |
class ReactRenderer | |
mattr_accessor :pool | |
def self.setup! | |
size = ::Rails.configuration.react.max_renderers || 10 | |
timeout = ::Rails.configuration.react.renderer_timeout || 20 #seconds | |
@@pool ||= ConnectionPool.new(:size => size, :timeout => timeout) { ReactRenderer.new } |
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 python | |
# Quick and dirty demonstration of CVE-2014-0160 by | |
# Jared Stafford (jspenguin@jspenguin.org) | |
# Modified so that it finds cookies | |
import sys | |
import struct | |
import socket | |
import time | |
import select |
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
# Copy of TorqueBox::Logger | |
# Try to unfrak it | |
require 'logger' | |
module TorqueBox | |
# @api private | |
class FallbackLogger < ::Logger |
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
gem 'lograge' # more readable logs | |
gem 'logstash-event' # for logstash json format | |
gem 'mono_logger' # threadsafe logging |
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
Runtime Threads Pool Renders user system total real | |
JavaScriptCore 1 1 100 0.060000 0.140000 3.590000 ( 3.621248) | |
JavaScriptCore 10 1 100 0.060000 0.180000 3.760000 ( 3.913241) | |
JavaScriptCore 1 10 100 0.060000 0.160000 4.100000 ( 4.511085) | |
JavaScriptCore 10 10 100 0.070000 0.230000 6.000000 ( 1.366264) | |
Node.js (V8) 1 1 100 0.050000 0.140000 10.390000 ( 10.602247) | |
Node.js (V8) 10 1 100 0.070000 0.190000 10.510000 ( 10.632389) | |
Node.js (V8) 1 10 100 0.050000 0.150000 10.150000 ( 10.297540) | |
Node.js (V8) 10 10 100 0.060000 0.210000 17.010000 ( 3.465977) | |
therubyrhino (Rhino) 1 1 100 0.980000 0.030000 1.010000 ( 0.651000) |
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
script/plugin install git://github.com/myobie/htmldiff.git | |
# bottom of environment.rb | |
require 'htmldiff' | |
# in model | |
class Page < ActiveRecord::Base | |
extend HTMLDiff | |
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
# Read the log into an array. | |
@mylog = IO.readlines("path/to/log/file.log") | |
Now, if you want to get rid of the ANSI escape codes from the log (assuming you are accessing your application/database logs) you will have to use regular expressions. There are two ways of doing this. The first is to get rid of the codes after you read the log file, or do it as you display. | |
Here are the examples: | |
# Read the log into an array. | |
@mylog = IO.readlines("/path/to/log/file.log") |
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
class Canine | |
VERSION = '1.3' | |
def initialize(&block) | |
@commands = Hash.new | |
@default = @latest = :commands | |
@empty = nil | |
@auto = { | |
:commands => hash_command("commands","Show a list of commands",Proc.new { | |
@commands.each { |cmd| c = cmd[1] | |
name = c[:name].to_s |
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
test.rb | |
----------------------------------- | |
#!/usr/local/bin/ruby | |
require 'ripple' | |
# Create a client interface | |
client = Riak::Client.new | |
# Retrieve a bucket | |
bucket = client.bucket("doc") # a Riak::Bucket |
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
/** | |
IMPORTANT: Requires this version of jquery | |
until 1.3.3 comes out http://gist.github.com/186325 | |
ALSO: This is very dirty still and has not been | |
abstracted for use. It is just solving our immediate problems. | |
Use cases that must pass (and should be tested someday): | |
* Clicking on links updates layout | |
* Click around a bit and then use back/forward buttons |
OlderNewer