Skip to content

Instantly share code, notes, and snippets.

View cbaconnier's full-sized avatar
🍜
hungry

Clément Baconnier cbaconnier

🍜
hungry
View GitHub Profile
[user]
email = clement@baconnier.ch
name = Clément Baconnier
[alias]
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
recent-branches = "!git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)' | nl -w2 -s'> ' "
r = "!f() { git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)' | awk -v var=\"$1\" 'NR==var' | xargs git checkout ; }; f"
pushf = push --force-with-lease
recent-branches = "!git for-each-ref --count=30 --sort=-committerdate refs/heads/ --format='%(refname:short)' | nl -w2 -s'> ' "
@cbaconnier
cbaconnier / .bash_aliases
Created February 26, 2024 16:11
vapor-confirmation
vapor () {
local VAPOR_PATH=~/.config/composer/vendor/bin/vapor
if [[ "$*" == *"production"* ]]; then
/bin/echo -n "Enter \"${PWD##*/}\" to confirm: "
read answer
if [ "$answer" = ${PWD##*/} ]; then
$VAPOR_PATH "$@"
else
echo "Failed"
fi
@cbaconnier
cbaconnier / toggle-theme.sh
Last active September 26, 2023 11:35
Toggle theme
#!/bin/bash
CURRENT_COLOR_SCHEME=$(gsettings get org.gnome.desktop.interface color-scheme)
if [ "$CURRENT_COLOR_SCHEME" = "'prefer-dark'" ]; then
THEME="light"
GTK_THEME="Adwaita"
TERMINAL_THEME="solarized-light"
else
THEME="dark"
@cbaconnier
cbaconnier / dmenu_phpstorm.sh
Created July 7, 2022 08:32
Open recent PhpStorm projects with dmenu
#!/bin/bash
LATEST_PHPSTORM_VERSION=$(ls -dt $HOME/.config/JetBrains/PhpStorm* | head -1)
RECENT_PROJECTS_PATH="${LATEST_PHPSTORM_VERSION}/options/recentProjects.xml"
OLD_PATH='\$USER_HOME\$'
NEW_PATH=$(echo "${HOME}" | sed -e 's/\//\\\//g')
SELECTED_PROJECT="$( xmllint --xpath '//entry/@key' $RECENT_PROJECTS_PATH | sed -E "s/${OLD_PATH}/${NEW_PATH}/" | awk -F\" '{ print $2 }' | tac | dmenu -p 'PhpStorm projects' )"
import Sortable from '@shopify/draggable/lib/sortable'
if (typeof window.livewire === 'undefined') {
throw 'Livewire Sortable Plugin: window.livewire is undefined. Make sure @livewireScripts is placed above this script include'
}
window.livewire.directive('sortable-group', (el, directive, component) => {
if (directive.modifiers.includes('item-group')) {
// This will take care of new items added from Livewire during runtime.
el.closest('[wire\\:sortable-group]').livewire_sortable.addContainer(el)
@cbaconnier
cbaconnier / Login.php
Last active June 9, 2020 13:49
Livewire Login
<?php
namespace App\Livewire\Auth;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Http\Request;
use Livewire\Component;
class Login extends Component
@cbaconnier
cbaconnier / Flash.php
Last active February 14, 2020 22:19
Livewire flash component
<?php
namespace App\Components;
use Livewire\Component;
class Flash extends Component
{
public $message = '';
@cbaconnier
cbaconnier / SoundManager.js
Last active November 11, 2016 16:34
Sound Manager for Pixi.js using Howler
/*
* Will not work as expected
* Please refer to this: https://github.com/sharbelfs/pixi-game-template/issues/1
*/
import { utils, loader } from 'pixi.js'
import { Howler, Howl } from 'howler'
// import * as ResourceLoader from 'resource-loader'
class SoundManager extends utils.EventEmitter {