Skip to content

Instantly share code, notes, and snippets.

View pmint93's full-sized avatar
Working from anywhere

Thanh Pham Minh pmint93

Working from anywhere
View GitHub Profile
@pmint93
pmint93 / rmq_queue_cleaner.js
Last active August 29, 2015 14:24
Delete rabbitMQ queues by name matching
// Author: pmint93
function run(virtual_host, mask, auth){
var trs = $('.updatable table.list tbody tr');
var queues = trs.each(function(i, v){
var name = $(v).find('td').eq(1).text();
console.log(name);
if(name.match(mask)){
$.ajax({
method: 'GET',
def run
n = 1_000
id = User.first.id
display_name = User.only(:display_name).find(id).display_name
Benchmark.bm(50) do |x|
x.report('User.find(id).display_name') do
n.times{ User.find(id).display_name }
end
# Author: pmint93
# Exercise: https://www.facebook.com/groups/718037468264021/permalink/765003373567430/
class Greeter
def self.hello(file = '')
yield if defined? yield
eval open(file).read if File.exist? file
end
end