Skip to content

Instantly share code, notes, and snippets.

Geoff Blair geoffb

Block or report user

Report or block geoffb

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
@geoffb
geoffb / edit-entities.js.diff
Created Jan 10, 2011
ImpactJS Weltmiester: Don't consider entity offset when snapping to grid.
View edit-entities.js.diff
diff --git a/htdocs/lib/weltmeister/edit-entities.js b/htdocs/lib/weltmeister/edit-entities.js
index f9d9250..6272f3e 100644
--- a/htdocs/lib/weltmeister/edit-entities.js
+++ b/htdocs/lib/weltmeister/edit-entities.js
@@ -141,7 +141,7 @@ wm.EditEntities = ig.Class.extend({
for( var i = 0; i < this.entities.length; i++ ) {
var ent = this.entities[i];
if( ent.touches(this.selector) ) {
- this.selector.offset = {x: (x - ent.pos.x + ent.offset.x), y: (y - ent.pos.y + ent.offset.y)};
+ this.selector.offset = {x: (x - ent.pos.x), y: (y - ent.pos.y)};
@geoffb
geoffb / wtf.js
Created Nov 6, 2010
Fucking around
View wtf.js
(function () {
// Extends the base Object with data getter/setter and event target
var proto = Object.prototype;
proto._data = {};
proto._listeners = {};
proto.set = function (key, value) {
@geoffb
geoffb / simple_websocket_client.html
Created Oct 7, 2010
Super simple websockets client/server using Python. Compatible with the draft 76 challenge/response.
View simple_websocket_client.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>WebSocket Client</title>
<style>
#output {
border: solid 1px #000;
}
</style>
</head>
@geoffb
geoffb / Sprite Alpha using Canvas
Created Aug 14, 2010
A simple example of changing the alpha of a sprite.
View Sprite Alpha using Canvas
ctx.save();
// 50% opacity
// Anything drawn after this call (but before call .restore) will be drawn at 50% opacity
ctx.globalAlpha = 0.5;
ctx.drawImage(
spriteSourceImage,
sourceX, sourceY, sourceWidth, sourceHeight,
destX, destY, destWidth, destHeight
View gist:500856
if (
something &&
!somethingElse &&
otherThing === null) {
callFunction();
}
@geoffb
geoffb / libtiled.pro.diff
Created Jun 29, 2010
Patch to allow Tiled 0.5.0+ to compile under OSX
View libtiled.pro.diff
diff --git a/src/libtiled/libtiled.pro b/src/libtiled/libtiled.pro
index bd24e9c..5438f80 100644
--- a/src/libtiled/libtiled.pro
+++ b/src/libtiled/libtiled.pro
@@ -31,3 +31,8 @@ mac {
ppc
QMAKE_MAC_SDK = /Developer/SDKs/MacOSX10.5.sdk
}
+
+macx {
@geoffb
geoffb / canvas_perf_demo.html
Created Jun 2, 2010
Canvas Performance Demo
View canvas_perf_demo.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Canvas Performance Demo</title>
</head>
<body>
<div>
<h1>Canvas Performance Test</h1>
View example.sql
-- I used to do it like this:
SELECT * FROM table WHERE
hurr
AND (foo = 'bar')
AND (bar = 'foo')
-- Then later I spaced it out even more:
SELECT
View gist:303132
var myObject = function (someParam) {
var privateMember = "foobar";
return {
publicMethod: function () {
return "Hi! " + someParam + " " + privateMember;
}
};
You can’t perform that action at this time.