Skip to content

Instantly share code, notes, and snippets.

View RianFuro's full-sized avatar

Florian Proksch RianFuro

  • PROMETA GmbH
  • Austria
View GitHub Profile
@RianFuro
RianFuro / hibernate-repository.sh
Created April 30, 2023 16:30
Strip down a repository to just it's bare minimum remote tracking information, to reduce the size on disk as much as possible.
#!/bin/sh
# Create inactive branch with empty working directory
git checkout --orphan inactive
git reset --hard
git commit --allow-empty -m 'Configured to save space. Use `git pull && git checkout master` to get back to work!'
# Remove all other branches
git branch | grep -v "^*" | xargs git branch -D
@RianFuro
RianFuro / BladeCompiler.php
Last active September 13, 2021 08:54
Extend the `<x-slot>` and `@slot` directives for laravel's blade engine with scoping capabilities
<?php
class BladeCompiler extends \Illuminate\View\Compilers\BladeCompiler
{
static array $slotStack = [];
/**
* Compile the component tags.
*
* @param string $value
@RianFuro
RianFuro / #svelte-https.md
Last active December 29, 2020 21:56
Serve svelte app over https for development environments.

What to do to serve your svelte app over https for development purposes.

Note that this generates a self-signed certificate, which your browser WILL warn you about. For non-production uses, this is perfectly acceptable though.

live reload

You might need to add the generated certificate to your browsers, so the live reload request is not blocked by your browser. Or grab the live reload request form the debugging console and add the exception manually.

For firefox: https://javorszky.co.uk/2019/11/06/get-firefox-to-trust-your-self-signed-certificates/#solve-the-self-signed-cert-thing

@RianFuro
RianFuro / IsolatedHostingExtensions.cs
Created November 6, 2018 18:34
IsolatedMap from AspNet.Hosting.Extensions module split up into Add...() and Use...() functions to facilitate starting HostedServices from the isolated containers.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Builder.Internal;
using Microsoft.AspNetCore.Hosting.Internal;
using Microsoft.AspNetCore.Http;
@RianFuro
RianFuro / array-objects-assign.js
Created October 12, 2018 09:18
One important difference between Object.assign and the object spread operator for arrays in javascript
const arr = [1, 2, 3]
console.log({...arr, newKey: "I'm new!"}) // { '0': 1, '1': 2, '2': 3, newKey: "I'm new!" }
console.log(Object.assign(arr, {newKey: "I'm new!"})) // [ 1, 2, 3, newKey: "I'm new!" ]
@RianFuro
RianFuro / pomodoro.sh
Created March 1, 2017 19:09
Wrapping timewarrior with a pomodoro timer
#!/bin/sh
if [[ "$1" == "--minutes="* ]]; then
MINUTES="${1#--minutes=}"; shift
elif [[ "$1" == "-m"* ]]; then
MINUTES="${1#-m}"; shift
if [ "$MINUTES" == "" ]; then
MINUTES="${1}"; shift
fi
fi
### Keybase proof
I hereby claim:
* I am rianfuro on github.
* I am rianfuro (https://keybase.io/rianfuro) on keybase.
* I have a public key ASCI2EHIiNE-Dm1O-Pj1txu2MWC-ZpaiAx5nNlBv7zLfbwo
To claim this, I am signing this object:
@RianFuro
RianFuro / wrapping.js
Created December 11, 2016 19:44
Playing around with ES6 proxies to implement object access wrapping losely based on pythons decorator functionality (@before, @after)
function getAllFuncs(obj) {
var props = [],
orig = obj;
do {
props = props.concat(Object.getOwnPropertyNames(obj));
} while ((obj = Object.getPrototypeOf(obj)) && obj != Object.prototype);
return props.sort().filter(function(e, i, arr) {
if (e!=arr[i+1] && typeof orig[e] == 'function' && e != 'constructor') return true;