Skip to content

Instantly share code, notes, and snippets.

@adibhanna
adibhanna / tmux.conf
Last active March 16, 2024 17:03
Tmux config
#--------------------------------------------------------------------------
# Configuration
#--------------------------------------------------------------------------
# Use Vi mode
setw -g mode-keys vi
# Increase scrollback buffer size
set -g history-limit 10000
<?php
namespace App\Repositories;
class Repository
{
/**
* The model instance.
*
@adibhanna
adibhanna / docker-cleanup-resources.md
Created April 2, 2019 05:40 — forked from dreamuth/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@adibhanna
adibhanna / filter_by_july.php
Last active May 23, 2018 23:46
Software Developer
return array_filter($data, function($e) {
if((new DateTime($e->created_at))->format('M') == 'Jul') {
return [
'name' => $e->name,
'price' => $e->price,
'created_at' => $e->created_at
];
}
});
@adibhanna
adibhanna / compare.php
Created April 12, 2017 04:18 — forked from naholyr/compare.php
Extract namespace from a PHP file
<?php
// Works in every situations
function by_token ($src) {
$tokens = token_get_all($src);
$count = count($tokens);
$i = 0;
$namespace = '';
$namespace_ok = false;
while ($i < $count) {
@adibhanna
adibhanna / Preferences.sublime-settings
Last active August 19, 2016 10:31
sublime text preferences
{
"always_show_minimap_viewport": true,
"auto_complete_selector": "source, text",
"bold_folder_labels": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 1,
"caret_style": "phase",
"color_scheme": "Packages/User/SublimeLinter/FreshCut (SL).tmTheme",
"draw_indent_guides": false,
<?php
/**
* Flatten an array / multi-dimensional
* @param array $arr
*
* @return array
*/
function flatten_array($arr) {
// Iteratively reduce the array to a single value using a callback function
// @link http://php.net/manual/en/function.array-reduce.php
@adibhanna
adibhanna / .vimrc
Created January 8, 2016 08:38 — forked from JeffreyWay/.vimrc
My .vimrc file
set nocompatible " Disable vi-compatibility
set t_Co=256
colorscheme xoria256
set guifont=menlo\ for\ powerline:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
@adibhanna
adibhanna / es.sh
Created January 5, 2016 08:57 — forked from Globegitter/es.sh
Easy install for elasticsearch on Ubuntu 14.04
cd ~
##If you want to install OpenJDK
#sudo apt-get update
#sudo apt-get install openjdk-8-jre-headless -y
###Or if you want to install Oracle JDK, which seems to have slightly better performance
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
@adibhanna
adibhanna / byte-sizetuts.md
Last active August 29, 2015 14:25 — forked from honkskillet/byte-sizetuts.md
A series of golang tutorials with youtube videos.