Skip to content

Instantly share code, notes, and snippets.

💭
🤓

Adib Hanna adibhanna

💭
🤓
Block or report user

Report or block adibhanna

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@adibhanna
adibhanna / docker-cleanup-resources.md
Created Apr 2, 2019 — forked from dreamuth/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

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
Software Developer
View filter_by_july.php
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 Apr 12, 2017 — forked from naholyr/compare.php
Extract namespace from a PHP file
View compare.php
<?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 Aug 19, 2016
sublime text preferences
View Preferences.sublime-settings
{
"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,
View Array Flatten
<?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 Jan 8, 2016 — forked from JeffreyWay/.vimrc
My .vimrc file
View .vimrc
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 Jan 5, 2016 — forked from Globegitter/es.sh
Easy install for elasticsearch on Ubuntu 14.04
View es.sh
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 Aug 29, 2015 — forked from honkskillet/byte-sizetuts.md
A series of golang tutorials with youtube videos.
View introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

View gist:00708854ba6f6fb5b779

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘KB toggle side bar
⌘⇧P command prompt
⌃ ` python console
⌘⇧N new window (useful for new project)
You can’t perform that action at this time.