Skip to content

Instantly share code, notes, and snippets.

View sandervanhooft's full-sized avatar

Sander van Hooft sandervanhooft

View GitHub Profile
@bahadiraraz
bahadiraraz / Git_Commit_Freeze_Solution.md
Last active April 18, 2025 15:06
Git Commit Freeze Due to GPG Lock Issues (Solution)

Git Commit Freeze Due to GPG Lock Issues

If you encounter a problem where you cannot commit changes in Git – neither through the terminal nor via the GitHub Desktop application – the issue might be a freeze during the Git commit process. This is often caused by GPG lock issues. Below is a concise and step-by-step guide to resolve this problem.

Solution Steps

1. Check for GPG Lock Messages

Open your terminal and try to perform a GPG operation (like signing a test message). If you see repeated messages like gpg: waiting for lock (held by [process_id]) ..., it indicates a lock issue.

@mpociot
mpociot / README.md
Last active April 5, 2025 13:09
A Scriptable widget to show the upcoming Laracon talks

Laracon Scriptable Widget

Usage

  1. Install and download the free Scriptable app on your iOS device.
  2. Inside the app, press the "Plus" icon to create a new script
  3. Paste the content of the JS file into the script
  4. Place a Scriptable widget on your home screen
@webdevmatics
webdevmatics / Multiform.php
Last active January 6, 2022 12:51
Livewire multiform #livewire
<?php
namespace App\Http\Livewire;
use App\Customer;
use Livewire\Component;
class Multiform extends Component
{
public $name;
@sandervanhooft
sandervanhooft / CanAssertFlash.php
Last active January 27, 2020 18:01
Assert flash for Laracasts/flash
<?php
namespace Tests;
trait CanAssertFlash
{
protected function assertFlash($level, $message, $important = false, $title = null, $overlay = false)
{
$expectedNotification = [
'title' => $title,
@gilbitron
gilbitron / ApiController.php
Last active July 21, 2020 01:05
ApiController Template for Laravel Spark
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
abstract class ApiController extends Controller
@gaejabong
gaejabong / laracast-theme.icls
Created January 31, 2016 12:32
Laracast theme updated
<scheme name="laracasts-theme-updated" version="142" parent_scheme="Default">
<option name="LINE_SPACING" value="1.7" />
<option name="EDITOR_FONT_SIZE" value="15" />
<option name="CONSOLE_FONT_NAME" value="Menlo" />
<option name="CONSOLE_FONT_SIZE" value="10" />
<option name="CONSOLE_LINE_SPACING" value="1.4" />
<option name="EDITOR_FONT_NAME" value="Menlo" />
<colors>
<option name="ADDED_LINES_COLOR" value="292d38" />
<option name="ANNOTATIONS_COLOR" value="8b999f" />
@RadGH
RadGH / short-number-format.php
Last active February 25, 2025 21:33
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@mudge
mudge / EachCons.php
Created July 17, 2014 14:32
Iterate over an array as a sliding window of element pairs.
<?php
$a = array(1, 2, 3);
$pairs = array_map(null, $a, array_slice($a, 1));
/**
* Prints:
* (1,2)(2, 3)(3, )
*/
foreach ($pairs as list($x, $y)) {
echo "({$x}, {$y})";
@trey
trey / happy_git_on_osx.md
Last active March 10, 2025 23:53
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "[email protected]"

@victorbstan
victorbstan / php_object_to_array.php
Created December 17, 2010 04:18
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);