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
// JSON | |
const data = await (await fetch('/my-url')).json(); | |
// Post | |
await fetch('/my-url', { method: 'POST', body: data }); | |
// Request | |
try { | |
const resp = await fetch('/my-url'); | |
// ... |
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
// works on selected text | |
var selection = window.getSelection().toString(); | |
if (selection) { | |
selection = selection.match(/[^\r\n]+/g) | |
.map(function(a) { return "* " + a; }). | |
join("\n"); | |
prompt("Here's your markdown:", selection); | |
} |
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
function hello(name) { | |
if (typeof name === 'undefined') { | |
name = 'World'; | |
} | |
return `Hello ${name}`; | |
} | |
console.log(hello()); | |
console.log(hello("Brian")); |
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
(function($){ | |
$.widget("ui.mywidget", { | |
options: { | |
autoOpen: true | |
}, | |
_create: function(){ | |
// by default, consider this thing closed. |