Skip to content

Instantly share code, notes, and snippets.

View jaywick's full-sized avatar

Jay Wick jaywick

View GitHub Profile
@jaywick
jaywick / launch-unity.ahk
Last active August 29, 2015 14:00
Launch Unity from Visual Studio
IfWinExist, ahk_class UnityContainerWndClass
{
WinActivate
Send ^p ; sends Ctrl+P
}
else
{
MsgBox, 64, Unity is not open. Please open the project to run from Visual Studio.
}
@jaywick
jaywick / Program.cs
Created May 17, 2014 14:19
copy-as-path
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace copypath
{
static class Program
{
/// <summary>
@jaywick
jaywick / clean-stackoverflow-2015.css
Created June 9, 2015 12:16
Cleaner StackOverflow Stylesheet for Stylish
.topbar { display: none; }
.community-bulletin { display: none; }
#hireme { display: none; }
#hot-network-questions {display:none;}
body {margin-top: 30px}
.tagged-ignored {display: none;}
pre
{
padding: 10px 15px;
border: rgb(207, 207, 207) solid 1px;
@jaywick
jaywick / app.gradle
Created June 21, 2015 11:29
Android Studio - Unit Testing - Gradle Files
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
compile(project(':lib'))
}
@jaywick
jaywick / MakeSafeFile.cs
Created June 30, 2015 05:26
Return file name safe from illegal file system characters
static string MakeSafeFileName(string name, char replaceChar = '_')
{
var temp = name;
foreach (var character in Path.GetInvalidFileNameChars().Concat(Path.GetInvalidPathChars()))
{
temp = temp.Replace(character, replaceChar);
}
return temp;
@jaywick
jaywick / OnEnterKeyListener.java
Created August 6, 2015 00:40
Android - Listen to Enter key down event on a View such as an EditText
package io.jaywick.android.helpers;
import android.view.KeyEvent;
import android.view.View;
public abstract class OnEnterKeyListener implements View.OnKeyListener
{
public abstract void onEnterKeyDown();
@Override
@jaywick
jaywick / singleton-csharp-snippet.cs
Last active December 26, 2015 02:59
Simple C# singleton pattern snippet
class MyClass
{
#region Singleton Access
private static readonly Lazy<Singleton> instance = new Lazy<Singleton>(() => new Singleton());
public static Singleton Instance
{
get { return instance.Value; }
}
using System;
using System.Drawing;
using System.Windows.Forms;
/// WinForms trap app boilerplate
/// Full credit to @alanbondo:
/// https://alanbondo.wordpress.com/2008/06/22/creating-a-system-tray-app-with-c/
namespace TrayApp
{
public class App : Form
@jaywick
jaywick / StartSnippingTool.ahk
Created May 26, 2016 02:05
Win + S to start Snipping Tool in snipping mode
#s::
Run C:\Windows\Sysnative\SnippingTool.exe,,,processId
WinWait, ahk_pid %processId%
WinActivate, ahk_pid %processId%
SendInput ^n
return
@jaywick
jaywick / keybindings.json
Created August 2, 2016 12:32
My keybindings for VSCode
[
{
"key": "ctrl+t",
"command": "workbench.action.files.newUntitledFile",
"when": "editorTextFocus"
},
{
"key": "ctrl+b",
"command": "editor.action.goToDeclaration",
"when": "editorTextFocus"