Skip to content

Instantly share code, notes, and snippets.

View Scarbous's full-sized avatar
🧐

Sascha Heilmeier Scarbous

🧐
  • netlogix GmbH & Co. KG
  • Germany
View GitHub Profile
@tippexs
tippexs / Readme.md
Last active January 19, 2022 08:26
njs 0.7.0

NGINX JavaScript Module (njs) 0.7.0 just arrived!

I am super excited about this new release! On October 19th 2021 NGINX launched the latest version of NGINX njs 0.7.0.

This represents a significant step forward for njs and introduces highly anticipated features and functionality including support for the ECMAScript6 (ES6) feature async/await and the implementation of the webcrypto API. In this post, we’ll explore these aspects in more detail, starting with async/await and Promises. Once these concepts are understood, we’ll then dig into the webcrypto functionality.

Let’s get started!

JavaScript 101 - Promises

@shankerwangmiao
shankerwangmiao / Rsync proxy for nginx
Last active December 6, 2023 13:54
Rsync proxy for nginx
Rsync proxy for nginx
@toan-tam
toan-tam / .magento.app.yaml-build-hook
Last active May 5, 2022 08:05
.magento.app.yaml build hook
# We run build hooks before your application has been packaged.
build: |
set -e
echo "\n================================== Install and configure Baler - Start =================================="
echo "================= Install and configure Baler - Upgrade node version 14.4.0 - Start ================="
unset NPM_CONFIG_PREFIX
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | dash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
@runlevel5
runlevel5 / nginx_njs_environment_variables.md
Last active February 28, 2024 09:17
Using njs to fetch environment variables

There are many ways to parse in variable into the nginx config file. Some uses set_by_lua which is offered by lua-nginx-module. Some use envstubst to populate varilabes into a template file.

Today I am going to show you how to do that with njs the JS scripting engine for nginx.

## /etc/nginx/fetch_env.js
function fetch_upstream_host(r) {
 return process.env.UPSTREAM_HOST;
@Potherca
Potherca / README.md
Last active January 17, 2024 00:30
Feature Toggles in PHP

If you look on Packagist, [the most popular packages][1] for [Feature toggles][2] are:

  1. qandidate/toggle "Feature toggling for your PHP application." (⬇️ 496.754 / ⭐ 362)
  2. opensoft/rollout "Feature switches or flags for PHP" (⬇️ 354.269 / ⭐ 215)
  3. flagception/flagception "Feature toggle on steroids." (⬇️ 139 265 / ⭐ 24)
  4. joshuaestes/feature-toggle "Provides feature toggle functionality" (⬇️ 61.736 / ⭐ 32)
  5. zumba/swivel "Strategy driven feature toggles" (⬇️ 49.954 / ⭐ 211)

Downloads Stars

@leek
leek / _Magento2_DeleteTestData.md
Last active July 25, 2024 12:46
Magento 2 - Delete All Test Data

These set of scripts are for Magento 2. For Magento 1, see this Gist.

@hideya
hideya / flex-wrap-anim.js
Last active April 25, 2023 05:49
CSS Flex Wrap Animation (code assumes no change in items except xy coords): https://codepen.io/hideya/pen/Jamabx
window.addEventListener('load', function(event) {
var targetClassName = 'flex-wrap-anim';
var defaultDuration = '0.3s';
var dummyList = [];
function addDummy(item, duration) {
var top = item.offsetTop;
var left = item.offsetLeft;
setTimeout(function() {
item.style.position = 'absolute';
@soyuka
soyuka / OperationPathResolver.php
Created May 15, 2018 13:24
Workflow bridge for api platform
<?php
declare(strict_types=1);
namespace ApiPlatform\Workflow\PathResolver;
use ApiPlatform\Core\PathResolver\OperationPathResolverInterface;
final class OperationPathResolver implements OperationPathResolverInterface
{
@eyecatchup
eyecatchup / powermailtracking.js
Last active November 19, 2021 06:30
Universal event tracking solution for TYPO3 Powermail XHR submissions.
// Universal event tracking for TYPO3 Powermail XHR submissions.
//
// Note: As of version 4.2.0, Powermail sends a custom event on submit;
// see https://github.com/einpraegsam/powermail/blob/develop/Documentation/Faq/Index.rst#how-can-i-add-a-callback-function-on-ajax-submit
document.addEventListener("DOMContentLoaded", function(event) {
// Step 1
// Attach an onsubmit handler to all powermail ajax forms, which will
// make the powermail form id available in the window object on submit.
var forms = document.querySelectorAll('form');
for (var i in forms) {
@htuscher
htuscher / .gitlab-ci.yml
Created August 3, 2017 08:12
Deploying with docker-compose via SSH tunnel in Gitlab CI
deploy:live:
image: 1drop/docker:git
stage: deploy
when: manual
environment:
name: production
url: https://www.somecustomer.de
before_script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")