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
// Stick this in the top of your main app.js/server.js/whatever file. | |
// Any time one of the below fs.* methods are called anywher in the app or dependencies, | |
// this code will log the details including the method, arguments, and a stack trace. | |
// It will then complete the write as normal. | |
var fs = require('fs'); | |
['write','writeSync','writeFile','writeFileSync', 'appendFile', 'appendFileSync','createWriteStream'].forEach(function(fn){ | |
fs['real'+fn] = fs[fn]; | |
fs[fn] = function() { | |
var e = new Error(); |
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
// buffers a stream of html untill it sees a charset meta tag (or opening <?xml tag with an encoding) | |
// then it creates an iconv-lite decoder for the charset and sends all data (the buffer and any future data) through it, emiting node.js-friendly utf8 | |
// if it cannot find a charset by the time the </head> tag is reached, it gives up and just calls .toString() on each chunk hoping that it's in a format that node.js can read | |
// based on iconv-lite's decodeStream | |
// todo: clean this up, add some tests, and stick it on npm | |
// == Decoder stream ======================================================= | |
function HTMLDecodeStream(options) { | |
this.buff = new Buffer([]); | |
this.isBuffering = true; |
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 fs = require('fs'); | |
var watson = require('watson-developer-cloud'); | |
var ogg = require('ogg'); | |
var opus = require('./opus_stream.js'); | |
var wav = require('wav'); | |
var Speaker = require('speaker'); | |
var oggDecoder = new ogg.Decoder(); |
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
[32minfo:[39m Welcome to DocPad v6.69.1 (local installation: c:\Users\IBM_ADMIN\watson-developer-cloud\node_modules\docpad) | |
[33mnotice:[39m If everyone who saw this message donated $1/week, maintaining DocPad would become sustainable: http://docpad.org/donate | |
[32minfo:[39m Contribute: http://docpad.org/docs/contribute | |
[32minfo:[39m Plugins: eco, minicms, mongodb | |
[32minfo:[39m Environment: development | |
[32minfo:[39m Watching setup starting... | |
[32minfo:[39m Watching setup | |
[31merror:[39m An error occured: | |
Error: The task [action runner ➞ watch] just completed, but it had already completed earlier, this is unexpected. State information is: | |
{ error: |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<p>Goal: <img src="http://sl-interview.s3.amazonaws.com/goal.png" style="max-width: 100%" /> </p> | |
<div id="popup"></div> |
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
// contrived example. This file uses 3 spaces for indentation | |
function doStuff() { | |
console.log("Stuff!"); | |
} |
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
<?xml version="1.0"?> | |
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> | |
<ShortName>Duck Duck Go + Google Suggest</ShortName> | |
<Description>Duck Duck Go + Google Suggest</Description> | |
<Image height="16" width="16" type="image/x-icon">http://duckduckgo.com/favicon.ico</Image> | |
<Url type="text/html" method="get" template="http://duckduckgo.com/?q={searchTerms}"/> | |
<Url type="application/x-suggestions+json" template="http://google.com/complete/search?output=firefox&q={searchTerms}&hl=da"/> | |
<Url rel="suggestions" type="application/x-suggestions+xml" template="http://google.com/complete/search?q={searchTerms}&client=ie8&mw={ie:maxWidth}&sh={ie:sectionHeight}&rh={ie:rowHeight}&inputencoding={inputEncoding}&outputencoding={outputEncoding}&hl=da" /> | |
</OpenSearchDescription> |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
// If you ask for a username before a pagename in the ?ids= Graph API, | |
// it looses the picture field for all pages. | |
// A few examples: | |
// http://graph.facebook.com/?ids=nfriedly&fields=picture,name works correctly: | |
{ | |
"nfriedly": { | |
"name": "Nathan Friedly", | |
"id": "215902661", |
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
FB.ApiServer.flash = function(b, e, c, d, a){ | |
if (!window.FB_OnXdHttpResult) window.FB_OnXdHttpResult = function(g, f) { | |
FB.ApiServer._callbacks[g](decodeURIComponent(f)); | |
}; | |
FB.Flash.onReady(function() { | |
if (b === 'graph') d.suppress_http_code = 1; | |
var h = FB.getDomain(b) + e, | |
f = FB.QS.encode(d); | |
if (c === 'get') { | |
if (h.length + f.length > 2000) { |
NewerOlder