Skip to content

Instantly share code, notes, and snippets.

@lshifr
lshifr / AutoRenamings
Created January 26, 2012 16:04
A tiny framework to cure the leaks of lexical scoping in Mathematica
ClearAll[getPatternSymbols, getDeclaredSymbols];
SetAttributes[{getPatternSymbols, getDeclaredSymbols}, HoldAll];
getPatternSymbols[expr_] :=
Cases[Unevaluated[expr],
Verbatim[Pattern][ss_, _] :> HoldComplete[ss], {0, Infinity},
Heads -> True];
getDeclaredSymbols[{decs___}] :=
Thread@Replace[HoldComplete[{decs}],
HoldPattern[a_ = rhs_] :> a, {2}];
@lshifr
lshifr / CodeHighligherGenerator.m
Created February 4, 2012 20:12
Code highligher generator
(* Mathematica Package *)
(* Created by the Wolfram Workbench 05.01.2012 *)
BeginPackage["CodeHighlighterGenerator`"]
(* Exported symbols added here with SymbolName::usage *)
HighlighterLocation;
HighlighterPackageName;
@lshifr
lshifr / FunctionVersionInfo.m
Created February 20, 2012 13:01
Version information for Mathematica system functions
{"AbelianGroup" -> {"8"}, "AbortKernels" -> {"7"}, "Abort" -> {"2"},
"AbortProtect" -> {"2"}, "Abs" -> {"1"},
"AbsoluteCurrentValue" -> {"6"}, "AbsoluteDashing" -> {{"2", "6"}},
"AbsoluteFileName" -> {"7"}, "AbsoluteOptions" -> {"4"},
"AbsolutePointSize" -> {{"2", "6"}},
"AbsoluteThickness" -> {{"2", "6"}}, "AbsoluteTime" -> {{"2", "6"}},
"AbsoluteTiming" -> {"5"}, "AccountingForm" -> {"2"},
"Accumulate" -> {{"6", "7"}}, "AccuracyGoal" -> {{"1", "5"}},
"Accuracy" -> {{"1", "5"}}, "ActionMenu" -> {{"6", "8"}},
"Active" -> {"3"}, "ActiveStyle" -> {"7"}, "AcyclicGraphQ" -> {"8"},
@lshifr
lshifr / largeData.m
Created May 14, 2012 19:55
Large data framework
ClearAll[$fileNameFunction,fileName, $importFunction,import, $exportFunction,
export, $compressFunction, $uncompressFunction]
$fileNameFunction = fileName;
$importFunction = import;
$exportFunction = export;
$compressFunction = Compress;
$uncompressFunction = Uncompress;
@lshifr
lshifr / GuideLinks.m
Created July 19, 2012 23:07
Graph rules for Mathematica documentation guides dependencies
@lshifr
lshifr / Readme.md
Created November 17, 2012 16:31
Correcting the prevoius commit using the API

##CodeFormatter.m

###Formatting Mathematica code

CodeFormatter.m is a pretty-printer / code formatter for code written in the Mathematica language, which is also written in Mathematica. It works on the box level at the moment. The direct support for strings has not yet been implemented, but one can always convert code to boxes and use it then. Only a few boxes are currently supported, but

@lshifr
lshifr / cover_flow.nb
Created November 19, 2012 11:50 — forked from greggroth/cover_flow.nb
Mathematica:coverflow
pic = Import["ExampleData/rose.gif"];
Module[{width = 28, layers = 6, offset, highlight, slides, img,
data},
offset[x_, slide_] := 15/(1 + Exp[-(x - slide) 3]);
highlight[x_, slide_] :=
0.85 PDF[NormalDistribution[slide, 1], x]/
PDF[NormalDistribution[slide, 1], slide] + 0.15;
img = Table[pic, {n, 1, layers}];
Manipulate[Graphics3D[{
Table[{
@lshifr
lshifr / Test1.m
Created November 25, 2012 13:14
Test gist with two packages
BeginPackage["Test1`"]
f[x_]:=x^2;
EndPackage[]
@lshifr
lshifr / Test1.m
Created November 25, 2012 13:24
Simple test project with one package and a project.m file
BeginPackage["Test1`"]
f[x_]:=x^2;
EndPackage[]
@lshifr
lshifr / Test1.m
Created November 25, 2012 13:34
Test gist with two packages and a project.m file
BeginPackage["Test1`"]
f[x_]:=x^2;
EndPackage[]