Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Paul Bennett mrpbennett

🏠
Working from home
View GitHub Profile
@mrpbennett
mrpbennett / dockerfile
Created Feb 19, 2021
Flask Docker file
View dockerfile
# For more information, please refer to https://aka.ms/vscode-docker-python
FROM python:3.8-slim-buster
EXPOSE 5000
ENV VAR1=10
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
@mrpbennett
mrpbennett / amazon-display.html
Last active Feb 16, 2021 — forked from jcottam/amazon-display.html
APS Basic Integration
View amazon-display.html
<!-- GPT -->
<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag
.defineSlot(
"/116082170/Cottam_Test_UAM_300x250",
[[300, 250]],
@mrpbennett
mrpbennett / btn-click.html
Last active Aug 11, 2020
Firing a Pixel on button click
View btn-click.html
<button id="unique_id">click me</button>
<script type="text/javascript">
(() => {
const b = document.getElementById('unique_id');
b.onclick = () => {
const i = document.createElement('img');
i.src = '< your pixel src goes here >';
i.setAttribute('width', 0);
i.setAttribute('height', 0);
@mrpbennett
mrpbennett / postcss.congif.js
Last active Jul 17, 2020
My postcss config file for TW
View postcss.congif.js
const IN_PRODUCTION = process.env.NODE_ENV === 'production';
module.exports = {
plugins: [
IN_PRODUCTION &&
require('tailwindcss')('tailwind.js'),
require('autoprefixer'),
require('@fullhuman/postcss-purgecss')({
content: [`./public/**/*.html`, `./src/**/*.vue`],
@mrpbennett
mrpbennett / settings.js
Last active Jun 19, 2020
Hyper.js Settings
View settings.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
View gist:17cdbacee336375ae4390c701dfb29f0
query {
user(login: "mrpbennett") {
pinnedItems(first: 6, types: REPOSITORY) {
edges {
node {
... on Repository {
name
description
url
primaryLanguage {
@mrpbennett
mrpbennett / dailyPL.gs
Created Dec 19, 2019
GSheet script for plotting daily P/L
View dailyPL.gs
function plotDailyPL() {
//read the counter (#) in cell A1 of History, number in cell is the row of column to input data
var counter = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("History").getRange("E2");
// record DATE in cell A#
var date = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("History").getRange("D"+counter.getValue());
date.setValue(new Date(new Date().getFullYear(),new Date().getMonth(), new Date().getDate()));
//read portfolio value in "Portfolio Sheet"
@mrpbennett
mrpbennett / dailyValuation.gs
Created Dec 19, 2019
GSheet Script for daily valuation
View dailyValuation.gs
function plotDailyValuation() {
//read the counter (#) in cell A1 of History, number in cell is the row of column to input data
var counter = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("History").getRange("D2");
// record DATE in cell A#
var date = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("History").getRange("A"+counter.getValue());
date.setValue(new Date(new Date().getFullYear(),new Date().getMonth(), new Date().getDate()));
//read portfolio value in "Portfolio Sheet"
var portfolioValue = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Portfolio").getRange("H18");
@mrpbennett
mrpbennett / chalkBootstrap.js
Created Oct 15, 2019
npm chalk use inspired by bootstrap
View chalkBootstrap.js
const chalk = require('chalk');
const success = chalk.green.bold('Success!');
const danger = chalk.red.bold('Danger!');
const warning = chalk.yellow.bold('Warning!');
View create_and_export_files.py
# export json to file to easily read and pick out data.
with open('_file_name_', 'w') as outfile:
json.dump(data, outfile, indent=4)