Skip to content

Instantly share code, notes, and snippets.

View gitllermopalafox's full-sized avatar
🏠
127.0.0.1

Guillermo Palafox gitllermopalafox

🏠
127.0.0.1
View GitHub Profile
//http://stackoverflow.com/questions/1386331/php-print-r-nice-table
function myprint_r($my_array) {
if (is_array($my_array)) {
echo "<table border=1 cellspacing=0 cellpadding=3 width=100%>";
echo '<tr><td colspan=2 style="background-color:#333333;"><strong><font color=white>ARRAY</font></strong></td></tr>';
foreach ($my_array as $k => $v) {
echo '<tr><td valign="top" style="width:40px;background-color:#F0F0F0;">';
echo '<strong>' . $k . "</strong></td><td>";
myprint_r($v);
@gitllermopalafox
gitllermopalafox / multiple_ssh_setting.md
Created April 23, 2016 04:36 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@gitllermopalafox
gitllermopalafox / config
Last active April 23, 2016 04:36
Add more than one private key to the same ssh server / Agregar más de una llave privada a un servidor ssh
Host *.kd.io
User username
IdentityFile ~/.ssh/koding
ProxyCommand ssh -i ~/.ssh/koding %[email protected] nc %h %p
Host gitlab.com-repo1
Hostname gitlab.com
User git # Opcional
IdentityFile ~/.ssh/key_repo1
@gitllermopalafox
gitllermopalafox / toymd.js
Created December 30, 2015 19:57
Function to add 'toYMD()' method to a Date object to get the format 'yyyy-mm-dd' (Mysql date format)
// http://stackoverflow.com/a/2280117/918072
// Function to add 'toYMD()' method to a Date object to get the format 'yyyy-mm-dd'
(function() {
Date.prototype.toYMD = Date_toYMD;
function Date_toYMD() {
var year, month, day;
year = String(this.getFullYear());
month = String(this.getMonth() + 1);
if (month.length == 1) {
month = "0" + month;
@gitllermopalafox
gitllermopalafox / .htaccess
Created December 21, 2015 18:19
Laravel htaccess for shared hostings
# Add to the root of your Laravel5+ project
# Based on ricksonchew's answer
# http://laravel.io/forum/03-06-2015-how-to-setup-laravel-5-in-shared-hosting
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
@gitllermopalafox
gitllermopalafox / recursive_function.php
Created November 28, 2015 18:00
PHP Recursive function for recursive db table
// https://stackoverflow.com/questions/8587341/recursive-function-to-generate-multidimensional-array-from-database-result/8587437#8587437
function buildTree(array $elements, $parentId = 0) {
$branch = array();
foreach ($elements as $element) {
if ($element['parent_id'] == $parentId) {
$children = buildTree($elements, $element['id']);
if ($children) {
$element['children'] = $children;
placeholder-color(color)
&::-webkit-input-placeholder
color color !important
&:-moz-placeholder /* Firefox 18- */
color color !important
&::-moz-placeholder /* Firefox 19+ */
color color !important
&:-ms-input-placeholder
color color !important
#!/usr/bin/env bash
# Variables
APPNAME=appname
DBHOST=localhost
DBNAME=db_app
DBUSER=user1
DBPASSWD=password1
# Update the box
#! /usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#