Skip to content

Instantly share code, notes, and snippets.

View denielaa's full-sized avatar
🏠
Working from home

Deniel Ariesta denielaa

🏠
Working from home
View GitHub Profile
@denielaa
denielaa / terminal-git-branch-date-time.md
Last active January 29, 2019 15:22
Display git branch name and date time in terminal
parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

PS1_date="\[\033[38;5;237m\]\d\[$(tput sgr0)\]\[\033[38;5;15m\]"
PS1_time="\[$(tput sgr0)\]\[\033[38;5;236m\]\t\[$(tput sgr0)\]\[\033[38;5;15m\]"
PS1_wdir="\[$(tput sgr0)\]\[\033[38;5;24m\]\W"
PS1_gitbranch="\e[38;5;204m\]\$(parse_git_branch)"
PS1_gt="\[$(tput bold)\]\[$(tput sgr0)\]\[\e[38;5;214m\]>"
@denielaa
denielaa / phpArrayFlatten.php
Created November 3, 2018 14:33
PHP array flatten
<?php
function flatten($array)
{
$result = [];
foreach ($array as $item) {
if (is_array($item)) {
// recursive function and merge the result with existing result
$result = array_merge($result, flatten($item));
@denielaa
denielaa / install.sh
Created September 17, 2017 14:18 — forked from meSingh/install.sh
Lemp stack for Ubuntu 16.04 (PHP7, Nginx, MongoDB, Git, Composer(with asset plugin))
#!/bin/bash
echo "Please, enter your username, it will be added to 'sudo' and 'docker' groups during the process."
read USERNAME
if [ -z "$USERNAME" ] ; then
echo "Exiting... Done."
exit
else
echo "Adding user to 'sudo' group..."
@denielaa
denielaa / Object Flatten
Created March 17, 2016 05:42 — forked from penguinboy/Object Flatten
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true