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
let mut guard_stats: HashMap<u16, (u16, [u16; 60])> = HashMap::new(); | |
let mut current_guard_id: u16 = 0; | |
let mut current_sleep_start_time: NaiveDateTime = NaiveDateTime::from_timestamp(0, 0); | |
for entry in log_entries { | |
match entry.entry_type { | |
EntryType::StartedShift(guard_id) => current_guard_id = guard_id, | |
EntryType::StartedSleeping => current_sleep_start_time = entry.date_time, | |
EntryType::WokeUp => { | |
let _entry = guard_stats.entry(current_guard_id); | |
let mut _temp0 = 0; |
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 sqlalchemy import Column, Integer, String, create_engine, func | |
from sqlalchemy.ext.declarative import declarative_base, DeclarativeMeta | |
from sqlalchemy.orm.descriptor_props import CompositeProperty | |
from sqlalchemy.sql.functions import GenericFunction | |
from sqlalchemy.orm import composite, sessionmaker | |
from sqlalchemy.sql.expression import case | |
import sqlalchemy.types as types | |
class Money(object): | |
def __init__(self, amount, currency): |
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 urllib | |
import codecs | |
from Crypto.Cipher import AES | |
from Crypto.Hash import MD5 | |
temp_token = "value from propay" | |
temp_token = codecs.encode(temp_token, 'utf-8') | |
settings = { |
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
define(['jquery', | |
'underscore', | |
'lib/forge/cipher', | |
'lib/forge/aes', | |
'lib/forge/md5', | |
'lib/forge/util'], function ($, _, _Cipher, _CipherAES, _CipherMD5, _CipherUtil) { | |
var forge = {}, | |
Cipher = _Cipher(forge), | |
CipherAES = _CipherAES(forge), |
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
define(['jquery', | |
'underscore', | |
'balanced', | |
'lib/forge/cipher', | |
'lib/forge/aes', | |
'lib/forge/md5', | |
'lib/forge/util'], function ($, _, balanced, _Cipher, _CipherAES, _CipherMD5, _CipherUtil) { | |
var forge = {}, | |
Cipher = _Cipher(forge), |
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 a(): | |
try: | |
return True | |
finally: | |
return False | |
print "The result of the function is: %s" % a() | |
print "The disassembly is:" | |
import dis |
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 flask import Flask, request, jsonify | |
from flask.ext.wtf import Form, TextField, Email | |
from flask.ext.babel import get_translations, lazy_gettext as __ | |
from flask.json import JSONEncoder | |
from speaklater import make_lazy_string, is_lazy_string | |
class CustomTranslations(object): | |
def babel_gettext(self, s): | |
return get_translations().ugettext(s) |
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 sys | |
class TestContext(object): | |
def __init__(self): | |
self.entered = False | |
self.exited = False | |
def __enter__(self): | |
self.entered = True | |
def __exit__(self, exc_type, exc_value, tb): | |
self.exited = True |
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 TestContext(object): | |
def __init__(self): | |
self.entered = False | |
self.exited = False | |
def __enter__(self): | |
self.entered = True | |
def __exit__(self): | |
self.exited = True |
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
rom flask import Flask | |
app = Flask(__name__) | |
@app.teardown_request | |
def teardown(exc = None): | |
if exc is not None: | |
print "An exception has occured!" | |
try: |
NewerOlder