Skip to content

Instantly share code, notes, and snippets.

View osvik's full-sized avatar
💭
Working

Osvaldo osvik

💭
Working
View GitHub Profile
@osvik
osvik / valida_nif_cif_nie.js
Created November 28, 2014 13:40
valida_nif_cif_nie
// -- VALIDATE ID NUMBER,
//Retorna: 1 = NIF ok, 2 = CIF ok, 3 = NIE ok, -1 = NIF error, -2 = CIF error, -3 = NIE error, 0 = ??? error
function valida_nif_cif_nie(a)
{
var temp=a.toUpperCase();
var cadenadni="TRWAGMYFPDXBNJZSQVHLCKE";
if (temp!==''){
//si no tiene un formato valido devuelve error
@osvik
osvik / manual-gzip-howto-and-test.html
Created August 10, 2014 17:08
How to manually gzip CSS and JS files and serve them with Apache
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Manually gzip CSS and JS files</title>
<link rel="stylesheet" href="bootstrap-custom.min.css" type="text/css">
<script src="header-scripts.min.js"></script>
</head>
<!DOCTYPE html>
<html>
<head>
<title>Greenpeace España</title>
<!-- Page header free html -->
<meta name="msvalidate.01" content="0EFA63D991131147715CF37F8DB5CE8C" />
<meta name='yandex-verification' content='6af16d6b271bec04' />
@osvik
osvik / testing-page.html
Created July 15, 2014 15:55
Google Analytics AB testing code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>AB Google Analytics testing code</title>
<!-- Load the Content Experiment JavaScript API client for the experiment -->
<script src="//www.google-analytics.com/cx/api.js?experiment=[YOUR EXPERIMENT ID]"></script>
@osvik
osvik / gist:3961003
Created October 26, 2012 19:43
Greek phone validation
var isGreek = {
mobile: function(value) {
return /^(\+30|0030)?69\d{8}$/.test( value.replace(/[\s\-()\.]/g, "") );
},
landline: function(value) {
return /^(\+30|0030)?(210)?\d{7}$/.test( value.replace(/[\s\-()\.]/g, "") );
},
phone: function(value) {
return isGreek.mobile(value) || isGreek.landline(value);
}