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.

License.

@patik
patik / sites.md
Last active Aug 29, 2015
Why you can't rely on JavaScript
View sites.md

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
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
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
patik / popover.md
Last active Sep 14, 2015
Popover plugin specifications
View popover.md

Popover

Overview

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.

Usage

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

@patik
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">
<head>
<meta charset="utf-8">
<title>BB6 Collapsible</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css">
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script>
$(document).ready(function() {
if (/blackberry/i.test(navigator.platform)) {
@patik
patik / custom.selector.test.html
Created Dec 10, 2011
Customized Zepto for fake selectors
View custom.selector.test.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<style> .hidden { display: none; } </style>
<script src="zepto.custom.js"></script>
<script>
$(document).ready(function(e) {
// This should print 2 results: #div3 and #div4
console.log("visible:", $("div:visible"));
@patik
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 http://github.com/cpatik
// @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 http://patik.com/code/user-scripts/
// @include https://twitter.com/*
// @include http://twitter.com/*
// @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 http://patik.com/code/user-scripts/
// @include https://alpha.app.net/*
// @version v20120903.1
// ==/UserScript==
(function _adnenhance_init(win) {
var adnenh = {};
You can’t perform that action at this time.