Skip to content

Instantly share code, notes, and snippets.

View chistel's full-sized avatar
:octocat:

Chistel chistel

:octocat:
  • PC
View GitHub Profile
@chistel
chistel / i18nextLanguageJson.ts
Created May 15, 2024 02:04 — forked from SimeonC/i18nextLanguageJson.ts
Using Webpack code-split "backend" for i18next translations. Note that your withTranslations/useTranslations must use namespaces or include a default namespace or the read function doesn't get called
// Used for one JSON file for each language containing all namespaces
i18next.use({
type: 'backend',
read<Namespace extends keyof typeof en>(
language: LocaleCode,
namespace: Namespace,
callback: (
errorValue: unknown,
translations: null | typeof en[Namespace]
) => void
@chistel
chistel / cwv-report-to-slack-gas.js
Created January 10, 2024 09:01 — forked from herablog/cwv-report-to-slack-gas.js
CWV (Core Web Vitals) Report to Slack with CrUX API
/**
* This is an example code for Google App Script
* You can run this script with time-driven triggers
* @see https://developers.google.com/apps-script/guides/triggers/installable#time-driven_triggers
*/
// Settings
const CRUX_ORIGINS = []; // e.g. https://example.com
const CRUX_METRICS = ['first_input_delay', 'largest_contentful_paint', 'cumulative_layout_shift']; // first_contentful_paint, first_input_delay, largest_contentful_paint, cumulative_layout_shift
const CRUX_FORM_FACTOR = ['PHONE', 'DESKTOP']; // ALL_FORM_FACTORS, PHONE, DESKTOP, TABLET
@chistel
chistel / QueueRetryAllCommand.php
Created November 16, 2023 06:06 — forked from vitorbari/QueueRetryAllCommand.php
Laravel 4.2 Queue Retry All Command
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
class QueueRetryAllCommand extends Command
{
/**
* The console command name.

Github action for creating the release from a tag

Create file .github/workflows/create-release-from-a-tag.yml with the content:

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - 'release*' # Push events to matching release*, i.e. release-1.0, release-20.15.10, release-2020-10-28-10-26-15

name: Create Release
@chistel
chistel / cloudfront.sh
Created October 31, 2023 14:13 — forked from ahmed-abdelazim/cloudfront.sh
Bash script to update coudfront origin using aws cli
#!/bin/bash
CLOUDFRONT_DISTRIBUTION_ID=E2C3RNL2F4MRMQ
NEW_ORIGIN="origin2-zaid.s3.us-west-2.amazonaws.com"
ETAG=`aws cloudfront get-distribution --id $CLOUDFRONT_DISTRIBUTION_ID | jq -r .ETag`
aws cloudfront get-distribution --id $CLOUDFRONT_DISTRIBUTION_ID | \
jq --arg NEW_ORIGIN "$NEW_ORIGIN" '.Distribution.DistributionConfig.Origins.Items[0].Id=$NEW_ORIGIN' | \
jq --arg NEW_ORIGIN "$NEW_ORIGIN" '.Distribution.DistributionConfig.Origins.Items[0].DomainName=$NEW_ORIGIN' | \
jq --arg NEW_ORIGIN "$NEW_ORIGIN" '.Distribution.DistributionConfig.DefaultCacheBehavior.TargetOriginId=$NEW_ORIGIN' | \
jq .Distribution.DistributionConfig > config.json
aws cloudfront update-distribution --id $CLOUDFRONT_DISTRIBUTION_ID --distribution-config "file://config.json" --if-match $ETAG > /dev/null
@chistel
chistel / wildcard-ssl-certificate.md
Created October 29, 2023 08:57 — forked from talyguryn/wildcard-ssl-certificate.md
How to get a wildcard ssl certificate and set up Nginx.

How to get and install a wildcard SSL certificate

In this guide you can find how to resolve the following issues.

Feel free to ask any questions in the comments section below.

@chistel
chistel / wildcard-ssl-certificate.md
Created September 30, 2023 07:06 — forked from utek/wildcard-ssl-certificate.md
How to get a wildcard ssl certificate and set up Nginx.

Request a new certificate

Get certbot

Go to any directory and clone repo with sources.

cd ~
git clone https://github.com/certbot/certbot
@chistel
chistel / bootstrap-sail.sh
Created September 2, 2023 14:08 — forked from njbair/bootstrap-sail.sh
Install Laravel Sail into an existing project without PHP & Composer
#!/bin/sh
# Installs Laravel Sail into an existing project
# The official Laravel Sail docs[1] provide instructions for installing Sail
# into an existing PHP application. But the official method requires invoking
# Composer locally. Part of Sail's appeal is that it removes the need to
# install PHP on your host machine.
# This script is lifted from laravel.build[2], and thus uses the same method
@chistel
chistel / github-workflow-lint-test-laravel-private-package.yaml
Created August 20, 2023 21:31 — forked from alistaircol/github-workflow-lint-test-laravel-private-package.yaml
GitHub Workflow - Laravel Unit Feature Test Private Repository Package Code Coverage Generation Artifact
---
name: GitHub Workflow - Laravel Unit Feature Test Private Repository Package Code Coverage Generation Artifact
on:
push:
branches:
- main
pull_request:
branches:
- main
@chistel
chistel / AppServiceProvider.php
Created March 18, 2023 11:21 — forked from wmandai/AppServiceProvider.php
Laravel, Livewire, Alpine JS Toast Notifications
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Component::macro('notify', function ($message, $title = '', $type = 'success') {
$this->dispatchBrowserEvent('notify', ['message' => $message, 'title' => $title, 'type' => $type]);
});