Skip to content

Instantly share code, notes, and snippets.

View danrabinowitz's full-sized avatar
☁️
Building the cloud

Dan Rabinowitz danrabinowitz

☁️
Building the cloud
View GitHub Profile
#!/usr/bin/env ruby
require 'erb'
require 'active_support'
require 'active_support/core_ext'
def newlines_to_br(s)
html = "".html_safe
s.split("\n").each_with_index do |line, idx|
html << "<br />".html_safe if idx > 0
@danrabinowitz
danrabinowitz / iseq_fix.patch
Created June 22, 2018 16:08
2.5.1 iseq patch to fix ruby for bootsnap
--- a/compile.c 2018-05-13 19:35:50.000000000 -0700
+++ b/compile.c 2018-05-13 19:34:53.000000000 -0700
@@ -4569,6 +4569,7 @@
DECL_ANCHOR(else_seq);
LABEL *then_label, *else_label, *end_label;
VALUE branches = 0;
+ int ci_size, ci_kw_size;
INIT_ANCHOR(cond_seq);
INIT_ANCHOR(then_seq);

Keybase proof

I hereby claim:

  • I am danrabinowitz on github.
  • I am danrabinowitz (https://keybase.io/danrabinowitz) on keybase.
  • I have a public key ASBu2Euhal8LX1Uo_I56nwA7E5JlqWVcgp9eNvJc87B75go

To claim this, I am signing this object:

@danrabinowitz
danrabinowitz / market_research.rb
Created October 7, 2016 20:18 — forked from searls/market_research.rb
Was chatting with @mfeathers about retaining Ruby's chained Enumerable style, but finding a way to inject names that reflects the application domain (as opposed to just littering functional operations everywhere, which may be seen as a sort of Primitive Obsession)
# A little toy file demonstrating how to build chainable
# data transformations that reveal some amount of intent
# through named extracted methods.
#
# Kudos to @mfeathers for giving me the idea to try this
#
# Copyright Test Double, LLC, 2016. All Rights Reserved.
require_relative "marketing_refinements"
require_relative "research_subjects"
https://twitter.com/trek/status/636286667087851520
https://twitter.com/DocOnDev/status/636173870937034752
https://twitter.com/KentBeck/status/634741725047615489
https://twitter.com/danmayer/status/632228562116849664
# gem "prawn", "0.8.4"
# Sometime there is no enough space for the last table row when it reaches the end of page
Prawn::Document.generate("text_group_overflow_question.pdf") do |pdf|
add_page_break_if_overflow(pdf) do |pdf|
# generating table here
# ...
end
end
@danrabinowitz
danrabinowitz / s
Created March 27, 2014 15:32 — forked from mslinn/s
#!/bin/bash
# Assumes you have defined subl command
# See http://www.sublimetext.com/docs/2/osx_command_line.html
# See http://www.sublimetext.com/forum/viewtopic.php?f=4&t=10473
if [ "$1" ]; then # open given file(s) or directory/directories
subl "$@" &
else # no arguments
PRJ=`ls -1 *.sublime-project 2> /dev/null`