Skip to content

Instantly share code, notes, and snippets.

Sean Cribbs seancribbs

Block or report user

Report or block seancribbs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@seancribbs
seancribbs / application.rb
Created Aug 5, 2010
Code from the "Riak with Rails" webinar
View application.rb
# Add this line to your config/application.rb to enable
# initialization of Ripple, after the other framework railties
require 'ripple/railtie'
# To use the Riak cache store, place this line inside the
# Application class
config.cache_store = :riak_store
View reduce.ex
# This function is only included for context - it creates a multi-operation transaction structure
# for a single widget and its associated options
def create_multi(params, operation_type, widget, identifier \\ :widget) do
changeset = Widget.changeset(widget, params)
apply(Ecto.Multi, operation_type, [Ecto.Multi.new(), identifier, changeset])
|> maybe_merge_widget_options(identifier, params)
end
# Here's the usage of reduce. Notice the map + "mappend"(?) inside the reduce. If Ecto.Multi
View alchemist-mix-format-spacemacs.el
;; Support mix format command
(defun alchemist-mix-format (&optional prefix)
"Runs mix format in the project"
(interactive)
(alchemist-mix-execute (list "format") prefix))
(defun alchemist-mix-format-buffer (&optional prefix)
"Runs mix format on the current buffer"
(interactive)
View print_code.ex
defmodule Mix.Tasks.PrintCode do
@shortdoc "Prints decompiled Erlang source for a module"
@moduledoc """
Pretty-prints the *Erlang-equivalent* source code of an *Elixir*
module. This is useful for understanding how particular Elixir
features (e.g. macros, protocols) operate under the covers.
*Erlang modules are not yet supported.*
@seancribbs
seancribbs / chicagoerlang-eunit.org
Last active Feb 26, 2018
Presentation source, code examples and exercises from "Getting Started with eunit", Chicago Erlang March 2014
View chicagoerlang-eunit.org

Getting Started with eunit

View gist:7806229
$ ack app_helper:get_env src
src/riak_client.erl:759: case app_helper:get_env(riak_kv, overload_backoff, undefined) of
src/riak_index.erl:444: Timeout = app_helper:get_env(riak_kv, secondary_index_timeout, ?DEFAULT_TIMEOUT),
src/riak_kv_app.erl:51: FSM_Limit = app_helper:get_env(riak_kv, fsm_limit, ?DEFAULT_FSM_LIMIT),
src/riak_kv_app.erl:60: case app_helper:get_env(riak_kv, direct_stats, false) of
src/riak_kv_app.erl:72: case app_helper:get_env(riak_kv, add_paths) of
src/riak_kv_app.erl:100: StorageBackend = app_helper:get_env(riak_kv, storage_backend),
src/riak_kv_app.erl:193: HealthCheckOn = app_helper:get_env(riak_kv, enable_health_checks, false),
src/riak_kv_app.erl:273: {Low, High} = app_helper:get_env(riak_kv, vnode_mailbox_limit, {1, 5000}),
src/riak_kv_app.erl:324: case app_helper:get_env(riak_kv, object_format, v0) of
@seancribbs
seancribbs / init.el
Last active Aug 22, 2017
seancribbs.com/emacs.d
View init.el
;; Use org-babel to load config
(require 'org)
(org-babel-load-file (expand-file-name "seancribbs.org" user-emacs-directory))
@seancribbs
seancribbs / qcon-nyc-2017-resources.md
Last active Jul 29, 2017
Resources for my talk "Adopting Stream Processing for Instrumentation" at QCon New York 2017
View riak_core.txt
~/dev/riak/deps/riak_core R16B02-basho3 [(detached from 699324c)@699324c]
$ ./rebar list-deps deps_dir=.. | grep -v "==>" | sort | uniq
basho_stats BRANCH develop git://github.com/basho/basho_stats.git
bear TAG 0.1.3p1 git://github.com/basho/bear.git
cuttlefish BRANCH develop git://github.com/basho/cuttlefish.git
eleveldb BRANCH develop git://github.com/basho/eleveldb.git
folsom TAG 0.7.4p4 git://github.com/basho/folsom.git
getopt TAG v0.4.3 git://github.com/jcomellas/getopt.git
goldrush TAG 0.1.5 git://github.com/DeadZen/goldrush.git
lager TAG 2.0.1 git://github.com/basho/lager.git
View python.txt
>>> urllib.URLopener().open('https://www.howsmyssl.com/a/check')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 208, in open
return getattr(self, name)(url)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 437, in open_https
h.endheaders(data)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 969, in endheaders
self._send_output(message_body)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 829, in _send_output
You can’t perform that action at this time.