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 / 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 / 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 / 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 / gitignore
Created October 9, 2014 19:33
Default .gitignore file
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~
@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/