Hacking CORS restriction to enable in-browser XHR to any server.
Say you are running an web app at localhost, and you want to send XHR to http://remote-server:80
, but the CORS restriction forbids access because you are sending requests from an origin that remote-server:80 does not allow.
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
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
Aurum GNC | |
Boot | |
ok -> Welcome | |
emergency stop -> Emergency Stop | |
some event -> Workout | |
Welcome | |
Mode Selection | |
Workout | |
Exercise |
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
index.js | |
index.d.ts | |
example.js | |
example.d.ts | |
node_modules/ |
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 mongoose = require('../lib/mongoose') | |
mongoose.connect('mongodb://localhost/test'); | |
var Document = null, DocumentSchema = new mongoose.Schema({ | |
data: { type: String }, | |
}); | |
DocumentSchema.pre('init', function(next) { | |
console.log('pre-init: ' + JSON.stringify(this)); |
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
{ | |
"name": "playground", | |
"version": "0.0.0", | |
"description": "", | |
"main": "server.js", | |
"dependencies": { | |
"connect": "~2.11.0", | |
"connect-compiler": "~0.1.3", | |
"less": "~1.5.1", | |
"livereload": "~0.3.2" |
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
require 'mail' | |
class Jekyll::Post | |
alias :to_liquid_without_comments :to_liquid | |
def to_liquid | |
data = to_liquid_without_comments | |
data['comments'] = Comments::load(self) |
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
#!/usr/bin/env node | |
var chars = | |
[ 'abcdefghijklmnopqrstuvwxyz' | |
, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
, '1234567890' | |
, '~!@#$%^&*()_a+' | |
, '`-=' | |
, '[]{}o\'O",./<>?' | |
].join(); |
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 |
NewerOlder