- Create actions similar to Flummox.
- Generate action ids.
- Supports actions with decorators, promises, and therefore ES7 async.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
Base.singleton_methods.each do |m| | |
Base.class_eval <<-EOS | |
class << self | |
puts "redefining #{m}" | |
define_method "#{m}_with_introspection" do |*args| | |
puts "#{m}" | |
send(:"#{m}_without_introspection", *args) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Angular needs to send the Rails CSRF token with each post request. | |
* | |
* Here we get the token from the meta tags (make sure <%= csrf_meta_tags %> | |
* is present in your layout.) | |
*/ | |
angular.module('myapp',[]). | |
// configure our http requests to include the Rails CSRF token | |
config(["$httpProvider", function(p) { | |
var m = document.getElementsByTagName('meta'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.configure do |c| | |
def profile | |
result = RubyProf.profile { yield } | |
name = example.metadata[:full_description].downcase.gsub(/[^a-z0-9_-]/, "-").gsub(/-+/, "-") | |
printer = RubyProf::CallTreePrinter.new(result) | |
open("tmp/performance/callgrind.#{name}.#{Time.now.to_i}.trace", "w") do |f| | |
printer.print(f) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
gem 'sidekiq' | |
gem 'slim' | |
# ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Life do | |
def run(board) when is_binary(board) do | |
board |> parse_board |> run | |
end | |
def run(board) do | |
IO.write("\e[H\e[2J") | |
Life.print_board board | |
:timer.sleep 1000 | |
board = next_board(board) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command line utility to send attachments to your kindle | |
# It supports sending a PDF in both regular form and with the convert option | |
# and sending to the regular (@kindle.com) or free Kindle mail (@free.kindle.com) | |
# The only argument it has is the name of the file to send. It will detect if | |
# it is a pdf and treat it accordingly. | |
## Preferences | |
# If true, send one version with pdf as-is, another with 'convert' subject | |
# else, just send the pdf version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Model.new.foo |
Prior to setting the PKG_CONFIG_PATH, as below, pip install cryptography
failed with Symbol not found: _ffi_type_double
on my machine running Mac OS X 10.8.5. I am not sure how commonly the error occurs for other users.
brew install libffi
# Note the version-specific path below.
PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/ pip install cryptography
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql> EXPLAIN SELECT * FROM tf_users WHERE user_id = 'darkhelmet'; | |
+----+-------------+----------+--------+---------------+------+---------+------+------+-------+ | |
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
+----+-------------+----------+--------+---------------+------+---------+------+------+-------+ | |
| 1 | SIMPLE | tf_users | system | NULL | NULL | NULL | NULL | 1 | | | |
+----+-------------+----------+--------+---------------+------+---------+------+------+-------+ | |
1 row in set (0.00 sec) |
OlderNewer