Skip to content

Instantly share code, notes, and snippets.

View artisonian's full-sized avatar

Leroy Campbell artisonian

View GitHub Profile
@import <AppKit/CPView.j>
CPTextViewDidFocusNotification = @"CPTextViewDidFocusNotification";
CPTextViewDidBlurNotification = @"CPTextViewDidBlurNotification";
@implementation CPTextView : CPControl
{
DOMElement _inputElement;
id _delegate;
CPScrollView _scrollView;
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@artisonian
artisonian / simple_gridfs_server.py
Created July 27, 2010 19:24
A simple GridFS server built with Flask
from flask import Flask, request, redirect, url_for, make_response, abort
from werkzeug import secure_filename
from pymongo import Connection
from pymongo.objectid import ObjectId
from gridfs import GridFS
from gridfs.errors import NoFile
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
DB = Connection().gridfs_server_test
FS = GridFS(DB)
(defun color-theme-mustang ()
(interactive)
(color-theme-install
'(color-theme-mustang
((background-color . "#202020")
(background-mode . dark)
(cursor-color . "#bdbdbd")
(mouse-color . "sienna1")
(foreground-color . "#bdbdbd"))
(default ((t (:background "#202020"))))
@artisonian
artisonian / sass_converter.rb
Created March 18, 2012 23:21 — forked from wolfeidau/sass_converter.rb
Sass plugin for Jekyll
module Jekyll
# Sass plugin to convert .scss to .css
#
# Note: This is configured to use the new css like syntax available in sass.
require 'sass'
require 'compass'
class SassConverter < Converter
safe true
priority :low
@artisonian
artisonian / .gitignore
Last active March 21, 2024 20:13
go-eventsource
eventsource
go-eventsource
client/client
(function(){
var BackboneEvents = {
on: function(events, callback, context) {
var ev;
events = events.split(/\s+/);
var calls = this._callbacks || (this._callbacks = {});
while (ev = events.shift()) {
var list = calls[ev] || (calls[ev] = {});
var tail = list.tail || (list.tail = list.next = {});
tail.callback = callback;
@artisonian
artisonian / errors.json
Created December 11, 2012 15:19
Sample API error handling
{
"status_code": "400",
"errors": {
"order.ice_cream.flavor": ["Flavor cannot be blank", "Flavor must be one of 'vanilla', 'chocolate', or 'strawberry'"],
"order.ice_cream.container": ["Container must be one of 'bowl', or 'cone'"]
}
}
[
{
"name": "Acme Broadcasting",
"published": true,
"markets": [
{
"name": "Boston",
"published": false,
"stations": [
{ "name": "WQXZ", "published": false },
function isLeapYear (n) { return (n % 400 === 0) || ((n % 4 === 0) && (n % 100 !== 0)); }
isLeapYear(1999); // => false
isLeapYear(2000); // => true
isLeapYear(2011); // => false
isLeapYear(2012); // => true