Skip to content

Instantly share code, notes, and snippets.

View edbond's full-sized avatar
👋
Looking for a job

Eduard Bondarenko edbond

👋
Looking for a job
View GitHub Profile
@edbond
edbond / active_job_retry_controlable.rb
Last active February 5, 2020 09:46 — forked from necojackarc/active_job_retry_controlable.rb
To enable ActiveJob to control retry
module ActiveJobRetryControlable
extend ActiveSupport::Concern
DEFAULT_RETRY_LIMIT = 5
class_methods do
def retry_limit(retry_limit)
@retry_limit = retry_limit
end
Rails.application.config.after_initialize do
ActiveSupport.on_load(:active_record) do
oid = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID
# https://github.com/rails/rails/blob/v4.2.3/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb
oid::Jsonb = Class.new(oid::Json) do
def type
:jsonb
end
# This is a monkey patch for MessageVerifier — I need to change Marshal.load to JSON
if defined?(ActionController::Flash::FlashHash)
class ActionController::Flash::FlashHash
def to_json(*args)
{}.merge(self).merge({:used => @used}).to_json
end
end
end
#!/bin/bash
# usage: time benchbulk.sh dbname
# it takes about 30 seconds to run on my old MacBook
BULKSIZE=1000
DOCSIZE=100
INSERTS=10
ROUNDS=10
DBURL="http://localhost:5984/$1"
@edbond
edbond / twitter_app.rb
Created April 3, 2009 10:06 — forked from mbleigh/twitter_app.rb
twitterapp
app_name = ask("What is your application called?")
puts "\nBefore this generator runs you will need to register your Twitter application for OAuth at http://twitter.com/oauth_clients, then enter the consumer key and secret below:\n\n"
consumer_key = ask("OAuth Consumer Key:")
consumer_secret = ask("OAuth Consumer Secret:")
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm README"
run "cp config/database.yml config/database.yml.example"

(This is the text of the keynote I gave at Startup Riot 2009. Will update when video becomes available.)

Hi everyone, I’m Chris Wanstrath, and I’m one of the co-founders of GitHub.

GitHub, if you haven’t heard of it, has been described as “Facebook for developers.” Which is great when talking about GitHub as a website, but not so great when describing GitHub as a business. In fact, I think we’re the polar opposite of Facebook as a business: we’re small, never took investment, and actually make money. Some have even called us successful.

Which I’ve always wondered about. Success is very vague, right? Probably even relative. How do you define it?

After thinking for a while I came up with two criteria. The first is profitability. We employ four people full time, one person part time, have thousands of paying customers, and are still growing. In fact, our rate of growth is increasing – which means January was our best month so far, and February is looking pretty damn good.

#
# cucumber.yml
#
# Filter which features are run with each profile by the file extension
webrat: --require features/steps/common --require features/support/webrat_env.rb --exclude selenium.feature --format progress
selenium: --require features/steps/common --require features/support/selenium_env.rb --exclude webrat.feature --format progress
#
# features/support/env.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'trollop'
config = {:step_type => 'Given,When,Then'}
opts = Trollop.options do
opt :step_type, "Given, When or Then", :type => :string, :default => config[:step_type]
end
term = ARGV.last
@edbond
edbond / gist:51126
Created January 23, 2009 18:32 — forked from peterc/gist:33337
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
get '/' do
haml :index
end
post '/unwind' do
@url, @unwound_url, @unwind_error = unwind(params[:url])
haml :index
end
get '/unwind.json' do