Skip to content

Instantly share code, notes, and snippets.

@lshifr
lshifr / AutoRenamings
Created Jan 26, 2012
A tiny framework to cure the leaks of lexical scoping in Mathematica
View AutoRenamings
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 Feb 4, 2012
Code highligher generator
View CodeHighligherGenerator.m
(* 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 Feb 20, 2012
Version information for Mathematica system functions
View FunctionVersionInfo.m
{"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
Large data framework
View largeData.m
ClearAll[$fileNameFunction,fileName, $importFunction,import, $exportFunction,
export, $compressFunction, $uncompressFunction]
$fileNameFunction = fileName;
$importFunction = import;
$exportFunction = export;
$compressFunction = Compress;
$uncompressFunction = Uncompress;
@lshifr
lshifr / GuideLinks.m
Created Jul 19, 2012
Graph rules for Mathematica documentation guides dependencies
View GuideLinks.m
@lshifr
lshifr / Readme.md
Created Nov 17, 2012
Correcting the prevoius commit using the API
View Readme.md

##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 Nov 19, 2012 — forked from greggroth/cover_flow.nb
Mathematica:coverflow
View cover_flow.nb
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 Nov 25, 2012
Test gist with two packages
View Test1.m
BeginPackage["Test1`"]
f[x_]:=x^2;
EndPackage[]
@lshifr
lshifr / Test1.m
Created Nov 25, 2012
Simple test project with one package and a project.m file
View Test1.m
BeginPackage["Test1`"]
f[x_]:=x^2;
EndPackage[]
@lshifr
lshifr / Test1.m
Created Nov 25, 2012
Test gist with two packages and a project.m file
View Test1.m
BeginPackage["Test1`"]
f[x_]:=x^2;
EndPackage[]