Skip to content

Instantly share code, notes, and snippets.

View andfaulkner's full-sized avatar
🐻
Working from home

Andrew Faulkner andfaulkner

🐻
Working from home
  • Ottawa Health Research Institute: mHealth lab (@Ottawa-mHealth)
  • Ottawa, Ontario
View GitHub Profile
@gwenzek
gwenzek / remote_subl.md
Last active May 3, 2024 05:52
Sublime Text for remote development

This steps should help working remotely with Sublime Text. They are meant to be incremental, just setting up SFTP will go a long way.

My workflow

I have all my code on my laptop, edit locally and automatically push the files to my server. I never edit "tracked" files on the server directly. I sometimes modify untracked files on the server using rmate (see below).

@robinduckett
robinduckett / README.md
Created January 31, 2020 23:58
Flatten Typescript Array

flatten

A simple Typescript implementation of a map reduce method to flatten a multidimensional array.

Position of array value should be preserved in the same order it was given

API

type MultiDimensionalArray = (T | (T | T[])[])[];
class Vector {
constructor(...components) {
this.components = components
}
// ...
// 3D vectors only
crossProduct({ components }) {
return new Vector(
this.components[1] * components[2] - this.components[2] * components[1],
@npearce
npearce / install-docker.md
Last active June 5, 2024 20:07
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@guillianbalisi
guillianbalisi / UIButton+AnimatedSetImage.swift
Created July 12, 2018 18:38
Change the image of UIButton with a bounce animation (reversible, for example liking/unliking with a heart image)
extension UIButton {
func setImage(_ image: UIImage?, animated: Bool = false, reversed: Bool = false, color: UIColor) {
guard animated else {
setImage(image, for: .normal)
return
}
let templateImage = image?.withRenderingMode(.alwaysTemplate)
tintColor = color
@berkedel
berkedel / flow-error-icu4c-not-loaded.md
Created April 4, 2018 14:13
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

How to solve dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

brew uninstall --ignore-dependencies node icu4c
brew install node
@PabTorre
PabTorre / install_python_36_amazon_linux2.sh
Last active July 13, 2021 11:58 — forked from niranjv/install_python_36_amazon_linux.sh
Install Python 3.6 in Amazon Linux 2
# A virtualenv running Python3.6 on Amazon Linux/EC2 (approximately) simulates the Python 3.6 Docker container used by Lambda
# and can be used for developing/testing Python 3.6 Lambda functions
# This script installs Python 3.6 on an EC2 instance running Amazon Linux and creates a virtualenv running this version of Python
# This is required because Amazon Linux does not come with Python 3.6 pre-installed
# and several packages available in Amazon Linux are not available in the Lambda Python 3.6 runtime
# The script has been tested successfully on a EC2 instance
# running 4.9.75-1.56.amzn2.x86_64
# and was developed with the help of AWS Support
@Yousha
Yousha / .gitignore
Last active May 10, 2024 07:52
.gitignore for PHP developers.
##### Windows
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
@bvaughn
bvaughn / react-lifecycle-cheatsheet.md
Last active March 2, 2023 13:29
React lifecycle cheatsheet

React lifecycle cheatsheet

Method Side effects1 State updates2 Example uses
Mounting
componentWillMount Constructor equivalent for createClass
render Create and return element(s)
componentDidMount DOM manipulations, network requests, etc.
Updating
componentWillReceiveProps Update state based on changed props
@andfaulkner
andfaulkner / irjs.js
Last active June 28, 2020 03:45 — forked from coolaj86/injs.js
REPL tools for NodeJS
#!/usr/bin/env node
// boot node repl with a few libraries auto-loaded and some top-level convenience functions
(function () {
"use strict";
var repl = require("repl");
var context = repl.start("irjs> ").context;
var path = require('path');
var fs = require('fs');