Skip to content

Instantly share code, notes, and snippets.


Roman retgoat

View GitHub Profile
retgoat /
Last active Aug 29, 2015 — forked from peterhellberg/
Install of ruby-oci8 for 10.9/OSX Mavericks

Install of ruby-oci8 for 10.9/OSX Mavericks - step-by-step:

  1. Go here:
  2. Download the 64bit versions of instantclient-sqlplus, instantclient-sdk, instantclient-basic - the 32bit versions do not work with OSX 10.9
  3. Create directories at /opt/oracle
  4. Unzip instantclient-basic first, move to /opt/oracle (should add a folder - something like /opt/oracle/instantclient_11_2/)
  5. Unzip instantclient-sdk and move its contents to /opt/oracle/instantclient_11_2/
  6. Unzip instantclient-sqlplus and move its contents /opt/oracle/instantclient_11_2/
  7. Open Terminal (if you haven't already) and type...
  8. DYLD_LIBRARY_PATH=/opt/oracle/instantclient_11_2 export DYLD_LIBRARY_PATH
retgoat / dispatcher.erl
Last active Nov 2, 2015 — forked from dry/dispatcher.erl
Moochiweb router example
View dispatcher.erl
-module (dispatcher).
-export ([dispatch/2, convert_method_to_action/1]).
dispatch(_,[]) -> none;
dispatch(Req, [{Regexp, Handler}|T]) ->
"/" ++ Path = Req:get(path),
Method = Req:get(method),
View active_support_logger.rb
# backported from rails 4 to use inside rails 3
# if you're using rails 4, you do not actually need this.
module ActiveSupport
class Logger < ::Logger
# extend ActiveSupport::TaggedLogging
# Broadcasts logs to multiple loggers. Returns a module to be
# `extended`'ed into other logger instances.
def self.broadcast(logger) do
define_method(:add) do |*args, &block|
retgoat / examples
Last active Apr 27, 2016
OAuth with Koala
View examples
GET http://localhost:3000/fb/fb_code
redirect to\u0026redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Ffb%2Fcallback
redirect to callback_url
GET http://localhost:3000/fb/callback?code=FB_AUTH_CODE
View gist:de7fa6601df61993002490fb72a25003
skip_filter *, :only => [:action_goes_here]
retgoat / time_travel_trigger.sql
Created May 29, 2017 — forked from myitcv/time_travel_trigger.sql
Trigger-based equivalent of old PostgreSQL time travel module - see for more details
View time_travel_trigger.sql
Copyright (c) 2015 Paul Jolly <
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Flat an array without using Array#flatten method


ary = [[1, 2, [3], []], 4]


ary.flat_map{|element| element.kind_of?(Array) ? element.flat_map{|i| i} : element }
View gist:1af8a46d81614eb089e9718b84c5d86c

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by
  • pry -r ./config/environment.rb - load your rails into a pry session


View plain.ex
def get_specific_version(id, version, scope) do
datetime = Timex.parse!(version, "%FT%T.%fZ", :strftime)
|> Timex.shift(seconds: -1)
|> Timex.to_datetime
q = """
SELECT #{version_fields()} FROM #{table()}
WHERE id = $1::integer AND sys_period @> $2::timestamptz AND scope @> $3::ltree
SELECT #{version_fields()} from #{history_table()}
WHERE id = $1::integer AND sys_period @> $2::timestamptz AND scope @> $3::ltree;
retgoat / 1-indirect_uses_tracker.ex
Created Dec 18, 2017 — forked from christhekeele/1-indirect_uses_tracker.ex
A way to track when modules are used in Elixir, and an example adapter/plugin architecture built on top.
View 1-indirect_uses_tracker.ex
# For simpler use cases, see the UsesTracker instead:
# A way to know, at runtime, what modules a module has used at compile time.
# In this case, you include `IndirectUsesTracker` into a module. When that module gets
# used in some other module, it makes that module registerable under a namespace of your choosing.
# When the registerable module is used into a third module, that third module will know at runtime which
# registerables were `use`d in it at compile time, via a function titled after the namespace.