Skip to content

Instantly share code, notes, and snippets.

View Scarygami's full-sized avatar

Gerwin Sturm Scarygami

View GitHub Profile
@Scarygami
Scarygami / dates.sql
Last active July 28, 2016 15:02
dynamic view for analysis services date dimension
-- Table-valued function to return a list of dates via a recursive query
CREATE FUNCTION [dbo].[dyn_dates](@DateFrom datetime, @DateTo datetime)
RETURNS @table TABLE (date_day datetime)
AS
BEGIN
WITH dates AS (
SELECT date_day = @DateFrom
UNION ALL
SELECT DATEADD(dd, 1, dates.date_day)
@Scarygami
Scarygami / my-name-polymer-1.x.html
Last active September 5, 2017 22:20
Samples and code snippets for my Polymer in Production article series
<!-- Polymer 1.x -->
<link rel="import" href="../polymer/polymer.html">
<dom-module id="my-name">
<template>
<style>
/* Amazing CSS to make my-name shine goes here */
</style>
<span>[[firstname]] [[lastname]]</span>
<template>
@Scarygami
Scarygami / polymer.json
Last active September 12, 2017 14:33
Polymer.json for differential serving
{
...
"builds": [
{
"name": "modern-es6",
"browserCapabilities": ["es2015"],
"preset": "es6-unbundled",
"basePath": true
}, {
"name": "fallback-es5",
@Scarygami
Scarygami / firebase.json
Last active September 12, 2017 18:51
firebase.json for differential serving
{
"hosting": {
"public": "build",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
@Scarygami
Scarygami / serve.js
Last active September 12, 2017 18:50
Cloud Function for differential serving on Firebase
const functions = require('firebase-functions');
const capabilities = require('browser-capabilities');
const rp = require('request-promise');
const request = require('request');
exports.serve = functions.https.onRequest((req, res) => {
const baseUrl = 'https://' + functions.config().firebase.authDomain;
// Fetch the hosted polymer.json to read the build configuration
return rp({