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
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 = {};
patik / wysihtml5.multi.example.html
Created Sep 3, 2012
wysihtml5 mulitiple editors issue
View wysihtml5.multi.example.html
<div id="alpha-toolbar"><!-- Toolbar commands here --></div>
<textarea id="alpha"></textarea>
<div id="bravo-toolbar"><!-- Toolbar commands here --></div>
<textarea id="bravo"></textarea>
<div id="charlie-toolbar"><!-- Toolbar commands here --></div>
<textarea id="charlie"></textarea>
patik / adn-auth.php
Created Oct 11, 2012
ADN auth issue
View adn-auth.php
require_once('keys.php'); // Where my constants are defined
$clientId = ADN_CLIENT_ID;
$clientSecret = ADN_CLIENT_SECRET;
$redirectUri = ADN_REDIRECT_URI;
# User has authorized:
if (isset($_GET['code']) && !empty($_GET['code'])) {
View wiki-travel-voyage-redirect.user.js
// @name Redirect from WikiTravel to WikiVoyage
// @description Automatically switch from a article to the same article on
// @namespace
// @include*
// @version v20130218.1
// ==/UserScript==
(function _wikivoyage_redir (win) {
// Example
// Before:
View insertAfterEveryFromRight.js
var insertAfterEveryFromRight = function _insertAfterEveryFromRight(str, insert, every) {
var result = '';
str.split('').reverse().forEach(function(s, idx) {
if (idx !== 0 && idx % every === 0) {
result += insert;
result += s;
patik / app.css
Last active Dec 22, 2015
Transition height/width to `auto` by defining the transition in CSS
View app.css
.expandable {
transition-property: none;
transition-duration: .5s;
transition-timing-function: ease-in-out;
/* Vary the transition with different classes */
.expandable.molasses {
transition-duration: 3s;
You can’t perform that action at this time.