Skip to content

Instantly share code, notes, and snippets.

@croaky
croaky / dataclips.rb
Last active December 3, 2022 16:36
"Heroku Dataclips" pair programmed with https://chat.openai.com/chat
#!/usr/bin/env ruby
# createdb db
# chmod +x dataclips.rb
# DATABASE_URL=postgres:///db ./dataclips.rb
require "bundler/inline"
require "csv"
gemfile do
@croaky
croaky / README.md
Last active April 17, 2021 17:27
Job queues in Ruby and Postgres

A few lines of Ruby with pg driver is a simple alternative to a job queuing library. Job queues are defined as database tables and workers are defined in one Ruby file.

queuea: bundle exec ruby queue/a.rb
queueb: bundle exec ruby queue/b.rb
@croaky
croaky / App.tsx
Last active July 25, 2021 19:55
Parcel + TypeScript + React
import * as React from 'react'
// routing, etc.
import { Reset } from '~/ui/shared/Reset'
export class App extends React.Component {
public render() {
return (
<div>
<title>Dashboard</title>
@croaky
croaky / .travis.yml
Created July 31, 2013 18:25
This is our current Travis configuration for our standard Rails 4 + Ruby 2 projects that have Capybara Webkit test suites and Postgres databases. It relies on the bundle_cache.rb and bundle_install.sh files from http://randomerrata.com/post/45827813818/travis-s3 to cache gem bundles for much faster test suite setup time.
---
rvm:
- 2.0.0
before_install:
- "echo 'gem: --no-document' > ~/.gemrc"
- "echo '--colour' > ~/.rspec"
- gem install fog
- "./script/travis/bundle_install.sh"
- export DISPLAY=:99.0
@croaky
croaky / .ruby-version
Created April 10, 2013 21:54
Development (.ruby-version) / CI (config/tddium.yml) / production (https://devcenter.heroku.com/articles/ruby-support) parity of Ruby versions down to patch level.
1.9.3-p392
class Customer
def initialize(attrs = {})
@id = attrs[:id]
@country = attrs[:country]
end
def tax_code
TaxCodes[@country].call(@id)
rescue
raise "Tax codes for #{@country} not supported"
@croaky
croaky / thank-you.md
Created November 9, 2012 22:44 — forked from anonymous/thank-you.md
This Week in Open Source

This Week in Open Source

Thanks to this week's contributors to thoughtbot projects.

Test your Ruby gem against different versions of its dependencies.

avatar Joe Ferris

module DelayedJob
module Matchers
def enqueue_delayed_job(handler)
DelayedJobMatcher.new handler
end
class DelayedJobMatcher
def initialize(handler)
@handler = handler
@attributes = {}