Skip to content

Instantly share code, notes, and snippets.

View kyleparisi's full-sized avatar

Kyle Parisi kyleparisi

  • Newtown, PA
View GitHub Profile
export $(cat file.env | grep -v ^# | xargs);
@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)

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:

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.

@kyleparisi
kyleparisi / hubot
Last active October 5, 2017 15:11
hubot init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: hubot
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the hubot service
# Description: starts the Hubot bot with slack adapter
@kyleparisi
kyleparisi / decent_search.js
Last active December 6, 2017 16:25
A little search algorithm for a person's name. It looks only for sequential letters in a name.
handleChange(event) {
let value = event.target.value;
if (!value) {
this.setState({ value, data: this.props.data });
return true;
}
// Let the search be async
// The the more the data is filtered the faster it will be
class RenderItemWithKeyAndHandlers extends Component {
  render() {
    return this.props.renderListItem(this.props.data);
  }
}

and then

docker run --name redis -p 6379:6379 -d redis
@kyleparisi
kyleparisi / README.md
Last active January 2, 2018 15:01
init.d script for java jar
vi /etc/init.d/java-app
chmod +x /etc/init.d/java-app
/etc/init.d/java-app start
# reminder:
# chown -R www-data: /needed/paths
0 1 * * * [[ -e /var/run/docker.sock ]] && /usr/local/bin/docker system prune --force
0 2 * * * [[ -e /var/run/docker.sock ]] && /usr/local/bin/docker volume prune --force