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
var Crawler = require("crawler"); | |
var map = require("lodash.map"); | |
var chalk = require('chalk'); | |
var errorStyle = chalk.bold.red; | |
var successStyle = chalk.bold.green; | |
var errors = []; | |
var c = new Crawler({ | |
rateLimit: 200, |
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 pipe = (...funcs) => seed => { | |
return funcs.reduce( (acc, func) => { | |
return func(acc); | |
}, seed); | |
} | |
const reverseWord = (val) => { | |
return val.split("").reverse().join(''); | |
}; |
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 Person = function(name) { | |
this.name = name; // set instance property | |
} | |
// Define "shared" methods on prototype property | |
Person.prototype.greet = function() { | |
console.log(`Hello ${this.name}!`); | |
} | |
const dave = new Person('David'); |
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
class Appliance { | |
turnOn() { | |
console.log(this.type + " now online"); | |
} | |
} | |
class Oven extends Appliance { | |
constructor() { | |
this.type = "Oven"; | |
} |
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
var lastScrollY = 0; | |
var ticking = false; | |
var windowMiddle = $(window).height()/2; | |
var scrollCallback = function scrollCallback(e) { | |
var elementClosestToMiddle = _this.findElementClosestToMiddle(elements, { | |
windowMiddle: windowMiddle | |
}); |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
javascript:(function()%7Bdocument.querySelector('body').setAttribute('contenteditable'%2C true)%7D)() |
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
/** | |
* Force GFORM Scripts inline next to Form Output | |
* | |
* force the script tags inline next to the form. This allows | |
* us to regex them out each time the form is rendered. | |
* | |
* see strip_inline_gform_scripts() function below | |
* which implements the required regex | |
*/ | |
function force_gform_inline_scripts() { |
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
/** | |
* Output Buffered Load Template Part | |
* loads a given template part using output buffering | |
* optionally including $data to be passed into template | |
*/ | |
function ob_load_template_part( $template_name, $data ) { | |
// Optionally provided an assoc array of data to pass to tempalte | |
// and it will be extracted into variables |
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::macro('selectRangeWithDefault', function($name, $start, $end, $selected = null, $default = null, $attributes = []) | |
{ | |
if ( is_null($default) ) { | |
return Form::selectRange($name, $start, $end, $selected, $attributes); | |
} | |
$range = array_combine($range = range($start, $end), $range); | |
$range = [null => $default] + $range; | |