Skip to content

Instantly share code, notes, and snippets.

View darkmavis1980's full-sized avatar
🎯
Focusing

Alessio Michelini darkmavis1980

🎯
Focusing
View GitHub Profile
@darkmavis1980
darkmavis1980 / git-aliases
Created April 25, 2018 22:27
Git aliases
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd)%Creset %C(bold blue)<%an>%Creset' --date=relative"
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br "branch -vv"
git config --global alias.fa "fetch --all -p"
@darkmavis1980
darkmavis1980 / composer-install
Created May 11, 2018 10:56
Composer Install with no platform requirements
composer install --ignore-platform-reqs
@darkmavis1980
darkmavis1980 / purge_files_from_history
Created May 23, 2018 11:41
Remove node_modules folder from git
# Found it here: https://stackoverflow.com/questions/10067848/remove-folder-and-its-contents-from-git-githubs-history
# Saved this gist as some people really don't understand that you don't have to put node_modules in your bloody repository
git filter-branch --tree-filter 'rm -rf node_modules' --prune-empty HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
echo node_modules/ >> .gitignore
git add .gitignore
git commit -m 'Removing node_modules from git history'
git gc
git push origin master --force
@darkmavis1980
darkmavis1980 / electron-install
Created May 30, 2018 10:59
Install electron globally
sudo npm install electron -g --verbose --unsafe-perm=true
@darkmavis1980
darkmavis1980 / composer-starter.php
Created June 7, 2018 12:36
Load packages with namespaces installed with Composer
<?php
require 'vendor/autoload.php';
use Namespace\For\Your\Package\Classname;
$a = new Classname();
$b = $a->someMethod();
?>
@darkmavis1980
darkmavis1980 / force-git-push
Last active July 5, 2018 15:51
Force git push
// When somebody fucked up the repo big time and the pre-hook fails without giving you an error, run this
git push --force --no-verify origin master
// or shorter
git push -f --no-verify origin master
@darkmavis1980
darkmavis1980 / launch.json
Last active July 13, 2018 08:35
Xdebug with VS Code & Vagrant
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"log": true,
"pathMappings": {
@darkmavis1980
darkmavis1980 / input.html
Created August 16, 2018 14:49
Placeholder move on focus
<!--
# found here https://stackoverflow.com/questions/35942247/how-to-move-placeholder-to-top-on-focus-and-while-typing
-->
<h1>The floating label</h1>
<div class="user-input-wrp">
<br/>
<input type="text" class="inputText" required/>
<span class="floating-label">Your email address</span>
</div>
@darkmavis1980
darkmavis1980 / input.html
Last active August 16, 2018 15:32
Placeholder move on focus
<h1>The floating label</h1>
<div class="input-wrapper">
<input type="text" name="email" required/>
<label>Your email address</label>
</div>
@darkmavis1980
darkmavis1980 / listdir.py
Last active September 20, 2018 15:34
Simple python test script to retrieve the files of the current directory
import os
path = os.curdir
files = os.listdir(path)
for file in files:
if os.path.isfile(path + file):
filesize = os.path.getsize(path + file)
print(f'- {file} - {filesize} Bytes')
else: