Skip to content

Instantly share code, notes, and snippets.

View pjeweb's full-sized avatar

Paul Golmann pjeweb

View GitHub Profile
@pjeweb
pjeweb / example-jquery.js
Created February 11, 2012 18:49
Simple PubSub snippet for both browser and nodejs (just remove outer wrap-function).
/* Use PubSub on e.g. jQuery */
PubSub.apply($);
function addText(text) {
$('body').append('<p>' + text + '</p>');
}
function logChange(text) {
console.log('new text: ' + text);
}
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php
// good javascript
(function ($) {
'use strict';
$(function () {
$('[placeholder]')
.focus(function () {
var input = $(this);
if (input.val() === input.attr('placeholder')) {