Skip to content

Instantly share code, notes, and snippets.

View andriytyurnikov's full-sized avatar

Andriy Tyurnikov andriytyurnikov

View GitHub Profile
@jssteinberg
jssteinberg / GTM.svelte
Last active September 8, 2023 14:51
How to Implement Google Tag Manager in Svelte, in Functional Programming
<script>
import { onMount } from 'svelte';
/** @type {string} gtmId - GTM ID 'GTM-F00BARS'. */
export let gtmId = '';
/** @type {(Object[]|Object)} [gtmDataPoints=[]] - Array or single object of custom data points for dataLayer.
* @type {Object} [gtmDataPoints[]] - Custom data point Object.
* @type {string} [gtmDataPoints[][]] - Custom data point property. */
export let gtmDataPoints = [];
/** @type {number} [timeout] - The number of milliseconds to timeout intiating loading the GTM script from Google */
@bkerley
bkerley / pipes.rb
Last active April 8, 2018 02:17
elixir-style function chaining that is also awful!
require 'pp'
class Object
def mutate
Mutagen.new(self)
end
end
class Mutagen < BasicObject
def initialize(collection)
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session