Skip to content

Instantly share code, notes, and snippets.

View rlemon's full-sized avatar
🍋
Hanging around.

Robert Lemon rlemon

🍋
Hanging around.
  • Dryer Moisture Systems Inc.
  • Kitchener, Ontario. Canada.
View GitHub Profile
@stagas
stagas / how-to-run-apache-and-node.js-together-the-right-way.markdown
Created December 24, 2010 14:45
How to run Apache and Node.js together (the right way)

Step 1

Get a VPS that offers 2 or more IP addresses.

Step 2

From the WHM cPanel, find the menu item Service Configuration, select Apache Configuration and then click on Reserved IPs Editor.

Step 3

@Raynos
Raynos / critique.md
Created December 1, 2011 14:15
jQuery library critique

jQuery

Related: [Why you don't need jQuery as an abstraction][2]

$ itself is a god object. Everything goes on it. The standard plugin / extension architecture that is recommended is to just bolt more methods on $ itself!

Surely this is bad. An example would be how we have both $.load which is overloaded to do completely different things. If they were on two separate sensibly named objects $Container.load and $EventTarget.load. Personally I would deprecate the latter in favour of .on('load'

The animation should be it's own little modular thing, not bolted onto $. Ajax should be it's own little modular thing, not bolted onto $

@Raynos
Raynos / select.js
Created December 10, 2011 16:01
tiny select. Selecting has never been so awesome \o/
// Pretty fast - http://jsperf.com/select-vs-natives-vs-jquery
/*
By, shortcuts for getting elements.
*/
var By = {
id: function (id) { return document.getElementById(id) },
tag: function (tag, context) {
return (context || document).getElementsByTagName(tag)
},
"class": function (klass, context) {
@rlemon
rlemon / gist:1634675
Created January 18, 2012 18:29
StackExchange Chat Blackout Bookmarklet - STOP SOPA
// Copy and paste this into the address bar or create a bookmark with this as the location.
// STOP SOPA!
javascript:$(".content").each(function(){var a=$(this),b=a.text().replace(/\S/g,"\u2587");a.text(b)});;
@Zirak
Zirak / gist:1677020
Created January 25, 2012 16:15
Visibility API
//http://www.w3.org/TR/2011/WD-page-visibility-20110602/
(function () {
"use strict";
//no need to shim if it's already there
if ( 'hidden' in document && 'onvisibilitychange' in document ) {
return;
}
//fail silently if the browser sux
@zackthehuman
zackthehuman / hexagons.js
Created February 20, 2012 03:46
Drawing a hexagonal grid with HTML canvas
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Canvas Hexagonal Map</title>
<style type="text/css">
canvas {
border:0;
display:block;
margin:0 auto;
@rlemon
rlemon / demo.markdown
Created February 24, 2012 14:28
Paper in CSS
@Raynos
Raynos / starred-gists.md
Created February 27, 2012 00:33
My starred gists
  • [Why you don't need Meteor][20]
  • [Shim status of ES6][1]
  • [unshimmable subset of ES5][2]
  • [Host objects][3]
  • [Why you don't need jQuery][4]
  • [All the DOM recursion you'll ever need][5]
  • [The heart of pd][6]
  • [jQuery library critique][7]
  • [klass][8]
  • [tiny select][9]
@rlemon
rlemon / demo.markdown
Created March 1, 2012 14:23
Ubuntu Keyboard with KBD tags and CSS
@rlemon
rlemon / utils.js
Created March 23, 2012 15:58
Javascript common Utility functions.
/* Listener Object
* For event registration and unregistration
*/
var listener = (function() {
function listenerAdd(elm, evt, func) {
if( elm.addEventListener ) {
elm.addEventListener(evt, func, false);
} else if( elm.attachEvent ) {
elm.attachEvent('on'+evt, func);
}