Skip to content

Instantly share code, notes, and snippets.

View amslezak's full-sized avatar

Andy Slezak amslezak

View GitHub Profile
@bdchauvette
bdchauvette / .babelrc
Last active June 21, 2021 17:44
Minimal babel boilerplate
{
"presets": [ "es2015" ]
}
@bahmutov
bahmutov / Docker shell commands.sh
Last active February 9, 2024 07:55
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .
Finding keys and values
Objects, in Vanilla JavaScript, use the same syntax as arrays
for accessing property
values.That is, the square bracket notation but typically with a human - readable
string, instead of a numerical index.However, the same issues that exist with
numerical indices and arrays exist with objects and keys too.Just because the key
is a string doesn 't mean that we know which keys are available. Sometimes, we
have to search the object to find the key we 're looking for.
We use the findKey()
function to locate the key of the first object property that
@tweinfeld
tweinfeld / example.js
Last active May 28, 2016 23:11
A JSONP mixin for Lodash
_.jsonp('https://api.ipify.org/?format=jsonp', function(err, value){
console.log(err || value);
});
@corbanb
corbanb / dev-node.md
Last active June 1, 2021 13:49
OSX 10.10.X Node Developer Setup

Node.js + OSX 10.10.X

Outline

Below is a quick start guide to developing node.js on OSX. These tools and settings will give you just about everything you would need on a clean install of OSX 10.10.X to get setup and coding.

Install iTerm2

https://www.iterm2.com

Install XCode

@beaugunderson
beaugunderson / cool-modules.md
Last active February 2, 2023 19:58
cool modules from nodeconf

from streams session

  • end-of-stream - specify a callback to be called when a stream ends (which is surpsingly hard to get right)
  • duplexify - compose a Duplex stream from a Readable and a Writable stream
  • pump - pipe streams together and close all of them if one of them closes
  • pumpify - combine an array of streams into a single duplex stream using pump and duplexify
  • through2 - tools for making Transform streams
  • from2 - tools for making Readable streams

from "participatory modules" session

@terranware
terranware / snsToSlack.js
Last active March 7, 2024 14:47
AWS Lambda function to Slack Channel hookup
var https = require('https');
var util = require('util');
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var postData = {
"channel": "#aws-sns",
"username": "AWS SNS via Lamda :: DevQa Cloud",
@techieshark
techieshark / copy-into-browser.js
Last active November 9, 2018 12:14
jquery-and-lodash-in-console
// For quickly trying things out in the browser, jQuery and Lo-Dash (like Underscore.js) are great.
// Read the code below (never copy & paste code you don't trust),
// then you can copy & paste it into the browser console to load jQuery & lodash.
(function () {
var jq = document.createElement('script');
jq.src = 'https://code.jquery.com/jquery-2.1.4.js';
@staltz
staltz / introrx.md
Last active June 15, 2024 12:24
The introduction to Reactive Programming you've been missing
@tsl0922
tsl0922 / .tmux.conf
Last active May 24, 2024 06:51
vim style tmux config
# vim style tmux config
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."