Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env node
console.log("Hello")
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind v split-window -h
bind s split-window -v
unbind '"'
unbind %
@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
# 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 ""
<VirtualHost 127.0.0.1>
DocumentRoot "D:/Projects/EnFeed/user/user-dashboard/public"
ServerName user.enfeed.com
<Directory "D:/Projects/EnFeed/user/user-dashboard/public">
Options FollowSymLinks Indexes ExecCGI
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
namespace App\Traits;
trait SelfReferenceTrait
{
protected $parentColumn = 'parent_id';
public function parent()
{
return $this->belongsTo(static::class);
@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])">
@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
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/
sudo -u www-data cmd
sudo -u ubuntu cmd
sudo -u server cmd
sudo -u user cmd