This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Goes into OnContentLoaded() | |
MaterialGroup material = (MaterialGroup)_boardGroup.Find<Surface>().Material; | |
DiffuseMaterialPart materialPart = (DiffuseMaterialPart)((MaterialPaintGroup)material.MaterialParts | |
.First(x => x.Name == "ground").MaterialGroup.MaterialParts | |
.First()).MaterialParts.First(); | |
_boardTexture = materialPart.Texture; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To convert a Texture2D to an Image : | |
public static System.Drawing.Image Texture2Image(Texture2D texture) | |
{ | |
if (texture == null) | |
{ | |
return null; | |
} | |
if (texture.IsDisposed) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Surface s = _scene.Find<Surface>(); | |
Texture2D t = MaterialPaintGroup.GetMaskTextures((MaterialGroup)s.Material).OfType<Texture2D>().First(); | |
RenderTarget2D target = new RenderTarget2D(GraphicsDevice, t.Width, t.Height); | |
GraphicsDevice.SetRenderTarget(target); | |
SpriteBatch sb = new SpriteBatch(GraphicsDevice); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Sets the mask textures of the material group. | |
/// </summary> | |
public static void SetMaskTextures(MaterialGroup materialGroup, System.Collections.IList value) | |
{ | |
if (value == null) | |
throw new ArgumentNullException("value"); | |
AttachablePropertyServices.SetProperty(materialGroup, MaskTexturesProperty, value); | |
MaterialPartCollection materialParts = materialGroup.MaterialParts as MaterialPartCollection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- MSSQL Table structure for Compsys Ticketing app. | |
CREATE TABLE Employee ( | |
id int IDENTITY(1,1) PRIMARY KEY, | |
email varchar(64) NOT NULL, | |
f_name varchar(64) NOT NULL, | |
l_name varchar(64) NOT NULL | |
); | |
CREATE TABLE Role ( | |
id int IDENTITY(1,1) PRIMARY KEY, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippets | |
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>RxUI IViewFor Implementation</Title> | |
<Author>Kaleb Lape</Author> | |
<Description>Helps relieve the RxUI IViewFor boilerplate strain.</Description> | |
<Shortcut>snipiviewfor</Shortcut> | |
</Header> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class IMutableDependencyResolverMixins | |
{ | |
public static void Register<T>(this IMutableDependencyResolver This, Func<Func<T>, object> factory, Type serviceType, string contract = null) | |
{ | |
This.Register(() => factory(() => This.GetService<T>(contract)), serviceType, contract); | |
} | |
public static void Register<T1, T2>(this IMutableDependencyResolver This, Func<Func<T1>, Func<T2>, object> factory, Type serviceType, string contract = null) | |
{ | |
This.Register(() => factory(() => This.GetService<T1>(contract),() => This.GetService<T2>()), serviceType, contract); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AdmitOne.Domain.Entities; | |
using System.Data.Entity; | |
using System.Data.Entity.Infrastructure; | |
using System.Data.Entity.ModelConfiguration.Conventions; | |
namespace AdmitOne.Persistence.Ticketing | |
{ | |
public class TicketingSession : Session | |
{ | |
public TicketingSession() : base(new TicketingContext()) { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import string | |
from fileinput import input | |
from os.path import dirname, basename, isdir, isfile, join, splitext | |
from shutil import copy2 | |
def copyProject(project, destinationDir = ""): | |
projectDir = dirname(project) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Func<A, R> Memoize<A, R>(this Func<A, R> f) | |
{ | |
var cache = new System.Collections.Concurrent.ConcurrentDictionary<A, R>(); | |
return a => cache.GetOrAdd(a, f); | |
} |
OlderNewer