This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function multiMax(multi){ | |
// Make an array of all but the first argument | |
var allButFirst = Array().slice.call(arguments); | |
// Find the largest number in that array of arguments | |
var largestAllButFirst = Math.max.apply(Math,allButFirst); | |
// Return the multiplied result | |
return multi * largestAllButFirst; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function counterf(n) { | |
var n = n; | |
var inc = function() { | |
return n += 1; | |
}; | |
var dec = function() { | |
return n -= 1; | |
}; | |
return { | |
dec: dec, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var counterf = (function(n){ | |
var inc = function() { | |
return n += 1; | |
}; | |
var dec = function() { | |
return n -= 1; | |
}; | |
return { | |
dec: dec, | |
inc: inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var revoke = (function(func) { | |
var tmp = func; | |
return { | |
invoke: function(p) { | |
tmp(p); | |
}, | |
revoke: function() { | |
tmp = null; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var restante = 0; | |
'use strict'; | |
function wait() { | |
return new Promise(function(done, reject) { | |
setTimeout(function() { | |
if (restante > 0) { | |
done(); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Triangle() { | |
this.a; | |
this.b; | |
this.c; | |
this.setSides = function(a, b, c) { | |
this.a = a; | |
this.b = b; | |
this.c = c; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Function clear_string | |
* | |
* Function used to user strings as usernames, filenames | |
* This function removes the accents, white-spaces and symbols from characters in a string | |
*/ | |
if (! function_exists('clear_string')) | |
{ | |
function clear_string($str = '') | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// This function can be used to decode a string with token_id from openId response | |
// | |
function decode_tokenid(token){ | |
var elements = Array(); | |
elements[0] = atob(token.split(".")[0]); | |
elements[1] = atob(token.split(".")[1]); | |
return elements; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Module Design Pattern | |
var Car = (function() { | |
var manufacturer = "hyundai"; | |
var wheels = 4; | |
var price = 149000; | |
var isAdmin = false; | |
var loginAdmin = function(u, p) { | |
if (u === 'admin' && p === '123') { | |
isAdmin = true; | |
console.log('Welcome admin'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /home/javier/sites/sitename/public; | |
index index.php index.html index.htm; | |
server_name server_domain_or_IP; | |
location / { | |
try_files $uri $uri/ /index.php?$query_string; |