Skip to content

Instantly share code, notes, and snippets.

@jasonroelofs
jasonroelofs / Timings.txt
Created Nov 29, 2012
Using Go for embarrassingly parallel scripts
View Timings.txt
] 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 Feb 7, 2018
Is there any Ruby Command Line Parsing library out there that JUST DOES PARSING?
View cli_plea.rb
# 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 Dec 27, 2017 — forked from mattslack/dupefinder.js
Find duplicate IDs in a document.
View dupefinder.js
(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 Oct 6, 2017
Configuring DatabaseCleaner for transaction and truncation
View database_cleaner.rb
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
View gist:30b7efef4c8c38f38f689b7314b38b32
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
View reply.md

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 Jan 27, 2014
Simple Snitching in Java
View snitch.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 Jan 23, 2014
Simple Recurly.js. For when you want the "transparent redirect" but none of the form generation.
View simple-recurly.coffee
# Ripped from recurly.js
createObject = (o) ->
F = ->
F.prototype = o
return new F()
$ ->
$(".recurly-form").submit (e) ->
e.preventDefault()
$form = $(this)
View test_actor.rb
require 'celluloid'
class TestActor
include Celluloid
def initialize
@handlers = []
end
def add_handler(&block)
View fix_refute.rb
class Minitest::Test
alias assert_not_nil refute_nil
alias assert_not refute
end
You can’t perform that action at this time.