Skip to content

Instantly share code, notes, and snippets.

View ghuntley's full-sized avatar
minimalist

Geoffrey Huntley ghuntley

minimalist
View GitHub Profile
@bryanbarnard
bryanbarnard / SimpleHttpClient.cs
Created December 23, 2013 19:15
Simple C# .NET 4.5 HTTPClient Request Using Basic Auth and Proxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
@jamie94bc
jamie94bc / IUpgrade.cs
Created October 16, 2013 09:51
Interfaces for an upgrade service to handle changes between versions on an application. If required, IUpgradeService should be implemented in a PCL with the CurrentAppVersion left as abstract to implement on a per device basis.
/// <summary>
/// Defines an interface which upgrades
/// the application from a version which is great
/// or equal to <see cref="IUpgrade.FromVersion"/>
/// and before <see cref="IUpgrade.ToVersion"/>.
/// </summary>
public interface IUpgrade {
Version FromVersion { get; }
Version ToVersion { get; }
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@rid00z
rid00z / FollowFingerViewController
Last active December 21, 2015 08:08
ViewController that follows fingers.
public partial class FollowFingerViewController : UIViewController
{
static bool UserInterfaceIdiomIsPhone {
get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
}
UIView _square;
public FollowFingerViewController ()
{
@ghuntley
ghuntley / gist:6229621
Last active December 21, 2015 01:39 — forked from anonymous/gist:6221307
Based on ServiceStack's RequiredRoleAttribute, this class requires that you have AT LEAST one of the roles -- not all, like the default ServiceStack implementation
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class RequiredOneRoleOfAttribute : RequestFilterAttribute
{
public List<string> RequiredRoles { get; set; }
public RequiredOneRoleOfAttribute(ApplyTo applyTo, params string[] roles)
{
this.RequiredRoles = roles.ToList();
this.ApplyTo = applyTo;
this.Priority = (int)RequestFilterPriority.RequiredRole;
anonymous
anonymous / gist:6221307
Created August 13, 2013 13:48
Based on ServiceStack's RequiredRoleAttribute, this class requires that you have AT LEAST one of the roles -- not all, like the default ServiceStack implementation
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
public class RequiredOneRoleOfAttribute : RequestFilterAttribute
{
public List<string> RequiredRoles { get; set; }
public RequiredOneRoleOfAttribute(ApplyTo applyTo, params string[] roles)
{
this.RequiredRoles = roles.ToList();
this.ApplyTo = applyTo;
this.Priority = (int)RequestFilterPriority.RequiredRole;
@Redth
Redth / LogCollector.cs
Created June 25, 2013 20:35
Collect Android Logs and Version info in Xamarin.Android
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
@mendelgusmao
mendelgusmao / gist:5823291
Last active March 28, 2021 08:08
BTSync / BitTorrent Sync behind nginx
# take one
# subdirectory (one server, multiple services)
location /btsync/ {
rewrite ^/btsync/gui(.*) /btsync$1 last;
proxy_pass http://127.0.0.1:8888/gui/;
proxy_redirect /gui/ /btsync/;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@anaisbetts
anaisbetts / FilesystemWatchCache.cs
Created May 8, 2013 22:14
An Rx-friendly Filesystem Watcher
using System;
using System.IO;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using ReactiveUI;
namespace SaveAllTheTime.Models
{
interface IFilesystemWatchCache
{
@bscheiman
bscheiman / Raygun
Created May 5, 2013 07:46
Raygun wrapper for MonoTouch / Xamarin.iOS
public static class Raygun {
private static string ApiKey { get; set; }
private static Uri BaseUrl = new Uri("https://api.raygun.io/entries");
[DllImport(MonoTouch.Constants.SystemLibrary)]
internal static extern int sysctlbyname([MarshalAs(UnmanagedType.LPStr)] string property, IntPtr output, IntPtr oldLen, IntPtr newp,
uint newlen);
public static void Attach(string apiKey) {