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
| // This doesn't work.... | |
| define("a/b/c", function () { | |
| // return something.... | |
| }); | |
| var mod = require("a/b/c"); | |
| // This does work... |
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
| <html> | |
| <script src="./lib/require.js"></script> | |
| <script> | |
| require.config({ | |
| paths : { | |
| //create alias to plugins (not needed if plugins are on the baseUrl) | |
| async: 'src/async', | |
| goog: 'src/goog', | |
| propertyParser : 'src/propertyParser' | |
| } |
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
| // Register for custom events | |
| document.addEventListener("oncustom", function () { | |
| console.log("fired!"); | |
| }); | |
| // Createcustom DOM events and fire | |
| var evt = document.createEvent("Event"); | |
| evt.initEvent("oncustom", true, true); | |
| document.dispatchEvent(evt) |
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 fs = require('fs'), | |
| jsdom = require("jsdom").jsdom, | |
| document = jsdom("<html><head></head><body></body></html>"), | |
| window = document.createWindow(); | |
| // Fix window objects in global scope. | |
| global.document = document; | |
| global.navigator = window.navigator; | |
| global.window = window; |
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 profile = (function(){ | |
| return { | |
| layerOptimize: "closure", | |
| releaseDir: "../../../release", | |
| packages:[{ | |
| name:"dojo", | |
| location:"../../../dojo" | |
| }], |
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
| input { | |
| stdin { | |
| type => "stdin-type" | |
| } | |
| tcp { | |
| port => 5000 | |
| type => syslog | |
| } | |
| udp { | |
| port => 5000 |
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
| call plug#begin('~/.vim/plugged') | |
| Plug 'tpope/vim-sensible' | |
| Plug 'tpope/vim-fugitive' | |
| Plug 'altercation/vim-colors-solarized' | |
| Plug 'scrooloose/syntastic' | |
| Plug 'scrooloose/nerdtree' | |
| Plug 'kien/ctrlp.vim' | |
| Plug 'bling/vim-airline' | |
| Plug 'jelera/vim-javascript-syntax' |
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 express = require('express') | |
| var bodyParser = require('body-parser') | |
| var app = express() | |
| app.use(bodyParser.json()) | |
| app.use(bodyParser.urlencoded()) | |
| var requests = [] | |
| var store_request = function (req) { | |
| requests.push({ |
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 iterations = 0 | |
| var print_board = function (columns) { | |
| var n = columns.length, row = 0, col = 0 | |
| while (row < n) { | |
| while (col < n) { | |
| process.stdout.write(columns[row] === col ? 'Q ' : '# ') | |
| col++ | |
| } |
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 vm = require('vm'); | |
| var Debug = vm.runInDebugContext('Debug'); | |
| Debug.setListener(function (event, exec_state) { | |
| if (event !== Debug.DebugEvent.Break) return; | |
| try { | |
| console.log(exec_state.frame(0).evaluate('inner')) | |
| } catch (err) { | |
| console.log(err) | |
| } |
OlderNewer