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
function basicAuth() { | |
return "Basic " + btoa("<username>:<password>"); | |
}; | |
$.ajax({ | |
url: 'https://<subdomain>.loggly.com/apiv2/customer', | |
beforeSend: function(xhr) { | |
xhr.setRequestHeader("Authorization", basicAuth()); | |
}, | |
success: function(data) { |
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
import flash.net.URLLoader; | |
import flash.net.URLRequest; | |
import flash.net.URLRequestMethod; | |
import flash.net.URLVariables; | |
import flash.events.Event; | |
import flash.events.ErrorEvent; | |
import flash.events.IOErrorEvent; | |
import flash.events.SecurityErrorEvent; |
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
from inspect import ismethoddescriptor, getmembers | |
def all_the_methods(_type): | |
""" | |
example usage: | |
all_the_methods(str) | |
sample elided output: | |
capitalize() ALL THE <type 'str'>!!!! | |
center() ALL THE <type 'str'>!!!! |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
from django.http import HttpResponse | |
from piston.resource import Resource | |
from piston.handler import AnonymousBaseHandler, BaseHandler | |
class CORSResource(Resource): | |
""" | |
Piston Resource to enable CORS. | |
""" | |
# headers sent in all responses |
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
// Draw pie charts | |
var charts = []; | |
function createPie(statsjson, type, div, title) { | |
if(document.getElementById(div)){ | |
data = createDataArray(statsjson, type, title, 'reg'); | |
if(data.getNumberOfRows() > maxResults){ | |
data.removeRows(maxResults, 999999) | |
} |
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
import inspect | |
def collect_frame_contexts(attr='__frame__', start_depth=1, **immediatecontext): | |
""" | |
Bubbles up the call stack, accumulating | |
__frame__ context dicts. | |
""" | |
contexts = [] | |
frames = inspect.getouterframes( inspect.currentframe() ) |
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
import re | |
from collections import defaultdict | |
SHORT_WORD_LEN = 4 | |
WORD_REGEX = '\w+' | |
TEXT_FILE_PATH = 'text.txt' | |
word_counter = defaultdict(int) | |
# read in all the words, cull out the ones that aren't long enough |
NewerOlder