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 / 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 / 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 / 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>

Keybase proof

I hereby claim:

  • I am croaky on github.
  • I am croaky (https://keybase.io/croaky) on keybase.
  • I have a public key ASAk8K7woEyWuZp5DG0lq8CZyvCSZzpPcO3oCbCz0CJKVAo

To claim this, I am signing this object:

@croaky
croaky / README.md
Last active June 14, 2016 21:04
Ubuntu setup for a Rails app

Read the script, then run:

https://gist.githubusercontent.com/croaky/51e896eb837fbdc6d1786893d215e120/raw/87beeec2e9de349d6d6af93fd9c1cd253cecfc2e/ubuntu
@croaky
croaky / user.rb
Created March 27, 2015 03:09
Clearance with Mongoid
class User
include Clearance::User
include Mongoid::Document
field :confirmation_token, type: String
field :email, type: String
field :password, type: String
field :remember_token, type: String
end
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://robots.thoughtbot.com</loc>
<priority>1.0</priority>
<changefreq>daily</changefreq>
</url>
<% sitemap_articles.each do |page| %>
<url>
<loc>http://robots.thoughtbot.com/<%= page.destination_path.gsub("/index.html", "")%></loc>
@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