Skip to content

Instantly share code, notes, and snippets.

View jahaskell53's full-sized avatar

Jakobi Haskell jahaskell53

View GitHub Profile
@jahaskell53
jahaskell53 / contracts...Locktime.sol
Created November 26, 2022 22:53
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.0;
// overflow and underflow examples and preventions
// one can deposit ether into this contract but you must wait 1 week before you can withdraw your funds
// use safe math to prevent underflow and overflow
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol";
@jahaskell53
jahaskell53 / contracts...Locktime.sol
Created November 26, 2022 22:41
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.0;
// overflow and underflow examples and preventions
// one can deposit ether into this contract but you must wait 1 week before you can withdraw your funds
// use safe math to prevent underflow and overflow
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol";
@jahaskell53
jahaskell53 / contracts...1Personal_Escrow.sol
Created August 15, 2022 01:36
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
* @custom:dev-run-script ./scripts/deploy_with_ethers.ts
*/
contract Storage {

Serving Static Webpage with Express

Express is a server that handles RESTful endpoints. Svelte is a UI framework for building single page apps. Since Svelte creates static webpages, it can be compiled into an html file and that file can be sent to the client from an Express server. This guide outlines how to do so:

  1. Specify the output compile directory in vite.config. {ts, js}. I chose mine as dist. Ex:
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 73 columns, instead of 66. in line 2.
year,-52,-45,-44,-42,-40,-39,-37,-36,-34,-32,-31,-29,-28,-26,-24,-23,-21,-20,-18,-16,-15,-13,-12,-10,-8,-7,-5,-4,-2,0,2,4,5,7,8,10,12,13,15,16,18,20,21,23,24,26,28,29,31,32,34,36,37,39,40,42,44,45,47,49,50,52,53,55,57,58,60,61,63,65,68,69
1900,5.1,8.73,9.54,12.24,9.75,12.31,13.61,13.21,15.38,15.38,18.34,17.73,18.6,17.25,19.72,20.69,21.41,21.14,20.27,20.89,20.98,19.11,20.64,23.45,24.26,25.32,25.82,24.34,23.11,24.07,25.49,24.45,25.05,25.75,26.13,26.4,26.37,26.69,25.4,26.65,25.37,21.75,24.54,24.34,22.77,22.76,21.72,19.9,19.06,17.28,14.97,13.24,13.23,11.23,10.98,9.11,8.72,7.67,6.87,7.84,7.68,7.76,5.57,3.35,2.68,2.21,2.14,-1.01,0.78,0.12,-2.84,-11.62
1910,5.56,9.14,10.3,12.36,9.71,11.8,13.53,12.93,14.76,14.61,17.36,16.68,17.74,16.33,18.89,20.19,21.07,20.85,19.58,20.44,20.46,18.43,20.17,22.92,23.85,25.06,25.47,23.75,22.43,23.56,25.04,23.86,24.6,25.5,25.77,26.0,25.92,26.24,25.0,25.99,24.66,21.03,24.0,23.86,22.39,22.3,21.24,19.44,18.57,17.01,14.73,13.01,12.85,10.81,10.45,8.7,8.35,7.23,6.63,7.74,7.74,7.85,6.0,4.28,3.5
@jahaskell53
jahaskell53 / annual_temp_1850_2013.csv
Last active May 19, 2022 10:12
UNCode of Country is id, value is percentage change of temperature from 1850 to 2013 (where negatives are normalized), and color is percentageChange mapped to a color (nonexistent data is 1). Data processed from: https://www.kaggle.com/code/amelinvladislav/map-of-temperatures-and-analysis-of-global-warming
id value colorValue
004 1.622 6
008 1.999 7
012 1.091 5
020 1.512 6
660 0.944 5
028 0.948 5
051 1.617 6
533 0.822 4
040 2.424 8
@jahaskell53
jahaskell53 / covidCasesBarChartVizObj
Created May 4, 2022 16:28
CSV and Data Viz Object for Monthy International and US Cases 2020-2021
{
type: "RectangleChart",
data: {
dataFile: "monthly_international_and_us_cases.csv",
fileType: "csv",
fieldDesc: [
["month", "number"],
["year", "number"],
["newPositiveCasesUS", "number"],
["newPositiveCasesInternational", "number"],
@jahaskell53
jahaskell53 / 2020flightTrends
Last active May 4, 2022 16:30
VR-Viz Visualization Object for Processed Air Traffic CSV Data File
Month,Domestic,International,Total,
1,61638893,18955398,80594291,
2,59879630,15829198,75708828,
3,34420555,8956945,43377500,
4,2879712,401329,3281041,
5,7861491,372915,8234406,
6,16132885,803948,16936833,
7,22922158,1862122,24784280,
8,24431822,2298093,26729915,
9,23854772,2280598,26135370,