This file contains hidden or 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
| var $j = jQuery.noConflict(); | |
| // Use jQuery via $j(...) | |
| $j(document).ready(function(){ | |
| $j("div").hide(); | |
| }); | |
| // Use Prototype with $(...), etc. | |
| $('someid').hide(); |
This file contains hidden or 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
| before_filter :log_ram # or use after_filter | |
| def log_ram | |
| logger.warn 'RAM USAGE: ' + `pmap #{Process.pid} | tail -1`[10,40].strip | |
| end |
This file contains hidden or 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 PoorManHook | |
| module ClassMethods | |
| private | |
| def after(*syms, &block) | |
| syms.each do |sym| # For each symbol | |
| str_id = "__#{sym}__after__" | |
| unless private_instance_methods.include?(str_id) |
This file contains hidden or 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
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: god | |
| # Required-Start: $all | |
| # Required-Stop: $all | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: God | |
| ### END INIT INFO |
This file contains hidden or 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 | |
| ['rubygems', 'eventmachine'].map{|x| require x} | |
| module SelfServer; def receive_data(data); send_data(IO.readlines __FILE__); end; end; | |
| EventMachine::run do | |
| host = ARGV[1] || '0.0.0.0' | |
| port = ARGV[2] || 8080 | |
| EventMachine::start_server host, port, SelfServer | |
| puts "If you don't like defaults try chaging host or port" | |
| puts "Open 2 terminal and try telnet #{host} #{port} and press enter" | |
| end |
This file contains hidden or 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
| 14:08 kuba@MacBook-Jakub-Oboza:~% ab -c 10 -n 15000 http://127.0.0.1:8081/ | |
| This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
| Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
| Licensed to The Apache Software Foundation, http://www.apache.org/ | |
| Benchmarking 127.0.0.1 (be patient) | |
| Completed 1500 requests | |
| Completed 3000 requests | |
| Completed 4500 requests | |
| Completed 6000 requests |
This file contains hidden or 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
| function sample(a, b){ | |
| return console.log(a + b); | |
| } | |
| function argless(){ | |
| console.log("Argless lol"); | |
| } | |
| function before(foo, filter, args){ | |
| return function(){ |
This file contains hidden or 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
| #!/bin/zsh | |
| # my personal everyday mongodb build script | |
| # clean | |
| scons --clean | |
| # pull new changes | |
| git pull | |
| # build into prefixed directory |
This file contains hidden or 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
| #!/bin/bash | |
| mongo localhost:27017/data_gatherer test.js |
This file contains hidden or 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 'redis' | |
| class RQue | |
| attr_reader :name, :connection | |
| def initialize(name) | |
| @name = name | |
| @connection = Redis.new | |
| end |