Skip to content

Instantly share code, notes, and snippets.

View szahn's full-sized avatar

Stuart Zahn szahn

View GitHub Profile
@ericelliott
ericelliott / new-sucks.js
Created September 13, 2012 09:25
new Breaks Factory Objects
// Create a factory object that can be used to swap out the prototype used
// to instantiate new instances.
var factory = {};
factory.proto = {foo: 'bar'};
factory.create = function () { return Object.create(this.proto); };
var t1 = factory.create();
@jaymcgavren
jaymcgavren / heroku.md
Created May 25, 2012 05:47
A Code TV screencast on getting started with Heroku

Description

Heroku is a simple way to publish your Rails app, and a powerful platform that will allow it to scale. In this episode, Jay McGavren gets you started with your first Heroku app.

Set up your Rails app

Isolate your gem environment

  • You WANT Rails to fail locally if a gem isn't in your Gemfile
@ericelliott
ericelliott / flyweight-factory-module.js
Last active November 6, 2015 21:38
Flyweight Factory Module Pattern
var myPrototype = {
methodA: function methodA() {},
methodB: function methodB() {},
methodC: function methodC() {}
};
createFoo = function createFoo() {
return (Object.create(myPrototype));
};
@oleganza
oleganza / impulse_review.md
Last active January 23, 2016 06:24
Impulse Review

(That's my attempt to understand what problem Impulse solves and how. I am not a designer/developer of this scheme.)

Problem

Regular Bitcoin transactions are not guaranteed until mined sufficiently deep in the blockchain. Unconfirmed transactions can be observed nearly instantly, but they cannot be trusted (could drop out because of insufficient fees, or double-spent).

Impulse Overview

@techbunny
techbunny / ContainersYourWay_StartHere.md
Last active September 13, 2017 18:09
Getting Started with Containers from MTX

Getting Started with Containers - Your Way

Here you can find a list of some quick tutorials and sample code to get you going quickly with containers on Azure.

On Your Computer

To quickly get started creating containers on your computer, download either Docker for Windows or Docker for Mac. One of the cool features of Docker for Windows is the ability to switch between Linux and Windows containers.

To get started creating containers with Docker, I recommend their Getting Started with Docker guide.

anonymous
anonymous / TokenValidator.cs
Created September 21, 2015 16:16
Validate JSON Web Token (JWT) With .NET JWT Library
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IdentityModel.Tokens;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography.X509Certificates;
using System.Text;
@to-var
to-var / install.sh
Created August 23, 2018 15:28
An Oh-my-zsh theme installer helper. Put this file on the same folder as a downloaded theme, then run `sh install.sh [theme-you-want-to-install]`
#!/bin/bash
# Colors
RED="\033[0;31m"
ORANGE="\033[0;33m"
GREEN="\033[0;32m"
NC="\033[0m"
# Messages
OK="[OK]"
@artisticcheese
artisticcheese / Dockerfile
Last active June 2, 2021 13:03
Dockerfile to build IIS + nanoserver + ASP.NET core
# escape=`
# Image with NET CORE installation to extract executables for final image
FROM microsoft/aspnetcore:2.0.0-nanoserver As CoreBuild
# Middleware image used to extract ASP.NET core module
From microsoft/iis as WindowsBuild
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'Continue'; $verbosePreference='Continue';"]
# Installing NET CORE webhosting in middleware image so latest module and configuration schema is extracted for final image
ADD https://download.microsoft.com/download/B/1/D/B1D7D5BF-3920-47AA-94BD-7A6E48822F18/DotNetCore.2.0.0-WindowsHosting.exe ".\hosting.exe"
@utsengar
utsengar / EncodeBased64Binary.java
Created October 11, 2011 00:27
Encode a file to base64 binary in Java
import org.apache.commons.codec.binary.Base64;
private String encodeFileToBase64Binary(String fileName)
throws IOException {
File file = new File(fileName);
byte[] bytes = loadFile(file);
byte[] encoded = Base64.encodeBase64(bytes);
String encodedString = new String(encoded);