Skip to content

Instantly share code, notes, and snippets.

View danlentz's full-sized avatar

Dan Lentz danlentz

View GitHub Profile
;;;; A simple Google Chart wrapper for Common Lisp
;;;
;;; API reference: http://code.google.com/apis/chart/
;;;
;;; WARNING: Incomplete and buggy -- still has much to be done, e.g.:
;;;
;;; * more thorough testing (that won't be hard...)
;;;
;;; * handle spaces/newlines appropriately
@danlentz
danlentz / gist:912198
Created April 10, 2011 09:54
examples of set-macro-character
(set-macro-character #\⌋ (get-macro-character #\)))
(set-macro-character #\⌊
(lambda (stream char)
(declare (ignore char))
(prog1 `(floor ,(read stream t nil t))
(let ((char (peek-char t stream t nil t)))
(if (char= char #\⌋)
(read-char stream t nil t)
(error 'reader-error :stream stream))))))
@danlentz
danlentz / gistGithubAddPaginationToTop4MyGists.user.js
Created May 22, 2011 03:31 — forked from erikvold/gistGithubAddPaginationToTop4MyGists.user.js
This userscript will add the pagination for the gist.github.com My Gists page.
// ==UserScript==
// @name Add Pagination For My Gists To Top
// @namespace gistGithubAddPaginationToTop4MyGists
// @include /^http:\/\/gist\.github\.com\/mine([?#].*)?$/i
// @include http://gist.github.com/mine*
// @match http://gist.github.com/mine*
// @datecreated 2010-03-21
// @lastupdated 2010-03-21
// @version 0.1
// @author Erik Vergobbi Vold
(defclass cons-presentation-mixin ()
((car-type :accessor cons-presentation-car-type
:initarg :car-type)
(cdr-type :accessor cons-presentation-cdr-type
:initarg :cdr-type))
(:documentation "A presentation for conses."))
(defclass cons-presentation (presentation cons-presentation-mixin)
()
)
@danlentz
danlentz / gist:986846
Created May 23, 2011 15:07 — forked from pyropeter/gist:506166
Google Search API documentation
# http://www.google.com/uds/GwebSearch?q=foo%20bar&v=1.0
{ responseStatus: 200
, responseData:
{ results:
[ { visibleUrl: 'www.foobar2000.org'
, titleNoFormatting: 'foobar2000'
, cacheUrl: 'http://www.google.com/search?q=cache:obAJTkESjhwJ:www.foobar2000.org'
, title: 'foobar2000'
, content: 'Media player with simple UI and low memory use. Offers plugin support for new features. Includes link to forum focused on application. [Win32]'
@danlentz
danlentz / google_ajax_search.rb
Created May 23, 2011 15:08 — forked from marshluca/google_ajax_search.rb
Google Ajax Search API
require 'rubygems'
require 'json'
require 'hpricot'
require 'open-uri'
def google_search(service,query,page,options=nil)
url = "http://ajax.googleapis.com/ajax/services/search/#{service}?v=1.0&q=#{query}&start=#{page}0"
url += options.to_s
url += "&key=ABQIAAAAvJK0-O6R9IuRS5y6YePa_BQ7FXN5Ck7MXp2rPPrMwF-0TtPdBhSCDq3eiNkPUQlaeTXgVbm7vRuvyw"
I've just put up a large chunk of my Twitter archives up on the
Talis Platform service. Talis Platform is a 'cloud'-based
triplestore hosting service. More at http://n2.talis.com
A triplestore is like a database but for graphs of RDF triples.
The cool thing about RDF and the triplestore is that you
basically have a completely schema-less datastore. You don't have
to figure out "Oh, there's integers going in this field and
strings going in that". You just upload a big pile of RDF and the
triplestore keeps it all there. This is obviously not as efficient
as using a database, so if you want to grow to Google size, it may
@danlentz
danlentz / rdfa-load
Created May 24, 2011 03:05 — forked from njh/rdfa-load
Example of parsing RDFa into a graph
#!/usr/bin/env ruby
require 'rubygems'
require 'rdf/rdfa'
graph = RDF::Graph.load('http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml1/0001.xhtml', :base_uri => 'http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml1/0001.xhtml')
graph.each_statement do |statement|
statement.inspect!
end
@danlentz
danlentz / gist:1002215
Created June 1, 2011 12:42 — forked from philogb/gist:979085
ext.js example
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Stack Simulator</title>
<link rel="stylesheet" type="text/css" href="../../../resources/css/ext-all.css" />
<script type="text/javascript" src="../../../bootstrap.js"></script>
<script>
Ext.require(['Ext.chart.*', 'Ext.data.*']);
@danlentz
danlentz / qdiff.lisp
Created September 28, 2011 01:24 — forked from hanshuebner/qdiff.lisp
Diff checked-out quicklisp project against dist version
;;;; qdiff.lisp
(defpackage #:qdiff
(:use #:cl)
(:shadowing-import-from #:ql-dist
#:name
#:release
#:ensure-local-archive-file
#:base-directory
#:prefix)