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
// Create an error (normally you don't do that, but a try-catch :)) | |
var e = new Error(); | |
// Add a lineNumber and fileName property to the error in case there is none. | |
if (e.stack){ // Chrome has the "stack" property, but it's a rough string, parse out the lineNo and fileName. | |
var match = e.stack.split("\n")[1].match(/.*(http(s)?:\/\/.*):(\d+):(\d+)/); | |
if (match.length==5){ e.lineNumber = match[3]; e.fileName = match[1]; } | |
} else if (e.line && e.sourceURL){ // Safari has those | |
e.lineNumber = e.line; e.fileName = e.sourceURL; | |
} |
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
// This is a macro for the IDE Komodo http://www.activestate.com/komodo-edit | |
var s = ko.views.manager.currentView.scimoz; | |
// If nothing was selected use {} ... dont know if useful, but we will see. | |
s.replaceSel("JSON.stringify("+ (s.selText || "{}") +")"); |
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
me@localhost:~> find /Applications/ -iname *.plist | wc -l | |
6660 | |
me@localhost:~> node -e "require('child_process').exec('find /Applications/ -iname *.plist', function(_, stdout){ console.log(stdout.split('\n').length) })" | |
1806 | |
// Why does the same find ran on the cmdline return a different number than when used via exec in node? | |
// Found the bug | |
// This works: |
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
var dict = new Dictionary; | |
dict[runTests] = true; | |
var isFirstRun = true; | |
for (var key in dict) { | |
trace('key = ' + key); | |
if (isFirstRun) { | |
dict[this] = true; | |
isFirstRun = false; | |
} | |
delete dict[key]; |
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
var dict = new Dictionary; | |
dict[flash.display.ActionScriptVersion] = true; | |
var isFirstRun = true; | |
for (var key in dict) { | |
trace('key = ' + key); | |
if (isFirstRun) { | |
dict[flash.display.AVM1Movie] = true; | |
isFirstRun = false; | |
} | |
delete dict[key]; |
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
/* | |
imho this shows that dictionary keys are sorted (even in the case of a namespace, as here flash.display | |
there is an order, alphabetcially it seems) and the keys are walked, | |
and if a key that is at the very first position (of that internal order) is added while iterating, | |
it gets NOT visited in the looping. | |
This is bad, i guess that is a bug in the ActionScript runtime. | |
It seems there is some comparison that breaks when it's index is 0 ... | |
let me know if I am wrong |
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
var async = require('async'); | |
async.parallel([ | |
function(callback){ | |
callback(null, 'one'); | |
}, | |
function(callback){ | |
setTimeout(function() {callback(new Error('ONE'));}, 0); | |
}, | |
function(callback){ |
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
var movieConfig = { | |
width: 550, | |
height: 400, | |
plugins: [ | |
'//cdn.pixelplant.com/as3shim-latest.min.js', | |
'//cdn.pixelplant.com/as3vm-latest.min.js', | |
'//cdn.pixelplant.com/transwf-runtime-latest.min.js' | |
], | |
pluginDebug: false, | |
urls: ['movie.js'], |
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
// inside app.js | |
export class App {} | |
// inside domUtil.js | |
import jQuery from 'jquery' // comes from the node_modules directory | |
export var domUtil = {} | |
// inside another file | |
import {App} from './app' | |
import {domUtil as domStuff} from './domUtil' |
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
module.exports = { | |
entry: './src/main', | |
module: { | |
loaders: [ | |
// Transpile any JavaScript file: | |
{ test: /\.js$/, loader: 'webpack-traceur?runtime&sourceMaps&experimental' } | |
] | |
}, | |
resolve: { | |
// you can now require('file') instead of require('file.js') |
OlderNewer