Skip to content

Instantly share code, notes, and snippets.

View stramel's full-sized avatar

Michael Stramel stramel

View GitHub Profile
@stramel
stramel / hax-blox.html
Last active November 9, 2017 07:48
Polymer 2 Element for dynamically switching out templates with slots
<link rel="import" href="../polymer/polymer-element.html">
<link rel="import" href="../polymer/lib/utils/import-href.html">
<dom-module id="hax-blox">
<template></template>
<script>
class haxBlox extends Polymer.Element {
static get is() {
return 'hax-blox';
}
0499c6fe28b49b1a02276ce841b8d838b31e5900d7eb342c7c6ae05df8c783383d570ed887a071d40e5ecd9f80161f831e4fd2c7b62fe320eb8456aea0538e8d1b;admwx7
@stramel
stramel / polymer-upgrade-cheatsheet.md
Last active April 5, 2018 14:08
Polymer v1 to v2 Upgrade Cheatsheet with associated lint rules

Upgrade Cheatsheet

This is a simplified version of https://www.polymer-project.org/2.0/docs/upgrade. It also lists what warnings and fixes are available for each upgrade task.

Shadow DOM template and styling

DOM Template

  • <dom-module> using is or name should be replaced to use id
    • Warns
    • Fixable: Except dom-modules that contain both name and is
@stramel
stramel / profiling_data.md
Last active March 7, 2018 23:27
Profiling Lazy Imports vs importHref on PSK

Profiling of lazy-imports vs importHref

Setup

System Specs

  • CPU: Intel Core i5
  • Memory: 16Gb
  • OS: Windows 10
  • Polymer CLI: 1.6.0
@stramel
stramel / lazy-imports-import.html
Last active March 7, 2018 19:36
Attempt at refactor for performance gainz
<!--
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
@stramel
stramel / .babelrc
Created May 11, 2018 06:14
Next.js v6 configs
{
"env": {
"development": {
"presets": ["next/babel"]
},
"production": {
"presets": ["next/babel"]
},
"test": {
"presets": [
@stramel
stramel / server.js
Created May 16, 2018 23:12
Next.js Express Server with next-routes
const express = require('express')
const bodyParser = require('body-parser')
const next = require('next')
const cookieParser = require('cookie-parser')
const routes = require('../universal/routes')
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
const routeHandler = routes.getRequestHandler(app)
@stramel
stramel / _app.js
Created May 16, 2018 23:18
Page overrides
import App, { Container } from 'next/app'
import React from 'react'
class MyApp extends App {
render() {
const {
Component, pageProps
} = this.props
return (
@stramel
stramel / HOWTO.md
Last active February 28, 2024 17:45
Installing Powerline fonts on Windows 10

Installing Powerline fonts on Windows 10

Steps

  1. Download and extract zip from here
  2. Press Windows + x
  3. Press a (Selects PowerShell (Admin))
  4. Navigate to directory where fonts were extracted to (cd ${HOME}\Downloads\fonts-master\fonts-master)
  5. Set Execution Policy Set-ExecutionPolicy RemoteSigned [1]
  6. Press y then Enter to accept
@stramel
stramel / README.md
Created September 12, 2018 03:40
Abortable Fetch helper function

Abortable Fetch helper

Usage

import fetch, { ABORT_ERROR } from 'custom-fetch'

const abortableFetch = makeAbortable(fetch) // Defaults to `window.fetch` if no fetch is passed

const request = abortableFetch('/URL') // Returns an object with a `promise` and an `abort` property