Skip to content

Instantly share code, notes, and snippets.

View sverrirs's full-sized avatar
🌟
Be the change you wish to see in the world

Sverrir Sigmundarson sverrirs

🌟
Be the change you wish to see in the world
View GitHub Profile
using System;
using System.Runtime.InteropServices;
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming
namespace VideoPlayerController
{
/// <summary>
/// Controls audio using the Windows CoreAudio API
/// from: http://stackoverflow.com/questions/14306048/controling-volume-mixer
@sverrirs
sverrirs / AdsInlineTag.rb
Last active October 1, 2020 23:34
How to create a Jekyll custom tag that injects Google Ads into posts
# http://www.createdbypete.com/articles/create-a-custom-liquid-tag-as-a-jekyll-plugin/
class AdsInlineTag < Liquid::Tag
def initialize(tag_name, input, tokens)
super
@input = input
end
def lookup(context, name)
lookup = context
name.split(".").each { |value| lookup = lookup[value] }
@sverrirs
sverrirs / Google Blogger Social Meta Tags.html
Last active April 28, 2020 05:26
Because it is notoriously difficult, here is how you integrate social media tags for Facebook, Twitter, Google+ and Pinterest into Google Blogger template. Tested and validated by myself on blogger.com in August 2015. This is based on https://gist.github.com/MilanAryal/92997b311580c6e96dd0 but with important fixes and different integration strat…
<!-- add the following code in the head and body tags -->
<head prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#'>
<body itemscope='itemscope' itemtype='http://schema.org/Blog' prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#'>
<!--
I've found easiest to simply include the rest of the tags in the body of the webpage.
The browser will automatically interpret the should-be header tags correctly.
The only problem, and unavoidable when using a blogger template is that the Pintrest markup
will not currently work with their Rich Pin validation tool.
[Version]
Signature="$Windows NT$"
Class=CustomUSBDevices
ClassGuid={a503e2d3-a031-49dc-b684-c99085dbfe92}
Provider=%ProviderName%
DriverVer=10/10/2015,1.0.0
[Manufacturer]
%ProviderName% = MyWinUSBDevice,NTx86,NTamd64
@sverrirs
sverrirs / AutoCompleteExt.cs
Created November 2, 2018 09:54
AutoComplete in .NET through the Windows Shell (provides more options than default implementation)
using System;
using System.Runtime.InteropServices;
/// <summary>
/// From: https://www.codeproject.com/Articles/3792/C-does-Shell-Part-4
/// Note: The UCOMIEnumString interface is deprecated in .NET as of 2018!
/// </summary>
public class AutoCompleteExt {
public static Guid CLSID_AutoComplete = new Guid("{00BB2763-6A77-11D0-A535-00C04FD7D062}");
@sverrirs
sverrirs / Contract Killer 3.md
Created December 12, 2016 13:19 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@sverrirs
sverrirs / AsyncBackgroundProcessor.cs
Created December 16, 2015 22:58
Asynchronous background processor code for WPF or WinForms that behaves similar to the BackgroundWorker class in the .NET framework but leverages the Task framework.
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace RectifyLib
{
; Set working dir to the driver dir (otherwise the uninstall of any loaded devices wont work)
Push $OUTDIR
SetOutPath "$INSTDIR\driver"
; Execute the device uninstall and inf deletion script
ExecWait '"$INSTDIR\driver\uninstall_device.bat"' $0
DetailPrint "Return code was $0"
; Restore the working directory
Pop $OUTDIR
@echo off
REM START BY FINDING THE OEM INF FILE
setlocal EnableDelayedExpansion
SET OEM_FILE=
set oemdata="devcon.exe dp_enum"
FOR /F "eol=. tokens=*" %%a IN ( '%oemdata%' ) DO (
set line=%%a
set ourline=!line:Sverrir Sigmundarson=!
if not !line!==!ourline! (
@sverrirs
sverrirs / VideoPlayerController.cs
Last active November 24, 2015 21:17
Example that shows how to leverage the XboxBigButton controller library code to control either VLC or Netflix using the Xbox 360 Big Button Controllers
public partial class Form1 : Form
{
public enum Players
{
None,
VLC,
Netflix
}
/// <summary>