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 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override |
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
_animateSection: function(duration) { | |
if (duration === undefined) duration = 1; | |
var self = this; | |
_animationLoop(); | |
function _animationLoop(_startTime, _timestamp) { |
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
switchSrc: function(overlayId, src, duration) { | |
var $original = $('#' + overlayId); | |
$newElement = $original.clone(); | |
$newElement.removeAttr('id'); | |
$newElement.css({opacity: 0, background: 'url(' + src + ')'}); | |
$original.after($newElement); | |
if (duration === undefined) { | |
duration = 200; |
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 cProfile | |
def do_cprofile(func): | |
def profiled_func(*args, **kwargs): | |
profile = cProfile.Profile() | |
try: | |
profile.enable() | |
result = func(*args, **kwargs) | |
profile.disable() | |
return result |
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 collections import defaultdict | |
import functools | |
from lxml import etree | |
def etree_to_dict(t, ns=None): | |
""" | |
http://stackoverflow.com/questions/2148119/how-to-convert-an-xml-string-to-a-dictionary-in-python | |
""" | |
def strip_ns(tag): | |
if ns: |
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 | |
def tryint(s): | |
try: | |
return int(s) | |
except: | |
return s | |
def alphanum_key(s): | |
""" Turn a string into a list of string and number chunks. |
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
class S3Property(db.StringProperty): | |
""" | |
On a put the value in the property is moved from the temp bucket to the | |
stated permanent one. | |
get_value_for_datastore is called as the model instance is placed in the | |
datastore, at this point we interrupt to process and move the asset before | |
setting the assets new url in the datastore. get_value_for_datastore doesnt | |
effect the model |
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
def retry(times, exceptions): | |
""" | |
Retry Decorator | |
Retries the wrapped function/method `times` times if the exceptions listed | |
in ``exceptions`` are thrown | |
:param times: The number of times to repeat the wrapped function/method | |
:type times: Int | |
:param Exceptions: Lists of exceptions that trigger a retry attempt |
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
def to_etree(self, data, name=None, depth=0): | |
""" | |
Given some data, converts that data to an ``etree.Element`` suitable | |
for use in the XML output. (Using recursion) | |
This is a highly modified version of the standard | |
``tastypie.Serialiser.to_etree``. These modifications allow use to do | |
the following by optionally setting arguments in the serialiser | |
constructor: |
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 base64 | |
import hashlib | |
import hmac | |
import urllib2 | |
def generate(key, message): | |
signature = hmac.new( | |
key=key, | |
msg=message, | |
digestmod=hashlib.sha256 |
NewerOlder