Skip to content

Instantly share code, notes, and snippets.

@iansym
iansym / jquery.pubsub.js
Created July 28, 2010 16:06
PubSub functionality
/**
* Package: jQuery PubSub
* a lightweight and fast jQuery Publish/Subscribe system
* based on the jQuery plugin by Peter Higgins (dante@dojotoolkit.org)
* http://higginsforpresident.net/js/jq.pubsub.js
*/
(function(window) {
var subscriptions = {},
cache = {},
we,
@cowboy
cowboy / HEY-YOU.md
Last active July 1, 2024 08:37
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@kylebarrow
kylebarrow / example.html
Created June 23, 2011 06:30
Prevent links in standalone web apps opening Mobile Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>
@irae
irae / _Stay_standalone.md
Last active January 29, 2024 12:38 — forked from kylebarrow/example.html
Stay Standalone: Prevent links in standalone web apps opening Mobile Safari

#Stay Standalone

A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.

@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@addyosmani
addyosmani / pubsub.md
Created October 28, 2011 06:49
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

(function($) {
// Used by dateinput
$.expr = {':': {}};
// Used by bootstrap
$.support = {};
// Used by dateinput
$.fn.clone = function(){
var ret = $();
@patik
patik / custom.selector.test.html
Created December 10, 2011 22:16
Customized Zepto for fake selectors
<!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"));
@JohnAllsopp
JohnAllsopp / Private Browsing and localStorage
Created December 13, 2011 06:59
Private Browsing and localStorage - different browsers handle it differently
What happens to localStorage when different browsers are in private browsing mode?
Safari returns null for any item set using localStorage.setItem either before or during the private browsing session. In essence, neither sessionStorage or localStorage are available in private brosing mode
Chrome and Opera return items set previous to private ("incognito") browsing, but once private browsing commences, treats localStorage like sessionStorage (only items set on the localStorage by that session will be returned) but like localStorage for other private windows and tabs
Firefox, like Chrome will not retrieve items set on locaStorage prior to a private session starting, but in private browsing treats localStorage like sessionStoroage for non private windows and tabs, but like localStorage for other private windows and tabs
@peteboere
peteboere / jquery.alterclass.js
Created December 24, 2011 12:49
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
/**
* jQuery alterClass plugin
*
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
*
* Copyright (c) 2011 Pete Boere (the-echoplex.net)
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
*
*/