Skip to content

Instantly share code, notes, and snippets.

View juzten's full-sized avatar
💭
(┛ಠ_ಠ)┛彡┻━┻

Justin Spain juzten

💭
(┛ಠ_ಠ)┛彡┻━┻
View GitHub Profile
@juzten
juzten / multiplecheckbox.py
Created April 11, 2015 07:48 — forked from doobeh/example.html
custom multiple checkbox field for wtforms and flask
from flask import Flask, render_template
from flask.ext.wtf import Form, widgets, SelectMultipleField
SECRET_KEY = 'development'
app = Flask(__name__)
app.config.from_object(__name__)
class MultiCheckboxField(SelectMultipleField):
widget = widgets.ListWidget(prefix_label=False)
@juzten
juzten / example.html
Created September 28, 2015 04:08 — forked from doobeh/example.html
Simple example of using a RadioField in Flask-WTForms to generate a form.
<form method="post">
{{ form.hidden_tag() }}
{{ form.example }}
<input type="submit">
</form>
@juzten
juzten / get-a-job.md
Created January 6, 2016 21:27
Helpful info on finding a dev related job in and around Chattanooga

Helpful info on finding a dev related job in and around Chattanooga

@juzten
juzten / for_loop_or_none.py
Last active April 19, 2016 04:09
For loop that handles if a list could be None instead of having items in a list.
# For loop that handles if an item is None instead of having
# items in a list.
# this is a sqlalchemy query, it will either return a list of people with
# the first_name of 'Justin' or if there is no person with that first name
# it will return None. This is just an example of when a variable might be
# a list with list items or None.
# people = Person.query.filter_by(first_name='Justin'.all()
# I'm specifically setting people to None here because I'm not calling the sqlalchemy query above.
@juzten
juzten / how-to-copy-ssh-keys-to-another-machine.md
Created December 20, 2016 06:16 — forked from nepsilon/how-to-copy-ssh-keys-to-another-machine.md
How to copy SSH keys to another machine? — First published in fullweb.io issue #79

How to copy SSH keys to another machine?

Public key authentication is generally safer than password-based and is way more convenient.

SSH offers a command to set it up, ssh-copy-id (part of the openssh client package) will copy your public key to the remote machine. Use it like this:

ssh-copy-id -i ~/.ssh/my_key.pub remote-machine

Find PI to the Nth Digit - Enter a number and have the program generate PI up to that many decimal places. Keep a limit to how far the program will go.

Mortgage Calculator - Calculate the monthly payments of a fixed term mortgage over given Nth terms at a given interest rate. Also figure out how long it will take the user to pay back the loan. For added complexity, add an option for users to select the compounding interval (Monthly, Weekly, Daily, Continually).

Change Return Program - The user enters a cost and then the amount of money given. The program will figure out the change and the number of quarters, dimes, nickels, pennies needed for the change.

Calculator - A simple calculator to do basic operators. Make it a scientific calculator for added complexity.

Unit Converter (temp, currency, volume, mass and more) - Converts various units between one another. The user enters the type of unit being entered, the type of unit they want to convert to and then the value. The program will

@juzten
juzten / how-to-update-a-github-forked-repository.md
Created May 9, 2017 03:32 — forked from nepsilon/how-to-update-a-github-forked-repository.md
How to update a GitHub forked repository? — First published in fullweb.io issue #91

How to update a GitHub forked repository?

So you hit "Fork" and now you have this repo copy on your Github account. Here is what to do to keep it up-to-date with the original repo.

1. Add the original repo as remote, here called upstream:

git remote add upstream https://github.com/author/repo.git

2. Fetch all the branches of that upstream remote:

@juzten
juzten / postgres-import-export-csv.md
Created December 6, 2017 05:16 — forked from nepsilon/postgres-import-export-csv.md
Importing and Exporting CSV files with PostgreSQL — First published in fullweb.io issue #19

Importing and exporting CSV files with PostgreSQL

Let’s see how to use PostgreSQL to import and export CSV files painlessly with the COPY command.

Import CSV into table t_words:

COPY t_words FROM '/path/to/file.csv' DELIMITER ',' CSV;

You can tell quote char with QUOTE and change delimiter with DELIMITER.

@juzten
juzten / excel_things.py
Created December 7, 2017 20:23 — forked from urschrei/excel_things.py
Open CSV or Excel files, return the contents as a list of lists, write out to Excel file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
excel_things.py
Created by Stephan Hügel on 2011-05-07
Read XLS or CSV files, and return contents as unicode strings in nested lists
One row per list item, one column per nested list item:
[[u'foo', u'bar'], [u'baz', u'abc123'], … ]
@juzten
juzten / code style.md
Created May 23, 2018 12:49 — forked from igogrek/Vue code style.md
Code style and application structure

Application structure

General

  1. Application has tree structure with folders for each "feature"
  2. Feature folders are named with lowerCamelCase → myComponentDashboard
  3. Feature can contain any number of components and nested features
  4. Components are named using UpperCamelCase → MyWidgetComponent.vue
  5. Component can have translation .yml file named correspondingly → MyWidgetComponent.yml
  6. If component requires more than 2 files: .vue and .yml file - folder is created with the same name → MyWidgetComponent