Skip to content

Instantly share code, notes, and snippets.

View murdockcrc's full-sized avatar

Luis Delgado murdockcrc

View GitHub Profile
@murdockcrc
murdockcrc / serialization-experiment.cs
Last active April 1, 2019 20:04
Console app that uses MessagePack and GZIP compression for benchmarking purposes
using System;
using System.Text;
using MessagePack;
using System.IO.Compression;
using System.IO;
namespace compress
{
class Program
{
### Keybase proof
I hereby claim:
* I am murdockcrc on github.
* I am murdockcrc (https://keybase.io/murdockcrc) on keybase.
* I have a public key ASA4-0FoUUxIu5r2--zOChdYInu6FPeV9m85wOJejeO3SAo
To claim this, I am signing this object:
@murdockcrc
murdockcrc / CosmosDataLoader.cs
Created May 29, 2017 14:54
CosmosDb TableAPI CSV Data Loader
namespace TableSBS
{
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using System.Linq;
using System.IO;
@murdockcrc
murdockcrc / EventHub.swift
Created April 9, 2016 09:59
Posts batched events to an Event Hub endpoint
//
// Created by Luis Delgado on 4/5/16.
//
import Foundation
import Alamofire
class EventHub {
static let eventHubName = NSURL(string: "https://{yourNamespace}.servicebus.windows.net/{yourEventhubName}")!
static let publisherId = "{yourPublisherId}"
@murdockcrc
murdockcrc / docDBFactory.js
Created August 5, 2015 11:52
Factory to create multiple DocumentDB clients
var AzureDbHelper = require('./azureDbHelper.js'),
config = require('../config.js');
module.exports = (function DbHelperFactory(){
var postsCollectionHelper;
var fanPostsCollectionHelper;
var concertsCollectionHelper;
return{
getPostsHelper: function getPostsHelper(){
@murdockcrc
murdockcrc / azureDocDBHelper.js
Last active August 29, 2015 14:26
DocumentDB facade (wrapper)
//Constructor
function AzureDbHelper(databaseName, collectionName){
var _this = this;
if(!this.database || !this.collection) {
readOrCreateDatabase(databaseName, function (error, database) {
if (error) {
//throw new Error(error);
return;
}
_this.database = database;
@murdockcrc
murdockcrc / singleton.js
Created July 29, 2015 18:35
NodeJS Singleton pattern
exports = module.exports = (function () {
// Instance stores a reference to the Singleton
var instance;
function init() {
// Singleton
// Private methods and variables
return {
@murdockcrc
murdockcrc / documentdb_random.js
Last active September 28, 2018 16:58
DocumentDB stored procedure to retrieve a random document
/*
The MIT License (MIT)
Copyright (c) 2015 HdV Media GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@murdockcrc
murdockcrc / gist:8f802d88f6f6a4c846f5
Last active August 29, 2015 14:22
cropbox - JScomplete
$('.bg-public').on('click', editBackground);
function initializeCropper(options){
var cropper = $(options.imageBox).cropbox(options);
var originalImgSrc = options.imgSrc;
$(options.fileInput).on('change', function(){
var reader = new FileReader();
reader.onload = function(e) {
options.imgSrc = e.target.result;
cropper = $(options.imageBox).cropbox(options);
@murdockcrc
murdockcrc / gist:396d752f6ba960b526f4
Last active August 29, 2015 14:22
cropbox-complete01
<div class="container-fluid profile-canopy">
<div class="row">
<div class="profile-canopy-bg bg-public">
<img alt src="http://i.imgur.com/Dbqggm5.jpg"/>
<button ng-show="isAuthor()" ng-click="editBackground()" type="button" class="btn btn-primary btn-lg btn-bg-edit">Edit</button>
</div>
<div class="canopy-bg-edit hidden">
<div class="profile-canopy-bg imageBox-bg">
<div class="action">
<input type="file" id="bg-file" style="float:left; width: 250px">