Skip to content

Instantly share code, notes, and snippets.

@shreeve
shreeve / ffi-ruby-bridge.rb
Last active August 29, 2015 14:22
FFI bridge to libruby
# See https://gist.github.com/nanki/1336545
require 'ffi'
module FFI::Ruby
class Value
class << self
extend ::FFI::Library
ffi_lib 'ruby'
@shreeve
shreeve / binding_of_caller-ffi.rb
Last active March 1, 2018 14:08
binding_of_caller, pure FFI version (no compiler needed)
#!/usr/bin/env ruby
# =============================================================================
# Quick proof-of-concept of an FFI-based binding_of_caller (no compiling!)
#
# Author: Steve Shreeve <steve.shreeve@gmail.com>
# Basis: binding_of_caller and ffi gems
# Date: 28 May 2015
#
# Legal: MIT License
@shreeve
shreeve / start.sh
Last active August 29, 2015 14:21
docker start script
#!/usr/bin/env bash
watch=/tmp/watch
ready=/tmp/ready
rm -f $watch $ready
mkfifo $watch
# reap all on exit
trap "exit" INT TERM
# RESTful API
#
# +--------+-------------------+---------+---------+----------+-----------+
# | METHOD PATH | ACTION | PAYLOAD | TEMPLATE | REDIRECT |
# + -------+-------------------+---------+---------+----------+-----------|
# | GET | /orders | index | | index | |
# | GET | /orders/new | new | | edit | |
# | GET | /orders/4;edit | edit | | edit | |
# | GET | /orders/4 | show | | show | |
# + -------+-------------------+---------+---------+----------+-----------+