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
| class HashTable { | |
| constructor(size) { | |
| this.buckets = Array(size); | |
| this.numBuckets = this.buckets.length; | |
| } | |
| hash(key) { | |
| let total = 0; | |
| for (var i = 0; i < key.length; i++) { | |
| total += key.charCodeAt(i); |
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
| class BST { | |
| constructor(value) { | |
| this.value = value; | |
| this.left = null; | |
| this.right = null; | |
| } | |
| insert(value) { | |
| if (value <= this.value) { | |
| if (!this.left) { |
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
| // Constant runtime - Big O Notation: "O (1)" | |
| function log(array) { | |
| console.log(array[0]); | |
| console.log(array[1]); | |
| } | |
| log([1, 2, 3, 4]); | |
| log([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
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 LinkedList() { | |
| this.head = null; | |
| this.tail = null; | |
| } | |
| function Node(value, next, prev) { | |
| this.value = value; | |
| this.next = next; | |
| this.prev = prev; | |
| } |
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
| let items = [ | |
| { | |
| id: 1, | |
| symbol: 'a', | |
| cost: 25, | |
| target: 50, | |
| value: 500, | |
| }, | |
| { | |
| id: 1, |
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 href="#" | |
| class="b-social-action" | |
| data-facebook-share | |
| data-url="{{app.request.uri}}" | |
| data-title="{{page_title}}"> | |
| <i>F</i><span class="name">Facebook</span> | |
| </a> | |
| <a href="https://twitter.com/intent/tweet?text={{page_title}}&url={{app.request.uri}}" | |
| class="b-social-action" | |
| data-twitter-share> |
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
| app.config(function ($provide) { | |
| $provide.decorator('$rootScope', function ($delegate) { | |
| var backup = $delegate.$emit; | |
| $delegate.$emit = function () { | |
| console.log.apply(console, arguments); | |
| backup.apply(this, arguments) | |
| } | |
| return $delegate; |
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
| .wrapper{ | |
| text-align: justify; | |
| text-justify: distribute-all-lines; | |
| .item{ | |
| display:inline-block; | |
| } | |
| &:after { | |
| content: ""; | |
| width: 100%; | |
| display: inline-block; |
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
| $field.on('keyup', function(event){ | |
| delay(function(){ | |
| alert('Delayed for 1 second') | |
| }, 1000); | |
| }); | |
| var delay = (function(){ | |
| var timer = 0; | |
| return function(callback, ms){ | |
| clearTimeout (timer); |
NewerOlder