Skip to content

Instantly share code, notes, and snippets.

@kensykora
kensykora / transform-all.bat
Last active December 31, 2020 16:58
Pre-Build event for T4 Transformation
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
:: set the working dir (default to current dir)
set wdir=%cd%
if not (%1)==() set wdir=%1
echo executing transform_all from %wdir%
:: create a list of all the T4 templates in the working dir
dir %wdir%\*.tt /b /s > t4list.txt
@sbarski
sbarski / gist:5a9e94632ff68e5dbd58
Created August 13, 2014 02:58
Schema for ASP.NET Identity Model 2.0
CREATE TABLE [dbo].[AspNetUsers](
[Id] [nvarchar](128) NOT NULL,
[Email] [nvarchar](256) NULL,
[EmailConfirmed] [bit] NOT NULL,
[PasswordHash] [nvarchar](max) NULL,
[SecurityStamp] [nvarchar](max) NULL,
[PhoneNumber] [nvarchar](max) NULL,
[PhoneNumberConfirmed] [bit] NOT NULL,
[TwoFactorEnabled] [bit] NOT NULL,
[LockoutEndDateUtc] [datetime] NULL,
@jamesrcounts
jamesrcounts / MySqlCommandAdapter.cs
Created October 3, 2014 02:42
IDatabaseToExecuteableQueryAdaptor for MySql
// Note: Connection string must include the following option: Allow User Variables=True
using System;
using System.Data.Common;
using System.Linq;
using ApprovalUtilities.Persistence.Database;
using MySql.Data.MySqlClient;
public class MySqlCommandAdapter : IDatabaseToExecuteableQueryAdaptor
@mbejda
mbejda / knockoutUtility.js
Created October 25, 2014 06:54
List of Knockout Utility Functions
ko.utils.arrayForEach
ko.utils.arrayFirst
ko.utils.arrayFilter
ko.utils.arrayGetDistinctValues
ko.utils.arrayIndexOf
ko.utils.arrayMap
ko.utils.arrayPushAll
ko.utils.arrayRemoveItem
ko.utils.extend
ko.utils.fieldsIncludedWithJsonPost
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@paulduran
paulduran / gist:91dd14c0eecc6b1ff22f
Created November 27, 2014 00:57
Premailer with Postal
public class MailSender
{
static MailSender()
{
var viewRenderer = new EmailViewRenderer(ViewEngines.Engines) {EmailViewDirectoryName = "UserMailer"};
var emailParser = new EmailParser(viewRenderer);
Email.CreateEmailService = ()=>new EmailService(viewRenderer, new PremailerEmailParser(emailParser), ()=>new SmtpClient());
}
public void SendEmail()
@igordeoliveirasa
igordeoliveirasa / gist:78a310f0348fcad9b270
Created March 26, 2015 01:41
iOS Loading Overlay View - SWIFT
//
// LoadingOverlay.swift
// app
//
// Created by Igor de Oliveira Sa on 25/03/15.
// Copyright (c) 2015 Igor de Oliveira Sa. All rights reserved.
//
// Usage:
//
// # Show Overlay

EDIT from 2019: Hi folks. I wrote this gist for myself and some friends, and it seems like it's gotten posted somewhere that's generated some (ahem, heated) discussion. The whitespace was correct when it was posted, and since then GitHub changed how it formats <pre> tags. Look at the raw text if you care about this. I'm sure someone could tell me how to fix it, but (thank you @anzdaddy for suggesting a formatting workaround) honestly this is a random throwaway gist from 2015, and someone more knowledgable about this comparison should just write a proper blog post about it. If you comment here I'll hopefully see it and stick a link to it up here. Cheers. @oconnor663

Here's the canonical TOML example from the TOML README, and a YAML version of the same.

title = "TOML Example"
 
@pocheptsov
pocheptsov / SoapExtensionRegistration.cs
Created July 30, 2015 20:22
Register SoapExtension in a code
public static void RegisterSoapExtension(Type type, int priority, PriorityGroup group)
{
if (!type.IsSubclassOf(typeof(SoapExtension)))
{
throw new ArgumentException("Type must be derived from SoapException.", nameof(type));
}
if (priority < 1)
{
throw new ArgumentOutOfRangeException(nameof(priority), priority, "Priority must be greater or equal to 1.");
@rahul286
rahul286 / mac-osx-el-captain-commands.sh
Last active September 24, 2024 03:11
Updating to Mac elCapitan using downloaded pkg file
## based on https://github.com/lioonline/OS-X-El-Capitan
## pkg file link - http://osxapps.itunes.apple.com/apple-assets-us-std-000001/Purple3/v4/74/d2/82/74d28291-9db9-7ae2-305d-9b8b3f5fd463/ftk3252456602304584541.pkg
# Run this from folder where you have downloaded or copied ftk3252456602304584541.pkg file
#create a tmp folder
mkdir elCapitanRoot && cd elCapitanRoot
#create a folder structure to match apple server
sudo mkdir -p ./apple-assets-us-std-000001/Purple3/v4/74/d2/82/74d28291-9db9-7ae2-305d-9b8b3f5fd463/