Skip to content

Instantly share code, notes, and snippets.

View skinofstars's full-sized avatar

Kevin Carmody skinofstars

View GitHub Profile
@skinofstars
skinofstars / hosts
Last active June 2, 2020 08:16
Ansible static site deploy
[live]
live ansible_ssh_host=12.34.56.78 ansible_ssh_user=ubuntu
@skinofstars
skinofstars / groupy.json
Last active August 29, 2015 14:01
ng bind across models
{
groupy: {
invited: {
eventOne: true,
eventTwo: false
},
responded: {
eventOne: false,
eventTwo: false
}
@skinofstars
skinofstars / deep_struct.rb
Last active August 29, 2015 14:01
nested hashes and arays to a nice OpenStruct
require 'ostruct'
# use dot notation on nested hash/arrays
# based on http://andreapavoni.com/blog/2013/4/create-recursive-openstruct-from-a-ruby-hash/#.U3NjHXWx3AF
# but extended to deal with arrays
# or you could just use https://github.com/jsuchal/hashugar
class DeepStruct < OpenStruct
@skinofstars
skinofstars / spec_helper.rb
Created May 14, 2014 10:55
consistent DatabaseCleaner strategy in rspec
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
# what i'm using for my bash git prompt today
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
@skinofstars
skinofstars / feature_macros.rb
Created April 9, 2014 17:36
RSpec + Capybara + Devise + Factory Girl: login macro
# support/feature_macros.rb
module FeaturesMacros
def signin_admin
DatabaseCleaner.clean
@user ||= FactoryGirl.create(:user)
visit '/sign_in'
within("#new_user") do
fill_in 'user[email]', :with => user.email
{
"ensure_newline_at_eof_on_save": true,
"font_size": 9,
"ignored_packages":
[
"Vintage"
],
"rulers":
[
80
@skinofstars
skinofstars / .gitconfig
Created September 27, 2013 10:59
couple of nice .gitconfig aliases from @garrettc
[alias]
where = log --decorate --pretty=short -n1
lol = log --pretty=oneline --graph --decorate --stat
lg = log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci) %C(bold blue)<%an>%Creset' --abbrev-commit
st = status -sb
@skinofstars
skinofstars / gist:6714637
Last active December 24, 2015 00:09
deploy cold override for db migrations
namespace :deploy do
desc "Override deploy:cold to include database setup"
task :cold do
before :run_migrations do
capifony_pretty_print "--> Creating database"
run "#{release_path}/app/console mygreatdbcommand:database:create-once"
capifony_puts_ok
end
@skinofstars
skinofstars / sub-domains
Created September 18, 2013 15:02
sub domains in apache VirtualHost
<VirtualHost *:80>
ServerName foo.kevin.dev
ServerAlias foo.local.dev
ServerAlias foo.local.test
DocumentRoot /home/kevin/projects/foo/web/
<Directory /home/kevin/projects/foo/web/>
Options Indexes FollowSymLinks MultiViews
# pcw AllowOverride None
AllowOverride All