Skip to content

Instantly share code, notes, and snippets.

View rickdaalhuizen90's full-sized avatar

Rick Daalhuizen rickdaalhuizen90

  • Belgium
View GitHub Profile
@rickdaalhuizen90
rickdaalhuizen90 / nginx.conf
Created September 15, 2024 13:22
Nginx Configuration with FastCGI Caching enabled
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=PHP_CACHE:200m max_size=10g inactive=2h use_temp_path=off;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
upstream backend {
server php-fpm:9000;
}
server {
listen 80;
@rickdaalhuizen90
rickdaalhuizen90 / .env.example
Created December 27, 2023 20:04
Generate a commit message using the OpenAI GPT-3 API
OPENAI_API_KEY="<YOUR_SECRET_KEY>"
OPENAI_ENDPOINT="https://api.openai.com/v1/chat/completions"
@rickdaalhuizen90
rickdaalhuizen90 / App.svelte
Last active December 30, 2021 22:00
Calendar heatmap
<section>
<h3>Uptime</h3>
<p>Overview of site uptime</p>
<div id="heatmap"></div>
</section>
<script>
import {onMount} from 'svelte';
import matrix from 'calendar-matrix';
@rickdaalhuizen90
rickdaalhuizen90 / client.php
Last active September 26, 2023 17:17
PHP OAuth client for Magento 2 REST API
<?php
/*
* OAuth 1.0a client (Example) for Magento 2
*
* @see: https://oauth.net/core/1.0a
* @see: https://tools.ietf.org/html/rfc5849
*/
class Api
{
const OAUTH_VERSION = '1.0';
@rickdaalhuizen90
rickdaalhuizen90 / script.php
Last active June 15, 2024 17:00
PHP script that removes duplicate fields in a csv
<?php
if ($argc < 2) {
exit('Error: No CSV file provided. Example usage: php script.php input.csv' . PHP_EOL);
}
if (pathinfo($argv[1], PATHINFO_EXTENSION) !== 'csv') {
exit('Error: Provided file is not a CSV.' . PHP_EOL);
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body {
font-family: sans-serif;
font-size: 1.3em;
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Vue</title>
<script src="https://unpkg.com/vue"></script>
<style id="jsbin-css">
.dashboard {
display: flex;
flex-direction: row;
width: 100%;
#!/bin/sh
echo "Deleting old publication"
rm -rf public
mkdir public
git worktree prune
rm -rf .git/worktrees/public/
echo "Checking out gh-pages branch into public"
git worktree add -B gh-pages public origin/gh-pages
@rickdaalhuizen90
rickdaalhuizen90 / Foo.php
Created January 28, 2018 16:40
Example of parsing arguments in php cli
<?php
class Hash
{
protected $string;
protected $hash;
/**
* Init arguments
@rickdaalhuizen90
rickdaalhuizen90 / permutations.rb
Created November 22, 2017 10:21
Find all the possible permutations using Ruby and recursion Ask
# https://stackoverflow.com/questions/25224321/find-all-the-possible-permutations-using-ruby-and-recursion
$letters = "prtsone"
# Make permutations from letters
def permutation(string)
return [string] if string.size < 2
ch = string[0]
permutation(string[1..-1]).each_with_object([]) do |perm, result|
(0..perm.size).each { |i| result << perm.dup.insert(i,ch) }