Skip to content

Instantly share code, notes, and snippets.

@paulkaplan
paulkaplan / fabricBezierCurve.js
Last active February 2, 2024 08:30
Cubic bezier curves with fabric.js renderer
var CubicBezier = function(canvas, opts){
if(!opts) opts = {};
this.start = opts.start || new Vec2(100,100);
this.end = opts.end || new Vec2(400, 400);
this.c1 = opts.c1 || new Vec2(100, 300);
this.c2 = opts.c2 || new Vec2(300, 100);
this.curve = new fabric.Path( this.toSVGPath() );
@frankvilhelmsen
frankvilhelmsen / gist:5336873
Last active September 6, 2021 17:23
call oracle stored procedure returning-java types from clojure
(ns package.classnamere)
(:import java.sql.Types)
(def db {:classname "oracle.jdbc.driver.OracleDriver"
:....
:password (System/getenv "password")})
(defn prepared-statement " on oracle stored procedure " []
(jdbc/with-connection db
(with-open [stmt (.prepareCall (jdbc/connection) "{ call PACKAGE.PROCEDURE(?, ?) }")]
@mbertrand
mbertrand / index.html
Last active October 25, 2023 23:58
D3.js + OpenLayers
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<title>D3.js and Openlayers - US States</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/openlayers/2.13.1/theme/default/style.css" type="text/css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/blitzer/jquery-ui.css" type="text/css">
<script src="http://d3js.org/d3.v2.min.js?2.9.3"></script>
@megakorre
megakorre / func-interface.clj
Created July 18, 2012 18:43
functional interface implementation in clojure
(defmacro fi
[interface args & code]
(let [interface-type (.getMapping *ns* interface)
methods (-> (.getMethods interface-type)
seq)
method-sym (.getName (first methods))]
(when-not (= (count methods) 1)
@gijs
gijs / index.html
Created July 4, 2012 16:56 — forked from pere/index.html
d3.js circles in leaflet.js
<html>
<head>
<title>Testing d3.js in Leaflet.js</title>
<link rel="stylesheet" href="leaflet.css" />
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js?2.9.3"></script>
<script src="http://code.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<style type="text/css">
@drankard
drankard / with-query-results-cursor
Created November 3, 2011 08:31
clojure jdbc - query with cursor
(def *default-fetch-size* 500)
(defn with-query-results-cursor [[sql & params :as sql-params] func]
(sql/transaction
(with-open [stmt (.prepareStatement (sql/connection) sql)]
(doseq [[index value] (map vector (iterate inc 1) params)]
(.setObject stmt index value))
(.setFetchSize stmt *default-fetch-size*)
(with-open [rset (.executeQuery stmt)]
(func (resultset-seq rset))))))
@mbostock
mbostock / .block
Last active April 18, 2025 00:24
Google Maps + D3
license: gpl-3.0