Skip to content

Instantly share code, notes, and snippets.

View SpiffGreen's full-sized avatar
:octocat:
Available

Spiff Jekey-Green SpiffGreen

:octocat:
Available
View GitHub Profile
@SpiffGreen
SpiffGreen / index.html
Created May 15, 2022 20:48
Temporal fix for html2canvas image generation for remote images
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js" integrity="sha512-BNaRQnYJYiPSqHHDb58B0yaPfCu+Wgds8Gp/gU33kqBtgNS4tSPHuGibyoeqMV/TJlSKda6FXzoEyYGjTe+vXA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js" integrity="sha512-csNcFYJniKjJxRWRV1R7fvnXrycHP6qDR21mgz1ZP55xY5d+aHLfo9/FcGDQLfn2IfngbAHd8LdfsagcCqgTcQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<style>
@SpiffGreen
SpiffGreen / composer-setup.sh
Created June 20, 2022 13:14
Composer Setup
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'some-long-SHA-checksum-number-goes-here') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
@SpiffGreen
SpiffGreen / create.php
Created June 25, 2022 06:58
API with vanilla php
<?php
require_once "./config/db.php";
if ($_SERVER['REQUEST_METHOD'] === "POST") {
//Make sure that the content type of the POST request has been set to application/json
$contentType = isset($_SERVER["CONTENT_TYPE"]) ? trim($_SERVER["CONTENT_TYPE"]) : '';
if (strcasecmp($contentType, 'application/json') != 0) {
// throw new Exception('Content type must be: application/json');
exit('Content type must be: application/json');
@SpiffGreen
SpiffGreen / index.html
Created July 5, 2022 02:29
Web1 - Frontend Heroku Hosting
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Web App 1</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
@SpiffGreen
SpiffGreen / login.js
Last active August 18, 2022 22:01
Next auth tutorial
import React from 'react'
import Link from "next/link";
function LoginPage() {
return (
<div className="bg-zinc-300 min-h-screen py-4">
<div className="bg-white rounded-lg p-3 mt-4 max-w-md shadow-sm mx-auto">
<div className="text-center text-2xl my-2 uppercase">Login</div>
<form action="/api/login" method="POST">
@SpiffGreen
SpiffGreen / HackathonList.md
Created August 21, 2022 12:26
A list of places to find hackathons
@SpiffGreen
SpiffGreen / bubble_sort.py
Last active December 15, 2022 06:20
Data Structures & Algorithms - implemented in python
# Bubble sort
def swap(arr, idx1, idx2):
temp = arr[idx1]
arr[idx1] = arr[idx2]
arr[idx2] = temp
def bubbleSort(arr):
for i in range(0, len(arr)):
swapped = False
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>
</head>
<body>
<script>
const urls = {
model:
"https://storage.googleapis.com/tfjs-models/tfjs/sentiment_cnn_v1/model.json",
metadata:
@SpiffGreen
SpiffGreen / shape_maker.html
Created November 29, 2022 11:40
Sample code to illustrate creating shapes based on land sizes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shape Maker</title>
<style>
* {