Skip to content

Instantly share code, notes, and snippets.

View derekgates's full-sized avatar

Derek Gates derekgates

View GitHub Profile
public class OAuthCredentialsStore : ICredentialStore
{
private const string ClientId = "<redacted>";
private const string ClientSecret = "<redacted>";
private readonly IGitHubClient _gitHubClient;
public OAuthCredentialsStore()
{
_gitHubClient = new GitHubClient(new ProductHeaderValue("HubBug", "0.0.0.1"))
{
@grenade
grenade / teamcity-backup.ps1
Last active January 2, 2016 12:19
TeamCity maintenance tasks including (and only) triggering regular backups.
<#
.Synopsis
Trigger a TeamCity backup using the TeamCity REST API.
.Parameter username
Defines a TeamCity username which has authority to trigger backups.
.Parameter password
Defines the password for the user which will trigger the backup.
.Parameter baseUrl
Defines the URL to the TeamCity server (eg: http://teamcity.example.com).
If not set, the script will attempt to determine it from the TeamCity properties file.
@neophit
neophit / Useful Keyboard Text Shortcuts.applescript
Last active January 5, 2025 02:58
Add useful keyboard text shortcuts for exponents and fractions to your System Preferences. With iCloud enabled, these shortcuts will sync with your iOS devices. Tested on OS X 10.9.1 and iOS 7.0.4. Requires GUI Scripting Access: http://support.apple.com/kb/HT5914 (Based partially on this script: https://gist.github.com/Zettt/7724258)
set clickDelay to 0.3
set textReplaceList to {}
set exponentsListName to "Exponents (replaces ^0-^9 with ⁰-⁹)"
set fractionsListName to "Fractions (replaces 1/2-7/8 with ½-⅞)"
set exponentsList to {{"^0", "⁰"}, {"^1", "¹"}, {"^2", "²"}, {"^3", "³"}, {"^4", "⁴"}, {"^5", "⁵"}, {"^6", "⁶"}, {"^7", "⁷"}, {"^8", "⁸"}, {"^9", "⁹"}}
set fractionsList to {{"1/2", "½"}, {"1/3", "⅓"}, {"1/4", "¼"}, {"1/5", "⅕"}, {"1/6", "⅙"}, {"1/7", "⅐"}, {"1/8", "⅛"}, {"1/9", "⅑"}, {"1/10", "⅒"}, {"2/3", "⅔"}, {"2/5", "⅖"}, {"3/4", "¾"}, {"3/5", "⅗"}, {"3/8", "⅜"}, {"4/5", "⅘"}, {"5/6", "⅚"}, {"5/8", "⅝"}, {"7/8", "⅞"}}
set chosenLists to (choose from list {exponentsListName, fractionsListName} with title "Useful Keyboard Text Shortcuts" with prompt "Choose one or more sets of keyboard text shortcuts to add to your System Preferences.
This may take a minute to complete." OK button name "Add text shortcuts" cancel button name "Cancel" default items {exponentsListName, fractionsListName} with multiple selections allowed)
@serbrech
serbrech / MsDeploy.ps1
Created December 17, 2013 11:57
Powershell wrapper around msdeploy.exe
function DeployWebsite($Package, $Server, $IISSite, $App, $Username, $Password) {
$MSDeployKey = 'HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3'
if(!(Test-Path $MSDeployKey)) {
throw "Could not find MSDeploy. Use Web Platform Installer to install the 'Web Deployment Tool' and re-run this command"
}
$InstallPath = (Get-ItemProperty $MSDeployKey).InstallPath
if(!$InstallPath -or !(Test-Path $InstallPath)) {
throw "Could not find MSDeploy. Use Web Platform Installer to install the 'Web Deployment Tool' and re-run this command"
}
@drdrang
drdrang / Wifi Statusbar.py
Last active July 1, 2024 07:54
Overlay full strength graphics on statusbar of an iOS screenshot when the device is using wifi.
#!/usr/bin/python
import Image
import base64, zlib
# Jay Parlar convinced me to turn this data structure
# from a dictionary into an object.
class PackedImage(object):
def __init__(self, mode, size, data):
self.mode = mode
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@carlspring
carlspring / gist:6762356
Last active September 27, 2023 04:02
TeamCity REST API Commands
@ebidel
ebidel / Web Components Resources.md
Last active October 12, 2024 17:10
List of resources related to Web Components
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active March 12, 2025 01:22
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");