Skip to content

Instantly share code, notes, and snippets.

View doobeh's full-sized avatar

Anthony Plunkett doobeh

View GitHub Profile
@doobeh
doobeh / Pipfile
Created April 21, 2021 21:09
creating_database
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
flask = "*"
flask-sqlalchemy = "*"
@doobeh
doobeh / home.html
Created March 4, 2020 22:52
nested form object population
<form method="post" action="">
{{ form.hidden_tag() }}
{{ form.id }}
{{ form.name }}
{% for entry in form.players %}
{{ entry() }}
{% endfor %}
<input type="submit"/>
</form>
@doobeh
doobeh / app.py
Created November 22, 2019 22:02
Add self and commit?
from flask_sqlalchemy import SQLAlchemy
from flask import Flask, jsonify
db = SQLAlchemy()
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, default="Person")
def add(self):

Keybase proof

I hereby claim:

  • I am doobeh on github.
  • I am doobeh (https://keybase.io/doobeh) on keybase.
  • I have a public key ASAvTOPwPit1ZpOwYMbqxx9_ylnjJ8lssqQeRAmcGH9mnQo

To claim this, I am signing this object:

[
{
"id": "webhook",
"execute-command": "/home/you/webhooks/myapp.sh",
"command-working-directory": "/home/you/webhooks",
"response-message": "Deploying new application from Github",
"trigger-rule": {
"match": {
"type": "payload-hash-sha1",
"secret": "the-password-to-protect-the-webhook",
@doobeh
doobeh / alamo.swift
Created May 29, 2019 13:45 — forked from cmoulton/Simple Alamofire Calls in Swift 4
Simple Alamofire Calls in Swift 4
import Alamofire
func makeGetCallWithAlamofire() {
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1"
Alamofire.request(todoEndpoint)
.responseJSON { response in
// check for errors
guard response.result.error == nil else {
// got an error in getting the data, need to handle it
print("error calling GET on /todos/1")
""" Appending DataFrame data to Excel Worksheets.
This script appends the contents of a dataframe to an existing
Excel (xlsx) file. If the file doesn't exist, it will create
a blank Excel file with the expected sheet names.
"""
import pandas as pd
from openpyxl import load_workbook, Workbook
import os
@doobeh
doobeh / noscroll.html
Created September 12, 2018 15:24
Block scrolling for document.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>scroll demo</title>
<style>
div {
color: blue;
}
p {
@doobeh
doobeh / core.py
Created September 5, 2018 20:37
register_blueprints
def register_blueprints(app):
"""Register all blueprint modules
Reference: Armin Ronacher, "Flask for Fun and for Profit" PyBay 2016.
"""
for name in find_modules("gtcloud.blueprints"):
mod = import_string(name)
if hasattr(mod, "bp"):
app.register_blueprint(mod.bp)
return None
import os
@app.route('/uploads', defaults={'page': 'index'})
@app.route('/uploads/<path:page>')
def show(page):
try:
return send_from_directory(os.path.join(app.static_folder, 'xxxx'), page)
except IOError:
abort(404)