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
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
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
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
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
var myImage = 'someimage.jpg'; | |
fetch(myImage) | |
.then(response => response.blob()) //To extract the image body content from the response, we use the blob() method | |
.then(myBlob => { | |
// An objectURL is then created from the extracted Blob, which is then inserted into the img. | |
const objectURL = URL.createObjectURL(myBlob); | |
myImage.src = objectURL; | |
}); |
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
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^source-domain.com [NC,OR] | |
RewriteCond %{HTTP_HOST} ^www.source-domain.com [NC] | |
RewriteRule ^(.*)$ https://target-domain.com/$1?source=sourcedomain [L,R=302,NC] |
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()%7B(async%20function()%20%7Bconst%20video%20%3D%20document.querySelector('video')%3Bif(!video)%20%7Balert(%22No%20video%20element%20found%20on%20page%22)%3B%7Dif%20(video%20!%3D%3D%20document.pictureInPictureElement)%20%7Bawait%20video.requestPictureInPicture()%3B%7D%20else%20%7Bawait%20document.exitPictureInPicture()%3B%7D%7D())%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
(function() { | |
let _takingTooLongTimeout; | |
const alarmSound = new Audio("https://archive.org/download/alarm_162/alarm.ogg"); | |
const startVideo = () => { | |
document.querySelector("video").play(); | |
}; | |
const stopVideo = () => { | |
document.querySelector("video").pause(); |
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
<!-- wp:group {"paddingSize":"default","marginSize":"default"} --> | |
<div class="wp-block-group"><div class="wp-block-group__inner-container"><!-- wp:heading --> | |
<h2>paddingDefault/marginDefault</h2> | |
<!-- /wp:heading --> | |
<!-- wp:paragraph --> | |
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
<!-- /wp:paragraph --></div></div> | |
<!-- /wp:group --> |