Skip to content

Instantly share code, notes, and snippets.

View taylorbrooks's full-sized avatar

Taylor Brooks taylorbrooks

  • Simple
  • Austin, TX
View GitHub Profile
emails = Customer.select(:email).map(&:email)
emails.map do |email|
grouping = emails
.group_by{|em| Levenshtein.distance(email, em) }
.select {|k,v| k < 5 && != 0 } # ignore exact matches and ones far off
if !grouping.empty?
[email, grouping]
end
<script>
$(document).ready(function(){
var start = moment().startOf('year');
var end = moment().endOf('year');
$('#group_by').change(function(e){
var val = $(this).val();
var string = Chartkick.charts["chart-1"].dataSource;
string = paramReplace("group_by", val, string);
<script>
$(document).ready(function(){
var start = moment().startOf('year');
var end = moment().endOf('year');
$('#group_by').change(function(e){
var val = $(this).val();
var string = Chartkick.charts["chart-1"].dataSource;
string = paramReplace("group_by", val, string);
# Is it thread-safe if this class is instantiated based on a new HTTP req
# and two separate reqs happen at the same time?
class BingBong
attr_reader :uuid, :person
def initialize(person:,)
@uuid = SecureRandom.uuid
@person = person
end
s = Time.now
lines = File.read_lines("./files/2014.txt").compact_map{|line| process(line) }
things = lines.select{|hsh| hsh[:amount] > 100000 }
e = Time.now
p things.size
p e-s
def process(line)
@taylorbrooks
taylorbrooks / passwordless_login.md
Last active August 8, 2016 13:11
Passwordless Login for Phoenix

I'd like to build an Elixir library for passwordless login.

Modeled after this post, with a few alterations: http://inaka.net/blog/2016/07/27/passwordless-login-with-phoenix

The library would generate (or provide) a number of things:

  1. A migration for a login_keys table with 3 columns: [email, key, created_at]
  2. HTML template for submitting an email
  3. Email template for mailing login key
  4. Session routes and controllers
@taylorbrooks
taylorbrooks / s3_photo_app.md
Last active August 4, 2016 05:55
React or Ember, S3 Photo App

This is a paid project.

I'm looking for someone to build a single page JavaScript app in either Ember or React/Redux.

The person should have a pretty good handle of AWS services, particularly S3 and the JS sdk

Project:

Here's a rough idea of what I'd like built.

  • Host photos in an S3 bucket
  • JS spa would be hosted in a separate bucket that provides an interface to:
# grab a user
user = User |> preload(:emails) |> Repo.get_by!(api_key)
# set the current_user in conn.assigns
conn
|> assign(:current_user, user)
|> put_session(:user_id, user.id)
|> configure_session(renew: true)
# try to use in a view
@taylorbrooks
taylorbrooks / date_setter.md
Last active February 20, 2016 22:39
Set correct days.

This is a paid project. I'll accept answers in Ruby, Elixir, or NodeJS. Or all 3.

  • I need the project done by Saturday, February 27th.
  • DONE I'll pay $500 for the Ruby answer.
  • And $250 for an Elixir or Node answer.
# Before starting, please email me at:
e = "dGJyb29rc0BnbWFpbC5jb20="
Base64.decode64(e)
(0..6).each do |i|
day = Date.today.next_week + i
it "should have emails with send_at on weekdays when started on #{day.strftime('%A')}" do
Timecop.freeze(day) do
p Date.today
end
end
end