Skip to content

Instantly share code, notes, and snippets.

@real34
real34 / load-test.sh
Last active November 30, 2020 09:57 — forked from bigomega/load-test.sh
A simple bash script to do load (performance) testing of a web service
max="$1"
date
echo "url: $2
rate: $max calls / second"
START=$(date +%s);
get () {
curl -s -o /dev/null -w %{http_code} --max-time 3 "$1" 2>&1 | tr '\r\n' '\\n' | awk -v date="$(date +'%r')" '{print $0"\n-----", date}' >> /tmp/perf-test.log
}
// Created with https://checklyhq.com/docs/puppeteer-recorder/
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
const navigationPromise = page.waitForNavigation()
await page.goto('https://demo.front-commerce.com/')
import React, { useState } from "react";
import logo from "./logo.svg";
import "./App.css";
function App() {
const [counter, setCounter] = useState(0);
const increment = () => setCounter(counter + 1);
const decrement = () => setCounter(counter - 1);
{
product(sku:"LOW-310589") {
name
imageUrl
giftMessageAvailable
sku
brand
terrangAdvice
isBuyableOnline
additionalInformation {
@real34
real34 / front_commerce-magento_2_url.json
Created May 23, 2017 06:37
Pact specification for retrieving urls from a headless Magento2 (custom module)
{
"consumer": {
"name": "Front Commerce"
},
"provider": {
"name": "Magento 2 Url"
},
"interactions": [
{
"description": "A find request for entity with type category and id 6",
@real34
real34 / FakeAddressRepository.php
Last active May 2, 2017 19:44
Magento2 Fakes implementation built step by step to support our tests. (Context: https://mobile.twitter.com/fschmengler/status/859473111984590848)
<?php
namespace Terrang\Fluxs\Test\Fake\Repository;
use Magento\Framework\Exception\NoSuchEntityException;
class FakeAddressRepository implements \Magento\Customer\Api\AddressRepositoryInterface
{
private $db = [];

Voici comme promis les docs pour Magento 1 afin de comprendre les différentes parties.

TL;DR

Le site https://magentotherightway.com/ reprend de manière assez concise un gros ensemble de bonnes pratiques.

Je pense que à froid cela vous semblera cryptique, mais je vous invite à vous mettre un rappel (par exemple toutes les 2 semaines) pour relire rapidement les différentes sections.

/*
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Content-Security-Policy: script-src 'self' https://apis.google.com
/css/main.css
Cache-Control: public max-age=31536000
/app.js
Cache-Control: public max-age=31536000
@real34
real34 / plugins.php
Last active March 22, 2017 05:37
Magento2 plugin
<?php
function displayAndConvert($input) {
display($input);
return strtoupper($input);
}
// displayAndConvert('foo') -> display('foo') -> return 'FOO'
function beforeDisplayAndConvert($input) {
return $input . ' - With before';
}