Skip to content

Instantly share code, notes, and snippets.

View timruffles's full-sized avatar

Tim Ruffles timruffles

View GitHub Profile
@timruffles
timruffles / elastic-search.md
Last active August 29, 2015 13:55
elastic search - fosdem 2014
console.log("Backbone, jQuery, underscore",!!Backbone,!!jQuery,!!_);
var RedditStories = Backbone.Collection.extend({
sync: redditSync
});
var AppRouter = Backbone.Router.extend({
routes: {
"": "root",
@timruffles
timruffles / hipchat-vars.yml
Created March 13, 2014 17:10
tell everyone the deploy went well in style :)
hipchat_color: yellow
hipchat_token: foo_bar_baz
hipchat_room: SomeRoom
hipchat_success_emotions:
- awthanks
- awyeah
- badass
- badpockerface
- cake
- chompy
var app = require('express')();
var sql = require('../db.js');
var auth = require('../auth.js');
var events = require('../events.js');
app.post("/sessions",function(req,res) {
// where would messaging passing objects improve this code?
sql
.from("users")
@timruffles
timruffles / debug from cassandra server
Created March 14, 2014 10:29
cqlsh problem with cassandra - hangs. seeing both sending and receiving
DEBUG 10:28:03,927 execute_cql3_query
DEBUG 10:28:03,928 Evicting cold readers for /var/lib/cassandra/data/system/local/system-local-jb-5-Data.db
DEBUG 10:28:03,930 Estimated memory usage is 2364282 compared to actual usage 0
DEBUG 10:28:03,931 Read: 2 ms.
DEBUG 10:28:03,931 request complete
DEBUG 10:28:07,058 retryPolicy for schema_triggers is 0.99
DEBUG 10:28:07,060 retryPolicy for compaction_history is 0.99
DEBUG 10:28:07,066 retryPolicy for batchlog is 0.99
DEBUG 10:28:07,0
@timruffles
timruffles / backbone-modularity.js
Last active August 29, 2015 13:57
getting globalish things down (event source, session) into components - without breaking unit testing
// overall idea is to use prototype props
// to give access to shared instances of
// 'globalish' stuff like session/router,
// but without resorting to globals. If we
// used straight globals, we couldn't have
// half the app using a different instance
// which might be necessary in future and is
// certaintly necess in testing
// so from use-case to implementation:
@timruffles
timruffles / clean_exited_docker_containers.sh
Last active August 29, 2015 14:00
clean up docker images - $2 = tags, $3 = image id
docker ps -a | grep Exit | awk '{print $1 }' | xargs docker rm
@timruffles
timruffles / node_stdin_readsync.js
Created May 2, 2014 11:01
node readSync from stdin - good for cli tools
process.stdin.resume()
var stdin = require("fs").readFileSync("/dev/stdin","utf8");
@timruffles
timruffles / elixir.inspect.erl
Last active August 29, 2015 14:01
Elixir.Inspect.Algebra crash
{function_clause,
[{'Elixir.Inspect.Algebra',format,
[infinity,0,
[{0,flat,
#{<<"blob_js_candidate">> => #{<<"esprima">> => #{<<"complexity_report">> => #{}},
<<"esvalidate">> => #{<<"jshint">> => #{},<<"jstodos">> => #{}}}}}]],
[{file,"lib/inspect/algebra.ex"},{line,432}]},
{'Elixir.Inspect.Algebra',pretty,2,
[{file,"lib/inspect/algebra.ex"},{line,405}]},
{'Elixir.Exception','-format_arity/1-lc$^0/1-0-',1,
@timruffles
timruffles / elixir.ex
Created May 19, 2014 15:17
elixir factoring question
defprotocol Cache do
def cached?(cache,item)
end
defmodule RedisCache do
def cached?(cache,item)
end
defmodule MapCache do
def new do