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
| //format into name style case formatting | |
| _.str.capitalize('chris') | |
| => "Chris" | |
| //Compress white space | |
| _.clean(" foo bar ") | |
| => 'foo bar' | |
| //Swaps the case of the string | |
| _.swapCase('hELLO') |
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 Twit = require('twit'); | |
| var T = new Twit({ | |
| consumer_key: 'j7e73ODaTmBLCjTebVuLyQ' | |
| , consumer_secret: '********************************' | |
| , access_token: '1952367470-wId4DkQc10jexSuUgg73Xo29Fjo53yCtc3Mzzkf' | |
| , access_token_secret: '********************************' | |
| }); |
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
| console.log("Posting Tweet"); | |
| var statusUpdate = 'Testing Status: ' + new Date().getTime(); | |
| T.post('statuses/update', { status: statusUpdate }, function(err, reply) { | |
| if (err) { | |
| console.dir(err); | |
| } else { | |
| console.dir(reply); | |
| } | |
| }); |
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
| console.log("Reading in the last 10 tweets with search: belfast"); | |
| T.get('search/tweets', { q: 'belfast', count: 10 }, function(err, reply) { | |
| if (err) { | |
| console.dir(err); | |
| } else { | |
| for (var i = 0; i < reply.statuses.length; i++) { | |
| var status = reply.statuses[i]; | |
| console.log('*************************'); | |
| console.log(' username: ' + status.user.name); | |
| console.log(' ' + status.text); |
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
| describe("Main Server Tests", function() { | |
| var request = require('request'); | |
| it("should respond with hello world", function(done) { | |
| request("http://localhost:3000/hello", function(error, response, body){ | |
| expect(body).toEqual("Hello World"); | |
| done(); | |
| }); | |
| }); |
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
| module.exports = function(grunt) { | |
| // Project configuration. | |
| grunt.initConfig({ | |
| pkg: grunt.file.readJSON('package.json'), | |
| jasmine_node: { | |
| matchall: true, // load only specs containing specNameMatcher | |
| projectRoot: ".", | |
| requirejs: false, | |
| forceExit: true, | |
| jUnit: { |
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 emptyMap = {}; | |
| var key = 'toString'; | |
| emptyMap[key] == undefined; // outputs false when it should be true |
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 map = Object.create(null); | |
| var key = 'toString'; | |
| map[key] == undefined; //outputs true as expected |
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
| describe('Login', function() { | |
| beforeEach(function() { | |
| // Browse to index page | |
| browser.get('/'); | |
| }); | |
| it('should provide login button', function() { | |
| expect(element('a[href="#/login"]').getText()).toEqual("Login"); | |
| }) |
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 array = []; | |
| for (var i = 0; i < 100; i++) { | |
| array.push(i); | |
| } | |
| console.time('loop ++i'); | |
| for(var i = 0; i < array.length; ++i) { | |
| var a = array[i]; | |
| } | |
| console.timeEnd('loop ++i'); |
OlderNewer