Skip to content

Instantly share code, notes, and snippets.

@hoangitk
hoangitk / gist:6afbbff538692bd0e0732a0b30de1e7c
Created February 28, 2017 04:42 — forked from oazabir/gist:8e3187b5756b25b52393
Build, deploy, anonymize config, zip package, git commit, push from a single command
# Build, anonymize config, deploy, zip, commit, push in one shot
param (
[string]$solution = "OracleDashboard.sln",
[string]$zipname = "OracleDashboard.zip",
[string]$compressor = "c:\Program Files\7-Zip\7z.exe",
[string]$folder = "OracleDashboard",
[string]$deployPath = "..\Binary",
[string]$commitFrom = "..",
[Parameter(Mandatory=$true)][string]$comment
)
@hoangitk
hoangitk / DbProviderFactories.xml
Last active April 11, 2017 15:37 — forked from rippinrobr/gist:3241701
updated app.config file to add Npgsql as a data provider for this app.
<!--Ref: http://outofmemory.azurewebsites.net/configure-npgsql-on-windows/ -->
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<connectionStrings>
<add name="hockeydb"
connectionString="Server=127.0.0.1;Port=5432;Database=hockeydb;User Id=demo;Password=demo;"
providerName="Npgsql"
/>
</connectionStrings>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.Framework.Runtime;
namespace SomeApp
{
public class TypeFinder
{
@hoangitk
hoangitk / Common.props
Last active May 17, 2017 10:31 — forked from Antaris/Common.props
Flexible package management with MSBuild
<Project>
<!-- TARGET FRAMEWORKS -->
<ItemGroup Condition="'$(TargetFramework)'=='netstandard1.6'">
<PackageReference Include="NETStandard.Library" Version="1.6.1" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp1.1'">
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
</ItemGroup>
<!-- /TARGET FRAMEWORKS -->
@hoangitk
hoangitk / DependenciesVisualizer.linq
Created May 31, 2017 02:05 — forked from plaurin/DependenciesVisualizer.linq
LinqPad query to generate a DMGL of projects, libraries and NuGet packages dependencies
<Query Kind="Program" />
private string[] projectExtensionExclusions = new[] { ".vdproj", ".ndproj", ".wdproj", ".shfbproj" };
private string rootFolder = @"C:\Users\Pascal\Dev\MyProject";
void Main()
{
LoadAllProjects();
LoadAllPackagesConfig();
GenerateDGML(Path.Combine(rootFolder, "Dependencies.dgml"));
@hoangitk
hoangitk / CleanVS.csx
Created June 8, 2017 06:44 — forked from shawnwildermuth/CleanVS.csx
A ScriptCS script that will clean a Visual Studio project directory of files that I don't need. (Think of it as an ignore file that deletes the actual files).
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Diagnostics;
Console.WriteLine("Cleaning current folder and subfolders");
Console.WriteLine();
var toDelete = new [] { "bin","obj","bld","Backup","_UpgradeReport_Files","Debug","Release,ipch","*.mdf","*.ldf","*.suo","Packages","bower_components","node_modules","lib",".vs","artifacts" };
@hoangitk
hoangitk / scanner.rb
Created July 7, 2017 01:58 — forked from wvengen/scanner.rb
Hack to use Android phone as barcode scanner for pc
#!/usr/bin/env ruby
#
# Hack to use Android phone as barcode scanner for pc.
#
# Installation and setup:
# * Enable usb debugging on your Android phone
# * Make sure you have an Android SDK installed
# * Make sure xdotool is installed (apt-get has it) http://www.semicomplete.com/projects/xdotool/
# * Build and install https://github.com/majido/clipper
# * Start service: `adb shell su -c \'am startservice ca.zgrs.clipper/.ClipboardService\'`
@hoangitk
hoangitk / index.html
Created July 26, 2017 06:34 — forked from robdodson/index.html
Shady DOM example
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h2>Hello from outside the Shadow DOM!</h2>
@hoangitk
hoangitk / RoslynReflection.cs
Created October 31, 2017 03:15 — forked from aelij/RoslynReflection.cs
Reflection using Roslyn (without loading assemblies into the app domain)
var compilation = CSharpCompilation.Create("C")
.AddReferences(MetadataReference.CreateFromFile(pathToAssembly));
foreach (var type in
from assemblySymbol in compilation.SourceModule.ReferencedAssemblySymbols
from module in assemblySymbol.Modules
from n in module.GlobalNamespace.GetMembers()
where n.IsNamespace
from type in n.GetTypeMembers()
select type)
@hoangitk
hoangitk / gist:bb593e2e50703342e91b5638b247a495
Created May 2, 2018 14:41 — forked from benfoster/gist:5933215
ASP.NET MVC Action Filter for automatic handling of Ajax requests
using System.Net;
using System.Web.Mvc;
namespace Fabrik.Common.Web
{
public class HijaxAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (CanBeHijaxed(filterContext))