Skip to content

Instantly share code, notes, and snippets.

View voidtuxic's full-sized avatar

Tuxic voidtuxic

View GitHub Profile
@voidtuxic
voidtuxic / gitlfsserver.sh
Created March 18, 2016 13:26
Git LFS server config
#!/bin/sh
### BEGIN INIT INFO
# Provides: gitlfsserver
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
@voidtuxic
voidtuxic / croppedImg.xaml
Last active December 7, 2015 14:31
Getting a useable cropped content with zero transform and correct size in UWP XAML
<!--
Full is your viewmodel containing the whole of your content (whatever control, here as an example an image)
Part is your viewmodel containing the area to crop
Part has a clipping rect, and 2 offset (OffsetX and OffsetY) why are basicaly -Rect.X and -Rect.Y. This puts the cropped part
on the top left of the grid and allow natural clipping through its render
protip : surround with a ViewBox if the size needs to be fluid in your UI
-->
<Grid Width="{Binding Part.Rect.Width}" Height="{Binding Part.Rect.Height}">
<Grid Width="{Binding Full.Width}" Height="{Binding Full.Height}">
@voidtuxic
voidtuxic / MenuItem.cs
Created November 25, 2015 16:44
MVVM, UWP and MenuFlyout binding
// Using MVVM light, replace ViewModelBase with your MVVM framework
public class MenuItem : ViewModelBase
{
private readonly List<MenuItem> _items = new List<MenuItem>();
private readonly string _title;
private RelayCommand _command;
public MenuItem(string title)
: this(title, new RelayCommand(()=> { }, () => { return false; }))
@voidtuxic
voidtuxic / bindableinkcanvas.cs
Created September 29, 2015 09:11
Bindable InkCanvas for UWP
using Windows.UI.Input.Inking;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
public class BindableInkCanvas : InkCanvas
{
public static readonly DependencyProperty StrokesProperty = DependencyProperty.RegisterAttached(
"Strokes",
typeof(InkStrokeContainer),
typeof(BindableInkCanvas),
@voidtuxic
voidtuxic / ViewController.m
Created March 6, 2014 14:08
GLKit starter ViewController
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
{
EAGLContext* context;
GLuint vertexArray; // our VAO
@voidtuxic
voidtuxic / metronome.cs
Created December 19, 2013 11:23
C# Metronome for Unity3D
using UnityEngine;
using System.Collections;
public delegate void MetronomeEvent(Metronome metronome);
public class Metronome : MonoBehaviour {
public int Base;
public int Step;
public float BPM;
public int CurrentStep = 1;
@voidtuxic
voidtuxic / ruby rack
Created October 25, 2012 10:00
ruby rack
require 'json'
class IngeServer
def call(env)
@path = env['PATH_INFO']
@request = Rack::Request.new(env)
self.router
end