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
const puppeteer = require('puppeteer'); | |
/************************************************** | |
SETUP CLASS USING PROXYS FOR PUPPETEER | |
***************************************************/ | |
class CustomPage { |
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
/*=========================================== | |
assertion function | |
=============================================*/ | |
function test(str, bool) { | |
console.log( | |
bool ? '\x1b[32m' : '\x1b[31m', | |
bool ? '[PASS]' : ' [FAIL]', | |
str | |
) | |
} |
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
<?php | |
# Help | |
php -h; | |
# PHP ini file | |
php -i; | |
# Filter files | |
php -i | grep "memory"; |
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
// Form response processor set session token | |
app.formResponseProcessor = function(formId,requestPayload,responsePayload){ | |
var functionToCall = false; | |
// If account creation was successful, try to immediately log the user in | |
if(formId == 'accountCreate'){ | |
// Take the phone and password, and use it to log the user in | |
var newPayload = { | |
'phone' : requestPayload.phone, | |
'password' : requestPayload.password | |
}; |
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
// AJAX Client (for RESTful API) | |
app.client = {} | |
// Interface for making API calls | |
app.client.request = function(headers,path,method,queryStringObject,payload,callback){ | |
// Set defaults | |
headers = typeof(headers) == 'object' && headers !== null ? headers : {}; | |
path = typeof(path) == 'string' ? path : '/'; | |
method = typeof(method) == 'string' && ['POST','GET','PUT','DELETE'].indexOf(method.toUpperCase()) > -1 ? method.toUpperCase() : 'GET'; |
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
// Bind the forms | |
app.bindForms = function(){ | |
if(document.querySelector("form")){ | |
var allForms = document.querySelectorAll("form"); | |
for(var i = 0; i < allForms.length; i++){ | |
allForms[i].addEventListener("submit", function(e){ | |
// Stop it from submitting | |
e.preventDefault(); |
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
# GET VERSION | |
npm -v (or --version) | |
# GET HELP | |
npm help | |
npm | |
# CREATE PACKAGE.JSON | |
npm init | |
npm init -y (or --yes) |
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
/* | |
Create a function that sums two arguments together. If only one argument is provided, then return a function that expects | |
one argument and returns the sum. | |
For example, addTogether(2, 3) should return 5, and addTogether(2) should return a function. | |
Calling this returned function with a single argument will then return the sum: | |
var sumTwoAnd = addTogether(2); |
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
/* | |
Check if the predicate (second argument) is truthy on all elements of a collection (first argument). | |
Remember, you can access object properties through either dot notation or [] notation. | |
*/ | |
function truthCheck(collection, pre) { | |
return collection.every(function(key) { | |
return key[pre]; | |
}); |
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
/* | |
Return an English translated sentence of the passed binary string. | |
The binary string will be space separated. | |
*/ | |
function binaryAgent(str) { | |
str = str.split(' '); | |
var convertedBinary = ''; | |
for (var i in str) { |