Skip to content

Instantly share code, notes, and snippets.

View jsclayton's full-sized avatar

John Clayton jsclayton

View GitHub Profile
using System.Web;
namespace NetflixDemo
{
public class AppHarborHttpContextWrapper : HttpContextWrapper
{
private readonly HttpContext httpContext;
public AppHarborHttpContextWrapper(HttpContext httpContext) : base(httpContext)
{
@jsclayton
jsclayton / Attribution.txt
Created June 6, 2011 18:07
Static Reflection in C#
Originally posted by Joel Abrahamsson
http://joelabrahamsson.com/entry/getting-property-and-method-names-using-static-reflection-in-c-sharp
@jsclayton
jsclayton / UserVoiceOAuthHelper.cs
Created September 13, 2011 21:48
UserVoice OAuth helper for SSO
using System;
using RestSharp;
using RestSharp.Authenticators;
namespace UserVoice.Api
{
public class UserVoiceOAuthToken
{
public string OauthToken { get; set; }
public string OauthTokenSecret { get; set; }
@jsclayton
jsclayton / load.js
Created March 11, 2012 05:18 — forked from mbrevoort/load.js
Simple ab style load generator
// requires request, measured, optimist and microtime npm modules
var util = require('util')
, request = require('request')
, microtime = require('microtime')
, measured = require('measured')
, collection = new measured.Collection('http')
, argv = require('optimist').usage('node load.js -c [concurrent] -n [total] url').argv;
var c = argv.c || 1
, n = argv.n || 1, uri = argv._[0]
@jsclayton
jsclayton / Program.cs
Created March 14, 2012 16:51
Interface default parameters
using System;
namespace Defaults
{
internal class Program
{
private static void Main(string[] args)
{
new Foo().Bar();
((IFoo) new Foo()).Bar();
@jsclayton
jsclayton / SerializationTest.cs
Created May 16, 2012 15:16
Protobuf-net Serialization
using System;
using System.IO;
using FluentAssertions;
using NUnit.Framework;
using ProtoBuf;
namespace ProtoBuffs
{
[ProtoContract]
public class AccessTokenV1
@jsclayton
jsclayton / gist:2789221
Created May 25, 2012 17:04
Remove cheezburger cookies
- (void)logout {
NSHTTPCookieStorage *cookies = [NSHTTPCookieStorage sharedHTTPCookieStorage];
NSArray *cheezburgerCookies = [cookies cookiesForURL:[NSURL URLWithString:@"http://cheezburger.com"]];
for (NSHTTPCookie *cookie in cheezburgerCookies) {
[cookies deleteCookie:cookie];
}
}
@jsclayton
jsclayton / remote_rejected.txt
Created May 31, 2013 22:57
Pushing to Heroku fails with npm error
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.10.9
Using npm version: 1.2.24
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm WARN package.json my-app@0.1.0 No repository field.
npm http GET https://registry.npmjs.org/request
@jsclayton
jsclayton / export.sh
Created June 4, 2013 03:42
In order for Windows Azure Websites to accept a certificate it must be generated with the server authentication extended key usage extension. To do this using OpenSSL you'll need a config file with the extension enabled, and to reference it from the generate command. 1. Download the openssl.cnf file 2. Run the generate command, replacing www.you…
openssl pkcs12 -export -out www.yourdomain.com.pfx -inkey www.yourdomain.com.key -in www.yourdomain.com.crt
class Load: RLMObject {
dynamic var localIdentifier: String?
dynamic var name: String? = ""
dynamic var loadDescription: String? = ""
dynamic var weapon: Weapon? = nil
dynamic var bullet: Bullet? = nil
dynamic var powder: Powder? = nil