Skip to content

Instantly share code, notes, and snippets.

View idiotandrobot's full-sized avatar

Michael Phillips idiotandrobot

View GitHub Profile
@idiotandrobot
idiotandrobot / OneDrive.cs
Last active May 1, 2022 14:50
OneDrive Windows Folder Path
public static class OneDrive
{
private static string _Path;
public static string Path => _Path ??= GetPath();
static string GetPath() => Environment.GetEnvironmentVariable("OneDriveConsumer");
}
@idiotandrobot
idiotandrobot / EmailDocument.vba
Created February 1, 2016 12:34
Pre-Office 2016 document emailing macro
Sub EmailDocument()
On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
ActiveDocument.Save
End If
Dim RanOutlook As Boolean
Dim Outlook As Outlook.Application
@idiotandrobot
idiotandrobot / EmailDocument.Office-2016.vba
Last active March 6, 2018 03:20
Office 2016 document emailing macro
Sub EmailDocument()
'On Error Resume Next
If Len(ActiveDocument.Path) = 0 Then
ActiveDocument.Save
End If
Dim RanOutlook As Boolean
Dim Outlook As Object 'Outlook.Application throws "Compile error: User-defined type not defined"
@idiotandrobot
idiotandrobot / index.html
Created January 13, 2016 17:43
InR-Time Configuration Page
<!DOCTYPE html>
<html>
<head>
<title>Slate Example Configuration</title>
<link rel='stylesheet' type='text/css' href='css/slate.min.css'>
<script src='js/slate.min.js'></script>
<style>
.title {
padding: 15px 10px;
text-transform: uppercase;
@idiotandrobot
idiotandrobot / background.c
Last active January 3, 2016 15:41
Pebble C
static BitmapLayer *s_background_layer;
static GBitmap *s_background_bitmap;
static void configure_background(Layer *window_layer, GRect bounds) {
s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BACKGROUND);
s_background_layer = bitmap_layer_create(bounds);
bitmap_layer_set_bitmap(s_background_layer, s_background_bitmap);
@idiotandrobot
idiotandrobot / IObservableContainerItem.cs
Created September 22, 2015 09:59
ObservableContainer
public interface IObservableContainerItem<T>
{
T Observed { get; set; }
}
@idiotandrobot
idiotandrobot / 1 - Original Listbox.xaml
Last active August 29, 2015 14:23
Simple Listbox Ordering using a CollectionViewSource
<ListBox ItemsSource="{Binding List}" />
@idiotandrobot
idiotandrobot / PercentageConverter.cs
Created June 24, 2015 07:40
Percentage IValueConverter
public class PercentageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var fraction = decimal.Parse(value.ToString());
return fraction.ToString("P1");
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
@idiotandrobot
idiotandrobot / Embed
Last active August 29, 2015 14:20
Embedding Gists in Jekyll Posts
{% gist 92b3fce859806a435a96 %}
@idiotandrobot
idiotandrobot / FontAwesome.css
Created April 27, 2015 08:46
Haacked FontAwesome support method
@font-face {
font-family: 'FontAwesome';
src: url("/blog/font/fontawesome-webfont.eot");
src: url("/blog/font/fontawesome-webfont.eot?#iefix") format("embedded-opentype"),
url("/blog/font/fontawesome-webfont.woff") format("woff"),
url("/blog/font/fontawesome-webfont.ttf") format("truetype"),
url("/blog/font/fontawesome-webfont.svgz#FontAwesomeRegular") format("svg"),
url("/blog/font/fontawesome-webfont.svg#FontAwesomeRegular") format("svg");
font-weight: normal;
font-style: normal;