Skip to content

Instantly share code, notes, and snippets.

@jasonroelofs
jasonroelofs / Timings.txt
Created November 29, 2012 18:23
Using Go for embarrassingly parallel scripts
] wc -l domains.txt
783 domains.txt
] time go run domain_lookup_parallel.go
real 0m5.743s
user 0m0.359s
sys 0m0.355s
] time go run domain_lookup_sequential.go
@jasonroelofs
jasonroelofs / cli_plea.rb
Last active February 7, 2018 15:53
Is there any Ruby Command Line Parsing library out there that JUST DOES PARSING?
# The ones I've tried (almost all from http://www.awesomecommandlineapps.com/gems.html):
#
# OptParse -- Doesn't support commands
# Commander -- Everything is about procs
# Trollop -- Doesn't support commands
# GLI -- Relies on calling a proc
# Methadone -- See GLI
# Main -- Seems to require the use of a #run method or proc
# Thor -- Focused on running methods, resulting code very difficult to read
# CRI -- Requires #run method or proc (seeing a pattern here...)
@jasonroelofs
jasonroelofs / dupefinder.js
Last active December 27, 2017 11:50 — forked from mattslack/dupefinder.js
Find duplicate IDs in a document.
(function () {
"use strict";
var find_dupes = function () {
var identified = document.querySelectorAll('[id]'),
found = {},
id,
idx;
for (idx = 0; idx < identified.length; idx++) {
id = (identified[idx]).getAttribute('id');
if(found[id]) {
@jasonroelofs
jasonroelofs / database_cleaner.rb
Created October 6, 2017 19:54
Configuring DatabaseCleaner for transaction and truncation
require "capybara/rspec"
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
if config.use_transactional_fixtures?
raise(<<-MSG)
Delete line `config.use_transactional_fixtures = true` from rails_helper.rb
(or set it to false) to prevent uncommitted transactions being used in
@jasonroelofs
jasonroelofs / gist:30b7efef4c8c38f38f689b7314b38b32
Created February 22, 2017 14:08
browserify test failures
Browserify: /Users/jroelofs/Development/browserify-rails/test/dummy/node_modules/.bin/browserifyinc -d --list --cachefile=/Users/jroelofs/Development/browserify-rails/test/dummy/tmp/cache/browserify-rails/browserifyinc-cache.json -o "/Users/jroelofs/Development/browserify-rails/test/dummy/tmp/cache/browserify-rails/output20170222-67719-sza12e" -
Browserify: /Users/jroelofs/Development/browserify-rails/test/dummy/node_modules/.bin/browserifyinc -d --cachefile=/Users/jroelofs/Development/browserify-rails/test/dummy/tmp/cache/browserify-rails/browserifyinc-cache.json -o "/Users/jroelofs/Development/browserify-rails/test/dummy/tmp/cache/browserify-rails/output20170222-67719-1ga4zhp" -
Exorcist: /Users/jroelofs/Development/browserify-rails/test/dummy/node_modules/.bin/exorcist /Users/jroelofs/Development/browserify-rails/test/dummy/app/assets/javascripts/application.map -b /Users/jroelofs/Development/browserify-rails/lib
F

Brian,

I believe you misunderstood the message I was trying to convey in my reply, but that's understandable as Twitter does not really provide a usable framework for such discussions. As such, I'm not going to try to reply in Twitter as I can't make that work but instead will line out my thoughts here.

To preface my original tweet: The Ruby community is oft known for arrogance, egotism, and shaming. Rubyists have not been a very welcoming bunch. I myself have readily partook in such discussions and joined the echo chamber far more often than I probably realize. As such, I've met many developers who refuse to touch the language in fear or disgust of having to deal with what has been a toxic community. I do believe that we as a Ruby community are better today but the damage has been done and won't quickly be forgotten.

As such, this is the last thing I want to happen to the budding and fantastic Elixir community. While a simple website like "canphoenixscale.com" is in itself harmless, it cannot be taken on

@jasonroelofs
jasonroelofs / snitch.java
Created January 27, 2014 19:58
Simple Snitching in Java
// Using raw java.net.*
URL obj = new URL("https://nosnch.in/[snitch code]?m=[message]");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.getResponseCode();
// Apache HttpComponents http://hc.apache.org/httpcomponents-client-ga/quickstart.html
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet("https://nosnch.in/[snitch code]?m=[message]");
CloseableHttpResponse response1 = httpclient.execute(httpGet);
@jasonroelofs
jasonroelofs / simple-recurly.coffee
Created January 23, 2014 16:49
Simple Recurly.js. For when you want the "transparent redirect" but none of the form generation.
# Ripped from recurly.js
createObject = (o) ->
F = ->
F.prototype = o
return new F()
$ ->
$(".recurly-form").submit (e) ->
e.preventDefault()
$form = $(this)
require 'celluloid'
class TestActor
include Celluloid
def initialize
@handlers = []
end
def add_handler(&block)
class Minitest::Test
alias assert_not_nil refute_nil
alias assert_not refute
end