Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Jose Quintana joseluisq

🦀
View GitHub Profile
@joseluisq
joseluisq / sublime-text-3-x64.sh
Last active Aug 29, 2015
Sublime Text 3 Shell Installer for Fedora Linux x64
View sublime-text-3-x64.sh
#!/bin/sh
# Sublime Text 3 Installer
# for Fedora Linux x64 (64 Bit)
# Miscellaneous
B=`tput bold`
N=`tput sgr0`
# Sublime Text 3 - Build 3083
View Download-Canvas-Example.markdown
@joseluisq
joseluisq / change_datetime_format.php
Created Mar 15, 2014
Change format from string datetime
View change_datetime_format.php
<?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') {
View triangle_svg.html
<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 Aug 29, 2015
MongoDB Installer for Red Hat Enterprise, CentOS or Fedora 64-bit system
View mongodb-installer.sh
#!/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 Jun 2, 2014
Convert string datetime to Javascript Date object
View toDateFromDatetime.js
/**
* 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 Jun 3, 2014
Working with Doctrine 2 in CodeIgniter PHP Framework
View Doctrine.php
<?php
/**
* Doctrine library for CodeIgniter
*/
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
class Doctrine {
@joseluisq
joseluisq / FbApiHandler-1.0.js
Last active Aug 29, 2015
FB Extended Javascript Library 1.0
View FbApiHandler-1.0.js
/**
* 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;
View media-queries-devices.css
/*
* Default Media Queries Screen
* Based on purecss.io
*/
/* Small Sreen / ≥ 568px */
@media screen and (max-width: 35.5em) {
}
@joseluisq
joseluisq / random_string.php
Created Jun 28, 2014
Generate a random string with PHP
View random_string.php
<?php
function random_string($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}