Skip to content

Instantly share code, notes, and snippets.

Craig Patik patik

Block or report user

Report or block patik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Duplicate-ID-Finder.markdown

Duplicate ID Finder

Reports IDs that are being used by multiple elements within a page, including the number of occurrences of each one

A Pen by Craig Patik on CodePen.


patik /
Last active Aug 29, 2015
Why you can't rely on JavaScript

Some of these articles may be old but their arguments hold true. In particular, with more and more people relying on flaky, high-latency cellular networks to deliver sites there is possibly even more concern that JS may not work, even in an otherwise capable browser.

patik / _breakpoint.scss
Last active Aug 29, 2015
Breakpoint without Compass
View _breakpoint.scss
@mixin breakpoint($size: "", $maxWidth: false) {
@if $size == "" {
$size: 20em; // Put your "main" or most-used breakpoint here to use it as a default
// Default, `min-width` media query
@if $maxWidth == false {
@media (min-width: $size) { @content; }
// Alternative `max-width` media query
patik / data.js
Created Jun 18, 2014
Simple JSON path parser
View data.js
// Source data (JSON) from the server
data = {
abc: {
def: {
ghi: 'jkl'
// The path you're looking for (you want the value of `ghi`)
patik /
Last active Sep 14, 2015
Popover plugin specifications



The popover plugin displays HTML in a container that overlays the page. It is triggered by clicking on a button or other UI element and the container is positioned near the element. The popover can be displayed and hidden at will.


The plugin must be provided with an options object and a jQuery collection of elements.

patik / jQueryMobile Blackberry 6 collapsible content bug
Created Feb 10, 2011
On a Blackberry Bold 9650 running OS 6, collapsible elements do not expand/collapse properly. This workaround adds an event listener with a `setTimeout` of zero milliseconds.
View jQueryMobile Blackberry 6 collapsible content bug
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>BB6 Collapsible</title>
<link rel="stylesheet" href="">
<script src=""></script>
$(document).ready(function() {
if (/blackberry/i.test(navigator.platform)) {
patik / custom.selector.test.html
Created Dec 10, 2011
Customized Zepto for fake selectors
View custom.selector.test.html
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<style> .hidden { display: none; } </style>
<script src="zepto.custom.js"></script>
$(document).ready(function(e) {
// This should print 2 results: #div3 and #div4
console.log("visible:", $("div:visible"));
patik / scrollToHash.user.js
Last active Sep 28, 2015
Scroll to the heading that matches the URL hash
View scrollToHash.user.js
// ==UserScript==
// @name Scroll To Heading From Hash
// @author Craig Patik
// @namespace
// @version 1.0
// @description Enable jumping to any heading without adding IDs to the heading elements
// @include http://*
// ==/UserScript==
// Site owners can drop the code below into their pages,
View twitter-avatar-in-menu.user.js
// ==UserScript==
// @name Twitter Avatar in Menu
// @namespace
// @include*
// @include*
// @version 2.1.20131118
// ==/UserScript==
(function _twitter_avatar_in_menu() {
// Find the generic 'person' outline in the nav bar, which will be replaced
View alpha-app-net-enhanced.user.js
// @name Enhanced Alpha.App.Net
// @description Image previews, Repost links, and Twitter character count on Alpha.App.Net
// @namespace
// @include*
// @version v20120903.1
// ==/UserScript==
(function _adnenhance_init(win) {
var adnenh = {};
You can’t perform that action at this time.