Skip to content

Instantly share code, notes, and snippets.

@ThisIsntMyId
ThisIsntMyId / starship.toml
Last active February 4, 2023 08:44
starship config
format = '$all'
[username]
style_user = "green bold"
style_root = "red bold"
format = "[$user]($style) "
disabled = false
show_always = true
set number
set relativenumber
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set hlsearch
hi Search ctermbg=LightBlue
hi Search ctermfg=DarkGreen
set incsearch
@ThisIsntMyId
ThisIsntMyId / sam in gitbash
Created March 5, 2022 05:36
Aws sam not found in git bash
create alias in git bash (C:\Program Files\Git\etc\bash.bashrc)
open as admin
alias sam="/c/Program\ Files/Amazon/AWSSAMCLI/bin/sam.cmd"
sudo -u www-data cmd
sudo -u ubuntu cmd
sudo -u server cmd
sudo -u user cmd
mongoexport --uri="" --collection=collection_name --out=collection_name.json
mongoimport --uri="" --collection=collection_name --file=collection_name.json
mongodump --uri="" --collection=collection_name
mongorestore --uri="" --db=db_name --collection=collection_name dump/db_name/collection_name
ref: https://hashinteractive.com/blog/mongodump-and-mongorestore-vs-mongoexport-and-mongoimport/
@ThisIsntMyId
ThisIsntMyId / tmux-gen
Created February 5, 2022 12:09
tmux generator
#!/bin/sh
if [ -z "$1" ]
then
echo "No collection slug provided"
exit 1
fi
coll_slug=$1
# bash prompt
# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo " [${BRANCH}${STAT}]"
else
echo ""
@ThisIsntMyId
ThisIsntMyId / gist:fac3477a8852a0f91669c2fb57df23ce
Created September 13, 2021 20:42
image preview on upload
<img id="blah" alt="your image" width="100" height="100" />
<input type="file"
onchange="document.getElementById('blah').src = window.URL.createObjectURL(this.files[0])">
namespace App\Traits;
trait SelfReferenceTrait
{
protected $parentColumn = 'parent_id';
public function parent()
{
return $this->belongsTo(static::class);
@ThisIsntMyId
ThisIsntMyId / AppServiceProvider.php
Created March 14, 2021 19:28
Collections Paginate
<?php
namespace App\Providers;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider