Skip to content

Instantly share code, notes, and snippets.

@simon0191
simon0191 / designer.html
Created November 8, 2014 08:34
designer
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
var memo = {
0: 1,
1: 1
};
function fib(n) {
if(memo[n]) return memo[n];
return (memo[n] = fib(n-1) + fib(n-2));
}
var memo = {
0: 1,
1: 1
};
function fib(n) {
if(memo[n]) return memo[n];
return (memo[n] = fib(n-1) + fib(n-2));
}
function main(str) {
var mid = Math.floor(str.length/2);
for(var i = 0;i<mid;++i) {
if(str[i] !== str[str.length-1-i]) return false;
}
return true;
}
/*
console.log(main('a'));
function main(str) {
var mid = str.length>>1;
for(var i = 0;i<mid;++i) {
if(str[i] !== str[str.length-1-i]) return false;
}
return true;
}
console.log(main('anitalavalatina'));
console.log(main('a'));
function main(str) {
var mid = str.length>>1;
for(var i = 0;i<mid;++i) {
if(str[i] !== str[str.length-1-i]) return false;
}
return true;
}
/*
console.log(main('anitalavalatina'));
function main(str) {
str = str.replace(/\s/g,'');
var mid = str.length>>1;
for(var i = 0;i<mid;++i) {
if(str[i] !== str[str.length-1-i]) return false;
}
return true;
}
/*
function main(str) {
var s = "";
for(var i = str.length-1;i>=0;--i)s+=str[i];
return s;
}
console.log(main('hola'));
console.log(main('mundo'));
console.log(main('mundo bla'));
function main(n) {
var sol = 1;
while(n > 1) sol*=(n--);
return sol;
}
/*
console.log(main(1));
console.log(main(2));
console.log(main(10));
console.log(main(8));
var mapa = {'á':'a','é':'e','í':'i','ó':'o','ú':'u','ñ':'n'};
function main(str) {
var sol = '';
for(var i = 0;i<str.length;++i) {
var curr = str[i].toLowerCase();
curr = (mapa[curr] || curr );
if(isAscii(curr)) {
sol+=curr;
} else {
if(sol[sol.length-1] !== '-')