Skip to content

Instantly share code, notes, and snippets.

@blachniet
blachniet / Diagnostics
Created January 11, 2012 03:12
Files Pertaining to "Could not locate the Android SDK at the given path" in Titanium
Host OS: Windows 7
OS Arch: x86
JRE Version: 1.6.0_24
JRE Vendor: Sun Microsystems Inc.
JRE Home: C:\Users\Brian\AppData\Local\Titanium Studio\jre
Install Directory: file:/C:/Users/Brian/AppData/Local/Titanium Studio/
Version: 1.0.7.201112281340
VM Arguments: -Xms40m
-Xmx1024m
-Declipse.p2.unsignedPolicy=allow
@blachniet
blachniet / ClassLogDefClip.cs
Last active November 26, 2019 11:39
Simple log4net configuration
private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@blachniet
blachniet / createBody.as
Created April 4, 2012 14:54
blog_diving-into-world-construction-kit
override public function createBody():void
{
super.createBody();
b2body.SetUserData( new BodyData( BodyData.WALL, this ) );
}
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<_locDefinition xmlns="urn:locstudio">
<_locDefault _loc="locNone" />
<_locTag _loc="locData">Title</_locTag>
<_locTag _loc="locData">Description</_locTag>
<_locTag _loc="locData">Author</_locTag>
<_locTag _loc="locData">ToolTip</_locTag>
</_locDefinition>
<CodeSnippet Format="1.0.0">
@blachniet
blachniet / ModifiedNinjectWebCommon.cs
Created April 9, 2012 16:32 — forked from haacked/ServiceResolverAdapter.cs
ServiceResolverAdapter: Allows you to use the ASP.NET MVC DependencyResolver for ASP.NET Web API
/// <summary>
/// Starts the application
/// </summary>
public static void Start()
{
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
bootstrapper.Initialize(CreateKernel);
System.Web.Http.GlobalConfiguration.Configuration.ServiceResolver.SetResolver(System.Web.Mvc.DependencyResolver.Current.ToServiceResolver());
@blachniet
blachniet / snippet0.xml
Created June 30, 2012 15:46
blachniet-post_borderless-wpf-window
<Window x:Class="SimpleBorderlessWindow.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
Height="562"
Width="1000"
WindowStyle="None"
AllowsTransparency="True"
ResizeMode="CanResizeWithGrip">
@blachniet
blachniet / TSinMVC4.xml
Created October 3, 2012 11:32
Compile TypeScript in MVC4 project by adding this to the end of the *.csproj
<ItemGroup>
<TypeScriptCompile Include="$(ProjectDir)\**\*.ts" Exclude="$(ProjectDir)\**\*.d.ts" />
</ItemGroup>
<Target Name="BeforeBuild">
<Exec Command="&quot;$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.1.0\tsc.exe&quot; @(TypeScriptCompile ->'&quot;%(fullpath)&quot;', ' ')" />
</Target>
@blachniet
blachniet / AttackOfTheTray.cs
Last active April 18, 2023 13:58
Open and close cd tray from C#
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace AttackoftheTray
{
class Program
{
static void Main(string[] args)
{
@blachniet
blachniet / MyModel.Context.tt
Created January 11, 2013 18:59
The default DbContext generation script only generates one constructor for the DbContext. That constructor takes no arguments, so it is not possible to progromatically create the database connection string. If you add the constructor manually, your changes will be erased the next time the generation script is run. To fix this, add the following …
public <#=code.Excape(container)#>(string connectionString)
: base(connectionString)
{
<#
if (!loader.IsLazyLoadingEnabled(container))
{
#>
this.Configuration.LazyLoadingEnabled = false;
<#
}
@blachniet
blachniet / gist:5249654
Created March 26, 2013 21:53
Macro to collapse all xml comments in a C# document (Visual Studio). via http://www.helixoft.com/blog/archives/30?n=collapse-all-xml-comments-in-vb-net-or-c I mapped this to Ctrl+M,C
''' <summary>
''' Collapse XML comment for all code members
'''</summary>
Sub CollapseXmlComments()
Try
DTE.UndoContext.Open("Collapse XML comments")
Dim ce As CodeElement2
For Each ce In DTE.ActiveDocument.ProjectItem.FileCodeModel.CodeElements
collapseSubmembers(ce, False)
Next