Skip to content

Instantly share code, notes, and snippets.

View stefanzweifel's full-sized avatar
🎯
Focusing

Stefan Zweifel stefanzweifel

🎯
Focusing
View GitHub Profile
@stefanzweifel
stefanzweifel / fetch-github-repo-dependants.js
Created December 18, 2023 18:25
JavaScript function to cycle through the "Dependents" off a GitHub repository and create a collection of repos with the most stars.
function $$(selector, scope = document) {
return Array.from(scope.querySelectorAll(selector));
}
const stats = [];
const threshold = 100;
function processPage() {
let buttons = $$('a.btn');
let nextButton = buttons.find(function (button) {
@stefanzweifel
stefanzweifel / UseCarbonImmutableInAppServiceProviderRector.php
Created January 4, 2023 19:46
Rector Rule to enable ImmutableDates in Laravel by updating the AppServiceProvider
<?php
namespace App\Rector;
use PhpParser\Node;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Name\FullyQualified;
use PhpParser\Node\Stmt\ClassLike;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Expression;
@stefanzweifel
stefanzweifel / update-changelog-laravel.yaml
Created February 19, 2022 10:36
GitHub Actions workflow tailored to the workflow the Laravel org uses to release new versions of their projects.
name: "Update Changelog"
on:
release:
types: [released]
jobs:
update:
runs-on: ubuntu-latest
#!/bin/bash
set -e
# NOTE to create labels for your repo
# to support types from commit message guide (feat, fix, docs, style, refactor, test, chore)
# by hitting GitHub API v3
#
# https://developer.github.com/v3/issues/labels/#create-a-label
# https://gist.github.com/caspyin/2288960
@stefanzweifel
stefanzweifel / CustomParser.php
Created April 15, 2021 18:18
A Custom Markdown Parser for Jigsaw projects.
<?php
namespace App\Markdown;
use Illuminate\Container\Container;
use League\CommonMark\Block\Element\FencedCode;
use League\CommonMark\Block\Element\IndentedCode;
use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment;
use League\CommonMark\Extension\ExternalLink\ExternalLinkExtension;
@stefanzweifel
stefanzweifel / deploy.yml
Created April 12, 2021 11:05
A very very very simple approach to start a deployer deployment through GitHub Actions.
name: Deployment
on:
repository_dispatch:
types: ['deploy']
workflow_dispatch:
inputs:
deploy_host:
description: 'Environment'
required: true
@stefanzweifel
stefanzweifel / content-standards.yml
Created March 5, 2021 18:53
GitHub Actions workflow to run `alex`
name: "Content Standards"
on:
pull_request: null
push:
branches:
- "main"
jobs:
content-standards:
@stefanzweifel
stefanzweifel / composer.json
Created February 15, 2021 19:04
A PHP script to rename a collection of Zettelkasten notes into a different format. I've used this script to rename my notes, so that the timestamp/ID is always at the front.
{
"require": {
"illuminate/collections": "^8.26",
"illuminate/support": "^8.26",
"symfony/var-dumper": "^5.2"
}
}
@stefanzweifel
stefanzweifel / gist:67ee7d1d8942cc181b5019308910de38
Last active December 10, 2020 22:29
Paddle Ciphers for Laravel Forge
ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
@stefanzweifel
stefanzweifel / list-of-domains-hosted-on-forge.js
Last active March 3, 2020 14:49
Quick and dirty hack to get a list of all domains hosted on Forge. Run it in your browser console. You still have to manually remove the server name strings.
let domains = Array.from($('.nav-item')[1].children[1].children);
let domainList = domains.map(function (item) {
return item.textContent.replace(/(\r\n|\n|\r)/gm, "").trim();
});
console.table(domainList);