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 charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| <script src="https://unpkg.com/vue"></script> | |
| <script src="https://cdn.jsdelivr.net/lodash/4.17.4/lodash.core.min.js"></script> | |
| </head> |
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 logging | |
| import logging.config | |
| LOG_SETTINGS = { | |
| 'version': 1, | |
| 'disable_existing_loggers': False, | |
| 'formatters': { | |
| 'standard': { | |
| 'format': "%(asctime)s %(levelname)-8s%(module)s:%(lineno)s:%(funcName)s %(message)s", | |
| }, |
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 logging | |
| DEBUG_LEVELV_NUM = 35 | |
| logging.DEBUG_LEVELV_NUM = DEBUG_LEVELV_NUM | |
| logging.addLevelName(DEBUG_LEVELV_NUM, "DEBUGV") | |
| def debugv(self, message, *args, **kws): | |
| # Yes, logger takes its '*args' as 'args'. | |
| if self.isEnabledFor(DEBUG_LEVELV_NUM): | |
| self._log(DEBUG_LEVELV_NUM, message, args, **kws) |
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 add() { | |
| function checkNum(num) { | |
| if (typeof num != 'number') { | |
| return false; | |
| } | |
| return true; | |
| } | |
| if(arguments.length == 1) { | |
| var c=arguments[0]; | |
| if (checkNum(c)) { |
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 binaryAgent(str) { | |
| actualStr="" | |
| str.split(" ").map(function(val) { | |
| actualStr += String.fromCharCode(parseInt(val,2)); | |
| }) | |
| return actualStr; | |
| } |
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 steamroller(arr) { | |
| // I'm a steamroller, baby | |
| return flatten(arr); | |
| } | |
| function flatten(a, r){ | |
| if(!r){ r = [];} | |
| for(var i=0; i<a.length; i++){ | |
| if(Array.isArray(a[i])){ | |
| flatten(a[i], r); |
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 drop(arr, func) { | |
| for(i=0;i<=arr.length;i++) { | |
| if (func(arr[i])) { | |
| return arr.slice(i); | |
| } | |
| } | |
| return []; | |
| } | |
| drop([1, 2, 3], function(n) {return n < 3; }); |
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 find(arr, func) { | |
| var num = 0; | |
| for(i=0;i<=arr.length;i++) { | |
| if (func(arr[i])) { | |
| return arr[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
| function smallestCommons(arr) { | |
| if(arr[0]>arr[1]) { | |
| min = arr[1]; | |
| max = arr[0]; | |
| } else { | |
| min = arr[0]; | |
| max = arr[1]; | |
| } | |
| function range(min, max) { | |
| var arr = []; |
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 isPrime(n) { | |
| if (n==1 || n == 2 || n == 3) { | |
| return true; | |
| } else { | |
| for(i=Math.floor(Math.sqrt(n));i>=2;i--){ | |
| if(n%i == 0 || n%2 == 0 || n%3 == 0) {return false;} | |
| } | |
| } | |
| return true; | |
| } |