Skip to content

Instantly share code, notes, and snippets.

View spdegabrielle's full-sized avatar
🏠
Working from home

Stephen De Gabrielle spdegabrielle

🏠
Working from home
View GitHub Profile
@spdegabrielle
spdegabrielle / tf-idf.rkt
Created April 20, 2012 11:26 — forked from samth/tf-idf.rkt
TF-IDF in Racket
#lang racket
(require unstable/dict)
(provide main)
;; Set[String]
(define stopwords (list->set (file->lines "./stopwords.txt")))
;; String -> List[String]
(define (tokenize raw-text) ;; Lowercases and splits on non-letters, non-numbers.
(filter-not (λ (e) (set-member? stopwords e))
@spdegabrielle
spdegabrielle / choices.rkt
Created January 6, 2014 14:28
> is there a way to replace all the choices at one whack?
#lang racket/gui
(define (main)
(define f (new frame% [label "testing choice replacement"][width 100][height 200]))
;; String [List-of String] String [-> (instance-of Choice%)] -> (instance-of Choice%)
;; add a choice% object to f with selections los and special switch entry s at bottom
;; if this special choice is made, switch to (next)
(define (choice lbl los s next)
(new choice%
[label lbl]
!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,
@spdegabrielle
spdegabrielle / index.html
Last active August 29, 2015 14:02
TIMELINE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Demo: Making a scatterplot with SVG</title>
<script type="text/javascript" src="http://bl.ocks.org/spdegabrielle/raw/3303215619a06c35b158/d3.min.js"></script>
<style type="text/css">
/* No style rules here yet */
</style>
</head>
@spdegabrielle
spdegabrielle / index.html
Created June 9, 2014 13:51
timeline 3.3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Epro timeline</title>
<script type="text/javascript" src="http://bl.ocks.org/spdegabrielle/raw/3303215619a06c35b158/d3.min.js"></script>
<style type="text/css">
/* No style rules here yet */
</style>
</head>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Epro timeline</title>
<script type="text/javascript" src="http://bl.ocks.org/spdegabrielle/raw/3303215619a06c35b158/d3.min.js"></script>
<style type="text/css">
/* No style rules here yet */
</style>
</head>
@spdegabrielle
spdegabrielle / index.html
Created June 10, 2014 07:53
timeline 3.5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Epro timeline</title>
<script type="text/javascript" src="http://bl.ocks.org/spdegabrielle/raw/3303215619a06c35b158/d3.min.js"></script>
<style type="text/css">
/* No style rules here yet */
</style>
</head>
@spdegabrielle
spdegabrielle / index.html
Last active August 29, 2015 14:02
timeline 3.6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Epro timeline</title>
<script type="text/javascript" src="http://bl.ocks.org/spdegabrielle/raw/3303215619a06c35b158/d3.min.js"></script>
<style type="text/css">
/* No style rules here yet */
</style>
</head>
@spdegabrielle
spdegabrielle / index.html
Created June 10, 2014 08:24
timeline 3.7
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Epro timeline</title>
<script type="text/javascript" src="http://bl.ocks.org/spdegabrielle/raw/3303215619a06c35b158/d3.min.js"></script>
<style type="text/css">
/* No style rules here yet */
</style>
</head>