Skip to content

Instantly share code, notes, and snippets.

@sondreb
sondreb / copy_binary_sql
Last active December 17, 2015 20:38
Copy (binary) data between columns of two different tables in the same database.
UPDATE
Table1
SET
Table1.OverlayImage = T2.BinaryImage
FROM
Table1 T1
INNER JOIN
Table2 T2
ON
T1.ID = 45 AND T2.ID = 20
@sondreb
sondreb / Sanitize Filename
Created March 28, 2014 10:03
One-liner that sanitizes the file name. Remember: There is a different method to get invalid path chars.
// Remove any invalid file name characters that might have been added to the name.
var newName = string.Join("_", fileName.Split(Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries)).TrimEnd('.');
@sondreb
sondreb / custom_header
Last active August 29, 2015 14:02
Add custom HTTP header to OWIN server
options.StaticFileOptions.OnPrepareResponse = _ => { _.OwinContext.Response.Headers.Add("X-UA-Compatible", new string[] { "IE=edge" }); };
@sondreb
sondreb / angular_select
Last active August 29, 2015 14:07
Two examples of binding JSON-annotated object with select in HTML using AngularJS
$scope.sort = 'relevance';
$scope.sorting = {
'relevance': 'Relevant',
'date-posted-desc': 'Recent',
'interestingness-desc': 'Interesting'
};
$scope.sorting2 = [
{'id': 'relevance', 'text': 'Relevant'},
@sondreb
sondreb / game.html
Created February 14, 2015 01:13
Game (app) layout using flex-layout, works on IE, FireFox and Chrome
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Game Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<style>
*, *:before, *:after
{
@sondreb
sondreb / DictionaryExtensions
Created April 14, 2015 14:14
DictionaryToObject
namespace Utils
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
public static class DictionaryExtensions
{
public static T DictionaryToObject<T>(this IDictionary<string, string> dict) where T : new()
@sondreb
sondreb / deepmind-css-guide.md
Last active August 29, 2015 14:26 — forked from bobbygrace/trello-css-guide.md
Deepmind CSS Guide
Verifying that +sondreb is my blockchain ID. https://onename.com/sondreb

Keybase proof

I hereby claim:

  • I am sondreb on github.
  • I am sondreb (https://keybase.io/sondreb) on keybase.
  • I have a public key ASBflNAn_pbBNxKTmd06R_H_X8PdnHvUNAhsFK2WEYx0rwo

To claim this, I am signing this object:

Verifying my Blockstack ID is secured with the address 1qYUwfvrfaxeqrsEgDResKQvsBBnSQVVF https://explorer.blockstack.org/address/1qYUwfvrfaxeqrsEgDResKQvsBBnSQVVF