(See also https://gist.github.com/ryansobol/5252653)
Originally published November, 2013
How would you toggle the visibility of several controls on the page?
$$('#element_one, #element_two').invoke('toggle');
@account = Account.find(131856) | |
@account.set_shard_connection | |
@agent = Agent.find(3256655) | |
@metric = Metric.find(425412176) | |
time_window = TimeWindow.new((Time.now.utc - 1.day).to_i, Time.now.utc.to_i) | |
@timeslice_data = Timeslice.find_and_aggregate(@agent, time_window, @metric, :aggregate_time => false, :raw_data => true) |
class PluginRater | |
def self.rate_plugin_for_user!(rating, plugin, user) | |
plugin.update_rating_for_user(rating, user) | |
Event::Publish('user_rated_a_plugin', rating, plugin, user) | |
Auditor::AuditRatingChange(rating, plugin, user) | |
end | |
end | |
class Controller | |
def rate |
(See also https://gist.github.com/ryansobol/5252653)
Originally published November, 2013
How would you toggle the visibility of several controls on the page?
$$('#element_one, #element_two').invoke('toggle');
2,993,717,480,458,674,908,733,078,505,849,100,877,784,752,474,407,970,784,777,982,933,032,299,915,607,456,584,350,734,288,199,678,298,057,023,547,642,133,556,459,842,823,351,420,653,618,908,442,506,537,140,874,134,893,915,505,096,701,911,979,338,787,150,902,113,486,096,257,549,453,567,977,276,240,859,580,715,880,702,555,252,519,755,283,622,058,711,130,731,562,563,655,168,973,134,991,636,342,197,801,286,507,632,401,926,438,563,655,774,906,335,864,864,729,631,435,236,236,885,265,125,253,670,491,304,479,125,680,108,355,901,460,171,287,676,228,271,996,252,773,804,148,484,642,055,975,821,970,723,516,015,443,684,594,081,463,096,144,340,164,057,879,356,756,905,407,109,073,831,170,044,988,227,625,453,876,690,315,656,028,773,968,024,095,524,544,976,927,649,755,127,879,197,475,409,648,681,614,334,126,614,821,881,068,020,553,186,391,548,578,611,585,309,801,614,924,252,989,099,133,585,387,299,164,548,525,283,947,288,600,473,501,542,171,178,617,483,491,020,538,707,291,098,842,580,189,556,070,638,510,815,419,264,004,657,26 |
var size = 3; | |
var grid = new Array(size); | |
for (var i = 0; i < size; i++) { | |
grid[i] = new Array(size); | |
} | |
grid[0][0] = 'x'; | |
grid[0][1] = 'o'; | |
grid[0][2] = 'o'; |
brew install libxml2 libxslt | |
brew link --force libxml2 libxslt | |
cd /tmp | |
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz | |
tar xvfz libiconv-1.13.1.tar.gz | |
cd libiconv-1.13.1 | |
./configure --prefix=/usr/local/Cellar/libiconv/1.13.1 | |
make | |
sudo make install |
require 'rubygems' | |
require 'action_controller' | |
class Sanitizer | |
def initialize(model) | |
@delegate = model | |
end | |
def method_missing(method_name, *args, &block) |
require 'rubygems' | |
require 'action_controller' | |
class String | |
unless respond_to?(:sanitized) | |
define_method :sanitized do | |
ActionController::Base.helpers.sanitize( | |
self || 'No name', | |
:tags => %w(h3 h4 ul ol li p a strong em br font), |
require 'rubygems' | |
require 'action_controller' | |
module Sanitizer | |
def method_missing(method_name, *) | |
attr = sanitized_attr_method_name(method_name) | |
if attr && respond_to?(attr) | |
ActionController::Base.helpers.sanitize( | |
send(attr) || 'No name', |
// Counting Event observers with Prototype 1.6 | |
javascript:alert( | |
"Event Observers\n" + $H(Event.cache).inject( $H(), | |
function (acc, p) { | |
$H(p.value).each( | |
function (evtT) { | |
if ( !acc.get(evtT.key) ) | |
acc.set(evtT.key, 0); | |
acc.set(evtT.key, |