Skip to content

Instantly share code, notes, and snippets.

@JamesRandall
JamesRandall / BlobStorageMultipartStreamProvider.cs
Last active March 19, 2020 23:12
Azure Blob Container Web API Image Upload
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
@devinceble
devinceble / .goproject
Last active March 14, 2018 17:19
Starting My Golang Project Adding To Path and Exporting $GOPATH
#!/usr/bin/env bash
function goproject {
export GOPATH=$(pwd)
add_to_path "$GOPATH/bin"
alias gocd="cd $GOPATH"
if [ -f goconf ]
then
lines=($(cat goconf))
cd ${lines[0]}
@StephenCleary
StephenCleary / Program.cs
Last active December 30, 2015 21:59
Serialization size test for Azure caching. Requires NuGet packages: Comparers, Newtonsoft.Json
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using Comparers;
package main
import (
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/binding"
"github.com/codegangsta/martini-contrib/render"
"labix.org/v2/mgo"
)
type Wish struct {
@mausch
mausch / gist:6774627
Created October 1, 2013 06:37
Applicative validation is simple.
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
// As opposed to magic validation libraries that rely on reflection and attributes,
// applicative validation is pure, total, composable, type-safe, works with immutable types, and it's easy to implement.
public abstract class Result<T> {
private Result() { }
@nmilford
nmilford / 00_hello_world.markdown
Last active September 5, 2018 13:53
A quick, non-conclusive, non-scientific tete-a-tete HelloWorld off for poops-n-giggles.

Inspired by https://gist.github.com/josevalim/1582864

Environment

Ubuntu 12.04

Linux citadel 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

  • 12G of DDR3 RAM (@ 1033MHz)
  • 16 cores (E5530 @ 2.40GHz)
@southpawfishel
southpawfishel / Point.as
Last active December 19, 2015 03:18
Quick implementation of flash.geom.Point in Loomscript. I took loom2d.math.Point and used it as a base, and added all the methods from the Flash version, as well as a distanceSquared method since thats on loom.graphics.Point.
package loom2d.math
{
/**
* A slightly less simple Point class.
*/
public struct Point
{
public var x:Number, y:Number;
// CREATION / ASSIGNMENT
@mattt
mattt / uiappearance-selector.md
Last active February 7, 2025 15:27
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@scottrippey
scottrippey / jQuery.antiforgerytoken.js
Created August 22, 2012 18:21
ASP.NET MVC AntiForgeryToken + AJAX = jQuery to the rescue
// Setup CSRF safety for AJAX:
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
if (options.type.toUpperCase() === "POST") {
// We need to add the verificationToken to all POSTs
var token = $("input[name^=__RequestVerificationToken]").first();
if (!token.length) return;
var tokenName = token.attr("name");