View jquery.atwho.d.ts
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
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* |
View PromiseArray.js
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 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(); | |
} |
View gist:1102255
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
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(); |
View Search Current Site
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
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; |
View before-promisify.js
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
const fs = require('fs'); | |
function exists(f, callback) { | |
fs.stat(f, (err) => { | |
callback(err ? false : true); | |
}); | |
} | |
function main() { | |
const filename = './example.txt'; |
View after-promisify.js
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
const promisify = require('util').promisify; | |
const fs = require('fs'); | |
const stat = promisify(fs.stat); | |
const writeFile = promisify(fs.writeFile); | |
const appendFile = promisify(fs.appendFile); | |
async function exists(f) { | |
try { | |
const stats = await stat(f); | |
return true; |
View requirePromise.js
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
function requirePromise(modName, fnName) { | |
return require('util').promisify(require(modName)[fnName]); | |
} | |
const stat = requirePromise('fs', 'stat'); | |
const writeFile = requirePromise('fs', 'writeFile'); | |
const appendFile = requirePromise('fs', 'appendFile'); |
View web.config.xml
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
<system.web> | |
<httpCookies requireSSL="true" /> | |
</system.web> | |
<system.webServer> | |
<httpProtocol> | |
<customHeaders> | |
<add name="Strict-Transport-Security" value="max-age=31536000"/> | |
<add name="X-XSS-Protection" value="1; mode=block"/> | |
<add name="X-Content-Type-Options" value="nosniff"/> |
View 41705559.ts
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
type Opt = { id: string, name: string } | |
interface MultiProps { | |
isMultiple: true; | |
options: Opt[]; | |
id: string[]; | |
onChange: (id: string[]) => void; | |
} | |
interface SingleProps { |
View 49156502.ts
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
function isDate(obj: any): obj is Date { | |
return typeof obj === 'object' && 'toISOString' in obj; | |
} | |
function isString(obj: any): obj is string { | |
return typeof obj === 'string'; | |
} | |
interface JWT { | |
id: string; |
OlderNewer