Skip to content

Instantly share code, notes, and snippets.

View joseluisq's full-sized avatar

Jose Quintana joseluisq

View GitHub Profile
@joseluisq
joseluisq / sublime-text-3-x64.sh
Last active August 29, 2015 13:56
Sublime Text 3 Shell Installer for Fedora Linux x64
#!/bin/sh
# Sublime Text 3 Installer
# for Fedora Linux x64 (64 Bit)
# Miscellaneous
B=`tput bold`
N=`tput sgr0`
# Sublime Text 3 - Build 3083
@joseluisq
joseluisq / Download-Canvas-Example.markdown
Created February 25, 2014 17:50
A Pen by Jose Luis Quintana.
@joseluisq
joseluisq / change_datetime_format.php
Created March 15, 2014 03:15
Change format from string datetime
<?php
/**
* Change format from the datetime
* Example: changeDatetimeFormat('2014-11-02 09:11:00', 'd/m/Y H:i:s a');
*
* @param string $datetime String datetime
* @param string $format String datetime format
* @return string
*/
function changeDatetimeFormat($datetime, $format = 'Y-m-d H:i:s') {
@joseluisq
joseluisq / triangle_svg.html
Created March 17, 2014 03:41
SVG Triangle
<svg height="250" width="450">
<polygon points="225,10 100,210 350,210" style="fill:rgba(0,0,0,0);stroke:#609AAF;stroke-width:10" />
</svg>
@joseluisq
joseluisq / mongodb-installer.sh
Last active August 29, 2015 14:00
MongoDB Installer for Red Hat Enterprise, CentOS or Fedora 64-bit system
#!/bin/sh
# Mongodb Shell 64-bit System Installer
# OS: Red Hat Enterprise, CentOS, Fedora or a related linux system.
# Miscellaneous
B=`tput bold`
N=`tput sgr0`
# Checks if package is installed on system
@joseluisq
joseluisq / toDateFromDatetime.js
Created June 2, 2014 03:02
Convert string datetime to Javascript Date object
/**
* Convert string datetime to Javascript Date object
* Eg. "2014-04-23 22:06:17".toDateFromDatetime()
*/
String.prototype.toDateFromDatetime = function() {
var parts = this.split(/[- :]/);
return new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]);
};
@joseluisq
joseluisq / Doctrine.php
Created June 3, 2014 03:37
Working with Doctrine 2 in CodeIgniter PHP Framework
<?php
/**
* Doctrine library for CodeIgniter
*/
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
class Doctrine {
@joseluisq
joseluisq / FbApiHandler-1.0.js
Last active August 29, 2015 14:02
FB Extended Javascript Library 1.0
/**
* FB Extended
* Jose Luis Quintana <www.joseluisquintana.pe>
* Reference: https://developers.facebook.com/docs/javascript/reference/FB.api
*/
function FbApiHandler(options, fn) {
var ready = false;
this.options = null;
this.response = null;
@joseluisq
joseluisq / media-queries-devices.css
Created June 26, 2014 05:39
CSS Media Queries Screen
/*
* Default Media Queries Screen
* Based on purecss.io
*/
/* Small Sreen / ≥ 568px */
@media screen and (max-width: 35.5em) {
}
@joseluisq
joseluisq / random_string.php
Created June 28, 2014 05:30
Generate a random string with PHP
<?php
function random_string($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}