Skip to content

Instantly share code, notes, and snippets.

@vsymguysung
vsymguysung / index.md
Created June 15, 2018 12:55 — forked from alexcasalboni/index.md
Bridge Function between Kinesis Streams and Step Functions

Bridge Function between Kinesis Streams and Step Functions

For each record read from the Kinesis Stream, a StepFunction state machine will be executed asynchronously.

Required Environment Variables

  • region: the AWS region where your StepFunction state machine is defined.
  • stateMachineArn: the ARN of the StepFunction state machine you want to execute.

Notes

@vsymguysung
vsymguysung / lambda-not-anon.md
Created April 28, 2018 15:25
The distinction between anonymous functions and lambdas in JavaScript.

TL;DR - Lambda means "function used as data".

Anonymous function means "function without a name".

This is one of the relatively few cases where the Wikipedia definition of a word, while not entirely wrong, is misleading. Lambdas and anonymous functions are distinct ideas.

These ideas are commonly confused because in many programming languages (and lambda calculus) all lambdas are anonymous or vise verse.

In JavaScript, not all lambdas are anonymous, and not all anonymous functions are lambdas, so the distinction has some practical meaning.

@vsymguysung
vsymguysung / lambda-not-anon.md
Created April 28, 2018 15:25
The distinction between anonymous functions and lambdas in JavaScript.

TL;DR - Lambda means "function used as data".

Anonymous function means "function without a name".

This is one of the relatively few cases where the Wikipedia definition of a word, while not entirely wrong, is misleading. Lambdas and anonymous functions are distinct ideas.

These ideas are commonly confused because in many programming languages (and lambda calculus) all lambdas are anonymous or vise verse.

In JavaScript, not all lambdas are anonymous, and not all anonymous functions are lambdas, so the distinction has some practical meaning.

@vsymguysung
vsymguysung / ssh-forward-clipboard.md
Created January 27, 2018 22:17 — forked from dergachev/ssh-forward-clipboard.md
Forward your clipboard via SSH reverse tunnels

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

@vsymguysung
vsymguysung / tmux_cygwin.md
Created October 24, 2017 12:45 — forked from zlalanne/tmux_cygwin.md
tmux on Cygwin

Steps to install tmux in Cygwin

Install required Cygwin packages

  1. run Cygwin setup.exe
  2. install these packages that are not installed by default: automake, gcc, git and pkg-config

Install libevent

  1. browse http://libevent.org
  2. download libevent-2.0.21-stable.tar.gz
import Ember from 'ember';
export default Ember.Controller.extend({
appName: `Ember's Route Hook Order`,
actions: {
clearLog() {
Ember.$('.log-item').remove();
}
}

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@vsymguysung
vsymguysung / controllers.application.js
Created December 29, 2016 15:20 — forked from jpadilla/controllers.application.js
promise-proxy-mixin-example
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
isBooked: Ember.computed(function() {
var ObjectPromiseProxy = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);
return ObjectPromiseProxy.create({
promise: $.getJSON('https://httpbin.org/get')
});

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

// {{ radio-button name='dish' value='spam' groupValue=selectedDish }} Spam
// {{ radio-button name='dish' value='eggs' groupValue=selectedDish }} Eggs
//
App.RadioButtonComponent = Ember.Component.extend({
tagName: 'input',
type: 'radio',
attributeBindings: [ 'checked', 'name', 'type', 'value' ],
checked: function () {