Skip to content

Instantly share code, notes, and snippets.

View asaaki's full-sized avatar
🦀
Oh crab!

Christoph Grabo asaaki

🦀
Oh crab!
View GitHub Profile
@peterjmag
peterjmag / react-native-talk.md
Last active June 21, 2021 10:13
Let's build a React Native app in 20 minutes - React Berlin #1 (April 2015)
@trodrigues
trodrigues / gist:3a575d78e552cec785e6
Created March 11, 2015 16:18
Flux implementations
Fluxxor
Tuxedo
nexus-flux
Marty
Reflux
Fluxy
@chrismccord
chrismccord / gist:cf51346c6636b5052885
Last active January 17, 2016 12:11
Phoenix 0.9 to 0.10.0 upgrade instructions

form_tag, link, CSRF changes

Plug 0.10.0 moves CSRF tokens from cookies back to sessions. To avoid future bumps on the road, a get_csrf_token/0 function has been added to controllers and imported into views. Update all your csrf token reference code to use the new function. Additionally, form_tag and link helpers have been added that will inject the csrf token for you automatically. You should transition to these new functions where possible, ie:

  <%= form_tag("/hello", method: :post) %>
    ... your form stuff. csrf is inject for you
  </form>
@sirkkalap
sirkkalap / nfs-mount-boot2docker.sh
Last active September 3, 2016 21:23
A script to switch boot2docker to use NFS instead of VBoxfs for speed and proper permissions
#!/bin/bash
############################################################################
# Note: Special network 192.162.50.3 to use Cisco Anyconnect Split tunnel.
#
# On OX X host you need to add a line (and file) /etc/exports:
# /Users -mapall=[youruser]:[yourgroup] [boot2dockerip]
# See: https://quip.com/EDYLAAfuup5M (no login needed)
# See also: https://github.com/boot2docker/boot2docker/issues/587#issuecomment-66935011
# See also: http://support.apple.com/en-us/HT202243
@sdepold
sdepold / travis.sh
Last active October 29, 2015 20:00
io.js on travis
if [ ! -z "$IOJS" ] && [ "$IOJS" != "false" ]; then
echo "Installing io.js v$IOJS ..."
curl -s https://iojs.org/dist/v$IOJS/iojs-v$IOJS-linux-x64.tar.xz > iojs-v$IOJS-linux-x64.tar.xz
tar xf iojs-v$IOJS-linux-x64.tar.xz
export PATH="$(pwd)/iojs-v$IOJS-linux-x64/bin/:$PATH"
echo "Installation successful"
else
echo "Using node..."
fi
@solnic
solnic / require_measure.rb
Last active August 29, 2015 14:14
A hack to measure how long it takes to require bundled gems in a rails app
REQUIRE_DATA = {}
BUNDLED_GEMS = `bundle show | grep "*" | awk '{print $2}'`.split("\n").sort
require 'bigdecimal'
def require(name)
start = Time.now
ret = super
stop = Time.now
total = BigDecimal(stop-start, 6)
REQUIRE_DATA[name] = total if BUNDLED_GEMS.include?(name)
@solnic
solnic / active-rom.rb
Created January 29, 2015 21:06
ActiveROM ;)
require 'rom-sql'
require 'virtus'
module ActiveRecord
class Base
def self.inherited(klass)
rel_class = Class.new(ROM::Relation[:sql]) {
base_name Inflecto.tableize(klass.name).to_sym
}
dataset = repository.dataset(rel_class.base_name)
@charithe
charithe / curry.exs
Created January 4, 2015 15:10
Elixir Currying With Macros
defmodule Curry do
defmacro defcurry({func_name, _func_ctx, args}, do: body) do
num_args = Enum.count(args)
if num_args - 1 >= 1 do
new_args = Enum.take(args, num_args - 1)
quote do
def unquote(func_name)(unquote_splicing(args)) do
unquote(body)
end
@chrismccord
chrismccord / gist:c24b2b516066d987f4fe
Last active April 24, 2016 23:17
Phoenix 0.6.x to 0.7.0 Upgrade Instructions

How to upgrade to Phoenix from 0.6.x to 0.7.0.

  1. 0.7.0 depends on Plug HEAD, so you'll need to include plug in your mix deps until the next plug release:
{:plug, github: "elixir-lang/plug", ref: "7040c89cb4cf1f1c6afdee379e5982a07d77a6c3"}
```

  1. The `Pheonix.Controller` functions html/2, json/2, text/2, redirect/2 and render/3 no longer halt automatically. *Important*: You must now explicity call `halt/1` yourself if you want to stop invoking further plugs after calling these functions. This is improtant for auth filtering plugs, ie:

```elixir
# How to update values on immutable objects?
class Foo
def initialize(attrs)
@x = attrs.fetch(:x)
@y = attrs.fetch(:y)
freeze
end
end