This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A generic confirmation for risky actions. | |
* Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function | |
*/ | |
angular.module('app').directive('ngReallyClick', [function() { | |
return { | |
restrict: 'A', | |
link: function(scope, element, attrs) { | |
element.bind('click', function() { | |
var message = attrs.ngReallyMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Giant dictonary to hold key name and VK value | |
VK_CODE = {'backspace':0x08, | |
'tab':0x09, | |
'clear':0x0C, | |
'enter':0x0D, | |
'shift':0x10, | |
'ctrl':0x11, | |
'alt':0x12, | |
'pause':0x13, | |
'caps_lock':0x14, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Placeholder @mixin for Sass | |
// | |
// A mixin to style placeholders in HTML5 form elements. | |
// Includes also a .placeholder class to be used with a polyfill e.g. | |
// https://github.com/mathiasbynens/jquery-placeholder | |
// Requires Sass 3.2. | |
// | |
// Example usage (.scss): | |
// | |
// input { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* setup JQuery's AJAX methods to setup CSRF token in the request before sending it off. | |
* http://stackoverflow.com/questions/5100539/django-csrf-check-failing-with-an-ajax-post-request | |
*/ | |
function getCookie(name) | |
{ | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a sample script for upstart to keep a twisted project running. | |
# Place it in /etc/event.d/[projectname] | |
description "useful description" | |
author "Dustin Sallings <dustin@spy.net>" | |
start on runlevel 2 | |
start on runlevel 3 | |
stop on runlevel 0 |