Skip to content

Instantly share code, notes, and snippets.

View ToeJamson's full-sized avatar

Joe Hanson ToeJamson

  • @observe.ai
  • San Francisco, CA
View GitHub Profile
@ToeJamson
ToeJamson / TPD1.js
Last active December 18, 2015 07:49
Trackpad Destroyer
// TIMER
// CREDITS : http://houtz.tv/javascript/timer.html
function start(){
var seconds = 30;
var millisec = 0;
var timer;
function display(){
if (millisec <= 0){
millisec=9;
seconds-=1;
@ToeJamson
ToeJamson / gist:5817487
Created June 19, 2013 19:55
Chat Room in 10 Lines of JavaScript
Enter Chat and press enter
<div><input id=input placeholder=you-chat-here /></div>
Chat Output
<div id=box></div>
<div id=pubnub pub-key=demo sub-key=demo></div>
<script src=http://cdn.pubnub.com/pubnub-3.1.min.js></script>
<script>(function(){
var box = PUBNUB.$('box'), input = PUBNUB.$('input'), channel = 'chat';
@ToeJamson
ToeJamson / PubNubjQTouch1
Created June 19, 2013 20:16
PubNub + jQTouch
// Overlay (div)
var over = $('#over');
// ====================
// STEP 1: SUBSCRIBE()
// ====================
// Listen for updates on 'jqtouch' channel.
$.PUBNUB.subscribe( { channel : 'jqtouch' }, function(message) {
@ToeJamson
ToeJamson / jQuery Push API1
Created June 19, 2013 20:25
jQuery Push API
// jQuery.PUBNUB.subscribe( args, callback )
jQuery.PUBNUB.subscribe({
channel : 'my_channel'
}, function(message) {
// Show Message
console.log(message);
} );
@ToeJamson
ToeJamson / 1
Last active December 18, 2015 17:19
Fastest JavaScript Google Closure + gzip -9 + Memcache + CDN + Headers
java -jar compiler.jar \
--compilation_level ADVANCED_OPTIMIZATIONS \
--js code.js \
| gzip -c9 \
| wc -c
@ToeJamson
ToeJamson / 1
Last active December 18, 2015 17:19
How To Real-time Multi-touch
// Listen for Touch Coordinates
PUBNUB.subscribe({
channel : 'touch-receive',
callback : update_player
});
@ToeJamson
ToeJamson / 1
Created June 19, 2013 21:39
Your Style Sheet in Realtime
<!-- DIV to be Updated -->
<div id=update-this-with-css class=original-class>
<p>This DIV will be updated via remote call.</p>
</div>
@ToeJamson
ToeJamson / 1.js
Last active January 23, 2017 19:26
HTML5 Mass Broadcasting Desktop Notifications
<div
channel-name=notifications-channel
segregate-notifications-by-page=false
id=desktop-notifications-config
></div>
<div id=pubnub pub-key=demo sub-key=demo></div>
<script src=http://http://cdn.pubnub.com/pubnub-3.5.4.min.js></script>
<script
src=http://www.pubnub.com/static/html5-desktop-notification-broadcasting.js
></script>
@ToeJamson
ToeJamson / 1
Last active December 18, 2015 17:29
A PubNub-Powered Game for ImpactJS
ig.module(
'game.main'
)
.requires(
'impact.game',
...
'plugins.pubnub.game'
)
.defines(function(){
MyGame = ig.PubNubGame.extend({ ...
@ToeJamson
ToeJamson / 1.js
Last active December 19, 2015 15:49
Build RealTime Chat
Enter Chat and press enter
<div><input id=input placeholder=you-chat-here /></div>
Chat Output
<div id=box></div>
<div id=pubnub pub-key=demo sub-key=demo></div>
<script src=http://cdn.pubnub.com/pubnub-3.1.min.js></script>
<script>(function(){
var box = PUBNUB.$('box'), input = PUBNUB.$('input'), channel = 'chat';
PUBNUB.subscribe({
channel : channel,