Skip to content

Instantly share code, notes, and snippets.

View artisonian's full-sized avatar

Leroy Campbell artisonian

View GitHub Profile
@defunkt
defunkt / test-spec-mini.rb
Created November 16, 2008 10:34
test/spec/mini 3
##
# test/spec/mini 3
# http://gist.github.com/25455
# [email protected]
# file:lib/test/spec/mini.rb
#
def context(*args, &block)
return super unless (name = args.first) && block
require 'test/unit'
klass = Class.new(defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase) do
@implementation CPTextView : CPView
{
DOMElement FIXME_textArea;
id _delegate;
CPScrollView _scrollView;
CPView _contentView;
JSObject _existingSelectStart;
;; this file is a walkthrough of Moustache features, a web framework for Clojure
;; http://github.com/cgrand/moustache/tree/master
;; Moustache allows to declare routes, apply middlewares and dispatch on http methods.
;; Moustache is compatible with all frameworks built on Ring, including Compojure
(ns demo
(:use net.cgrand.moustache)
(:use [ring.adapter.jetty :only [run-jetty]])) ;; hmmm Ring without servlets
@eleclerc
eleclerc / PHP_Markdown_Extra+GeSHi.patch
Created May 17, 2009 12:56
patch for PHP Markdown Extra 1.2.4 to use GeSHi to add syntax coloring to code block. first line of your codeblock need to be the language id line: ie: #!php (github and posterous' way)
--- markdown.php 2009-10-10 10:11:04.000000000 -0400
+++ markdown-geshi.php 2010-06-16 16:54:51.000000000 -0400
@@ -2,6 +2,11 @@
#
# Markdown Extra - A text-to-HTML conversion tool for web writers
#
+# GeSHI addition by Eric Leclerc
+# uses GeSHI 1.0.8.8. add a shebang line as the first line of your
+# code block to trigger GeSHI parsing/highlighting, ie:
+# #!php
Warden::Strategies.add(:bcrypt) do
def valid?
params[:username] || params[:password]
end
def authenticate!
return fail! unless user = User.first(:username => params[:username])
if user.encrypted_password == params[:password]
success!(user)
@ThisIsMissEm
ThisIsMissEm / gist:242732
Created November 25, 2009 14:18
A very basic daemon for Node.js
#! /bin/sh
CUR_DIR=$PWD
PID_FILE="$CUR_DIR/node.pid"
if [ $1 = "start" ]; then
if [ -e $PID_FILE ]; then
echo "Node.js is already running."
else
echo "Starting Node Server"
@defunkt
defunkt / browser
Created March 1, 2010 10:01
pipe html to a browser
#!/bin/sh -e
#
# Usage: browser
# pipe html to a browser
# e.g.
# $ echo '<h1>hi mom!</h1>' | browser
# $ ron -5 man/rip.5.ron | browser
if [ -t 0 ]; then
if [ -n "$1" ]; then
; response to http://toinfinity.wordpress.com/2010/05/01/does-groovy-know-you-are-seeing-clojure
; tell the gnomes! phase two is (map - closing-prices)!
; prior to 1.2, reductions is in clojure.contrib.seq-utils
(->> (reductions min closing-prices) ;; lowest prices at each point
(map - closing-prices) ;; possible profit at each point
(apply max)) ;; profit!
@tbtlr
tbtlr / get_barcode_from_image.js
Created June 1, 2010 19:33
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
/*
* AppController.j
* imdbdemo
*
* Created by Randy Luecke on July 2, 2010.
* Copyright 2010, RCLConcepts, LLC All rights reserved.
*/
@import <Foundation/CPObject.j>
@import <AppKit/CPScrollView.j>