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
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 = {};
@patik
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
patik / adn-auth.php
Created Oct 11, 2012
ADN auth issue
View adn-auth.php
<?php
require_once('keys.php'); // Where my constants are defined
require_once('AppDotNet.php');
$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 WikiTravel.org article to the same article on WikiVoyage.org
// @namespace http://patik.com/code/user-scripts/
// @include http://wikitravel.org/*
// @version v20130218.1
// ==/UserScript==
(function _wikivoyage_redir (win) {
// Example
// Before: http://wikitravel.org/en/Bangkok/Sukhumvit
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
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.