Skip to content

Instantly share code, notes, and snippets.

View kayluhb's full-sized avatar

Caleb Brown kayluhb

View GitHub Profile
@kayluhb
kayluhb / README
Last active August 31, 2017 23:59 — forked from joelambert/README
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
@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 / 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
@kayluhb
kayluhb / break.py
Last active June 20, 2017 22:55 — forked from obfusk/break.py
python equivalent of ruby's binding.pry
import code; code.interact(local=dict(globals(), **locals()))
@kayluhb
kayluhb / Mobile
Created August 10, 2016 18:47 — forked from hugeuser/Mobile
"Scroll-Jacking in Full Screen."
var delta;
dragThreshold = 0.15;// "percentage" to drag before engaging
dragStart = null; // used to determine touch / drag distance
percentage = 0,
target,
previousTarget;
function touchStart(event) {
if (dragStart !== null) { return; }
@kayluhb
kayluhb / offline-notification.js
Last active August 24, 2016 15:49 — forked from deanhume/offline-notification.js
Offline toast notifications
var urlToCheck = 'https://deanhume.github.io/beer' + createStyleUrl(styleId, pageId, false);
/**
* Display the offline notification.
* @return {void}
**/
function showOfflineNotification() {
// return if there is no service worker
if (!'serviceWorker' in navigator) {
return;
@kayluhb
kayluhb / offline-swer.js
Last active August 24, 2016 16:00 — forked from deanhume/offline-swer.js
Offline SW example
/**
* Helper method to determine the filename from the URL
* @param {url} the path to match
* @return {String} the path for caching
**/
function getFilenameFromUrl(url){
var path = url.substring(path.lastIndexOf("/")+ 1);
return (path.match(/[^.]+(\.[^?#]+)?/) || [])[0];
}
@kayluhb
kayluhb / JavaScript
Created August 25, 2016 19:32 — forked from hugeuser/JavaScript
"Scroll-Jacking" in Full Screen.
var delta;
var currentSlideIndex = 0;
function elementScroll (e) {
// --- Scrolling up ---
if (e.originalEvent.detail < 0 || e.originalEvent.wheelDelta > 0) {
delta--;