Skip to content

Instantly share code, notes, and snippets.

Avatar

Tim Ruffles timruffles

View GitHub Profile
@timruffles
timruffles / elastic-search.md
Last active Aug 29, 2015
elastic search - fosdem 2014
View elastic-search.md
View app.js
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 Mar 13, 2014
tell everyone the deploy went well in style :)
View hipchat-vars.yml
hipchat_color: yellow
hipchat_token: foo_bar_baz
hipchat_room: SomeRoom
hipchat_success_emotions:
- awthanks
- awyeah
- badass
- badpockerface
- cake
- chompy
View http_doesnt_want_stateful_objects.js
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 Mar 14, 2014
cqlsh problem with cassandra - hangs. seeing both sending and receiving
View debug from cassandra server
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 Aug 29, 2015
getting globalish things down (event source, session) into components - without breaking unit testing
View backbone-modularity.js
// 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 Aug 29, 2015
clean up docker images - $2 = tags, $3 = image id
View clean_exited_docker_containers.sh
docker ps -a | grep Exit | awk '{print $1 }' | xargs docker rm
@timruffles
timruffles / node_stdin_readsync.js
Created May 2, 2014
node readSync from stdin - good for cli tools
View node_stdin_readsync.js
process.stdin.resume()
var stdin = require("fs").readFileSync("/dev/stdin","utf8");
@timruffles
timruffles / elixir.ex
Created May 19, 2014
elixir factoring question
View elixir.ex
defprotocol Cache do
def cached?(cache,item)
end
defmodule RedisCache do
def cached?(cache,item)
end
defmodule MapCache do
def new do
@timruffles
timruffles / elixir.inspect.erl
Last active Aug 29, 2015
Elixir.Inspect.Algebra crash
View elixir.inspect.erl
{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,
You can’t perform that action at this time.