Skip to content

Instantly share code, notes, and snippets.

View mucit's full-sized avatar
🎯
Focusing

mucit mucit

🎯
Focusing
View GitHub Profile
@lavie
lavie / snagurl.py
Created February 14, 2012 18:19
Upload image to imgurl and copy remote URL into clipboard
import sys
import urllib2
from json import loads
from urllib import urlencode
import base64
print sys.argv
LOG_FILE = 'uploads.log'
DEV_KEY = 'YOUR KEY HERE' # from http://imgur.com/register/api_anon
@neoGeneva
neoGeneva / gist:1234779
Created September 22, 2011 13:34
Detect Encoding in C#
public static Encoding GetFileEncoding(string path)
{
if (path == null)
throw new ArgumentNullException("path");
var encodings = Encoding.GetEncodings()
.Select(e => e.GetEncoding())
.Select(e => new { Encoding = e, Preamble = e.GetPreamble() })
.Where(e => e.Preamble.Any())
.ToArray();
@yadyn
yadyn / SemanticVersion.cs
Created May 6, 2011 18:11
Semantic Version C# class
using System;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// Represents assembly, application, or other version information,
/// compliant with the Semantic Versioning specifications.
/// </summary>
/// <remarks>
/// See http://semver.org/ for specifications.
@anehir
anehir / EfPocoGenerator.sql
Last active December 20, 2016 11:49
Generates POCO classes for entity framework for all the tables in current database. Considers primary keys, foreign keys, and writes object descriptions saved as extended properties to the comments of classes.
set nocount on
declare @namespace varchar(500)
declare @schemaName varchar(50)
set @namespace = 'ConsoleApplication3.Data'
set @schemaName = 'dbo'
declare @typeMap table(sqlName varchar(50), dotNetName varchar(50), isNullable bit)