Skip to content

Instantly share code, notes, and snippets.

View Vanlalhriata's full-sized avatar

Vanlal Hriata Vanlalhriata

  • Aizawl, Mizoram, India
View GitHub Profile
@Vanlalhriata
Vanlalhriata / AnimatedWrapPanel
Created May 22, 2015 14:04
WPF Animated WrapPanel
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
namespace ExpandDemo
{
class AnimatedWrapPanel : Panel
{
@Vanlalhriata
Vanlalhriata / XAML DataTrigger Visual states
Last active October 6, 2015 11:08
Trigger XAML visual state changes from viewModels
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="window"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
x:Class="MvvmLightExtended.MainWindow"
Width="800"
Height="600"
@Vanlalhriata
Vanlalhriata / Kinect v2 HD-Face post-build
Created February 25, 2015 16:01
Visual Studio post build for using HighDefinitionFaceFrameSource
xcopy "$(KINECTSDK20_DIR)Redist\Face\$(Platform)\NuiDatabase" "$(TargetDir)\NuiDatabase" /S /R /Y /I
@Vanlalhriata
Vanlalhriata / JS-ForceDownload
Created January 30, 2015 12:27
Force download
var url = (window.URL || window.webkitURL).createObjectURL(mp3blob);
var link = window.document.createElement('a');
link.href = url;
link.download = 'output.mp3';
var evt = new MouseEvent('click', { 'view': window, 'bubbles': true, 'cancelable': true });
link.dispatchEvent(evt);
@Vanlalhriata
Vanlalhriata / CloneObject
Created January 27, 2015 14:38
Deep copy an object in JavaScript
newCopy = jQuery.extend(true, {}, originalObject);
@Vanlalhriata
Vanlalhriata / DelegateCommand
Created January 14, 2015 12:01
DelegateCommand for MVVM
using System;
namespace CommandHelpers
{
public class DelegateCommand : System.Windows.Input.ICommand
{
#region Fields
private readonly Action<object> execute;
@Vanlalhriata
Vanlalhriata / RunSync
Last active August 29, 2015 14:05
Using async methods synchronously
var getFileOperation = Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(relativePath);
getFileOperation.AsTask().Wait();
var file = getFileOperation.GetResults();
var openReadOperation = file.OpenReadAsync();
openReadOperation.AsTask().Wait();
using (var stream = openReadOperation.GetResults().AsStreamForRead())
{
return Load(stream, segmentsX, segmentsY, width);
}