Skip to content

Instantly share code, notes, and snippets.

@calebhearth
calebhearth / gist:1186863
Created September 1, 2011 18:25 — forked from voodootikigod/gist:1155790
PyCodeConf Ticket Give-away
Day job: Software Engineer @ BIT Systems in Sterling, VA
Favorite Python project: Django, or if you mean my own Python projects, github.com/calebthompson/books
Favorite Conference: GDC
Python Experience Level: Beginner
@calebhearth
calebhearth / swtor.cs
Created January 19, 2012 00:33
Star Wars: The Old Republic launcher wrapper to allow for Valve's Steam Overlay to work with the game
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Pipes;
using System.Management;
using System.Threading;
using System.Windows.Forms;
namespace steamswtor
{
47) Error:
test_should_update_company(CompaniesControllerTest):
ActiveRecord::StatementInvalid: PGError: ERROR: relation "investor_company_profiles" does not exist
LINE 4: WHERE a.attrelid = '"investor_company_profiles"...
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"investor_company_profiles"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
t = [ '/', '/start/somethingelse/1', '/upload' ]
for (d in t) { result = t[d].match( /\/([a-z]+)?(\/(.*)?)?/i ); console.log(result[1], result[3]) }
var path = require('path');
var controllersPrefix = './controllers/';
var notFoundPath = controllersPrefix + '404';
function getController(resource) {
var controllerPath = controllersPrefix + resource;
var controller;
if path.existsSync(controllerPath) {
controller = require(controllerPath);
@calebhearth
calebhearth / for_vs_each.rb
Created August 7, 2012 21:37
The Dangers of Ruby 'for' and metaprogramming
THINGS = %w{ foo bar baz }
class EachThing
THINGS.each do |thing|
define_method(thing) { thing }
end
end
class ForThing
for thing in THINGS do
@calebhearth
calebhearth / gist:3415475
Created August 21, 2012 13:36
taxonomy of a project idealized
|-- app
| |-- assets
| | |-- images
| | |-- behavior
| | `-- styles
| | |-- components
| | | |-- *_helpers.scss
| | |-- globals
| | | |-- *_helpers.scss
| | | `-- variables.scss
draper[master*]/
↪ bundle install --binstubs
Using rake (0.9.2.2)
Using ZenTest (4.8.2)
Using i18n (0.6.1)
Using multi_json (1.3.6)
Using activesupport (3.2.8)
Using builder (3.0.3)
Using activemodel (3.2.8)
Using erubis (2.7.0)
unproject(snapToGrid(project(getHoverPoint())))
hoverPoint = getHoverPoint()
projected = project(point)
gridded = snapToGrid(projected)
unproject(gridded)
2012-11-28 20:49:40.762 webkit_server[7049:707] *** WARNING: Method userSpaceScaleFactor in class NSView is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
2012-11-28 20:49:41.638 webkit_server[7049:707] Error loading /Library/Internet Plug-Ins/npgtpo3dautoplugin.plugin/Contents/MacOS/npgtpo3dautoplugin: dlopen(/Library/Internet Plug-Ins/npgtpo3dautoplugin.plugin/Contents/MacOS/npgtpo3dautoplugin, 262): no suitable image found. Did find:
/Library/Internet Plug-Ins/npgtpo3dautoplugin.plugin/Contents/MacOS/npgtpo3dautoplugin: mach-o, but wrong architecture
2012-11-28 20:49:41.638 webkit_server[7049:707] Error loading /Library/Internet Plug-Ins/Silverlight.plugin/Contents/MacOS/agcore: dlopen(/Library/Internet Plug-Ins/Silverlight.plugin/Contents/MacOS/agcore, 262): no suitable image found. Did find:
/Library/Internet Plug-Ins/Silverlight.plugin/Contents/MacOS/agcore: mach-o, but wrong architecture
2012-11-28 20:49:41.639 webkit_server[7049:707]