Skip to content

Instantly share code, notes, and snippets.

View JeffBezanson's full-sized avatar

Jeff Bezanson JeffBezanson

View GitHub Profile
# as a string
"function check_new_version(existing::Vector{VersionNumber}, ver::VersionNumber)
@assert issorted(existing)
for v in [v\"0\", v\"0.0.1\", v\"0.1\", v\"1\"]
lowerbound(v) <= ver <= v && return
end
error(\"$ver is not a valid initial version (try 0.0.0, 0.0.1, 0.1 or 1.0)\")
end"
argtail(x, rest...) = rest
tail(x::Tuple) = argtail(x...)
# x >= y ? t : f
_cmp_ge(x::(), y::(), t, f) = t
_cmp_ge(x::(), y::Tuple, t, f) = f
_cmp_ge(x::Tuple, y::(), t, f) = t
_cmp_ge(x::Tuple, y::Tuple, t, f) = _cmp_ge(tail(x), tail(y), t, f)
function dispatchratio(D, M::Module, expor, recur)
nspec = 0
nGFspec = 0
for name in names(M,!expor)
if isdefined(M, name)
F = eval(M, name)
if isa(F,Union(Function,DataType))
if isgeneric(F)
if !haskey(D,F)
positions = IntSet()
@JeffBezanson
JeffBezanson / symbol-input.el
Created January 17, 2014 20:26
emacs symbol input mode
(quail-define-package
"symbol-input" "unicode" "unicode-sym" t
"Easier input for unicode technical symbols"
nil t nil nil nil nil nil nil nil nil t)
(quail-define-rules
("\\alpha" ?α)
("\\beta" ?β)
("\\gamma" ?γ)
("\\delta" ?δ)
@JeffBezanson
JeffBezanson / gist:5325156
Created April 6, 2013 06:45
emacs input method for unicode technical symbol input
(quail-define-package
"symbol-input" "unicode" "unicode-sym" t
"Easier input for unicode technical symbols"
nil t nil nil nil nil nil nil nil nil t)
(quail-define-rules
("\\alpha" ?α)
("\\beta" ?β)
("\\gamma" ?γ)
("\\delta" ?δ)
@JeffBezanson
JeffBezanson / gist:4212658
Created December 5, 2012 05:38
add ProcessEachLine
diff --git a/base/process.jl b/base/process.jl
index e8fadae..74a8914 100644
--- a/base/process.jl
+++ b/base/process.jl
@@ -677,11 +677,27 @@ end
readall(ports::Ports) = _readall(ports, cmds(ports))
readall(cmds::Cmds) = _readall(stdout(cmds), cmds)
+type ProcessEachLine
+ stream::IO
index b2b032c..ce89fb3 100644
--- a/extras/tk.jl
+++ b/extras/tk.jl
@@ -92,11 +92,10 @@ type TkWidget
global Window
function Window(title, w, h)
wpath = ".jl_win$ID"; ID += 1
- tcl_eval("frame $wpath -width $w -height $h")
- tcl_eval("wm manage $wpath")
+ tcl_eval("toplevel $wpath -width $w -height $h")