Þú þarft að vera búinn að installa nodejs. (Yfirleitt öruggast að velja nýjustu LTS útgáfuna, því allra, allra nýjasta nýjasta útgáfa er stundum pínu experimental og bögguð.)
cd myprojectfolder
npm init
| { | |
| // Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | |
| // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | |
| // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | |
| // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
| // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | |
| // Placeholders with the same ids are connected. | |
| // Example: | |
| // "Print to console": { | |
| // "scope": "javascript,typescript,typescriptreact", |
| export default function isValidKennitala(kt) { | |
| // Trim and remove optional "-" or " " separators | |
| kt = kt.trim().replace(/\s|-/, ''); | |
| // Alternatively only allow separator as 7th character | |
| // kt = kt.replace(/^(.{6})[\s-]/, '$1'); | |
| // Must be 10 digits, ending in either 0 or 9 (note Y2.1k problem!) | |
| if ( kt.length !== 10 && !/^\d{9}[90]$/.test(kt) ) { | |
| return false; | |
| } |
Copy of Tryggvi's Flow Examples gist demonstrating the Flow omment syntax (and one bug in flow)
Type comments. Bug fixed:
| // Usage: | |
| // 1. Visit http://www.thisamericanlife.org/radio-archives | |
| // 2. Paste this script into the developer console of your browser. | |
| // 3. Wait... | |
| // 4. Copy-paste the resulting XML into a file. | |
| // | |
| (function(){ | |
| var jQuery = window.jQuery; | |
| var doc = document; |
Moved here: https://github.com/maranomynet/mithril-mu
| // https://gist.github.com/maranomynet/b3070a9aa08219566508 | |
| var _sortRoutes = function ( routes ) { | |
| var sortedRoutes = {}; | |
| var tokens = {}; | |
| var tokenize = function (str) { | |
| var token = tokens[str]; | |
| if ( token == null ) | |
| { | |
| token = tokens[str] = str | |
| // Sort order: ? < n < s < v < … |
| /* | |
| array.sortISL.js -- (c) 2014 Hugsmiðjan ehf. - MIT/GPL | |
| Written by Már Örlygsson - http://mar.anomy.net | |
| Original at: https://gist.github.com/maranomynet/9972930 | |
| Install via npm: | |
| npm install gist:9972930 | |
| Use with CommonJS: |
| // returns a throttled function that never runs more than every `delay` milliseconds | |
| // the returned function also has a nice .finish() method. | |
| $.throttleFn = function (func, skipFirst, delay) { | |
| if ( typeof skipFirst === 'number' ) | |
| { | |
| delay = skipFirst; | |
| skipFirst = false; | |
| } | |
| delay = delay || 50; | |
| var throttled = 0, |