Skip to content

Instantly share code, notes, and snippets.

View juan-m-medina's full-sized avatar

Juan M. Medina juan-m-medina

  • Austin, TX
  • 21:21 (UTC -05:00)
View GitHub Profile
@juan-m-medina
juan-m-medina / .gitconfig
Created June 3, 2019 15:59
Git configuration to address ssh-add issues
# The SSH Command is necessary to make sure the ssh-add for the agent uses the same binary as your global SSH.
# In this case OpenSSH was installed and the Windows 10 Agent was uninstalled.
# Prior to this the git client and the ssh-agent were hitting different binaries and the git client kept asking for the passphrase
[user]
name = Juan_M_Medina
email = myemail@emailserver.com
[core]
sshCommand = c:/Program\\ Files/OpenSSH-Win64/ssh.exe
@juan-m-medina
juan-m-medina / LunchNLearn-Mixins.js
Created February 17, 2016 16:21
LunchNLearn - Mixins
// General library function to apply mixins to classes
function applyMixins(derivedCtor: any, baseCtors: any[]) {
baseCtors.forEach(baseCtor => {
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
derivedCtor.prototype[name] = baseCtor.prototype[name];
})
});
}
// An Enum to classify items for pricing
@juan-m-medina
juan-m-medina / LunchNLearn-TypescripBasics.js
Created February 10, 2016 17:02
Lunch N Learn Typescript Basics
enum OrderType {
stationery,
food,
electronics
}
enum Priority {
low,
medium,
high
var oneSecondCall = function(resolve, reject) {
setTimeout(resolve, 1000, 1);
};
var twoSecondCall = function(resolve, reject) {
setTimeout(resolve, 2000, 2);
};
var threeSecondCall = function(resolve, reject) {
setTimeout(resolve, 3000, 3);
@juan-m-medina
juan-m-medina / LunchNLearn-ES6Destructuring.js
Created February 3, 2016 16:36
Destructuring examples
// Simple one to one assignment
var [a, b, c] = [1, 2, 3];
console.log(`a is ${a}`);
console.log(`b is ${b}`);
console.log(`c is ${c}`);
// Assigning the remaining elements
var [alpha, beta, gamma, ...theRest] = [1,2,3,4,5,6,7,8,9,10];
console.log(`alpha is ${alpha}`);
console.log(`beta is ${beta}`);
"use strict";
var coolPeople = {};
coolPeople[Symbol.iterator] = function* () {
yield "Supriya";
yield "Andy (Basu)";
yield "Sachin";
yield "Tom";
};
"use strict";
/*
///------------------------------------------------------------------------------------
/// Hoisting example
(function badHoistTest() {
console.log(prettyPrint(a)); // 'a' is known, not undefined, declaration is hoisted
var a = 'ugly'; // Initializations are NOT hoisted, only declarations;
function prettyPrint(input) {
@juan-m-medina
juan-m-medina / gitignore-reapply.sh
Created January 18, 2016 18:37
Git Ignore Reapply
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@juan-m-medina
juan-m-medina / gist:90b0862989832476a4a0
Last active January 5, 2016 14:42
Git single file Cherry Pick
# I'd do it with cherry-pick -n (--no-commit) which lets you inspect (and modify) the result before committing:
git cherry-pick -n <commit>
# unstage modifications you don't want to keep, and remove the
# modifications from the work tree as well.
# this does work recursively!
git checkout HEAD <path>
# commit; the message will have been stored for you by cherry-pick
$wc=new-object net.webclient;
$wp=[system.net.WebProxy]::GetDefaultProxy();
$wp.UseDefaultCredentials=$true;
$wc.Proxy=$wp;
iex ($wc.DownloadString('https://chocolatey.org/install.ps1'))