Skip to content

Instantly share code, notes, and snippets.

@drewlesueur
drewlesueur / grrrails.markdown
Created December 13, 2010 04:32
Things that make me go Grr in rails

GRR Rails

I am learning Rails.

Here are the things that make me go GRR

  1. I see code like this MyModel.like "apples". Is there any documentation on that? or did someone write the method like? Is there a cool way to do likes relationally?
@drewlesueur
drewlesueur / lagnuage.markdown
Created December 15, 2010 03:27
Thoughts on programming languages

Programming Language Thoughts

What makes a good programming language?

A good programming language is expressive. That means I can easily turn the thoughts of my head into code. A good programming language is easy to read. It's important for code to be read because code lives. Others edit it, extend it, learn from it. A good programming language is fast.

@drewlesueur
drewlesueur / expresscgi.coffee
Created December 20, 2010 03:01
Example of using the express framework as cgi instead of running on a node server!
#!/usr/bin/env coffee
cgi = require "/root/sites/coffee-cgi/cgi"
sys = require "sys"
http = require "http"
http.IncomingMessage = cgi.Request
http.ServerResponse = cgi.Response
connect = require "connect"
<!doctupe html>
<html>
<head>
<title> ABC
</title>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<script src="http://includes.the.tl/zepto/zepto.js"></script>
<script src="http://includes.the.tl/underscore.js"></script>
@drewlesueur
drewlesueur / util.php
Created December 29, 2010 19:27
A couple PHP utility functions
// Disable magic quotes
if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
@drewlesueur
drewlesueur / explicit_scope.md
Created January 8, 2011 02:55
Explicit scope in JavaScript

Explicit Scope in JavaScript

Wouldn't it be cool if JavaScript had explicit scope?

Every function would have an extra scope variable that represents the scope of that function.

Example

function update_scope(s) {

s.name = "Bob"

@drewlesueur
drewlesueur / jqueryui.js
Created January 22, 2011 21:36
jQuery UI
/*!
* jQuery UI 1.8.9
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI
*/
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.9",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
@drewlesueur
drewlesueur / test.md
Created January 28, 2011 06:21
markdown

|test|table| |another| test|

x = 1
log x
log "hello #{name}"