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
# My translation from javascript | |
def encode(message, offset): | |
baseChars = list('abcdefghijklmnopqrstuvwxyz') | |
messageChars = list(message) | |
for i in range(len(messageChars)): | |
baseIndex = baseChars.index(messageChars[i]) | |
messageChars[i] = baseChars[(baseIndex + offset) % len(baseChars)] | |
return(''.join(messageChars)) |
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
// Observes an element and fires callback when element is updated with a given class. | |
// If the element already contains that class callback is immediately without creating | |
// the mutation observer. This is useful for observing dom modifications by a third party. | |
function awaitClass (elem, elemClass, callback) { | |
let observer = new MutationObserver(function (mutationList) { | |
mutationList.forEach(function (mutation) { | |
if ( | |
mutation.attributeName === 'class' && | |
mutation.target.classList.contains(elemClass) |
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
/** | |
* Expects html attribute of 'data-bgset' with a json object as it's content. | |
* bgset='{"desktop_image":"desktop.jpg","mobile_image":"mobile.jpg"}' | |
*/ | |
document.addEventListener('lazybeforeunveil', function(e) { | |
var attribute = e.target.getAttribute('data-bgset'), | |
backgrounds = attribute ? JSON.parse(attribute) : null; | |
function loadBackground () { | |
e.target.style.backgroundImage = window.innerWidth >= 768 ? |
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
window.konamify = function (cb) { | |
var k = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13], i = 0; | |
window.addEventListener('keydown', function (e) { | |
i = (e.keyCode === k[i]) ? i + 1 : 0; | |
if (i === k.length) cb(); | |
}); | |
}; |
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
<?php | |
namespace Vendor\Module\Plugin\Catalog\Model; | |
class Config | |
{ | |
public function afterGetAttributeUsedForSortByArray( | |
\Magento\Catalog\Model\Config $catalogConfig, | |
$options | |
) { |
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
const gulp = require('gulp') | |
const connect = require('gulp-connect') | |
const sass = require('gulp-sass') | |
/** | |
* Paths to source files... | |
*/ | |
const htmlPath = './public/' | |
const scssPath = './scss/' | |
const scssOutput = './.tmp/css' |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<textarea value="150" name="" id="" cols="50" rows="1"></textarea> |
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
{"environment":"rh-api-live","version":"1.2.488.211","rhendpoint":"https://www.retailhubservices.com/RetailHub-2.1.14","data":[{"name":"Abbey Road Dlr","code":"ZAL","nlc":"0750","isfgw":false,"isgroup":false,"isalias":false,"tod":false},{"name":"Abbey Wood","code":"ABW","nlc":"5131","isfgw":false,"isgroup":false,"isalias":false,"tod":true},{"name":"Aber","code":"ABE","nlc":"3813","isfgw":false,"isgroup":false,"isalias":false,"tod":true},{"name":"Abercynon","code":"ACY","nlc":"3801","isfgw":false,"isgroup":false,"isalias":false,"tod":false},{"name":"Aberdare","code":"ABA","nlc":"3982","isfgw":false,"isgroup":false,"isalias":false,"tod":true},{"name":"Aberdeen","code":"ABD","nlc":"8976","isfgw":false,"isgroup":false,"isalias":false,"tod":true},{"name":"Aberdour","code":"AUR","nlc":"9090","isfgw":false,"isgroup":false,"isalias":false,"tod":true},{"name":"Aberdovey","code":"AVY","nlc":"4435","isfgw":false,"isgroup":false,"isalias":false,"tod":false},{"name":"Abererch","code":"ABH","nlc":"4440","isfgw":false,"isgr |
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
// Single line comment | |
/* Multi- | |
line comment */ | |
// A package clause starts every source file. | |
// Main is a special name declaring an executable rather than a library. | |
package main | |
// Import declaration declares library packages referenced in this file. |