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 script lets you export all heroku config vars | |
// 1) Go to your app settings and reveal config vars | |
// 2) Open the console and run this code: | |
// BONUS: You can add this script as a bookmark. | |
function download(filename, text) { | |
var element = document.createElement('a'); | |
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); | |
element.setAttribute('download', filename); |
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 print(str) { | |
document.getElementById('resultzone').innerHTML += `<br><b>${JSON.stringify(str)}</b>`; | |
} | |
const seperateNumbers = function(arr) { | |
const evenNumbers = []; | |
const oddNumbers = []; | |
for (let i = 0; i < arr.length; i++) { | |
(arr[i] % 2 === 0) ? evenNumbers.push(arr[i]) : oddNumbers.push(arr[i]); |
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 n = Nightmare({ | |
switches: { 'ignore-certificate-errors': true, 'force-device-scale-factor': options.scale ? options.scale.toString() : '1' }, | |
show: typeof options.show === 'boolean' ? options.show : true, | |
width: options.width || 1280, | |
height: options.height || 720 | |
}); | |
n | |
.viewport(options.width || 1280, options.height || 720) |
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 = { | |
/** | |
* | |
* Using raw socket.io functionality from a Sails.js controller | |
* | |
*/ | |
index: function (req,res) { |
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
facebookAuth: function(req, res) { | |
//You need to add the fb signup button in the frontend, and post the token that you got from facebook to the backend. | |
if (_.isUndefined(req.param('facebookToken'))) { | |
return res.json({ | |
success: false, | |
msg: 'Please log in using your facebook account' | |
}); | |
} | |
// Get information about the Facebook user with the specified access token. |