This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Option 1: Duplicating the function | |
async function payWithPayPal(payload) { | |
setLoading(true); | |
await apis.paypal(payload); | |
trackWithAnalytics({ method: 'paypal', amount: payload.amount }); | |
setLoading(false); | |
} | |
async function payWithCreditCard(payload) { | |
setLoading(true); | |
await apis.creditcard(payload); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original function definition with comments | |
async function asyncFunc() { | |
let data; // data variable gets declared, but it is `undefined` | |
// The promise returned by `axios.get` is not returned | |
axios.get("/some_url_endpoint") | |
.then((result) => { | |
// When this GET call gets resolved, we assign data variable to the result | |
data = result | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g=git | |
ga='git add' | |
gap='git add --patch' | |
gb='git branch' | |
gba='git branch -a' | |
gbr='git branch --remote' | |
gc='git commit -v' | |
'gc!'='git commit -v --amend' | |
gca='git commit -v -a' | |
'gca!'='git commit -v -a --amend' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var | |
_ = require('underscore'), | |
Utils = { | |
string: require('../utils/string') | |
}, | |
whereToValues = { | |
notification: ['inApp', 'email'], | |
sharing: ['facebook', 'twitter'] | |
}, | |
categoryValues = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(toRemove){toggleChat();leftMenuToggle();for(var i=0;i<toRemove.length;i++)$(toRemove[i]).remove();})(['#left_55', '#chat', '#top', '.view_bot']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.element(document.querySelector('[ng-view]')).scope() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by gonchub on 19/03/14. | |
*/ | |
function keysToLowerCase(obj) { | |
if (!typeof(obj) === "object" || typeof(obj) === "string" || typeof(obj) === "number" || typeof(obj) === "boolean") { | |
return obj; | |
} | |
var keys = Object.keys(obj); | |
var n = keys.length; | |
var lowKey; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('freqshoApp') | |
.directive('formAutofillFix', function () { | |
return function (scope, elem, attrs) { | |
// Fixes Chrome bug: https://groups.google.com/forum/#!topic/angular/6NlucSskQjY | |
elem.prop('method', 'POST'); | |
function triggerChangeHandlers(element) { | |
element.triggerHandler('input').triggerHandler('change').triggerHandler('keydown'); |