Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Croak croaky

View GitHub Profile
@croaky
croaky / favicon.sh
Created Mar 10, 2020
Make a circular favicon from your GitHub avatar
View favicon.sh
#!/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 Nov 2, 2020
Parcel + TypeScript + React
View App.tsx
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>
View keybase.md

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 Jun 14, 2016
Ubuntu setup for a Rails app
View README.md

Read the script, then run:

https://gist.githubusercontent.com/croaky/51e896eb837fbdc6d1786893d215e120/raw/87beeec2e9de349d6d6af93fd9c1cd253cecfc2e/ubuntu
@croaky
croaky / user.rb
Created Mar 27, 2015
Clearance with Mongoid
View user.rb
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
View sitemap.xml.erb
<?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>
View keybase.md

Keybase proof

I hereby claim:

  • I am croaky on github.
  • I am croaky (https://keybase.io/croaky) on keybase.
  • I have a public key whose fingerprint is 1C67 B823 631B 4D86 BDD6 A0D7 913C E9ED B057 DC22

To claim this, I am signing this object:

@croaky
croaky / .travis.yml
Created Jul 31, 2013
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.
View .travis.yml
---
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 Apr 10, 2013
Development (.ruby-version) / CI (config/tddium.yml) / production (https://devcenter.heroku.com/articles/ruby-support) parity of Ruby versions down to patch level.
View use_factory_method.rb
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"
You can’t perform that action at this time.