Skip to content

Instantly share code, notes, and snippets.

@chaboo
chaboo / gist:d5a02da4af8caf0f9de384c407349a2c
Created October 17, 2016 14:22 — forked from bkimble/gist:1365005
List local memcached keys using Ruby
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
@chaboo
chaboo / hn_seach.js
Created March 2, 2016 08:57 — forked from kristopolous/hn_seach.js
hn job query search
function query() {
var
// HN is done with very unsemantic classes.
job_list = Array.prototype.slice.call(document.querySelectorAll('.c5a,.cae,.c00,.c9c,.cdd,.c73,.c88')),
query_list = Array.prototype.slice.call(arguments),
shown = 0, total = job_list.length;
// Traverses up the dom stack trying to find a match of a specific class
function up_to(node, klass) {
if (node.className === klass) {
@chaboo
chaboo / include vs extend
Last active January 3, 2016 18:39
Learning Ruby
include: adds methods from the provided Module to the object
extend: calls include on the singleton class of the object
- http://ficate.com/blog/2012/01/17/explaining-include-and-extend/
- http://confreaks.com/videos/825-mwrc2008-ruby-internals
- http://stackoverflow.com/questions/156362/what-is-the-difference-between-include-and-extend-in-ruby