- yes,
cross-originincludes different port numbers. to the IT students everyone pulling their hair out because twolocalhosts on your machine can't talk to each other: we salute you. - what is a simple request?
- one of [
GET,HEAD,POST] -- no side effects. - the ONLY manual (ie, not added by the browser) headers allowed are:
AcceptAccept-Language
- one of [
Content-Language
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 fs = require('fs'); // the node file system package | |
| const path = require('path'); | |
| // Usage: | |
| // node file_tree.js name_of_folder_to_get_files_from | |
| // node file_tree.js | |
| // Either a passed-in-folder name (process.argv[2]) | |
| // or default to the current working directory | |
| const folder = process.argv[2] || process.cwd(); |
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
| [ | |
| ["xqBt3ImNzJbYqRINxEFlkg==", "K7DJLdLooIwIG/MOpvWFB3y3FE8="], | |
| ["AQIDBAUGBwgJCgsMDQ4PEC==", "OfS0wDaT5NoxF2gqm7Zj2YtetzM="], | |
| ["dGhlIHNhbXBsZSBub25jZQ==", "s3pPLMBiTxaQ9kYGzzhZRbK+xOo="], | |
| ["bLqBK0TPRX06acXKoTMg0w==", "PUOv+s9LKpmD8Eqd/JHHU3/0+ts="], | |
| ["cGtZLupHO2Ng7bTySyqJAg==", "7PZjZ/xia21YsFgao3D7dGKk/nk="], | |
| ["T3CQ1QBhwQU+ART28dF1lg==", "nVnvAbc8RUGnQU+7M+SrTTBmXlA="], | |
| ["A4soB7HbG+RDb/0K4pOfQQ==", "6hlHUdFX8bFPzGrYhEd5DrkgeZY="], | |
| ["IUe1bWHff0Oe6/6Kwz0S7g==", "YNvyb2r1JRBDCxcvgvbpZwMinqA="], | |
| ["ZcifuDaMvDry71n+ffJZIQ==", "yk/8ZCjP66vVy8oQz50cxQofOWc="], |
The functions included are for generating the base64-encode of a sha1 hash of the input string sent in as an argument.
This is the mechanism for processing something to be used as the header for either the Sec-WebSocket-Key request header or Sec-WebSocket-Accept response header in the websocket opening handshake.
To generate the Sec-WebSocket-Key, you would use generateRandomBase64String; for the matching Sec-WebSocket-Accept header value, you would use base64EncodeOfSha1Hash(keyConcatenatedWithMagicString).
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
| #!/bin/bash | |
| table_to_check_references_to='table_name' | |
| database_name='dbname' | |
| query=$(cat <<SQL | |
| SELECT | |
| table_constraints.table_schema, | |
| table_constraints.constraint_name, | |
| table_constraints.table_name, |
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
Show hidden characters
| { | |
| "compilerOptions": { | |
| /* Basic Options */ | |
| "target": "es5", | |
| "module": "commonjs", | |
| // "lib": [], | |
| // "allowJs": true, | |
| // "checkJs": true, | |
| // "jsx": "preserve", | |
| // "declaration": true, |
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
| { | |
| "keysAsKeyboard": [ | |
| [ | |
| "~ ! @ # $ % ^ & * ( ) _ +", | |
| "` 1 2 3 4 5 6 7 8 9 0 - =" | |
| ], | |
| [ | |
| "Q W E R T Y U I O P { } |", | |
| "q w e r t y u i o p [ ] \\" | |
| ], |
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
| /* | |
| Some languages, like Elixir, have sigils -- things that often look like a ~, a letter, and then some delimiters | |
| with a string between them. | |
| One handy one is: `~w` -- in Elixir, you can look it up in the Kernel as `sigil_w`. | |
| */ | |
| // this is a one-liner of the function in the earlier file | |
| const basicTag = (slots, ...values) => slots.map((slot, index) => [slot, values[index]].join('')).join(''); | |
| function w(pieces, ...values) { |
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
| class SuperClass { | |
| nonarrow() { | |
| console.log('nonarrow', 'superclass'); | |
| } | |
| arrow = () => { | |
| console.log('arrow', 'superclass'); | |
| } | |
| } |
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 sortByKeysLegibly = maybeObject => { | |
| // presumably we want the array to stay ordered. Possibly not, but if there is | |
| // anything that should preserve order, it's an array | |
| if (maybeObject instanceof Array) { | |
| return maybeObject; | |
| } | |
| // don't sort strings etc | |
| if (typeof maybeObject !== 'object') { | |
| return maybeObject; |