Skip to content

Instantly share code, notes, and snippets.

View spdegabrielle's full-sized avatar

Stephen De Gabrielle spdegabrielle

View GitHub Profile
#lang racket/base
(require racket/class json net/url racket/port net/base64 racket/match
racket/format racket/trait net/head framework/preferences)
(provide client%)
(define-local-member-name login)
(define-local-member-name password)
(preferences:set-default 'github:oauth-token #f (λ _ #t))
!function(){function n(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function t(n){return null!=n&&!isNaN(n)}function r(n){return{left:function(t,r,e,u){for(arguments.length<3&&(e=0),arguments.length<4&&(u=t.length);u>e;){var i=e+u>>>1;n(t[i],r)<0?e=i+1:u=i}return e},right:function(t,r,e,u){for(arguments.length<3&&(e=0),arguments.length<4&&(u=t.length);u>e;){var i=e+u>>>1;n(t[i],r)>0?u=i:e=i+1}return e}}}function e(n){return n.length}function u(n){for(var t=1;n*t%1;)t*=10;return t}function i(n,t){try{for(var r in t)Object.defineProperty(n.prototype,r,{value:t[r],enumerable:!1})}catch(e){n.prototype=t}}function o(){}function a(n){return sa+n in this}function c(n){return n=sa+n,n in this&&delete this[n]}function s(){var n=[];return this.forEach(function(t){n.push(t)}),n}function l(){var n=0;for(var t in this)t.charCodeAt(0)===la&&++n;return n}function f(){for(var n in this)if(n.charCodeAt(0)===la)return!1;return!0}function h(){}function g(n,t,r){return function(){var e=r.apply(t,arguments);return e===t?n:e}}function p(n,
@tonyg
tonyg / opencv-demo.rkt
Created August 13, 2014 04:06
Capturing and displaying video (webcam) frames using OpenCV from Racket
#lang racket/base
(provide )
(require ffi/unsafe)
(require ffi/unsafe/define)
(require ffi/unsafe/cvector)
(require ffi/vector)
(define highgui-lib (ffi-lib "libopencv_highgui" '("2.4" #f)))
#lang racket
(require racket/gui)
;
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
; I wrote this code five years ago while learning functional programming.
; It is an example of what you should NOT do in a functional language (or in software writing in general).
;
; THIS IS NOT A GOOD EXAMPLE OF RACKET CODE.
;
@setupminimal
setupminimal / rpn.rkt
Created May 31, 2015 16:42
Racket RPN Transformation
#lang racket
(require syntax/strip-context)
; A '#lang reader' language must provide read and read-syntax, which return a module form
; The idea is that "3 4 +:2 7 eq?:2" gets turned into '(module anything racket (eq? (+ 3 4) 7))
(provide (rename-out [rpn-read read]
[rpn-read-syntax read-syntax]))
@jkominek
jkominek / ami.rkt
Created June 15, 2015 23:20
Asterisk Manager Interface for Racket
#lang racket/base
(require racket/tcp racket/async-channel racket/match racket/function)
(define-struct ami [input-port
output-port thread
request-channel
response-channel
event-channel
[dead? #:mutable]]
module type CELL = sig
type 'a cell
type 'a exp
val return : 'a -> 'a exp
val (>>=) : 'a exp -> ('a -> 'b exp) -> 'b exp
val cell : 'a exp -> 'a cell exp
val get : 'a cell -> 'a exp
@msgodf
msgodf / kiczales-oopsla94-black-boxes-reuse.md
Last active March 28, 2022 22:23
Gregor Kiczales "Why are black boxes so hard to reuse?"

This talk was given by Gregor Kiczales of Xerox PARC at OOPSLA ’94, 10/26/94. © 1994, University Video Communications. A transcript, with point- and-click retrieval of the slides, is available at http:/www.xerox.com/PARC/spl/eca/oi/gregor-invite/gregor- transcript.html

Why are black boxes so hard to reuse?

I think our field will go through a revolution. We will fundamentally change the way we think about and use abstraction in the engineering of software.

The goal of this talk is to summarize the need for and the basic nature of this abstraction framework.

The change is not new problems or new systems, but a new way of thinking about existing problems and existing systems.

@jackfirth
jackfirth / package-count.rkt
Created November 4, 2015 04:27
Counts the number of packages at pkgs.racket-lang.org
#lang racket
(require request
fancy-app)
(define (read-from-string s) (read (open-input-string s)))
(define read-response-requester (wrap-requester-response read-from-string _))
(define (header-requester key value requester)
(add-requester-headers (list (format "~a:~a" key value)) requester))
#lang s-exp syntax/module-reader
(submod "daylang.rkt" semantics)
#:read my-read
#:read-syntax my-read-syntax
(define (my-read in) (syntax->datum (my-read-syntax #f in)))
(define (my-read-syntax src in)
(define line (read-line in))
(if (eof-object? line)