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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src='jquery.js'></script> | |
<script src="main.js"></script> | |
</head> | |
<body> | |
<p> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. | |
</p> |
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
/** | |
* Depth-first search tree | |
* @param {string} nodeName - Name of the node to find | |
* @param {object} tree - Node example: {name: 'a', children: [nodeA, nodeB, ...]} | |
* @return {object} Returns the node with the given name | |
*/ | |
function depthFirstSearch(nodeName, tree) { | |
if (tree.name === nodeName) { | |
return tree; //Node found | |
} else { |
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 BFS(node){ | |
var list = [node]; | |
var current = list.shift(); | |
while(current){ | |
console.log(current.data); | |
var i = 1; |
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
/** | |
* A Little example of recursion | |
**/ | |
(function(){ | |
var flatten = function(toFlatten){ | |
var flatArr = [], | |
result, | |
tmp; |
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 bubbleSort = function(array) { | |
var len = array.length; | |
var swap = function(i,j,array){ | |
var holder = array[i]; | |
array[i] = array[j]; | |
array[j] = holder; | |
} | |
for(var j = 0; j < len - 1; j++){ | |
var swaps = false; |
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 compose = function(){ | |
//Your code here | |
var args = Array.prototype.slice.call(arguments); | |
return function(val){ | |
return args.reduceRight(function(memo, fn){ | |
return fn(memo); | |
}, val); | |
}; | |
}; |
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 app = angular.module("modalFormApp", ['ui.bootstrap']); | |
app.controller("modalAccountFormController", ['$scope', '$modal', '$log', | |
function ($scope, $modal, $log) { | |
$scope.showForm = function () { | |
$scope.message = "Show Form Button Clicked"; | |
console.log($scope.message); | |
var modalInstance = $modal.open({ |
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
set -o verbose | |
set -o errexit | |
echo '* Create and initialize a repository.' | |
git init gitflow-tutorial | |
cd gitflow-tutorial/ | |
git flow init -d | |
echo '* Develop a Feature' |
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 matrix = | |
[ [ 1, 2, 3, 4, 5 ], | |
[ 6, 7, 8, 9, 10 ], | |
[ 11, 12, 13, 14, 15 ], | |
[ 16, 17, 18, 19, 20 ], | |
[ 21, 22, 23, 24, 25 ] ]; | |
var spiralTraversal = function(matrix){ | |
var results =[]; | |
var startRowIndex = 0; |
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
/* | |
Example usage: | |
var obj = mixEvents({ name: 'Alice', age: 30 }); | |
obj.on('ageChange', function(){ // On takes an event name and a callback function | |
console.log('Age changed'); | |
}); | |
obj.age++; | |
obj.trigger('ageChange'); // This should call our callback! Should log 'age changed'. | |
*/ |
OlderNewer