Skip to content

Instantly share code, notes, and snippets.

string filePath = Path.Combine(path, mode + ".json");
var theme = JsonConvert.DeserializeObject<ThemeSet>(
File.ReadAllText(filePath);
if (theme.AccentColors == null || theme.AccentColors.Count <= 0)
{
theme.AccentColors = this.Colors;
File.WriteAllText(
filePath,
foreach(var mode in item.Value.Modes)
{
string directory = $@"c:\temp\themes\{item.Key}";
Directory.CreateDirectory(directory);
var theme = item.Value.GetTheme(mode, item.Value.DefaultColor);
theme.ThemeName = $"{item.Key} {mode}";
File.WriteAllText(
Path.Combine(directory, $"{item.Key}-{mode}.json"),
var xxx = new Dictionary<string, Color>()
{
{ "Red - Dark", new Color(172, 25, 61) },
{ "Pink - Dark", new Color(220, 79, 173) },
{ "Orange - Dark", new Color(255, 129, 25) },
{ "Green - Dark", new Color(0, 138, 23) },
{ "Blue - Dark", new Color(0, 75, 139) },
{ "Teal - Dark", new Color(0, 130, 153) },
{ "Light Blue - Dark", new Color(93, 178, 255) },
{ "Purple - Dark", new Color(70, 23, 180) },
public class SignInChoicePage : DialogPage
{
public SignInChoicePage()
{
this.HeaderText = this.WindowTitle = "Select Printer".Localize();
var commonMargin = new BorderDouble(4, 2);
// Create export button for each plugin
var buttonA = new RadioButton(new RadioButtonViewText("Sign in to access your existing printers".Localize(), theme.Colors.PrimaryTextColor))
var rows = jQuery("tr", jQuery("table").eq(0));
var results = {};
for(var i = 1; i < rows.length; i++)
{
var cells = rows[i].cells;
var make = cells[13].innerText;
var model = cells[14].innerText;
@jlewin
jlewin / Simple.Graphviz
Created August 9, 2018 16:43
Simple.Graphviz template
digraph Dependencies {
ratio = fill;
node [style=filled color="#118893"];
start -> main
start -> on_exit
main -> sort
main -> merge
merge -> term
term -> signal
// InteractiveScene.cs - Line 312
public IPrimitive TraceData()
{
var timer = Stopwatch.StartNew();
var result = sourceItem.TraceData();
Trace.WriteLine("TimeToInvoke TraceData(): " + timer.ElapsedMilliseconds);
return result;
}
private static Regex bracedNumbers = new Regex("[\\(\\{]+(\\d+\\.*\\d*|\\w{1})[\\}\\)]+", RegexOptions.CultureInvariant | RegexOptions.Compiled);
private static Regex number = new Regex("[\\(\\{]+\\d+\\.*\\d*[\\}\\)]+", RegexOptions.CultureInvariant | RegexOptions.Compiled);
public static void SanitizeLine(string text, HashSet<string> words)
{
// Remove escaped newlines
text = text.Replace("\\n", " ");
// Remove braced numbers (0), {0}
@jlewin
jlewin / StlLoadTiming.cs
Last active July 16, 2017 06:29
StlLoadTiming
[Test]
public void StlLoadTiming()
{
var timer = Stopwatch.StartNew();
var times = new List<string>();
var loadedObjects = new List<IObject3D>();
for(int i = 0; i < 5; i++)
{
loadedObjects.Add(Object3D.Load(@"C:\Users\John\Desktop\bdPenHolder_low_fixed.STL", CancellationToken.None, progress: ((double ratio, string state) progress) =>
@jlewin
jlewin / ReconstructPrintLog.cs
Last active June 29, 2017 18:38
Reconstruct MatterControl print logs back into GCode
/// </summary>
public static Regex regex = new Regex(
"Z(\\d+\\.*\\d*)",
RegexOptions.Multiline
| RegexOptions.CultureInvariant
| RegexOptions.Compiled
);
void Main()
{