Skip to content

Instantly share code, notes, and snippets.

@mmfilesi
mmfilesi / js-oo-01.html
Created January 11, 2016 11:33
javaScript orientado a objetos (1)
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
@mmfilesi
mmfilesi / module.js
Last active March 7, 2016 16:39
patrones
'use strict';
/* 1. Closures */
(function () {
var privateVar = "foo";
})();
console.log(privateVar); // Uncaught ReferenceError: privateVar is not defined
@mmfilesi
mmfilesi / introduccion.html
Created January 19, 2016 21:31
web-components
<meta name="description" content="taller: presentación polymer">
<meta name="author" content="mmfilesi">
<meta name="Copyright" content="cc-by-sa">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui, shrink-to-fit=no">
@mmfilesi
mmfilesi / app.js
Created February 19, 2016 17:40
demo jasmine
var checkForm = {
checkInputs: function(user, pass) {
var isValid = true;
if ( !user || !pass || user.indexOf('@') === -1 ) {
isValid = false;
}
@mmfilesi
mmfilesi / foo-component.html
Created March 7, 2016 19:33
how works with arrays in polymer
<dom-module id="foo-component">
<template>
<style>
</style>
<button on-tap="addFruit">Añadir fruta</button>
La primera fruta es: {{getFruit(fruits.*, 0)}}
</template>
@mmfilesi
mmfilesi / fruits-components.html
Created March 8, 2016 23:02
how combine polymer with handlebars
<dom-module id="fruit-component">
<template>
<p>color: {{color}}</p>
<button on-tap="setColor">set color in light dom</button>
</template>
<script>
Polymer({
is: 'fruit-component',
@mmfilesi
mmfilesi / helpers-polymer
Created March 13, 2016 17:30
demo helpers polymer (if and repeat)
<dom-module id="foo-component">
<template>
<h3>Frutas</h3>
<template id="templateFruits" is="dom-repeat" filter="filterFruits" items="{{fruits}}" sort="orderFruits">
<template is="dom-if" if="{{item.color}}">
<p>La fruta {{index}} es {{item.name}}
y es de color {{item.color}} <br>
<button on-tap="setFavorite">favorita</button></p>
</template>
@mmfilesi
mmfilesi / gist-list.html
Created March 16, 2016 06:10
web component (polymer) to show user gists (0.0.5)
<dom-module id="gist-list">
<template>
<style>
.fade-ajax-out {
transition:1s linear all;
opacity:0;
background-color: #fcffdf;
}
.fade-ajax-in {
@mmfilesi
mmfilesi / foo-jquery.js
Created March 22, 2016 23:03
jquery style
'use strict';
(function () {
var foo = function (params) {
return new DomModule(params);
};
var DomModule = function (params) {
var selector = document.querySelectorAll(params),
@mmfilesi
mmfilesi / constructor
Created May 5, 2016 05:29
3 node modules patterns
'use strict';
function Foo(numParam) {
this.bar = numParam || 0;
}
Foo.prototype.publicMethod = function() {
let temp = 1 + this.bar;
return temp;
};