Skip to content

Instantly share code, notes, and snippets.

View ethanstenis's full-sized avatar

Ethan Stenis ethanstenis

View GitHub Profile
@ethanstenis
ethanstenis / gist:cc6c2f6e85598a83ed6d0348fb1325e6
Created August 22, 2017 19:20
Pluralsight Analytics: Query Strings
?ps_debug=true
// Add to URL and reload page - shows all analytics events being captured by the Data Layer in the console.
&ps_debug=true
// same query string except that it is not be used first.
analytics.debug();
analytics.debug(false);
@ethanstenis
ethanstenis / KATA: My Head is at the Wrong End!
Created July 17, 2017 16:17
This is the solution to Codewars' Kata: My head is at the wrong end.
function fixTheMeerkat(arr) {
var end = arr.shift();
var begin = arr.pop();
arr.push(end);
arr.unshift(begin);
return arr;
}
@ethanstenis
ethanstenis / KATA: Do I get a bonus?
Created July 17, 2017 16:34
This is the solution to Codewars' KATA: Do I get a bonus?
function bonusTime(salary, bonus) {
if(bonus === true){
return '£' + salary * 10;
} else {
return '£' + salary;
}
}
@ethanstenis
ethanstenis / KATA: Square(n)Sum
Created July 17, 2017 16:51
This is the solution to Codewars' KATA: Square(n)Sum
function squareSum(numbers){
var total = 0;
for(var i = 0; i < numbers.length; i++) {
total += numbers[i] * numbers[i];
}
return total;
@ethanstenis
ethanstenis / KATA: Basic Mathematical Operations
Created July 17, 2017 16:25
This is the solution to Codewars' KATA: Basical Mathematical Operations
function basicOp(operation, value1, value2)
{
if (operation === '+') {
return value1 + value2;
} else if(operation === '-') {
return value1 - value2;
} else if(operation === '*') {
return value1 * value2;
} else if(operation === '/'){
return value1/value2;
@ethanstenis
ethanstenis / Postman POST PUT Requests.txt
Last active September 13, 2023 01:11
How to make Postman work with POST/PUT requests in Laravel...
To make Postman work with POST/PUT requests...
https://laravel.com/docs/5.2/routing#csrf-x-csrf-token
In addition to checking for the CSRF token as a POST parameter, the Laravel VerifyCsrfToken middleware will also check for the X-CSRF-TOKEN request header.
1. Store the token in a "meta" tag at the top of your root view file (layouts/app.blade.php)...
<meta name="csrf-token" content="{{ csrf_token() }}">
** If using jQuery, you can now instruct it to include the token in all request headers.
$.ajaxSetup({