Skip to content

Instantly share code, notes, and snippets.

View corbanb's full-sized avatar

corban baxter corbanb

View GitHub Profile
@corbanb
corbanb / readme.md
Last active June 11, 2016 19:11
PostgreSQL Useful commands

psql commands

Export to CSV

$ psql postgres://user:pass@localhost:1337/dbname -o 'file.csv' -F , --no-align -c 'SELECT * FROM column ORDER BY created_at ASC;'

Arrays

UPDATE "Jobs" SET "subscribers" = array_replace("subscribers", 'corbanb+plan@gmail.com', 'corbanb+plan2@gmail.com') WHERE "deletedAt" IS NULL AND 'corbanb+plan@gmail.com' = ANY ("subscribers")
@corbanb
corbanb / post-merge
Created May 20, 2016 23:59 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed. In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@corbanb
corbanb / developer-resources.md
Last active May 17, 2016 08:25
Creative Developer Resources
@corbanb
corbanb / banned.txt
Last active May 9, 2016 22:52
Banned and Blacklisted Usernames. Includes basic routes and curse words. Also other Profanity
4r5e
5h1t
5hit
God
God damn
Goddamn
a55
a_s_s
about
account
# Opens the bitbucket page for the current git repository in your browser
function bit() {
giturl=$(git config --get remote.origin.url)
if [ "$giturl" == "" ]
then
echo "Not a git repository or no remote.origin.url set"
exit 1;
fi
var App = App || {};
App.Helpers = App.Helpers || {};
(function($) {
'use strict';
App.Helpers.Numbers = {
@corbanb
corbanb / csv_to_html.php
Created January 10, 2014 00:23
Output CSV data into HTML with this simple script.
<?php
ini_set('auto_detect_line_endings',TRUE);
$handle = fopen("mydata.csv", "r");
?>
<ul>
<?php while ( ($data = fgetcsv($handle, 1000, ",")) !== FALSE ): ?>
<li>
<a href="<?= $data[4] ?>" class="product-container">
<img class="lazy" src="<?= $data[3] ?>" data-original="<?= $data[3] ?>">
<div class="post-details">
@corbanb
corbanb / unicorn.rb
Created September 20, 2013 15:37
Basic Unicorn and heroku config file.
worker_processes Integer(ENV['WEB_CONCURRENCY'] || 4)
timeout 120
preload_app true
listen ENV['PORT'].to_i || 3000, tcp_nopush: false
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
@corbanb
corbanb / multi_php
Last active December 23, 2015 11:59
This will give you the ability to install multiple versions of php side by side. (via: https://coderwall.com/p/vn1iqg)
# More info - https://github.com/josegonzalez/homebrew-php#installing-multiple-versions
# install multiple versions of php with homebrew
brew tap josegonzalez/php
brew install php53 --with-fpm
brew install php54 --with-fpm
brew install php55 --with-fpm
# These are the aliases that will auto switch to the version you want to use.
alias use_php53="brew unlink php54 && brew unlink php55 && brew unlink php53 && brew link php53"
[Mensch font](http://robey.lag.net/2010/06/21/mensch-font.html),
[Webkit](http://webkit.org),
[Chrome](http://google.com/chrome),
[Firefox](http://firefox.com),
[Kaleidoscope](http://www.kaleidoscopeapp.com),
[iTerm](http://iterm2.com),
[Transmit](http://panic.com/transmit),
[Coda](http://panic.com/coda),
[Sublime Text](http://www.sublimetext.com/dev),
[Sequel Pro](http://nightly.sequelpro.com),