Skip to content

Instantly share code, notes, and snippets.

@rishitells
rishitells / Jest_GitLab_CI.md
Last active October 16, 2025 10:06
Setting up Jest tests and coverage in GitLab CI

Configuring Jest Tests in GitLab CI

1. Add GitLab CI configuration file in the root

In the root of your project, add .gitlab-ci.yml with the configuration below.

image: node:latest

stages:
@normal-carrot
normal-carrot / Readme.md
Last active April 29, 2025 21:46
Docker + nginx-proxy + let's encrypt + watchtower + fail2ban

Complete solution for websites hosting

This gist contains example of how you can configure nginx reverse-proxy with autmatic container discovery, SSL certificates generation (using Let's Encrypt) and auto updates.

Features:

  • Automatically detect new containers and reconfigure nginx reverse-proxy
  • Automatically generate/update SSL certificates for all specified containers.
  • Watch for new docker images and update them.
  • Ban bots and hackers who are trying to bruteforce your website or do anything suspicious.
@RichardDillman
RichardDillman / getSlotsByRequestData
Last active May 27, 2020 11:04
Retrieve all slot data from performance.getEntries. Fire it once all the slots have been requested. If you page happens to have a LOT of network traffic. you may want to expand the number of entries allowed using the following script before the first GPT request. window.performance.setResourceTimingBufferSize(10000);
/**
* We collect this data from the performance entries instead of directly from GPT because the targeting
* can can change between requests. Pulling data from googletag after a refresh will only give you the
* cuurent state of GPT.
*/
(() => {
function getUrlParams(search) {
let hashes = search.split('&').filter(item => {
return /^enc_prev_ius|^iu_parts|^prev_iu_szs|^prev_scp|^cust_params|^correlator/.test(item);
@yhuard
yhuard / package.json
Created February 16, 2017 10:32
Browsersync proxy example
{
"name": "browsersync-proxy-example",
"version": "1.0.0",
"description": "",
"main": "proxy.js",
"scripts": {
"start": "node ./proxy.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
@dahjelle
dahjelle / pre-commit.sh
Created July 13, 2016 16:48
Pre-commit hook for eslint, linting *only* staged changes.
#!/bin/bash
for file in $(git diff --cached --name-only | grep -E '\.(js|jsx)$')
do
git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file" # we only want to lint the staged changes, not any un-staged changes
if [ $? -ne 0 ]; then
echo "ESLint failed on staged file '$file'. Please check your code and try again. You can run ESLint manually via npm run eslint."
exit 1 # exit with failure status
fi
done