Skip to content

Instantly share code, notes, and snippets.

View owen2's full-sized avatar

Owen Johnson owen2

View GitHub Profile
@metacollin
metacollin / Polycarbonate.ini
Last active May 6, 2024 10:17
Slic3r settings for high quality, low-warp, high-strength printing of polycarbonate without an enclosure on a Prusa i3 MK2S
# generated by Slic3r 1.37.2-prusa3d on Thu Dec 7 09:48:20 2017
# Figured out by trial and error engineer metacollin
# Released as public domain.
# USE GLUESTICK FOR PRINT BED ADHESION
avoid_crossing_perimeters = 0
bed_shape = 0x0,250x0,250x210,0x210
bed_temperature = 110
before_layer_gcode = ;BEFORE_LAYER_CHANGE\n;[layer_z]\n\n
bottom_solid_layers = 8
bridge_acceleration = 1000
@DamianReeves
DamianReeves / .gitconfig
Created April 18, 2015 01:44
Using Visual Studio AS Git Merge Tool
[diff]
tool = vsdiffmerge
[difftool]
prompt = true
[difftool "vsdiffmerge"]
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
keepbackup = false
trustexistcode = true
[merge]
tool = vsdiffmerge
@owen2
owen2 / ListBoxExtensions.cs
Last active December 1, 2016 16:12
Bind to all of the SelectedItems in a ListBox set to multiple select mode.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
@owen2
owen2 / DataGridBoundTemplateColumn.cs
Created March 4, 2014 19:51
DataGridBoundTemplateColumn
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace OwensWpfFunStuff
{
public class DataGridBoundTemplateColumn : DataGridBoundColumn
{
public DataTemplate CellTemplate { get; set; }
public DataTemplate CellEditingTemplate { get; set; }
@owen2
owen2 / enforcessl.php
Created July 18, 2012 18:33
Enforce ssl automatically in PHP
if ($_SERVER['HTTPS'] != "on") {
$url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
header("Location: $url");
exit;
}
@robert-dale-schell
robert-dale-schell / gist:2702914
Created May 15, 2012 16:05 — forked from psiborg/gist:1569659
Javascript: Function, Self-Invoking
;(function (window, $, undefined) {
})(window, jquery);
@tansey
tansey / gist:1375526
Created November 18, 2011 03:40
Linear regression in C#
/// <summary>
/// Fits a line to a collection of (x,y) points.
/// </summary>
/// <param name="xVals">The x-axis values.</param>
/// <param name="yVals">The y-axis values.</param>
/// <param name="inclusiveStart">The inclusive inclusiveStart index.</param>
/// <param name="exclusiveEnd">The exclusive exclusiveEnd index.</param>
/// <param name="rsquared">The r^2 value of the line.</param>
/// <param name="yintercept">The y-intercept value of the line (i.e. y = ax + b, yintercept is b).</param>
/// <param name="slope">The slop of the line (i.e. y = ax + b, slope is a).</param>