Skip to content

Instantly share code, notes, and snippets.

View MikeLarned's full-sized avatar

Mike Larned MikeLarned

View GitHub Profile
@MikeLarned
MikeLarned / UAFiddlerMessageTags
Created May 18, 2012 16:34
UrbanAirshipMessageTags
Authorization: Basic <key:secret>
Content-Type: application/json
Host: go.urbanairship.com
Content-Length: 243
POST - https://go.urbanairship.com/api/push/
Request Body:
{
@MikeLarned
MikeLarned / BackboneCollectionExampleApp.js
Created May 18, 2012 16:41
BackboneCollectionExample
App = {
start: function () {
new StockCollectionView;
}
};
$().ready(function() {
App.start();
});
@MikeLarned
MikeLarned / UAFiddlerMessageAliases
Created May 21, 2012 02:49
UrbanAirshipMessageAliases
Authorization: Basic <key:secret>
Content-Type: application/json
Host: go.urbanairship.com
Content-Length: 243
POST - https://go.urbanairship.com/api/push/
Request Body:
{
@MikeLarned
MikeLarned / ZebraInsecureConnection.java
Created September 24, 2012 15:21
ZebraInsecureConnection
private ZebraSocket tryPublicApiWay() throws ZebraPrinterConnectionException
{
try {
BluetoothSocket bSocket = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(this.macAddress).createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
ZebraBluetoothSocket zBtSocket = new ZebraBluetoothSocket(bSocket);
zBtSocket.connect();
return zBtSocket;
} catch (IOException e) {
throw new ZebraPrinterConnectionException(e.getMessage());
}
@MikeLarned
MikeLarned / StripRestSharpCharge.cs
Created October 17, 2012 00:17
Stripe-RestSharp-Charge
[HttpPost]
public JsonResult SubmitCharge(string token, int amount)
{
const string baseUrl = "https://api.stripe.com/";
const string endPoint = "v1/charges";
var apiKey = ConfigurationManager.AppSettings.Get("StripeSecretKey");
var client = new RestClient(baseUrl) { Authenticator = new HttpBasicAuthenticator(apiKey, "") };
var request = new RestRequest(endPoint, Method.POST);
@MikeLarned
MikeLarned / StripRestSharpCharge.cs
Created October 17, 2012 00:18
Stripe-RestSharp-Charge
[HttpPost]
public JsonResult SubmitCharge(string token, int amount)
{
const string baseUrl = "https://api.stripe.com/";
const string endPoint = "v1/charges";
var apiKey = ConfigurationManager.AppSettings.Get("StripeSecretKey");
var client = new RestClient(baseUrl) { Authenticator = new HttpBasicAuthenticator(apiKey, "") };
var request = new RestRequest(endPoint, Method.POST);
@MikeLarned
MikeLarned / BackboneViewBindToModel.js
Created December 3, 2012 23:09
BackboneViewBindToModel
m.Views.Friend = Backbone.View.extend({
template: "#friend-item-template",
initialize: function () {
this.model.on("change", this.render, this);
}
})
@MikeLarned
MikeLarned / LayoutManagerCleanViews.js
Created December 4, 2012 18:09
LayoutManagerCleanViews
cleanViews: function(views) {
// Clear out all existing views.
_.each(aConcat.call([], views), function(view) {
// Remove all custom events attached to this View.
view.unbind();
// Automatically unbind `model`.
if (view.model instanceof Backbone.Model) {
view.model.off(null, null, view);
}
namespace ExampleTemplateGenerator
{
partial class Entity
{
private readonly string _entityName;
private readonly string _assemblyName;
public Entity(string entityName, string assemblyName)
{
_entityName = entityName;
@MikeLarned
MikeLarned / RuntimeT4Template.tt
Last active December 10, 2015 00:59
Basic Runtime template to be used in an application outside of Visual Studio
<#@ template language="C#" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
using System;
namespace <#= _assemblyName #>.Infrastructure.Entities
{