Skip to content

Instantly share code, notes, and snippets.

vsviridov / ef4_pk_detect.cs
Created Aug 2, 2012
Crappy way to detect Primary Keys in EF4
View ef4_pk_detect.cs
//Get all fields marked as Primary Key
var keyFields = type.GetProperties()
.Where(prop => prop.GetCustomAttributes(typeof(KeyAttribute), true).Any())
.Select(prop => prop.Name)
//Get all fields that end with Id and Not marked as Foreign Key
.Where(prop =>
prop.Name.EndsWith("Id", true, CultureInfo.InvariantCulture)
&& !prop.GetCustomAttributes(typeof(ForeignKeyAttribute), true).Any()
View JapaneseTypesettingWithFurigana
%!TEX TS-program = xelatex
\setCJKmainfont{Hiragino Kaku Gothic ProN}
vsviridov / AngularTimings.js
Created Dec 5, 2013
This is some assorted code to add support for Chrome Canary timline API to track angular timings. It also outputs some timings to the console.
View AngularTimings.js
"use strict";
var nop = function() {};
var ops = ["log", "info", "error", "warn", "time", "timeEnd", "group", "groupEnd", "timeline", "timelineEnd", "timeStamp"];
for(var x = 0; x < ops.length; x++)
if(!console[ops[x]]) { console[ops[x]] = nop; }
}(window.console = window.console || { $replaced: true }));
vsviridov / NewEggBTC.user.js
Created Dec 21, 2014
GreaseMonkey script to see the BTC price before checkout.
View NewEggBTC.user.js
// ==UserScript==
// @name NewEgg Price in Bitcoin
// @namespace
// @description Display the grand total of your shopping cart in BTC
// @include *//*
// @include *//*
// @version 1
// @grant none
// ==/UserScript==
vsviridov / 01_add_cors.config.yaml
Created Sep 5, 2015
Add CORS to Nginx on AWS Elastic Beanstalk
View 01_add_cors.config.yaml
command: "/tmp/"
mode: "000755"
owner: root
group: root
content: |