This file contains 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
let s:V= vital#of('vital') | |
let s:S= s:V.import('Data.String') | |
let s:L= s:V.import('Data.List') | |
unlet s:V | |
" | |
" Public API | |
" --- | |
" | |
let s:style= {} |
This file contains 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 java.lang.reflect.InvocationTargetException; | |
import javax.swing.JFrame; | |
import javax.swing.JLabel; | |
import javax.swing.SwingUtilities; | |
public class CreateAndShowGUI extends Thread{ | |
Runnable HelloWorldFrame = new Runnable() { | |
public void run() { |
This file contains 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
/* | |
* Test 1 - for..in with hasOwnProperty check. | |
*/ | |
var counter = 0 | |
var i | |
var p | |
var start = performance.now() | |
for (i=0; i<1000; i+=1) { | |
for (p in window) { | |
if (window.hasOwnProperty(p)) {} |
This file contains 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 run(generator) { | |
var iterator = generator(resume); | |
var data = null, yielded = false; | |
iterator.next(); | |
yielded = true; | |
check(); | |
function check() { | |
while (data && yielded) { |
This file contains 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 performanceTests(...testCases) { | |
const NUM_ITERATIONS = 5000000 | |
let results = [] | |
console.log(' -- Running tests... ') | |
for (let i=0, l=testCases.length; i<l; i+=1) { | |
results.push(testCases[i](NUM_ITERATIONS)) | |
} |
This file contains 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
// No need to sub class Array if what you need is just an extended | |
// array. Example below illustrates the way to extend Array. | |
function SubArray() { | |
return Object.defineProperties(Array.prototype.slice.call(arguments), SubArrayDescriptor) | |
} | |
SubArray.prototype = Array.prototype | |
var SubArrayDescriptor = | |
{ constructor: { value: SubArray } | |
, last: { value: function last() { |
This file contains 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 * as THREE from 'three' | |
export function isRenderItem(obj: THREE.Object3D): obj is THREE.RenderItem & THREE.Object3D { | |
return 'geometry' in obj && 'material' in obj | |
} | |
export function disposeMaterial(obj: THREE.Object3D): void { | |
if (!isRenderItem(obj)) return | |
// because obj.material can be a material or an array of materials |
This file contains 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
// ES7, async/await | |
function sleep(ms = 0) { | |
return new Promise(r => setTimeout(r, ms)); | |
} | |
(async () => { | |
console.log('a'); | |
await sleep(1000); | |
console.log('b'); | |
})() |
This file contains 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
// recursively deletes all properties within an `object` or `function` | |
// TODO option to also handle non-enumerable but configurable descriptors | |
function obliterate(obj: object) { | |
const visited = new WeakSet | |
_obliterate(obj) | |
async function _obliterate(obj) { | |
if (!obj || !(typeof obj === 'object' || typeof obj === 'function')) return |
This file contains 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
Remove osxfuse if installed via homebrew: | |
> brew uninstall osxfuse | |
Install osxfuse binary and choose to install the MacFUSE compatibility layer: | |
http://sourceforge.net/projects/osxfuse/files/latest/download?source=files | |
Reboot (optional but recommended by osxfuse) | |
Install ntfs-3g via homebrew: | |
> brew update && brew install ntfs-3g |
OlderNewer