Skip to content

Instantly share code, notes, and snippets.

@vsviridov
vsviridov / 01_add_cors.config.yaml
Created Sep 5, 2015
Add CORS to Nginx on AWS Elastic Beanstalk
View 01_add_cors.config.yaml
container_commands:
01_fix_static_cors:
command: "/tmp/fix_static_cors.sh"
files:
"/tmp/fix_static_cors.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
@vsviridov
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
(function(console)
{
"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 }));
View JapaneseTypesettingWithFurigana
%!TEX TS-program = xelatex
\documentclass[24pt]{letter}
\usepackage{xeCJK}
\usepackage{ruby}
\setCJKmainfont{Hiragino Kaku Gothic ProN}
\usepackage{setspace}
%\doublespace
%
@vsviridov
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)
.ToList();
//Get all fields that end with Id and Not marked as Foreign Key
keyFields.AddRange(type.GetProperties()
.Where(prop =>
prop.Name.EndsWith("Id", true, CultureInfo.InvariantCulture)
&& !prop.GetCustomAttributes(typeof(ForeignKeyAttribute), true).Any()
@vsviridov
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 gist.github.com/vsviridov/
// @description Display the grand total of your shopping cart in BTC
// @include *//secure.newegg.ca/Shopping/ShoppingCart.aspx*
// @include *//secure.newegg.com/Shopping/ShoppingCart.aspx*
// @version 1
// @grant none
// ==/UserScript==