Skip to content

Instantly share code, notes, and snippets.

View DanTup's full-sized avatar

Danny Tuppeny DanTup

  • Coded Consultants Ltd
  • England, UK
  • 22:12 (UTC +01:00)
  • X @DanTup
View GitHub Profile
@DanTup
DanTup / main.dart
Created October 24, 2022 18:37
quintessential-dryad-3795
void main() {
var num = 5;
var factorial = 1;
for( var i = num ; i >= 1; i-- ) {
factorial = factorial * i ;
print(factorial);
}
print(factorial);
}
@DanTup
DanTup / paths.dart
Last active April 6, 2022 22:25
Sudoku Killer Cage path calculations
import 'package:built_collection/built_collection.dart';
import 'package:flutter/painting.dart';
import 'package:sudoku/src/model/model.dart';
import 'package:sudoku/src/model/model_extensions.dart';
typedef CellSelector = CellCoordinate Function(CellCoordinate);
class InsetInfo {
/// The relative cell to check for selection to know if we need a line along
/// this edge.
@DanTup
DanTup / Dart.plist
Created January 27, 2022 14:31
Basic Language Module for BBEdit to recognise Dart
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BBEditDocumentType</key>
<string>CodelessLanguageModule</string>
<key>BBLMLanguageDisplayName</key> <string>Dart</string>
<key>BBLMLanguageCode</key> <string>Dart</string>
@DanTup
DanTup / dart_download.strace
Last active May 10, 2019 16:38
Simple Dart script to download data for testing WSL hangs
This file has been truncated, but you can view the full file.
4514 execve("/home/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/dart", ["/home/danny/Dev/Google/flutter/b"..., "./dart_download_test.dart"], [/* 18 vars */]) = 0
4514 brk(NULL) = 0x2c1c000
4514 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
4514 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa18d450000
4514 readlink("/proc/self/exe", "/home/danny/Dev/Google/flutter/b"..., 4096) = 58
4514 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
4514 open("/home/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/tls/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
4514 stat("/home/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/tls/x86_64", 0x7fffd5f28bb0) = -1 ENOENT (No such file or directory)
4514 open("/home/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
@DanTup
DanTup / proxy_test.dart
Created January 2, 2019 09:56
Dart localhost WebSocket proxy test script
import 'dart:io';
var port = 3456;
main() async {
print('HTTP_PROXY: ${Platform.environment['HTTP_PROXY']}');
print('NO_PROXY: ${Platform.environment['NO_PROXY']}');
print('');
await test('ws://echo.websocket.org');
@DanTup
DanTup / README.md
Last active December 16, 2018 19:53
Custom Cura definition for Monoprice Ultimate

Copy this JSON file to ~/Library/Application Support/cura/3.6/definitions/monoprice_ultimate.def.json on macOS (note the Cura version in the path). It'll list a new printer (Monoprice Ultimate) that inherits the Wanhao Duplicator 6 profile but with the correct acceleration/jerk values (at least the defaults for mine).

This will improve the accuracy of time estimates (for example, a Tito head estimated 4hrs without this change, and 7:22 with it - which looks about right given it's 55% through the Gcode after 4:10!).

// Generated by dart2js, the Dart to JavaScript compiler version: 1.24.2.
// The code supports the following hooks:
// dartPrint(message):
// if this function is defined it is called instead of the Dart [print]
// method.
//
// dartMainRunner(main, args):
// if this function is defined, the Dart [main] method will not be invoked
// directly. Instead, a closure that will invoke [main], and its arguments
// [args] is passed to [dartMainRunner].
@DanTup
DanTup / Actual cube state.txt
Created March 16, 2017 15:43
MindCub3r Logs
w w w
o o r
g o r
o w y r g y b y g r b b
g b g w y o b g o y w y
y w b r b g o y o g g o
w r y
r r b
b r y
@DanTup
DanTup / dart.md
Created March 3, 2017 13:09 — forked from paulmillr/dart.md
Leaked internal google dart email

---------- Forwarded message ----------

From: Mark S. Miller <erights@google.com>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: javascript-standard@google.com
@DanTup
DanTup / code.cs
Last active November 30, 2016 21:26
PoSh module for formatting objects using Razor
function Format-Razor()
{
<#
.SYNOPSIS
Formats a set of objects using the Razor Engine.
.DESCRIPTION
The Format-Razor function formats a set of objects using a supplied template using the Razor Engine created for ASP.NET.
.NOTES
Author: Danny Tuppeny (DanTup)
.LINK