Skip to content

Instantly share code, notes, and snippets.

View kylebuch8's full-sized avatar

Kyle Buchanan kylebuch8

View GitHub Profile
/*
* ========================================================================
* Initialize the Popovers!!!
* ========================================================================
*
* there is an issue with IE7 and IE8 creating popovers
* in the way that i want to create them. lucky for us,
* there is a fix. make sure that we only apply the fix
* for IE7 and IE8
*
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
#core_animated_pages {
width: 420px;
height: 582px;
overflow: hidden;
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@kylebuch8
kylebuch8 / gist:03d681678becd15a7281
Created May 29, 2015 17:17
Polymer 1.0 with Firebase Document
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/more-routing/more-route.html">
<link rel="import" href="../bower_components/firebase-element/firebase-document.html">
<dom-module id="mc-player">
<template>
<more-route context name="player" params="{{params}}"></more-route>
<firebase-document id="playerDocument" data="{{player}}"></firebase-document>
<button on-tap="goBack"><</button>
@kylebuch8
kylebuch8 / gulpfile.js
Created June 15, 2015 23:55
Starting Gulpfile with BrowserSync
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
gulp.task('serve', function () {
browserSync.init({
server: {
baseDir: "./app"
}
@kylebuch8
kylebuch8 / gist:076ca81676f0a72699cb
Created July 20, 2015 23:48
AngularJS httpInterceptor
config.$inject = ['$provide', '$httpProvider'];
function config($provide, $httpProvider) {
$provide.factory('httpInterceptor', httpInterceptor);
httpInterceptor.$inject = ['$rootScope'];
function httpInterceptor($rootScope) {
return {
'request': request,
@kylebuch8
kylebuch8 / gist:fa62ceb83d31e0e1f60bff4bda8d0e4f
Created March 7, 2017 17:40
Do I need to load the web component polyfill?
if ('registerElement' in document
&& 'import' in document.createElement('link')
&& 'content' in document.createElement('template')) {
// browser has web components
} else {
// polyfill web components
var e = document.createElement('script');
e.src = 'bower_components/webcomponentsjs/webcomponents-lite.min.js';
document.head.appendChild(e);
}
/*
* show modal to certain accounts
*
* check to see if the user is logged in by looking at the account_number
* property on portal.user_info
*
* Show the modal if the following conditions are true:
* - the current date is between the start and end dates for showing the modal
* - the API call to /api/flagged-accounts returns flagged: true
* - the user has not already seen the modal
@kylebuch8
kylebuch8 / lightdom.html
Created May 19, 2017 12:29
Polymer 2.0 - Place element html in the light dom instead of creating a shadow root
<dom-module id="thing-thing">
<template>
<h1>I'm in the light dom</h1>
</template>
<script>
class ThingThing extends Polymer.Element {
_attachDom(dom) {
this.appendChild(dom);
}