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 React, { | |
createContext, | |
useReducer, | |
useContext, | |
} from 'react' | |
type Event = { | |
title: string; | |
start: string | Date; | |
end?: string | Date; |
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 hmac | |
import hashlib | |
def validate_signature_header(verifier_token, request_body, signature): | |
# per quickbooks documentation | |
# 1st step: | |
# hash the notification payload (request_body) with HMAC_SHA256_ALGORITHM | |
# using <verifier token> as the key | |
hmac_hex_digest = hmac.new( |
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 wtforms import fields | |
class AceEditorWidget(object): | |
def __init__(self,mode='python',theme='twilight'): | |
self.theme = theme | |
self.mode = mode | |
self.custom_css = '<style>#editor { width: 100%; }</style>' | |
self.theme_js = 'editor.setTheme("ace/theme/{theme}");'.format(theme=self.theme) | |
self.mode_js = 'editor.setOption("mode","ace/mode/{mode}");'.format(mode=self.mode) | |
self.js = ''' |
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
# requires twill==0.9 | |
import sys | |
from twill import get_browser | |
from pprint import pprint | |
class PdfFinder: | |
browser = None | |
_b = None | |
_q = None | |
links = {} |
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
So22222222222222222222222222222o2SoSoeinSo22222*3oSoSo22222222222oSoSo2oSoSoSoSo | |
22222222o22222o2222o222221I*11I|I**Xl|+i**|I1i|+|II1*I12222oo2222oo222o2o222o2o2 | |
22o22222o22222o2222o22222n||+|+|++||=|+|+|+=||+|+|+|+||*1o222222ooSo22o222222oSo | |
22o222o2o222o2oo2o2ooo*1||+|+|++|+|+|+|++|+||++|++|+|+|+|||I*2o22oo222oo22o2o2o2 | |
22o22o22o22o22o22o*1|||+++|++|+|+|++|++|+|+++|+|+|+++|++|=|+||iooo222o2o2222o222 | |
22222222o22222oeii||+|+|+|+|||+|++|+||+|+||||+||+|+||+|+|+|+||*Soo2222o222222o22 | |
222o2222oSo222o1||++|+||||||||||||||||||||||||||||||||||++|++|+|*n2222oo2222o222 | |
22oSoSo2o22221i|++|++|||||||||||||||||||||||||||||||||||||+|++|++|*So2o222222222 | |
2ooooooooooeii||+|+|||||||i|i|i|||||||||||||||||||||i|||||||||++|iisvooooooooooo | |
22222222222ool=|++||||||>=::::::::+++++i|+++++++==;::=<||||||+|+|+i1222oSoS22222 |
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 python | |
import commands | |
import sys | |
from functools import partial | |
CMD = 'git clone {protocol}{sep1}github.com{sep2}{user}/{repo}.git' | |
make_cmd = lambda **kwargs: CMD.format(**kwargs) | |
ssh = partial(make_cmd,protocol='git',sep1='@',sep2=':') | |
https = partial(make_cmd,protocol='https',sep1='://',sep2='/') |
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
{% for cat,msg in get_flashed_messages(with_categories=true) %} | |
<div class="alert alert-dissmissable alert-{{ cat }}" id="alert-{{ loop.index }}"> | |
<span id="close-alert-{{ loop.index }}" class=close>x</span> | |
{{ msg }} | |
</div> | |
<script> | |
var alert = document.getElementById('alert-{{ loop.index }}'), | |
closeBtn = document.getElementById('close-alert-{{ loop.index }}'); | |
closeBtn.onClick = function(){ | |
alert.remove(); |
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
print_tables =\ | |
lambda\ | |
BaseModel:\ | |
''.join( | |
map( | |
lambda x:\ | |
'\n{}\n{}\n'.format( | |
x[0], | |
x[1].__table__.c.keys() | |
),filter( |
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 | |
from flask import render_template | |
app = Flask(__name__) | |
app.url_map.strict_slashes = False | |
@app.route('/partials/<partial>') | |
def partial(partial): | |
return render_template(partial,jinja_var='this is from jinja') |
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 | |
from flask_script import Manager | |
from flask_admin import Admin | |
import os.path as op | |
import os | |
app = Flask(__name__) | |
manager = Manager(app) | |
admin = Admin(app) #<-- this gives our app some templates to gather |
NewerOlder