Skip to content

Instantly share code, notes, and snippets.

View justin-lyon's full-sized avatar

Justin Lyon justin-lyon

  • Daejeon, South Korea
View GitHub Profile
@justin-lyon
justin-lyon / ssh-cheatsheet
Last active August 3, 2020 14:17
ssh cheatsheet
# generate rsa key-pair without password (-N) with comment (-C) and name (-f)
ssh-keygen -t rsa -b 4096 -N "" -C "userName localName remoteName" -f keyName
# windows bash
# activate ssh-agent in windows bash
eval $(ssh-agent -s)
# list registered ssh keys - these keys are cached by the agent so you only need to enter pw once
ssh-add -l
@justin-lyon
justin-lyon / setup.md
Last active March 19, 2018 14:57
Getting started with git
const Benchmark = require('benchmark')
const suite = new Benchmark.Suite
const arr = new Array(800)
// Prep code
for (var i = 0; i < arr.length; ++i) {
arr[i] = (Math.random() * 10001) | 0
}
@justin-lyon
justin-lyon / git-cheatsheet.md
Created May 16, 2018 12:21
Justin's git cheatsheet

Sum [dev] branch revisions into a single merge commit on [target] branch (Like Pull Request)

git checkout [target]
git pull
git merge [dev] --no-ff -m "message"
git push

Cherry Pick

var foo = function() {
console.log("I'm foo");
};
var bar = function(cb) {
console.log("bar before");
cb();
console.log("bar after");
};
var fetchData = function () {
return new Promise(function (resolve, reject) {
//Fake an async action with a timeout.
setTimeout(function () {
var data = {
users: [
{ name: 'Jack', age: 22 },
{ name: 'Tom', age: 21 },
{ name: 'Isaac', age: 21 },
{ name: 'Iain', age: 20 }

functional expression

notHoisted(); // TypeError: notHoisted is not a function

var notHoisted = function() {
	console.log('bar');
};

functional declaration

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Event Demo</title>
<style type="text/css">
.grid {
display: grid;
grid-template-columns: 100px 100px 100px 100px;
/* MyLightningComponentHelper.js */
({
requestAccounts: function(cmp) {
var auraAction = cmp.get("c.getLimitedAccounts");
auraAction.setParams({
limitter: 10
});
acumen.promisify(auraAction)
.then(function(auraRes) {
window.acumen = (function AppContext(acumen, window) {
var hasLightning = function() {
return window.$A
};
var isMobile = function() {
var userAgent = window.navigator.userAgent.toLowerCase();
return (-1 != userAgent.indexOf('mobile'));
};