The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"/> | |
| <title>cache selector (with & w/o jQuery)</title> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
| <script src="./suite.js"></script> | |
| </head> | |
| <body> | |
| <h1>Open the console to view the results</h1> |
| package main | |
| import ( | |
| "fmt" | |
| "encoding/xml" | |
| ) | |
| type Example struct{ | |
| XMLName xml.Name `xml:"Example"` | |
| Markup []string `xml:"xhtml"` |
| function convertMS( milliseconds ) { | |
| var day, hour, minute, seconds; | |
| seconds = Math.floor(milliseconds / 1000); | |
| minute = Math.floor(seconds / 60); | |
| seconds = seconds % 60; | |
| hour = Math.floor(minute / 60); | |
| minute = minute % 60; | |
| day = Math.floor(hour / 24); | |
| hour = hour % 24; | |
| return { |
| // css | |
| .dialogWide > .modal-dialog { | |
| width: 80% !important; | |
| } | |
| // script | |
| bootbox.dialog({ | |
| className: "dialogWide", | |
| title: "Foo", | |
| message: "what to say, go wide", | |
| buttons: { |
| var crypto = require('crypto'); | |
| const create_string_hash = (data) => crypto.createHash('md5').update(data).digest("hex"); |
| module.exports = { | |
| countries: { | |
| 'DE': 20, | |
| 'UK': 21, | |
| 'FR': 20, | |
| 'IT': 25, | |
| 'ES': 19, | |
| 'PL': 21, | |
| 'RO': 20, | |
| 'NL': 20, |
| const fs = require('fs'); | |
| // List all files in a directory in Node.js recursively in a synchronous fashion | |
| const walkSync = function(dir, filelist,ignoreList) { | |
| if(!dir.endsWith('/')){ | |
| dir+='/'; | |
| } | |
| const files = fs.readdirSync(dir); | |
| filelist = filelist || []; | |
| ignoreList = ignoreList || []; | |
| files.forEach(function(file) { |
Here is a list of scopes to use in Sublime Text 2/3 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
| let int = i => parseInt(i,10); | |
| let numbers=prompt("Enter numbers seperated by comma").split(',').map(Number); | |
| let sum = numbers.reduce((sum,val)=>sum+val); | |
| alert("Sum of numbers = ->"+sum); |