Skip to content

Instantly share code, notes, and snippets.

@bartimaeus
bartimaeus / company.rake
Created February 18, 2011 14:43
Part of my FatFreeCRM migration rake task. I've added custom fields and roles to this install of FatFreeCRM. The files used by this rake task are generated by another task that downloads them and converts then to csv files using the pipe "|" as the delimi
# Store rake tasks specific to [company]
namespace :[company] do
# Migrate [Company]'s data into the new CRM
namespace :migrate do
require 'progressbar'
desc "Run all [company] migration tasks"
task :all => [:config, :users, :comments, :accounts]
@bartimaeus
bartimaeus / install-ruby.sh
Created May 31, 2012 19:55 — forked from ryanb/chef_solo_bootstrap.sh
Install Ruby 1.9.3-p286 on Ubuntu 12.04 LTS
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libxml2-dev libxslt-dev libreadline6-dev libyaml-dev
# apt-get -y install libmysqlclient-dev # uncomment for mysql support
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz
tar -xvzf ruby-1.9.3-p286.tar.gz
cd ruby-1.9.3-p286/
./configure --prefix=/usr/local
make
@bartimaeus
bartimaeus / PKGBUILD
Created September 28, 2021 23:35
Build the latest commit of https://github.com/TylerBrock/saw
# Maintainer: Tyler Brock <tyler.brock@gmail.com>
pkgname=saw
pkgver=b37c70de306768a0d54e5b97e46690b1f99cf1d0
pkgrel=1
pkgdesc="Fast, multipurpose tool for AWS CloudWatch Logs"
arch=('i686' 'x86_64' 'armv6h' 'armv7h')
provides=('saw')
url="https://github.com/TylerBrock/$pkgname"
license=('MIT')
makedepends=('go' 'git')
@bartimaeus
bartimaeus / [app_name].sh
Created June 30, 2012 03:58
Init script for rails application, originally developed by mikesmullin
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@bartimaeus
bartimaeus / .drone.yml
Created September 12, 2019 06:02
Example drone.io config for gatsby deploy to s3 and CloudFront
---
kind: pipeline
name: www [staging]
steps:
- name: build
image: node
environment:
GATSBY_GOOGLE_ANALYTICS_ID:
from_secret: staging_www_analytics_id
@bartimaeus
bartimaeus / start-docker.sh
Created February 6, 2019 19:57
Command used with tmuxinator to ensure that docker is running before starting the session
#!/bin/bash
# Open Docker, only if Docker not running
if (! docker ps -q 2>/dev/null ); then
# On Mac OS this would be the terminal command to launch Docker
open /Applications/Docker.app
echo "~> Starting Docker..."
echo ""
# Wait until Docker daemon is running and has completed initialisation
@bartimaeus
bartimaeus / git-sync.sh
Created February 6, 2019 19:04
Bash function to sync git repository. I use this when automatically pulling changes from many repositories so that I don't have to open each repo and determine if it's dirty or clean.
# Determine if we need to stash or not when updating git repository
function git-sync {
untracked=$(expr `git status --procelain 2>/dev/null | grep "^??" | wc -l`)
if [ "$untracked" = "0" ]; then
git pull --rebase
else
git stash
git pull --rebase
git stash apply
fi
@bartimaeus
bartimaeus / App.js
Last active August 16, 2018 07:41
Lesson 03
/*
- Make the Play button work
- Make the Pause button work
- Disable the play button if it's playing
- Disable the pause button if it's not playing
- Make the PlayPause button work
- Make the JumpForward button work
- Make the JumpBack button work
- Make the progress bar work
- change the width of the inner element to the percentage of the played track
@bartimaeus
bartimaeus / App.js
Created August 16, 2018 03:20
Lesson 05
////////////////////////////////////////////////////////////////////////////////
// Exercise:
//
// - Refactor App by creating a new component named `<GeoPosition>`
// - <GeoPosition> should use a render prop callback that passes
// the coords and error
// - When you're done, <App> should no longer have anything but
// a render method
// - Now create a <GeoAddress> component that also uses a render
// prop callback with the current address. You will use
@bartimaeus
bartimaeus / App.js
Created August 16, 2018 03:19
Lesson 04
/*
Create a `withStorage` higher order component that manages saving and retrieving
the `sidebarIsOpen` state to local storage
*/
import "./index.css";
import React from "react";
import MenuIcon from "react-icons/lib/md/menu";
import { set, get, subscribe } from "./local-storage";