Skip to content

Instantly share code, notes, and snippets.

View Whatapalaver's full-sized avatar

Angela Wolff Whatapalaver

View GitHub Profile
@Whatapalaver
Whatapalaver / .env
Created February 16, 2022 12:57
Flask - Dev and Prod Configuration Setup
# Sensible defaults for development
CONFIGURATION_SETUP=config.DevelopmentConfig
HOST_SERVER=test
HOST_SERVER_URL="https://placeholder_for_test.com"
SECRET_KEY="1234"
@Whatapalaver
Whatapalaver / forms.py
Created February 15, 2022 16:54
RadioFields using WTForms in Flask
from flask_wtf import FlaskForm
from wtforms import TextAreaField, SubmitField, RadioField
from wtforms.validators import DataRequired
class HtmlForm(FlaskForm):
html = TextAreaField(
"Paste exported html", validators=[DataRequired()]
)
hosts = [("s1", "S1"), ("b2", "B2")]
eval "$(pyenv init -)"
export WORKON_HOME=~/.virtualenvs
. ~/.pyenv/versions/3.7.4/bin/virtualenvwrapper.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
@Whatapalaver
Whatapalaver / enhanced_object.rb
Last active December 23, 2019 15:13
Reflecting updates to primary object
class EnhancedObject < ActiveRecord::Base
def self.from_museum_object(parsed_museum_object, object_namer, object_locator)
logger.debug "Museum_Object_Data: #{parsed_museum_object}"
EnhancedObject.new.tap do |enhanced_object|
enhanced_object.attributes = {
museum_unique_id: parsed_museum_object.museum_unique_id,
museum_number: parsed_museum_object.museum_number,
object_type: parsed_museum_object.object_type,
object_data_id: parsed_museum_object.museum_object_id,
@Whatapalaver
Whatapalaver / collection_objects.html.erb
Created November 7, 2019 12:33
Add a csv download button to Rails view
<p>Generate Outstanding Migration CSV Report: <%= link_to("CSV Report", admin_dashboard_collection_objects_path(format: :csv), class: "btn btn-success",) %></p>
class Grains
LOCATIONS = (1..64)
MULTIPLIER = 2
def self.square(location)
new(location).square
end
def self.total
new(LOCATIONS.min).total
class Grains
def self.square(square_no)
raise ArgumentError, 'Square must be between 1 and 64' unless square_no >= 1 && square_no <= 64
chessboard[square_no - 1]
end
def self.chessboard
chessboard = []
(1..64).each do |square|
@Whatapalaver
Whatapalaver / image-grid.md
Created March 1, 2019 13:22 — forked from trusktr/image-grid.md
Image grid in Markdown
screen shot 2017-08-07 at 12 18 15 pm blah screen shot 2017-08-07 at 12 18 15 pm screen shot 2017-08-07 at 12 18 15 pm
@Whatapalaver
Whatapalaver / Sound.swift
Last active December 24, 2018 16:11
Swift - Recipes
import UIKit
import AVFoundation
class ViewController: UIViewController, AVAudioPlayerDelegate {
var audioPlayer : AVAudioPlayer!
let soundArray = ["note1", "note2", "note3", "note4", "note5", "note6", "note7"]
override func viewDidLoad() {
@Whatapalaver
Whatapalaver / exportLoopedSheets.gs
Last active December 5, 2020 03:16
Google Scripts for Sheet Export to PDF
// This loops through a list of products, updating a cell that triggers a query refresh on main
// Then each product query is exported to pdf
function exportLoopedSheet(firstRow, lastRow) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheetName = 'Printout'; // update for print sheet name
var productSheetName = 'Product_List'; // update for final product list
var folderName = 'productPDFs';
var main = ss.getSheetByName(sheetName);
var sheets = ss.getSheets();