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 _get; | |
| window.SN = { | |
| get: function(scriptInclude, name, obj, cb) { | |
| return _get(scriptInclude, name, obj, cb, true); | |
| }, | |
| getPlane: function(scriptInclude, name, obj, cb) { | |
| return _get(scriptInclude, name, obj, cb); | |
| } | |
| }; |
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, 2, 3, 4, 5]; | |
| var sum = arr.reduce(function(pv, cv){ | |
| return cv + pv; | |
| }); |
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
| @font-face { | |
| font-family: 'Guild Wars 2'; | |
| src: url('inc/fonts/GuildWars2.eot'); | |
| src: url('inc/fonts/GuildWars2.eot?#iefix') format('embedded-opentype'), | |
| url('inc/fonts/GuildWars2.woff') format('woff'), | |
| url('inc/fonts/GuildWars2.ttf') format('truetype'), | |
| url('inc/fonts/GuildWars2.svg#GuildWars2Regular') format('svg'); | |
| font-weight: normal; | |
| font-style: normal; | |
| } |
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
| // toType better typeof | |
| var toType = function(obj) { | |
| return ({}).toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase() | |
| } | |
| toType({a: 4}); //"object" | |
| toType([1, 2, 3]); //"array" | |
| (function() {console.log(toType(arguments))})(); //arguments |
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
| func getFilesInPath(rootPath string, fileType string) ([]FileObj, error) { | |
| var files []FileObj | |
| err := filepath.Walk(rootPath, func(path string, info os.FileInfo, err error) error { | |
| // read file | |
| if err != nil { | |
| fmt.Print(err) | |
| } | |
| subStr := strings.Replace(path, "testdata/", "", -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
| value.replace(/(?!^)([A-Z]|\d+)/g, " $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
| if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { | |
| // dark mode | |
| } | |
| // to watch for changes: | |
| window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) { | |
| console.log(`changed to ${e.matches ? "dark" : "light"} mode`) | |
| }); |
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
| const [, year, month, day] = /^(\d\d\d\d)-(\d\d)-(\d\d)$/.exec('2999-12-31'); |
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
| // get the fib number: | |
| function fib(n) { | |
| let arr = [0,1,1]; | |
| for (let i = 3; i <= n; i++) { | |
| arr.push(arr[i-2] + arr[i-1]) | |
| } | |
| return arr[n] | |
| } |
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
| // Find (not equal to): | |
| db.getCollection('Task').find({type: {$ne: 1}}) | |
| db.getCollection('documents').find({'pages.zones.regex': {$exists: true, $ne: ''}}) | |
| // Detect non empty strings | |
| db.getCollection('DocumentDefinition').find({'pages.zones.regex': /(.|\s)*\S(.|\s)*/}) |
NewerOlder