Skip to content

Instantly share code, notes, and snippets.

View haraonline's full-sized avatar
🎯
Focusing

Hara haraonline

🎯
Focusing
  • Germany
View GitHub Profile
@haraonline
haraonline / pg_import_csv_to_heroku.sh
Created September 2, 2017 14:03 — forked from jboesch/pg_import_csv_to_heroku.sh
Importing a CSV dump of Postgres data into Heroku
# You have your csv data and it looks like so... It's in a file named "my_data.csv" and we want to import it into a table named "my_things".
"1", "Something", "0.50", "2013-05-05 10:00:00"
"2", "Another thing", "1.50", "2013-06-05 10:30:00"
# Now you want to import it, go to the command line and type:
$ PGPASSWORD=PWHERE psql -h HOSTHERE -U USERHERE DBNAMEHERE -c "\copy my_things FROM 'my_data.csv' WITH CSV;"
# Voila! It's impoted. Now if you want to wipe it out and import a fresh one, you would do this:
@haraonline
haraonline / tk_scale_widget.py
Last active May 2, 2018 14:05
tkinter slider that changes font size dynamically
from tkinter import *
from tkinter import ttk
master = Tk()
master.geometry('750x350+200+200')
scale_1 = ttk.Scale(master, orient='horizontal', length=200, from_=10, to=30)
scale_1.pack(padx=10, pady=30, anchor='nw')
label_1 = ttk.Label(master, text='Hello World', background='orange', font=('Candara', 10, 'italic'))
import tkinter
from tkinter import ttk
import requests
class MoviesDB:
def __init__(self, master):
self.master = master
self.createWidgets()
# code for the lesson "understanding query strings"
# section 2: lecture 9
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/index')
@app.route('/')
# incremental source code for the lesson "numbers and floats"
# section 2: lecture 10
from flask import Flask, render_template, request
app = Flask(__name__)
# incremental source code for the lesson "rendering html templates"
# section 2: lecture 11
# TO USE THIS CODE, YOU NEED THE TEMPLATES FOLDER WITH THE HTML FILE. SEE THE OTHER LINK PROVIDED FOR THE HTML PAGE
from flask import Flask, render_template, request
app = Flask(__name__)
# USE WITH THE PYTHON FILE PROVIDED
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello Home</title>
</head>
<body>
# code for the lesson "jinja templating part 1"
# section 3: lecture 12
# USE THIS CODE IN CONJUNCTION WITH THE HTML PROVIDED
from flask import Flask, render_template, request
app = Flask(__name__)
<!-- HTML CODE FOR JINJA2: PART 1 -->
<!-- USE WITH THE PYTHON FILE PROVIDED -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Watchable</title>
<!-- HTML FOR JINJA2 - PART 2 -->
<!-- USE WIHT THE PYTHON FILE PROVIDED -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>movie durations</title>
</head>