Skip to content

Instantly share code, notes, and snippets.

var
privateMethod = Symbol('privateMethod');
function DoNotExposePrivateMethod() { return this; }
DoNotExposePrivateMethod.prototype[privateMethod] = function() { console.log('Private phrase!'); }
DoNotExposePrivateMethod.prototype.publicMethod = function() { console.log('Public phrase! ' + this[privateMethod]()); }
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>
<body>
<script type="text/javascript" src="bower_components/underscore/underscore-min.js"></script>
<script type="text/javascript" src="bower_components/ring/ring.js"></script>
<script type="text/javascript">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>
<body>
<script type="text/javascript" src="bower_components/underscore/underscore-min.js"></script>
<script type="text/javascript" src="bower_components/ring/ring.js"></script>
<script type="text/javascript">
this.$el.fadeOut((function() { this.remove() }).bind(this))
@gvidon
gvidon / gist:5cbdfa92a6a72da76489
Last active August 29, 2015 14:05
Component itself
<polymer-element name="tasks-list">
<template>
<link rel="stylesheet" href="style.css">
<template repeat="{{ tasks }}"><div>{{ title }}</div></template>
</template>
<script>Polymer({reset: function(collection){ this.tasks = collection.toJSON() }})</script>
</polymer-element>
@gvidon
gvidon / gist:e6b03c261dbe0d190b93
Last active August 29, 2015 14:05
External call of component method
<body>
<tasks-list></tasks-list>
<script>window.addEventListener('polymer-ready', function() {
document.querySelector('tasks-list').reset(new Backbone.Collection([
{title: 'Minification deployment script'},
{title: 'Refine Vagrantfile'},
{title: 'Fix header markup'}
]))
})</script>
$('#gallery-tip').after((
this.layout.settings = (new exports.SettingsFormView({app: this.app, parent: this})).render()
).el);
$('.option').addClass('active')
.siblings().removeClass('active')
.parent().addClass('expand');
$('.touch-me')
.addClass('again')
.prop('hidden', false)
.html('I\'m touched!');
$('.btn').addClass('active')
.siblings().removeClass('active');
<x-main id="properties-list" class="-module-items-list" hidden>
<x-captions></x-captions>
<x-list></x-list>
</x-main>