This file contains hidden or 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
1. Branch off of develop. | |
$ git checkout -b feature/myfeature develop | |
2. Squash commits into one commit | |
Open github and figure out how many commits to go back | |
$ git rebase -i head~(number of commits) | |
- You can remove commits in editor by doing {command K}. | |
- Save! | |
3. Checkout develop and make sure it's up to date | |
$ git checkout develop | |
$ git pull |
This file contains hidden or 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() { | |
"use strict"; | |
var loader = function(assets) { | |
if (Object.prototype.toString.call(assets) !== "[object Array]" && assets.length < 1) { | |
return; | |
} | |
// get asset | |
var assetSrc = assets.shift(); | |
// determine asset type | |
var assetType = (assetSrc.indexOf(".css") !== -1) ? "script" : "style"; |
This file contains hidden or 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 animals = [ | |
{ name: "Waffles", type: "dog", age: 12 }, | |
{ name: "Fluffy", type: "cat", age: 14 }, | |
{ name: "Spelunky", type: "dog", age: 4 }, | |
{ name: "Hank", type: "dog", age: 11 } | |
]; | |
// filter dogs | |
animals = animals.filter(function(animal) { | |
return animal.type === "dog"; |
This file contains hidden or 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.module("myApp", []) | |
.controller("TodoCtrl", ["$scope", function($scope){ | |
// clear input todo text | |
$scope.lastTodoClass = "odd"; | |
$scope.todoText = ""; | |
// default todos | |
$scope.todos = [ | |
{text:'Learn AngularJS', done:false, class:"even"}, | |
{text: 'Build an app', done:false, class:"odd"} | |
]; |
This file contains hidden or 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
// A barebones UMD implementation | |
;(function(){ | |
"use strict"; | |
var myObj = {}; | |
myObj.property = "prop"; | |
myObj.method = function method() {}; | |
// normalize for different environments | |
if (typeof define === "function" && define.amd) { | |
define(function() { return myObj; }); | |
} else if (module && module.exports) { |
This file contains hidden or 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
// Tell if given strings are anagrams without using any API methods except split | |
function anagrams(str1, str2) { | |
str1 = str1.split(""); | |
str2 = str2.split(""); | |
var charLen = []; | |
var anagram = false; | |
if(str1.length !== str2.length) { |
This file contains hidden or 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 getLetterCount(arr){ | |
return arr.reduce(function(prev,next){ | |
prev[next] = (prev[next] + 1) || 1; | |
console.log(prev[next]); | |
return prev; | |
},{}); | |
} | |
var str = "dfdddf"; |
This file contains hidden or 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 Animal = { | |
type: 'mammal', | |
legs: 4, | |
eyes: ['blue', 'black', 'brown'], | |
saying: '' | |
}; | |
console.log(Animal.constructor); // Refers to the constructor method on the Object | |
Animal.prototype = { |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[add your bin description]" /> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> |
This file contains hidden or 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
// increment/decrement large integers in JavaScript | |
var num = "900719925474599945678999"; | |
function incdecLargeInt(str, operation){ | |
var arr = str.split(""); | |
var lastInt = Number(arr.pop()); | |
if(lastInt===9){ | |
// implement carry over | |
fixCarryOver(num.split('')); | |
var zx = res.reverse().join(''); | |
// edge case when all are '9's |