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
| mymodel.findOne({ | |
| 'user': this.req.user, | |
| }, function(err, data){ | |
| doSomethingWithData(data, function(err, data){ | |
| doSomethingWithELSEWithData(data, function(err, data){ | |
| doSomethingMOREWithData(data, function(err, data){ | |
| haveAnaneurysm(data, function(err, data){ | |
| //die |
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 getTweets (req, res) { | |
| var d = Q.defer(); | |
| T.get('statuses/user_timeline', {screen_name: 'petetasker', count: 2}, function (err, data, response) { | |
| if (err) { | |
| var error = new Error('Something went wrong trying to get Tweets'); | |
| error.innerError = err; | |
| throw error; |
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 authenticate() { | |
| return getUsername() | |
| .then(function (username) { | |
| return getUser(username); | |
| }) | |
| // chained because we will not need the user name in the next event | |
| .then(function (user) { | |
| return getPassword() | |
| // nested because we need both user and password next | |
| .then(function (password) { |
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 tweets = { | |
| /** | |
| * | |
| * Responsible for running the call to Twitter API | |
| * | |
| * @param err | |
| * @param result | |
| * @returns {*} | |
| */ |
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
| doTwitterCall: function (extraArg, err, result) { | |
| //MOAR code here etc. | |
| //extraArg is available here with a value of 'foo' | |
| //return result | |
| }, | |
| getResults: function (err, result) { |
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
| git diff --diff-filter=D --name-only -z | xargs -0 git rm |
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
| sudo setsebool -P httpd_unified 1 |
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 monthArray = []; | |
| for(var i in monthly){ | |
| var month = monthly[i].split('-')[1]; | |
| monthArray.push(months[month]); | |
| } | |
| currStartMonth = monthly[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
| //Do this first! | |
| window.open("about:blank", "sharer"); | |
| var params = {...} | |
| ajaxFunction(function (data) { | |
| var url = 'http://google.ca'; | |
| //Refer to the original window here... | |
| var w = window.open(url, 'sharer'); |
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
| //All the contact forms from Jetpack have the .contact-form class. This _should_ match all of them on a page and work correctly. | |
| $(".contact-form").on('submit', function (e) { | |
| //Wrapper for our form fields to submit via ajax | |
| var formData = {}; | |
| var contact_form_id = $(this).find('input[name=contact-form-id]').val(); | |
| //Get our form fields here. New fields can be added here as well. | |
| formData['g' + contact_form_id + '-name'] = $('input[name=g' + contact_form_id + '-name]').val(); |