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: 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

@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 / 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 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 / 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 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 Smart Let Construct B
Last active June 22, 2016 00:30 — forked from lshifr/SmartLet.m
Smart Let in Mathematica
ClearAll[Let, let, symbolOrListQ, inSetDelayed];
SetAttributes[{Let, let, symbolOrListQ}, HoldAll];
symbolOrListQ[_Symbol] = True;
symbolOrListQ[{___?symbolOrListQ}] = True;
symbolOrListQ[_] = False;
Let::lvset = "Local variable specification `1` is not valid.";
@gcdr
gcdr / OTH: Mathematica Plot Waves?
Last active June 22, 2016 00:26 — forked from Eckankar/waves.nb
Making wave animations in Mathematica
circleLine[x_, y_, s_] :=
Module[{d = 3/2*Sin[s + (x/2 + y)/10*Pi] + 3/2},
Graphics[
If[{x, y} == {7, 7}, {LightGray, Line[{{x, y}, {x + 3, y - 3}}],
Red}, {}]~Join~
{Circle[{x + d, y - d}, 0.1]}
]
];
frames = Table[
@gcdr
gcdr / notepad.html
Created March 1, 2018 05:19 — forked from jdkanani/notepad.html
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`
@gcdr
gcdr / .bashrc
Created March 13, 2018 19:24 — forked from mbround18/.bashrc
Personal bashrc
#--------------------------------------------------------------------------------------------
# if found on gist use `git clone https://gist.github.com/650d59476b86fbe885e66af953099006.git .`
# this is a modified version of Emmanuel Rouat [no-email] bashrc how to which can be found at
# `http://tldp.org/LDP/abs/html/sample-bashrc.html`
#--------------------------------------------------------------------------------------------
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
#-------------------------------------------------------------