Skip to content

Instantly share code, notes, and snippets.

View meteormanaged's full-sized avatar
🏠
Working from home

mk meteormanaged

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am meteormanaged on github.
  • I am mikekozak (https://keybase.io/mikekozak) on keybase.
  • I have a public key ASC-OHwFXNNydwnJMoTeCT-cmJuRsAqTmdi4exD-44lxcwo

To claim this, I am signing this object:

@meteormanaged
meteormanaged / gist:1ecfe84373b3f53022b65e595d33f619
Created December 14, 2016 16:30
Push or replace history state for ncm.com
// Function to "update" state by pushing or replacing depending on current state.
function updateState(queryParams) {
//Build other options.
var title = document.title;
var newUrl = window.location.protocol + '//' + window.location.host + window.location.pathname + '?' + queryParams;
// Do we already have a query state that we've pushed? Let's look at window.location.search to find out.
if (window.location.search.length > 1) {
// If so, let's replace it.
window.history.replaceState({}, title, newUrl);
} else {
// partial code
// You can tighten this up
return {
setPosition: setPosition,
getPosition: getPosition,
incrPosition: incrPosition,
decrPosition: decrPosition,
resetPosition: resetPosition,
addMarker: addMarker,
nextLocationShow: nextLocationShow,
//Docker CMD ran at launch is CMD [ "ember", "fastboot", "--serve-assets", "--environment=production", "--port=8080" ]
//First time this runs, it fails. If the container is restarted (so as to already have ran through building once), it starts as expected.
7/22/2016 11:50:14 AM[?25hCould not start watchman; falling back to NodeWatcher for file system events.
7/22/2016 11:50:14 AM[?25hVisit http://ember-cli.com/user-guide/#watchman for more info.
7/22/2016 11:51:18 AM[?25l⠋ Building⠙ Building⠹ Building⠸ Building⠼ Building⠴ Building⠦ Building⠧ Building⠇ Building⠏ Building⠋ Building⠙ Building⠹ Building⠸ Building
@meteormanaged
meteormanaged / gtm.es6.js
Created April 8, 2016 20:24
Simple filtering for Google Tags - ES6
const filterClasses = (ev) => {
// Filter those classes for a class containing with 'gtm-'
const filteredClasses = ev.toElement.className.split(' ').filter((thisClass) => thisClass.indexOf('gtm-' !== -1) ? thisClass : false);
//If it was a match, return the matching classname as a string, otherwise, return false.
if (filteredClasses.length > 0) return filteredClasses[0];
else return false;
};
const gaSend = (className) =>
ga('send', {
@meteormanaged
meteormanaged / gtm.js
Created April 8, 2016 20:18
Simple filtering for Google tags.
var filterClasses = function(ev) {
'use strict';
// Get the classNames associated with the clicked elements and split them into an array at whitespace.
var classes = ev.toElement.className.split(' ');
// Filter those classes for a class containing with 'gtm-'
var filteredClasses = classes.filter(function(thisClass) {
if (thisClass.indexOf('gtm-') !== -1) return thisClass;
else return false;
});
//If it was a match, return the matching classname as a string, otherwise, return false.
g6Rib2R5hqhkZXRhY2hlZMOpaGFzaF90eXBlCqNrZXnEIwEgvjh8BVzTcncJyTKE3gk/nJibkbAKk5nYuHsQ/uOJcXMKp3BheWxvYWTFAvF7ImJvZHkiOnsia2V5Ijp7ImVsZGVzdF9raWQiOiIwMTAxM2E1NTczYWM2NzE4YTI1ZTkyM2VjMmQxYjhmYzVkNTMyZTliYzVjNDQ1NTgxMTcwYTNjOWMyODk4NGM1ZGY3ODBhIiwiaG9zdCI6ImtleWJhc2UuaW8iLCJraWQiOiIwMTIwYmUzODdjMDU1Y2QzNzI3NzA5YzkzMjg0ZGUwOTNmOWM5ODliOTFiMDBhOTM5OWQ4Yjg3YjEwZmVlMzg5NzE3MzBhIiwidWlkIjoiNzBhMjA3NTJkZmZhOTVjMjEyODY2ZTU3NGI5NDJhMTkiLCJ1c2VybmFtZSI6Im1pa2Vrb3phayJ9LCJzZXJ2aWNlIjp7Im5hbWUiOiJnaXRodWIiLCJ1c2VybmFtZSI6Im1ldGVvcm1hbmFnZWQifSwidHlwZSI6IndlYl9zZXJ2aWNlX2JpbmRpbmciLCJ2ZXJzaW9uIjoxfSwiY2xpZW50Ijp7Im5hbWUiOiJrZXliYXNlLmlvIGdvIGNsaWVudCIsInZlcnNpb24iOiIxLjAuNCJ9LCJjdGltZSI6MTQ1NjA5ODI0MSwiZXhwaXJlX2luIjo1MDQ1NzYwMDAsIm1lcmtsZV9yb290Ijp7ImN0aW1lIjoxNDU2MDk4MjI4LCJoYXNoIjoiMTYzODNiN2NmNDYzNjE0YTdjOTJlNDhiNGQ0MDFhMGYwODlmYzgzYThjN2EwZTcwYjFhMzFlZDQ4Yzg0OTFmOGI5MjZhNjliZjczNzIyYzU0MGQzODg0NWJkMWFmMWEyMWYwODE2OWI4ZTEwOTNlYTllNDZjYWM3YTUwMjc5MzQiLCJzZXFubyI6MzkxOTc1fSwicHJldiI6ImRjOGY3Y2EzNGE3ZDE0ODY4ZjdhNzg4MGU1NDQ2
@meteormanaged
meteormanaged / gist:686267ece61b899c49e4
Created December 10, 2015 03:53
find object in an array.
const arrayFind = (index, val, items) => items.filter(e => e[index] === val ? e : false);