Skip to content

Instantly share code, notes, and snippets.

@dombarnes
dombarnes / head.html
Created August 27, 2015 18:48
Safari 9 SVG Pinned Tab Icon (via @siracusa on ATP #132)
<link rel="icon" sizes="any" mask href="http://hypercritical.co/images/tiny-mac.svg" />
<link rel="mask-icon" mask href="http://hypercritical.co/images/tiny-mac.svg" color="black" />
#!/bin/bash
red='\033[0;32m'
NC='\033[0m'
for D in `find . -type d -maxdepth 1 -mindepth 1`
do
cd $(basename "$D")
echo -e "${red}$(basename "$D"${NC})"
git pull
@dombarnes
dombarnes / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@dombarnes
dombarnes / rails_resources.md
Last active August 29, 2015 14:16 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@dombarnes
dombarnes / css_resources.md
Last active August 29, 2015 14:16 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@dombarnes
dombarnes / new_gist_file
Created March 12, 2015 14:34
iOS7/8 UIAlert
{
if (([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] == NSOrderedAscending)) {
// use UIAlertView
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Are you sure you want to do this on iOS7?" delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];
[alert show];
}
else {
// use UIAlertController
UIAlertController *discardController = [UIAlertController
alertControllerWithTitle:@"Alert Title"
scope :recent, -> { order('created_at DESC') }
scope :owned, -> { where('user_id = ?', 'current_user.id' ) }
scope :current_user_only, -> { where('user_id = ?', 'current_user.id') }
scope :pending_items, -> { where(:quote_status => 'Pending') }
scope :lost_items, -> { where(:quote_status => 'Lost')}
scope :won_items, -> { where(:quote_status => 'Won')}
@dombarnes
dombarnes / AppName-Info.xml
Last active September 8, 2015 22:15
Xcode ATS Security for non-HTTPS domains
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourserver.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
@dombarnes
dombarnes / invoice.rb
Created October 19, 2011 10:11
Invoices App
class Invoice < ActiveRecord::Base
attr_accessible :invoice_date, :company_id, :purchase_order, :vat_rate, :date_sent, :paid, :date_paid;
validate :invoice_date, :company_id, :vat_rate, :date_sent, :presence => true
validate :status, :inclusion => { :in => ['draft', 'sent', 'paid'] }
belongs_to :company
has_many :invoice_items, :dependent => :destroy
accepts_nested_attributes_for :invoice_items, :allow_destroy => true
scope :outstanding, where(:paid => "false")
@dombarnes
dombarnes / gist:1848577
Created February 16, 2012 23:01
brew install postgresql errors
==> Downloading http://ftp.postgresql.org/pub/source/v9.1.2/postgresql-9.1.2.tar.bz2
File already downloaded in /Users/domster83/Library/Caches/Homebrew
/usr/bin/tar xf /Users/domster83/Library/Caches/Homebrew/postgresql-9.1.2.tar.bz2
==> ./configure --disable-debug --prefix=/usr/local/Cellar/postgresql/9.1.2 --datadir=/usr/local/Cellar/postgresql/9.1.2/share/postgresql --docdir=/usr/local/Cellar/postgresql/9.1.2/share/doc/postgresql --enable-thread-safety --with-bonjour --with-gssapi --with-krb5 --with-openssl --with-libxml --with-libxslt --with-ossp-uuid --with-python --with-perl ARCHFLAGS='-arch x86_64'
./configure --disable-debug --prefix=/usr/local/Cellar/postgresql/9.1.2 --datadir=/usr/local/Cellar/postgresql/9.1.2/share/postgresql --docdir=/usr/local/Cellar/postgresql/9.1.2/share/doc/postgresql --enable-thread-safety --with-bonjour --with-gssapi --with-krb5 --with-openssl --with-libxml --with-libxslt --with-ossp-uuid --with-python --with-perl ARCHFLAGS='-arch x86_64'
checking build system type... x86_6