Skip to content

Instantly share code, notes, and snippets.

View birchestx's full-sized avatar

Jo Baker birchestx

  • ShipperHQ
  • Austin, TX
View GitHub Profile
In config/initializers/devise.rb configure your custom failure app:
config.warden do |manager|
manager.failure_app = CustomFailureApp
end
And in lib/custom_failure_app.rb:
class CustomFailureApp < Devise::FailureApp
def redirect
message = warden.message || warden_options[:message]
git log --shortstat --author "Karen Baker" --since "2 weeks ago" | grep "files\? changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'
@birchestx
birchestx / tidygitmaster
Last active August 29, 2015 14:02
change to master, pull latest, delete branch
#!/usr/bin/env bash
git checkout master
git pull
git branch -d $1
@birchestx
birchestx / data_sort_checkbox
Created June 21, 2014 16:18
column sorting with datatables on checkbox
/* Create an array with the values of all the checkboxes in a column */
$.fn.dataTableExt.afnSortData['dom-checkbox'] = function ( oSettings, iColumn )
{
return $.map( oSettings.oApi._fnGetTrNodes(oSettings), function (tr, i) {
return $('td:eq('+iColumn+') input', tr).prop('checked') ? '1' : '0';
} );
}
$('.ratemgr-table').dataTable({
git branch --merged master | grep -v master | xargs git branch -d
git branch -r --merged | grep -v master | sed 's/origin\///' | xargs -n 1 git push --delete origin
@birchestx
birchestx / find_unknowns
Last active August 29, 2015 14:05
find where database consistencies join table
SELECT c.ID, c.user_id
FROM carriers c
LEFT JOIN users u ON c.user_id = u.ID
WHERE u.ID IS NULL
@birchestx
birchestx / show_dupes
Created August 25, 2014 05:26
Show duplicates sql
SELECT id, COUNT( * ) , MAX( ID ) AS dupes
FROM method_codes
GROUP BY code
HAVING (
COUNT( * ) >1
)
LIMIT 0 , 30