Skip to content

Instantly share code, notes, and snippets.

View vbfox's full-sized avatar
❄️
Winter is coming

Julien Roncaglia vbfox

❄️
Winter is coming
View GitHub Profile
@vbfox
vbfox / GetReferencedAssemblies.cs
Created August 6, 2012 09:26
GetReferencedAssemblies & GetDirectlyReferencedAssemblies
static class Utils
{
static IEnumerable<Assembly> GetDirectlyReferencedAssemblies(Assembly startAssembly)
{
return startAssembly.GetReferencedAssemblies()
.Select(TryLoad)
.Where(a => a != null && !a.GlobalAssemblyCache);
}
static IEnumerable<Assembly> GetReferencedAssemblies(Assembly startAssembly)
@vbfox
vbfox / fullscreenMode.js
Created January 31, 2012 12:54
Just reading around the full screen API and implementing as i read for fun a small wrapper
// http://hacks.mozilla.org/2012/01/using-the-fullscreen-api-in-web-browsers/
function fullscreenMode()
{
this.request = function() {
var documentElement = document.documentElement;
if (documentElement.requestFullscreen) {
return documentElement.requestFullscreen();
}
else if (documentElement.mozRequestFullScreen) {
@vbfox
vbfox / AndroidTaskScheduler.cs
Created January 15, 2012 22:06
An implementation of a TaskScheduler running code on a thread designated by an Android.OS.Handler (MonoDroid)
namespace BlackFox
{
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Android.OS;
/// <summary>
/// Provides a <see cref="TaskScheduler"/> using an android <see cref="Handler"/> to run the tasks.
/// </summary>
@vbfox
vbfox / Mvvm.cs
Created December 7, 2011 23:56
CommandBindings from ICommands for WPF MVVM
namespace BlackFox
{
using System;
using System.Windows;
static class Mvvm
{
public static readonly DependencyProperty CommandBindingsProperty = DependencyProperty.RegisterAttached(
"CommandBindings", typeof(MvvmCommandBindingCollection), typeof(Mvvm),
new PropertyMetadata(null, OnCommandBindingsChanged));
@vbfox
vbfox / DisableTouchConversionToMouse.cs
Created November 4, 2011 15:54
Globally disable the conversion of touch events to mouse events in Windows 7
namespace BlackFox
{
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using System.Security;
/// <summary>
/// As long as this object exists all mouse events created from a touch event for legacy support will be disabled.
/// </summary>
@vbfox
vbfox / abuse.cs
Created November 3, 2011 19:54
Abuse C# operators
struct T
{
public static Action<string>[] operator + (T inst)
{
return new Action<string>[] { i => Console.WriteLine(i) };
}
}
void Main()
{
@vbfox
vbfox / FileTags.cs
Created October 14, 2011 00:19
Uses the Windows API to get the tags entered by the user in windows explorer
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
/// <summary>
/// Extract the tags that windows store for a file (internally called keywords)
/// </summary>
/// <code>
@vbfox
vbfox / minecraft_blocks.cs
Created May 2, 2011 18:48
Simple LINQPad script to spawn blocks in Minecraft
// This LINQPad script is usin the "C# Statement(s)" mode
// It requires a reference to System.Windows.Forms.dll
// and an import of the System.Windows.Forms namespace
//
// To use it click Execute, switch to minecraft and wait 5s.
var item = 20;
var user = "vbfox";
var stacks = 54;
var itemsPerStack = 64;
@vbfox
vbfox / pre-commit-check-binary-csfile.sh
Created November 10, 2010 16:56
Pre-Commit hook for svn checking that no .cs file is committed as a binary file.
#!/bin/bash
function script {
local repo="$1"
echo "repo=$repo"
local txn="$2"
echo "txn=$txn"
local selector="-t $txn"
@vbfox
vbfox / SvnFixBinaryCsFiles.cs
Created November 10, 2010 10:35
LINQPad program to remove 'svn:mime-type' properties with 'application/octet-stream' value from '.cs' files.
void Main()
{
var dir = "C:\\Code\\Repo\\";
var onlyChanged = true;
if (onlyChanged)
{
Console.WriteLine("Getting files from SVN... ");
var changed = GetSvnStatus(dir)
.Where(t => t.Item1 == 'A' || t.Item1 == 'M')