Skip to content

Instantly share code, notes, and snippets.

@NameOfTheDragon
NameOfTheDragon / filament_dryer.cfg
Last active June 3, 2024 09:29
Klipper macros for drying filament using the heated build plate of a 3D printer
; An idea for using the heated bed of a 3D printer as a filament dryer.
; Adds GCODE command: START_DRYER TIME=T TEMPERATURE=C
; (T is time in seconds, C is bed temperature in Celsuis)
; To stop drying early, use STOP_DRYER.
; Also defined some utility macros: DRY_PLA, DRY_PETG and DRY_ABS.
; Edit these with your own preferred defaults.
[gcode_macro START_DRYER]
description: Start the heated bed filament dryer.
gcode:
@danielgreen
danielgreen / ParseJSONDates.js
Last active March 8, 2021 22:26
When an ASP.NET MVC 4 action returns JSON containing a DateTime value, the value is serialized into a format that cannot be natively understood by JavaScript. Here is some code to process the value into a JavaScript Date. A better solution than this is to use JSON.NET to serialize dates instead. See https://gist.github.com/danielgreen/5669903
function dateTimeReviver (key, value) {
var a;
if (typeof value === 'string') {
a = /\/Date\((\d*)\)\//.exec(value);
if (a) {
return new Date(+a[1]);
}
}
return value;
}