Skip to content

Instantly share code, notes, and snippets.

View kayluhb's full-sized avatar

Caleb Brown kayluhb

View GitHub Profile
pg_dump --no-privileges --no-owner database_name > database_name.sql
psql -e -U root -d zoomin -f database_name.sql
for tbl in `psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" database_name` ; do psql -c "alter table $tbl owner to root" database_name; done
@kayluhb
kayluhb / gist:8327403
Created January 9, 2014 00:37
mpd is killing me
brew install mpd --with-flac --with-lame --with-two-lame --with-lastfm --with-yajl
@kayluhb
kayluhb / Preferences.sublime-settings.json
Last active December 28, 2015 12:38
My sublime settings
{
"color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
".sass-cache",
@kayluhb
kayluhb / nginx
Created August 19, 2013 15:30 — forked from hisea/nginx
sudo cp nginx /etc/init.d/
sudo update-rc.d nginx defaults
sudo chmod +x /etc/init.d/nginx
/etc/init.d/nginx start
Twitter Developer Display Requirements
https://dev.twitter.com/terms/display-requirements
2.b. Tweet Entities within the Tweet text must be properly linked to their appropriate home on Twitter. For example:
i. User_mentions must link to the mentioned user's profile.
ii. Hashtags must link to a twitter.com search with the hashtag as the query.
iii. Links in Tweet text must be displayed using the display_url field in the URL entities API response, and link to the original t.co url field.
i. User_mentions must link to the mentioned user's profile.
ii. Hashtags must link to a twitter.com search with the hashtag as the query.
@kayluhb
kayluhb / Clickity click click.js
Last active September 27, 2017 18:06
Show an element on click and hide if the user clicks anywhere outside of the element.
(function($){
var $searchToggle = $('#search-toggle'), // The element that will trigger our event
$search = $('#search-form'), // The element we want to hide/show
click = 'click',
on = 'on',
resize = 'resize';
// Called on load
function init() {
@kayluhb
kayluhb / gist:5627841
Last active December 17, 2015 14:58
pip install git
pip install -e 'git+git://github.com/<git-user>/<repo-name>.git@<branch>#egg=<repo-name>'
User.where(confirmed_at: nil)
.where("users.confirmation_sent_at < ?", 2.weeks.ago)
.select("users.email")
@kayluhb
kayluhb / gist:4251984
Created December 10, 2012 17:25 — forked from jsummerfield/gist:1486891
Amazon SES SMTP support for Django
"""
Django's SMTP EmailBackend doesn't support an SMTP_SSL connection necessary to interact with Amazon SES's newly announced SMTP server. We need to write a custom EmailBackend overriding the default EMailBackend's open(). Thanks to https://github.com/bancek/django-smtp-ssl for the example.
"""
--- settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'email-smtp.us-east-1.amazonaws.com'
EMAIL_PORT = 465
EMAIL_HOST_USER = 'username'
@kayluhb
kayluhb / gist:4176257
Created November 30, 2012 14:59
Initial git push
If you have an existing git repository and you’re about to push it to a new remote, then you can push all of your branches and update their tracking in one step:
git push -u --all origin