Skip to content

Instantly share code, notes, and snippets.

⚡️
Building.

José Daniel Paternina josedaniel

Block or report user

Report or block josedaniel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@josedaniel
josedaniel / md5.js
Created May 2, 2011
Javascript MD5 Tool
View md5.js
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*
@josedaniel
josedaniel / just_numbers.js
Created May 3, 2011
Avoid letters in number inputs
View just_numbers.js
$(document).ready(function(){
//cuando se intenten meter letras en un campo de precio
$('.cantidad_producto').keypress(function(e){
if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)){
return false;
}
});
});
@josedaniel
josedaniel / validate_email.js
Created May 3, 2011
Function to validate an email addres
View validate_email.js
//FUNCTION TO VALIDATE AN EMAIL ADDRESS
//USAGE: Ej:, validate_email(josedaniel.paterninasoto@gmail.com);
//This will return TRUE if the email is valid or FALSE if not.
function validate_email(email){
if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
return(true);
}else{
return(false);
@josedaniel
josedaniel / localStorage.js
Created May 31, 2011
Local storage cookies fallback
View localStorage.js
if (!window.localStorage){
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
@josedaniel
josedaniel / gist:1677160
Created Jan 25, 2012
Loop + condition example [codeigniter]
View gist:1677160
<?php
//create the array in the controller and add it ot the $data array
//then, in the view...
foreach($elements as $element){
if($element->name == 'example'){
//do stuff
}
}
View consultas.sql
//Colegios
Select a.creado_en_zambo__c, a.Id, a.Name, a.RecordType.Name from Account a where a.creado_en_zambo__c = false and a.RecordType.Name = 'Institución educativa'
//Destinos
Select d.creado_en_zambo__c, d.Fecha_1__c, d.Fecha_2__c, d.Fecha_3__c, d.Id, d.Nro_de_dias__c, d.Nro_minimo_de_dias__c, d.Programa_Destino__c from Destino_Alternativo__c d where creado_en_zambo__c = false
//Viajes
Select c.Colegio__c, c.Destino_definitivo__c, c.Fecha_llegada__c, c.Fecha_salida__c, c.Name, c.Nro_de_Grupos__c, c.RecordTypeId, c.RecordType.Name, c.Status from Campaign c where RecordType.Name = 'Viaje' and c.Status = 'Ganado'
@josedaniel
josedaniel / ssh.sh
Created May 22, 2012
Meterse al ssh del servidor remoto
View ssh.sh
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> ~/.ssh/authorized_keys'
@josedaniel
josedaniel / input.css
Created Jun 26, 2012
CSS custom inputs
View input.css
/* CUSTOM FORM CONTROLS */
input[type="text"],input[type="password"]{
font-size:13px;
padding: 3px 7px;
border:none;
box-shadow: inset 0 1px 2px #999;
outline: none;
color:#444;
margin-right:10px;
border-bottom: 1px solid #eee;
View README.md

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
    • apache's home directory is /var/www/
@josedaniel
josedaniel / gitignore
Created Oct 9, 2014
Default .gitignore file
View gitignore
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
You can’t perform that action at this time.