Skip to content

Instantly share code, notes, and snippets.

View josedaniel's full-sized avatar
Building.

José Daniel Paternina josedaniel

Building.
View GitHub Profile
@josedaniel
josedaniel / md5.js
Created May 2, 2011 14:21
Javascript MD5 Tool
/*
* 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 10:31
Avoid letters in number inputs
$(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 19:09
Function to validate an email addres
//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 21:55
Local storage cookies fallback
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 January 25, 2012 16:42
Loop + condition example [codeigniter]
<?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
}
}
@josedaniel
josedaniel / consultas.sql
Created March 15, 2012 16:55
Consultas SOQL
//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 22:24
Meterse al ssh del servidor remoto
cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> ~/.ssh/authorized_keys'
@josedaniel
josedaniel / input.css
Created June 26, 2012 20:31
CSS custom inputs
/* 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;
@josedaniel
josedaniel / README.md
Created February 10, 2014 23:06 — forked from oodavid/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 October 9, 2014 19:33
Default .gitignore file
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~