Navigation Menu

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 May 4, 2022 18:57
APIError: GitHub event 'schedule' is not supported.
@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 / 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>
module DelayedJob
module Matchers
def enqueue_delayed_job(handler)
DelayedJobMatcher.new handler
end
class DelayedJobMatcher
def initialize(handler)
@handler = handler
@attributes = {}
@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 / deploy.md
Created April 3, 2012 18:35
Heroku staging deployment process with additional Github staging remote

Periodically use pgbackups to pull latest production data.

Merge master into staging

git checkout master
git reset --hard origin/master
git pull
git checkout staging

git reset --hard origin/staging

@croaky
croaky / favicon.sh
Created March 10, 2020 17:22
Make a circular favicon from your GitHub avatar
#!/bin/bash
# Make a circular favicon from your GitHub avatar
#
# ./favicon.sh username
set -eu
if ! command -v convert >/dev/null; then
echo "error: ImageMagick isn't installed." >&2
@croaky
croaky / README.md
Created March 18, 2012 18:43
Typical README for a thoughtbot Rails app that is deployed to Heroku

Rails app

is a Rails 3.1 app running on Ruby 1.9.2 and deployed to Heroku's Cedar stack. It has an RSpec and Cucumber test suite which should be run before commiting to the master branch.

Running tests

Create aliases:

Common performance symptoms

The two most common performance symptoms are with throughput or timeouts.

An application's maximum throughput can be measured by how many requests per second it serves; New Relic reports this number as "rpm," which means "requests per minute." Throughput will be limited by how long the average request takes to process and how may servers are available to handle processes. Heroku calls these servers "dynos."