Skip to content

Instantly share code, notes, and snippets.

View kyleparisi's full-sized avatar

Kyle Parisi kyleparisi

  • Newtown, PA
View GitHub Profile

Typescript Notes

error TS1036: Statements are not allowed in ambient contexts === erronious semi colon (very human)

Doesn't actually make type safe code. If you do spread operators or destructuring you are doomed.

What would make typescript useful is if it removed the need for ternary statements for property accessors.

Keybase proof

I hereby claim:

  • I am kyleparisi on github.
  • I am nargella (https://keybase.io/nargella) on keybase.
  • I have a public key ASCpsO1L3z4WwOId8Z04PSXmQeCiPDgXmFyBs3kbG-OfYAo

To claim this, I am signing this object:

@kyleparisi
kyleparisi / README.md
Last active August 30, 2017 13:10
General Node.js notes (+lambda)

General Node.js notes (+lambda)

  • I'd recommend sticking with es6 syntax (no async-await).
  • Always consider throttling
  • Try to make scripts atomically process data that fits the lambda time allotment
  • Connections [DB] should be handled at the top most points and always wrapped in a function
  • Scripts should always exit when done doing atomic work (dangling connections problem)
  • Logging should be using a single/configurable handler (verbosity, cli, parsable)
  • Logging should be done where you see neccesary but at a minimum at the tail end + top most point of the process for feedback on the atomic data processed (then and catch should be directly visible in the entry script)
  • .then(fn) - fn should either be stupidly simple or be extractable to the point of being able to be unit tested. The name should also be painfully obvious (reference)
export $(cat file.env | grep -v ^# | xargs);
@kyleparisi
kyleparisi / brie.css
Created February 14, 2017 19:23
My go to set of sytles
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans",
"Droid Sans", "Helvetica Neue", sans-serif;
}
.container {
@kyleparisi
kyleparisi / index.html
Last active February 14, 2017 16:46
Electron starter
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
@kyleparisi
kyleparisi / index.js
Created February 9, 2017 14:23
Prototype of how to use lindy in a reactive setting (lindy modified slightly)
let init = lindy('h3', `Service running - false`);
let start = function () {
return lindy('button', {
onclick: () => this.emit('running', true)
}, 'Start Service');
};
let stop = function () {
return lindy('button', {
@kyleparisi
kyleparisi / date_looper.sh
Created January 20, 2017 18:15
Bash script that loops over dates for other atomic scripts
#!/bin/bash
# On linux use date, on mac gdate [via `brew install coreutils`].
# Will run from oldest date to today.
# $ sh date_looper.sh '2016-12-10'
currentdate=$1
loopenddate=$(gdate --date "$2 1 day" +%Y-%m-%d)
until [ "$currentdate" == "$loopenddate" ]
do
echo $currentdate
@kyleparisi
kyleparisi / stuff.sh
Created December 29, 2016 17:32
Debugging stuff
# Debug tcp requests and respond with 200
socat -v TCP-LISTEN:3000 "exec:printf \'HTTP/1.0 200 OK\r\n\r\n\'"
@kyleparisi
kyleparisi / lindy.js
Last active February 8, 2022 02:04
A basic function to create dom elements (lindy.js)
// signatures
// (root)
// (root, inner)
// (root, {})
// (root, {}, inner)
// inner = '' || [] - array can have text or html els
// {} = options i.e. onclick, class, id, etc.
var signatures = {
1: function(root) {