Skip to content

Instantly share code, notes, and snippets.

@zacharytamas
zacharytamas / gist:8247446
Created January 3, 2014 21:59
Closures.
(function () {
var ret;
for (var i = 0; i < 10; i++) {
if (i == 5) {
ret = function () {
return i;
}
}
@zacharytamas
zacharytamas / gist:8247567
Created January 3, 2014 22:06
Argument aliasing.
(function (a, b, c) {
Array.prototype.reverse.apply(arguments);
console.log(a, b, c);
})(1, 2, 3);
var a = new String('aaa');
var b = new String('aaa');
console.log(a == b); // false
var a = 'aaa';
var b = 'aaa';
console.log(a == b); // true
@zacharytamas
zacharytamas / gist:082e538784ebe07e40f9
Created June 13, 2014 19:24
Override window.location
(function () {
var _window = window;
(function () {
var window = {};
Object.defineProperty(window, 'location', {
get: function () { return _window.location; },
<link rel="import" href="../bower_components/polymer/polymer.html">
<polymer-element name="img-placeholder"
attributes="width height src alt">
<template>
<img src="http://placehold.it/{{ generatedSrc }}"
width="{{ width }}"
height="{{ height }}"
alt="{{ alt }}">
var a = {
// This should be myFunc: function(a, b)
myFunc(a, b) {
console.log(a, b);
}
};
@zacharytamas
zacharytamas / reddit-feed-row.js
Created December 6, 2016 17:34
RedditFeedRow
const RedditFeedRowTemplate = `
<style>
:host {
display: block;
}
div {
display: flex;
}
div > * {
### Keybase proof
I hereby claim:
* I am zacharytamas on github.
* I am zacharytamas (https://keybase.io/zacharytamas) on keybase.
* I have a public key ASAMaqyzP8ZxCgFIIA3lqxgDZGltHe6mHJQi6mnoUNQ4NQo
To claim this, I am signing this object:
@zacharytamas
zacharytamas / my-app.html
Created February 2, 2018 19:00
An example for Vincent.
<dom-module id="my-app">
<template>
<page-title base-title="My App" page-title="[[pageTitle]]"></page-title>
<iron-pages id="pages" attr-for-selected="name"
selected="{{selectedPage}}"
on-selected-item-changed="_selectedPageElementChanged"
on-update-page-title="_updatePageTitle">
@zacharytamas
zacharytamas / cloudSettings
Last active April 30, 2018 19:52
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-04-30T19:52:03.883Z","extensionVersion":"v2.9.0"}