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
| /** | |
| * dependencies | |
| */ | |
| var q = require('q'); | |
| /** | |
| * lib | |
| */ |
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 get_all_the_things(things) { | |
| var the_promises = []; | |
| for (var i = 0; i < things.length; i++) { | |
| (function(i) { // keep i in scope | |
| var deferred = Q.defer(); | |
| get_a_thing(things[i], function(result) { | |
| deferred.resolve(result); | |
| }); | |
| the_promises.push(deferred.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
| function tabname { | |
| printf "\e]1;$1\a" | |
| } | |
| if [ x`type -t cd` == "xfunction" ]; then | |
| # previously wrapped cd | |
| eval $(type cd | grep -v 'cd is a function' | sed 's/^cd/original_cd/' | sed 's/^}/;}/' ) | |
| else | |
| # builtin | |
| eval "original_cd() { builtin cd \$*; }" |
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 () { | |
| // this is the most important method. It creates a function | |
| // that uses either jQuery.ajax or node request() to do | |
| // async requests to the web. | |
| // | |
| // ThIS METHOD CREATES A FUNCTION DEPENDING ON THE ENVIRONMENT. | |
| // AFTER INITIALIZING EVERYTHINGZZ AMAZZIN' FAST!!!111einself |
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
| AppDotNet | |
| .getUser() | |
| ✓ returns a user object (827ms) | |
| ✓ returns an error when not authorized (730ms) | |
| .followUser() | |
| ✓ returns a user object (835ms) | |
| ✓ returns an error when not authorized (747ms) | |
| .unfollowUser() | |
| ✓ returns a user object (811ms) | |
| ✓ returns an error when not authorized (733ms) |
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 code = req.query.code, body = 'client_id=&client_secret=&grant_type=authorization_code&redirect_uri=https://localhost:3000/callback&code=' + code | |
| options = { | |
| method: 'POST', | |
| uri: 'https://alpha.app.net/oauth/access_token', | |
| form: body | |
| }; | |
| request.post(options, function (err, res, body) { | |
| console.log(body); | |
| }); |
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
| !!! 5 | |
| html | |
| head | |
| meta(charset='utf-8') | |
| title jadepreview | |
| body | |
| h1 jadepreview | |
| h2 | |
| | Converts | |
| a(href='http://jade-lang.com/') jade templates |
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
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>notifications</title> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
| <script> | |
| $(function () { | |
| if (window.webkitNotifications) { | |
| console.log('Notifications are supported!'); |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>floating search</title> | |
| <style> | |
| *:focus { | |
| outline: 0; | |
| } | |
| * { |
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
| // this should work and give us 1 to 5 | |
| var Step = function (steps) { | |
| // this only works with arrays, @todo better check | |
| if (typeof steps !== 'object') { | |
| return; | |
| } | |
| var currentStep = 0, lastStep = steps.length; | |