Skip to content

Instantly share code, notes, and snippets.

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

Omar Malave omalave

🏠
Working from home
View GitHub Profile
@omalave
omalave / gist:278d070b3efaad47e0ad
Last active July 21, 2016 19:03
How to install Composer on Debian
To make Composer (globally) available on Debian:
$ sudo su
$ cd /usr/src
$ apt-get install curl php5-cli
$ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Verify installation:
$ composer --version
@omalave
omalave / moment.php
Created February 2, 2015 16:46
Time Twitter Style, moment.js in PHP
function calc_time_diff($timestamp, $unit = NULL, $show_unit = TRUE) {
$seconds = round((time() - $timestamp)); // How many seconds have elapsed
$minutes = round((time() - $timestamp) / 60); // How many minutes have elapsed
$hours = round((time() - $timestamp) / 60 / 60); // How many hours have elapsed
$days = round((time() - $timestamp) / 60 / 60 / 24); // How many hours have elapsed
$seconds_string = $seconds;
$minutes_string = $minutes;
$hours_string = $hours;
$days_string = $days;
switch($unit) {
@omalave
omalave / gist:c2cc5904b06459436008
Created December 5, 2014 15:43
Command for silex sekeleton
composer create-project fabpot/silex-skeleton -sdev
@omalave
omalave / gist:623cd299f165797db4cd
Last active January 14, 2017 16:47
Remover Duplicados en SelectBox HTML
$("select>option").each( function(){
var $option = $(this);
$option.siblings()
.filter( function(){ return $(this).val() == $option.val() } )
.remove()
});