Skip to content

Instantly share code, notes, and snippets.

View gcdr's full-sized avatar
😀
Better!

Glen Ritchie gcdr

😀
Better!
View GitHub Profile
@gcdr
gcdr / OTH: Mathematica in LISP Mode
Last active June 22, 2016 00:19 — forked from redacted/mathematica.nb
Mathematica in Lisp mode
Set[f[x_],
ReplaceAll[Times[A, Exp[-x]],
First[Solve[
Equal[Integrate[Times[A, Exp[-r]], {r, -Infinity, Infinity}], 1], A]]]]
@gcdr
gcdr / OTH: Mathematica Make a Maze
Last active June 22, 2016 00:18 — forked from AlephAlpha/maze
Maze generator in Mathematica
MazeGraphics[m_, n_] :=
Block[{$RecursionLimit = Infinity,
unvisited = Tuples[Range /@ {m, n}], maze},
maze = Graphics[{Line[{{#, # - {0, 1}}, {#, # - {1, 0}}}] & /@
unvisited,
Line[{{0, n}, {0, 0}, {m, 0}}]}]; {unvisited =
DeleteCases[unvisited, #];
Do[If[MemberQ[unvisited, neighbor],
maze = DeleteCases[
maze, {#,
@gcdr
gcdr / OTH: Mathematica Plot Mandelbrot
Last active June 22, 2016 00:18 — forked from sgwizdak/mathematicaMandelbrot.nb
Mathematica Mandelbrot
Mandelbrot[c_] := Module[{z = 0, i = 0}, While[i < 100 && Abs[z] < 2, z = z^2 + c; i++]; i];
DensityPlot[Mandelbrot[xc + I yc], {xc, -2, 1}, {yc, -1.5, 1.5},
PlotPoints -> 275, Mesh -> False, Frame -> False,
ColorFunction -> (If[# != 1, Hue[#], Hue[0, 0, 0]] &)]
@gcdr
gcdr / 0_reuse_code.js
Last active May 20, 2016 23:01
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@gcdr
gcdr / OTH: Mathematica Let Scoping Construct A
Last active June 22, 2016 00:30 — forked from teake/gist:d914c07f18e89094efa1
Mathematica Let scoping construct from: Teake Nutma / teake. Mathematica
ClearAll[Let, let, symbolOrListQ];
SetAttributes[{Let, let, symbolOrListQ}, HoldAll];
Let::lvset = "Local variable specification `1` is not valid.";
Let /: Verbatim[SetDelayed][lhs_, rhs : HoldPattern[Let[__, _]]] :=
Block[{With}, Attributes[With] = {HoldAll};
lhs := Evaluate[rhs /. HoldPattern[With[{}, b_]] :> b]];
Let[args : HoldPattern[Set[_?symbolOrListQ, _] ...], body_] :=
@gcdr
gcdr / OTH: Tarantino Graph of Movies.adoc
Last active June 22, 2016 00:16 — forked from ramisU/graph_gist_tarantino.adoc
Powerful datatype "adoc" shows Online Visualizations

Quentin Tarantino Movies

nJLWScU

Setup