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'); | |
function exists(f, callback) { | |
fs.stat(f, (err) => { | |
callback(err ? false : true); | |
}); | |
} | |
function main() { | |
const filename = './example.txt'; |
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 toMarkdown(doc) { | |
let s = '| '; | |
let thead = doc.querySelector('thead'); | |
let headcells = thead.querySelectorAll('td'); | |
for (let i = 0; i < headcells.length; i++) { | |
let cell = headcells[i]; | |
s += cell.textContent.trim() + ' | '; | |
} |
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
interface JQueryAtWhoOptions<T> { | |
// key char for observing such as `@` | |
at?: string; | |
/* | |
alias name of `at` | |
it would be an id attribute of the popup view. | |
*/ | |
alias?: string; | |
/* | |
should be a plain object *Array* or a *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
var promiseArray = []; | |
function foo(i) { | |
var def = $.Deferred(); | |
// This line represents some async code: ajax, setTimeout, etc | |
setTimeout(function() {def.resolve(i); }, i); | |
// Return the promise which may not be resolved yet | |
return def.promise(); | |
} |
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
javascript:var%20u%20=%20document.URL;%20%20var%20a%20=%20u.split("://");%20var%20protocol%20=%20a[0];%20var%20temp%20=%20a[1];%20%20a%20=%20temp.split("/");%20var%20fullDomain%20=%20a[0];%20var%20theRest%20=%20a[1];%20%20var%20q%20=%20window.prompt("Search%20"+fullDomain+"%20for:%20","");%20q%20=%20q.replace("%20",%20"+");%20document.location%20=%20"http://www.google.com/search?btnG=1&pws=0&q=site%3A"+fullDomain+"+"+q; |
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
javascript:var friends = document.getElementsByClassName('fbChatOrderedList')[1].getElementsByClassName('item'); for (var i=0;i<friends.length; i++) { if (friends[i].className != "item active") friends[i].style.display = "none"; } ChatSidebar.toggle(); ChatSidebar.toggle(); |
NewerOlder