Skip to content

Instantly share code, notes, and snippets.

@smhmic
smhmic / allowlinker-ga.js
Last active October 22, 2020 00:26 — forked from sahava/allowlinker-ga.js
This script reproduces Google Analytics' (analytics.js) allowLinker/autolinker logic, resulting in a function that returns the GA client id, but only if the autolinker parameter is valid. Uses the "old" linker plugin format. You can also pass a string as an argument to check if that string is a valid linker parameter.
// Mirrors analytics.js logic to validate autolinker param, and returns cid if valid.
// Returns false if autolinker param found, but invalid.
// Otherwise returns undefined.
var getCidFromAutolinker = function(str) {
var joiner = function (cidGid, offset) {
var a = new Date,
b = window.navigator,
c = b.plugins || [];
var d = [cidGid, b.userAgent, a.getTimezoneOffset(), a.getYear(), a.getDate(), a.getHours(), a.getMinutes() + offset];
@smhmic
smhmic / functions.php
Last active July 19, 2022 07:17 — forked from un1ko85/new_gist_file.php
wordpress - disable all rss and pingbacks and trackbacks on dev/staging sites
<?php
if( IS_DEV_SITE ) {
//Disable RSS Feeds functions
add_action('do_feed', array( $this, 'disabler_kill_rss' ), 1);
add_action('do_feed_rdf', array( $this, 'disabler_kill_rss' ), 1);
add_action('do_feed_rss', array( $this, 'disabler_kill_rss' ), 1);
add_action('do_feed_rss2', array( $this, 'disabler_kill_rss' ), 1);
add_action('do_feed_atom', array( $this, 'disabler_kill_rss' ), 1);
if(function_exists('disabler_kill_rss')) {
@smhmic
smhmic / css_resources.md
Last active August 29, 2015 14:15 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@smhmic
smhmic / python_resources.md
Last active August 29, 2015 14:15 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@smhmic
smhmic / javascript_resources.md
Last active August 29, 2015 14:15 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@smhmic
smhmic / README.md
Last active August 29, 2015 14:15 — forked from dciccale/README.md

triggerEvent

Cross-browser function to trigger DOM events.

<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>Seon-Wook Park</author>
</meta>
<bindings>
<select itemPath="" produces="XML">
<inputs>
<key id='url' type='xs:string' paramType='variable' required='true' />
__author__ = 'schwa'
import os
import subprocess
import glob
from github import Github # pip install PyGithub
from bitbucket.bitbucket import Bitbucket # pip install --user bitbucket-api
GH_USERNAME = 'jwight@mac.com'
GH_PASSWORD = '1234'
@smhmic
smhmic / events-conditional-wrappers.php
Last active November 27, 2017 22:41 — forked from jo-snips/events-conditional-wrappers.php
Modern Tribe's The Events Calendar (WordPress plugin) conditional template tags
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/query.php
*/
$args = array(