Skip to content

Instantly share code, notes, and snippets.

View dsandstrom's full-sized avatar

Darrell Sandstrom dsandstrom

View GitHub Profile

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@dsandstrom
dsandstrom / fuubar.sh
Last active December 17, 2015 13:38
Shell script that runs RSpec Ruby tests in Fuubar format.
#!/bin/bash
# Fuubar format RSpec
# `fuubar` - runs all tests in spec/
# `fuubar [path/from/spec]` - if the folder or file is found, runs tests in that folder/file
# also guesses where the file is located based on the partial file name
# examples:
# ---
# `fuubar user` - runs spec/models/user_spec.rb
# Sublime plugin
# Save file: Packages/CloseProjectAndExit/close_project_and_exit.py
# Copy to keymap: { "keys": ["ctrl+shift+`"], "command": "close_project_and_exit" }
import sublime
import sublime_plugin
class CloseProjectAndExitCommand(sublime_plugin.WindowCommand):
def run(self):
@dsandstrom
dsandstrom / subl
Last active June 23, 2016 11:23
Bash script to open Sublime Text project. Defaults to opening current directory if no file given. If file/folder given, opens that.
#!/bin/bash
if [ "$#" -eq "0" ] ; then
for file in *sublime-project
do
if [ -f $file ] ; then
# if no arguments, find if there is a project file in the current directory
filename="${file%.*}"
echo "Opening project: $filename"
/opt/sublime_text_2/sublime_text --class=sublime-text-2 -n $file &
@dsandstrom
dsandstrom / conky_pacman.rb
Last active July 15, 2017 15:38
Ruby script to list packages with update with conky. Uses `pacman -Qu` to retrieve packages with updates and organizes per package importance. Add a hourly cron job that runs `pacman -Sy`. Recommend conky config: http://walkero.gr/post/50586862655/my-latest-conky-script
#!/usr/bin/env ruby
# Add ${execpi 3600 path/to/conky_pacman.rb} to the bottom of ~/.conkyrc
# TODO: use regex to match package ratings (linux*)
CONKY_WIDTH = 35
MAX_PACKAGES = 8
COLOR_INFO = '#FFFFFF'
COLOR_HIGH = '#FF0000'
COLOR_MED = '#FFFF00'
@dsandstrom
dsandstrom / Dockerfile
Created August 16, 2017 22:56
Phoenix deployer using a Docker container to compile
FROM staticfloat/centos-i386:centos6
MAINTAINER Darrell Sandstrom
RUN yum update -y && yum clean all
RUN yum install -y wget && yum clean all
# Install dependencies
RUN yum install -y gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf java-1.8.0-openjdk-devel git tar && yum clean all
# Install Erlang
@dsandstrom
dsandstrom / foundation-chosen.sass
Last active June 3, 2018 05:55
Foundation 5 and Chosen CSS Merger
// Foundation and Chosen CSS Merger
// ZURB Foundation v5 - Harvest Chosen v1.1
// Add to the bottom of foundation_and_overrides.scss: `@import 'foundation-chosen';`
$chosen-form-spacing: $form-spacing / 4 + rem-calc(1)
$chosen-input-height: ($input-font-size + ($form-spacing * 1.5) - rem-calc(1))
$chosen-input-height-multi: ($input-font-size + ($form-spacing * 1.5) - rem-calc(5))
$chosen-border-radius: 0
$chosen-highlighted: $primary-color
@dsandstrom
dsandstrom / starbucks_us_locations.json
Created November 13, 2018 17:42 — forked from wf9a5m75/starbucks_us_locations.json
8902 locations of US Starbucks with addresses, latitude, and longitude
This file has been truncated, but you can view the full file.
[
{
"position": {
"lat": 61.21759217,
"lng": -149.8935557
},
"name": "Starbucks - AK - Anchorage 00001",
"address": "601 West Street_601 West 5th Avenue_Anchorage, Alaska 99501",
"phone": "907-277-2477"
},
@dsandstrom
dsandstrom / deploy.rb
Last active December 26, 2019 22:17 — forked from twetzel/deploy.rb
Compile assets locally with capistrano 3.5.0 and rails 4.2.x (Nginx-Unicorn zero downtime)
# Runs rake assets:clean
# Defaults to nil (no asset cleanup is performed)
# If you use Rails 4+ and you'd like to clean up old assets after each deploy,
# set this to the number of versions to keep
set :keep_assets, 2
# Clear existing task so we can replace it rather than "add" to it.
Rake::Task["deploy:compile_assets"].clear
namespace :deploy do
@dsandstrom
dsandstrom / preview_devise_mail.rb
Last active December 11, 2020 02:33 — forked from ThawanFidelis/preview_devise_mail.rb
Preview Devise Mails
# spec/mailers/previews/devise_mailer_preview.rb
class Devise::MailerPreview < ActionMailer::Preview
def confirmation_instructions
Devise::Mailer.confirmation_instructions(User.first, {})
end
def unlock_instructions
Devise::Mailer.unlock_instructions(User.first, "faketoken")
end