Skip to content

Instantly share code, notes, and snippets.

Avatar

Darren Reid Layoric

View GitHub Profile
@Layoric
Layoric / GetAllValuesBetweenIDs.cs
Created Nov 5, 2012
Helpful C# method to get value between two string identifiers
View GetAllValuesBetweenIDs.cs
/// <summary>
/// Generic function to pull out string values between two identifiers
/// </summary>
/// <param name="document"></param>
/// <param name="startVal"></param>
/// <param name="endVal"></param>
/// <returns></returns>
private static List<string> GetAllValuesBetweenKeys(string document, string startVal, string endVal)
{
string temp = document;
View CookieAwareWebClient.cs
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
@Layoric
Layoric / ApplicationDirectory
Created Jul 25, 2013
Get file system directory of where the current executable is running from
View ApplicationDirectory
string assemblyDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location);
View MethodInvoke
Assembly assembly = Assembly.LoadFile("...Assembly1.dll");
Type type = assembly.GetType("TestAssembly.Main");
if (type != null)
{
MethodInfo methodInfo = type.GetMethod(methodName);
if (methodInfo != null)
{
object result = null;
ParameterInfo[] parameters = methodInfo.GetParameters();
object classInstance = Activator.CreateInstance(type, null);
View XNATextureLoader
/// <summary>
/// Based on http://jakepoz.com/jake_poznanski__background_load_xna.html
/// </summary>
public class TextureLoader
{
static TextureLoader()
{
BlendColorBlendState = new BlendState
{
ColorDestinationBlend = Blend.Zero,
@Layoric
Layoric / web.config
Last active Apr 22, 2018
IIS web config for .dart files
View web.config
<system.webServer>
<staticContent>
<remove fileExtension=".dart" />
<mimeMap fileExtension=".dart" mimeType="application/dart" />
</staticContent>
</system.webServer>
@Layoric
Layoric / AppHost.cs
Last active Aug 29, 2015
Dart config
View AppHost.cs
public override void Configure(Funq.Container container)
{
//ServiceStack v3
//SetConfig(new EndpointHostConfig {AllowFileExtensions = {"dart"}});
//ServiceStack v4
SetConfig(new HostConfig { AllowFileExtensions = {"dart"}});
}
@Layoric
Layoric / ArrayToTable.js
Created Mar 3, 2014
Javascript function to split a flat array into a fixed number of columns
View ArrayToTable.js
var arrayToTable = function (array, numOfCols) {
var arrayLength = array.length;
var rows = [{
columns: []
}];
var rowNum = 0;
for(var i = 0; i < arrayLength; i++) {
var rowMod = (i) % numOfCols;
if(rowMod === 0) {
rows.push({
@Layoric
Layoric / scrollto.js
Created Jun 16, 2014
Simple angular replacement for scroll to content links
View scrollto.js
app.directive('scrollTo', [function () {
"use strict";
return {
restrict: 'EA',
controller: function ($scope) {
},
link: function ($scope,$element,$attrs) {
if($attrs.scrollTo != null) {
var elementNameToScroll = $attrs.scrollTo;
View keybase.md

Keybase proof

I hereby claim:

  • I am layoric on github.
  • I am layoric (https://keybase.io/layoric) on keybase.
  • I have a public key whose fingerprint is 135F AF1F 5D3D 50D3 DBA3 FB53 E636 C4A7 22FE 459D

To claim this, I am signing this object:

You can’t perform that action at this time.