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
| /* Extend the underscore global object with the following method: | |
| * | |
| * https://gist.github.com/adamblank/7328089 | |
| * | |
| * reverseTemplate attempts to reverse engineer the original object used to generate | |
| * the rendered output by comparing the output string to the underscore template string. | |
| * | |
| * Paramaters | |
| * - renderedOutput - the string that was generated from the template | |
| * - template - the template string used to generate the compiled underscore template (not the compiled template function.) |
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
| [ | |
| "Abbaye de Belloc", | |
| "Abbaye du Mont des Cats", | |
| "Abertam", | |
| "Abondance", | |
| "Ackawi", | |
| "Acorn", | |
| "Adelost", | |
| "Airag", | |
| "Airedale", |
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
| _.compile = function(templ) { | |
| var compiled = this.template(templ); | |
| compiled.render = function(ctx) { | |
| return this(ctx); | |
| }; | |
| return compiled; | |
| } |
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
| ::-webkit-scrollbar{ | |
| width: 10px; | |
| } | |
| ::-webkit-scrollbar-track-piece{ | |
| background-color: #FFF; | |
| } | |
| ::-webkit-scrollbar-thumb{ | |
| background-color: #CBCBCB; |
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 generateTable(arr) { | |
| var content = {}, | |
| headers = [], | |
| longest = 0; | |
| function setEmpies(content) { | |
| for (var key in content) { | |
| if (!content[key].affected) { | |
| content[key].push(''); |
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
| /* | |
| * Boilerplate thread local singleton | |
| */ | |
| protected Singleton() {} //enforce singleton pattern with protected constructor | |
| private static ThreadLocal<Singleton> instance = null; //the current thread instance | |
| /** Get the singleton instance of this service | |
| * If no instance exists for this thread, instantiate one | |
| * |
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 stock_prices = [15,14,11,10,8,6,5,2,1];//[10,11,12,15,8,9,10,14,11];//[10, 9, 8, 10, 13, 11, 9, 10, 15]; | |
| var max_and_min = []; | |
| var i = stock_prices.length - 1; | |
| for (i; i >= 0; i--) { | |
| if (max_and_min.length && (max_and_min[0].min == null || max_and_min[0].min > stock_prices[i])) { | |
| max_and_min[0].min = stock_prices[i]; | |
| } | |
| if (!max_and_min.length || max_and_min[0].max < stock_prices[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
| var arr = [1, 7, 3, 4]; | |
| var brute = function(arr) { | |
| var i = 0; | |
| var final_arr = []; | |
| var temp_arr; | |
| var j; | |
| for (i; i < arr.length; i++) { | |
| temp_arr = arr.slice(); | |
| temp_arr.splice(i, 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
| public class Node { | |
| protected String data; | |
| protected Node next; | |
| public Node(final String data, final Node next) { | |
| this.data = data; | |
| this.next = next; | |
| } | |
| public Node getNext() { |
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
| import java.util.*; | |
| public class MyApp { | |
| protected List<Integer[]> meetings = new ArrayList<>(); | |
| public MyApp() { | |
| meetings.add(new Integer[] { 3, 5}); | |
| meetings.add(new Integer[] { 0, 1}); | |
| meetings.add(new Integer[] { 4, 8}); |
OlderNewer