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 createObserverPattern = () => { | |
let observers = []; | |
let register = (observer) => { | |
observers.push(observer); | |
} | |
let deregister = (observer) => { | |
observers = observers.filter((registeredObserver) => !Object.is(observer, registeredObserver)) | |
} | |
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 getProxyExample = (initialObject = {}) => { | |
const buildProxyClosure = () => { | |
let data = {}; | |
let proxyHandler = { | |
get(obj, prop) { | |
return prop in data ? data[prop] : obj[prop]; | |
}, | |
set(obj, prop, value) { | |
data[prop] = value; | |
} |
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
query Input { | |
discountNode { | |
metafield(namespace: "my-discount-namespace", key: "my-discount-amount") { | |
value | |
} | |
} | |
cart { | |
lines { | |
merchandise { | |
__typename |
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
// run from within app web/ directory, presumes the sqlite db file is named "database.sqlite" (default for template) | |
const DB_FILE_PATH = './database.sqlite'; | |
const getAccessToken = async () => { | |
return new Promise((resolve, reject) => { | |
import('sqlite3').then((sqlite) => { | |
const db = new sqlite.default.Database(DB_FILE_PATH); | |
db.serialize(() => { | |
db.get('SELECT accessToken FROM shopify_sessions LIMIT 1;', [], (err, { accessToken }) => { |
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
import socket | |
import select | |
if __name__ == "__main__": | |
# Get socket file descriptor as a TCP socket using the IPv4 address family | |
listener_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
# Set some modes on the socket, not required but it's nice for our uses | |
listener_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
address_port = ("127.0.0.1", 8080) |
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 warden_ngrok () { | |
network_name=$(docker network ls --filter name=$1 --format '{{.Name}}') | |
nginx_name=$(docker ps --filter name=$1_nginx --format '{{.Names}}') | |
docker run --rm -it --link $nginx_name --net $network_name wernight/ngrok ngrok http $nginx_name:80 | |
} | |
# Example: "myapp" is WARDEN_ENV_NAME from .env | |
warden_ngrok myapp |
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
# add to ~/.bashrc and run . ~/.bashrc or open a new terminal window | |
function m2config () { | |
ssh -C $1 'php -d include_path='\''/var/www/stage/current:/var/www/html/current:/var/www/prod/current'\'' -r '\''$c = include "app/etc/env.php"; echo json_encode($c);'\''' | jq -r .$2 | |
} | |
# usage | |
m2config www-stage@stage.mysite.com db.connection.default.username # returns db username from env.php |
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
# on VM | |
sudo su | |
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch | |
touch /etc/yum.repos.d/elasticsearch.repo | |
echo "[elasticsearch-6.x] | |
name=Elasticsearch repository for 6.x packages | |
baseurl=https://artifacts.elastic.co/packages/6.x/yum | |
gpgcheck=1 |
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
diff --git a/vendor/magento/module-payment/Block/Transparent/Redirect.php b/vendor/magento/module-payment/Block/Transparent/Redirect.php | |
new file mode 100644 | |
index 00000000000..aeaeee7e4d2 | |
--- /dev/null | |
+++ b/vendor/magento/module-payment/Block/Transparent/Redirect.php | |
@@ -0,0 +1,60 @@ | |
+<?php | |
+/** | |
+ * Copyright © Magento, Inc. All rights reserved. | |
+ * See COPYING.txt for license details. |
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
>>> mr dev:console | |
$state = $di->get(\Magento\Framework\App\State::class); | |
$state->setAreaCode('frontend'); | |
$redis = $di->get(\Magento\Framework\Session\SaveHandler\Redis::class); | |
$sessionData = $redis->read("<session id without 'sess_' prefix"); | |
# fully decode like PHP | |
session_start(); | |
session_decode($sessionData); | |
var_dump($_SESSION); |
NewerOlder