Skip to content

Instantly share code, notes, and snippets.

View UberMouse's full-sized avatar

Taylor Lodge UberMouse

View GitHub Profile
public IEnumerable<Game> GetAppInfos(params string[] appIds)
{
var response = _httpClient.Get(API_ENDPOINT + string.Join(",", appIds)).StaticBody<Dictionary<string, StoreApiResponse>>();
foreach (var id in appIds)
{
yield return _parseGame(response[id], id);
}
}
<ul id="topNavigation">
<li class="home">
<xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
<xsl:attribute name="class">home current</xsl:attribute>
</xsl:if>
<a href="/">Home</a>
</li>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<li>
<xsl:if test="@id = $currentPage/@id">
public void InsertGames(params SteamGame[] game)
{
var collection = GetGamesCollection();
try
{
collection.InsertBatch(game, WriteConcern.Acknowledged);
}
catch (MongoCommandException ex)
{
var x = ex;
@UberMouse
UberMouse / DAL.cs
Last active December 26, 2015 22:49
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
using SteamLibraryIntersecter.Models;
using SteamLibraryIntersecter.Steam.Entities;
2013-11-04 01:11:26,390 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
2013-11-04 01:11:31,441 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
2013-11-04 01:11:36,063 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
2013-11-04 01:11:41,151 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
2013-11-04 01:11:46,240 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
2013-11-04 01:11:51,296 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
2013-11-04 01:11:56,385 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
2013-11-04 01:12:01,017 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
2013-11-04 01:12:06,134 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
2013-11-04 01:12:11,266 (17c8) : DEBUG (logkit:13) - Nothing to do this time for Mayo Chiki!
@UberMouse
UberMouse / SequencesDetector.scala
Last active December 30, 2015 05:19
Detects simple sequences in a list of numbers. Only capable of determining liner addition/subtraction sequences.
object Worksheet {
val t = List(25, 21, 17, 13, 9) //> t : List[Int] = List(25, 21, 17, 13, 9)
sealed abstract class SequenceType(dif: Int)
case class Addition(dif: Int) extends SequenceType(dif)
case class Subtraction(dif: Int) extends SequenceType(dif)
case class Multiplication(dif: Int) extends SequenceType(dif)
case class Division(dif: Int) extends SequenceType(dif)
case class Invalid extends SequenceType(0)
object Source {
def :=(v: String) = Value := v
private object Value extends UntypedAttr("source") {
override def :=(v: String) = new Attr(this, v)
}
class Attr(att:Attr, newVal:String) extends AttrPair(att, newVal)
}
@UberMouse
UberMouse / CsvSplitter.scala
Created January 31, 2014 02:25
Leaks memory like a sieve
import java.io.{PrintWriter, File}
import scala.io.Source
/**
* Created by wyntl1 on 29/01/14.
*/
object Main extends App {
if(args.length != 4) {
val arguments = Array("location of csv files: string", "output directory: string", "sets: int", "set size (lines): int")
val example = "C:\\csvs C:\\csvs\\out 5 10000"
@UberMouse
UberMouse / CsvSplitter.scala
Created January 31, 2014 02:40
Second version of CSV Splitter, better on memory but still uses too much.
import java.io.{PrintWriter, File}
import scala.io.Source
/**
* Created by wyntl1 on 29/01/14.
*/
object Main extends App {
if(args.length != 4) {
val arguments = Array("location of csv files: string", "output directory: string", "sets: int", "set size (lines): int")
val example = "C:\\csvs C:\\csvs\\out 5 10000"
@UberMouse
UberMouse / gist:9401285
Created March 6, 2014 22:36
Quick and easy vigenere encoding
val Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
def vigenere(key:String, message:String) = {
val keyLength = key.length
val builder = new StringBuilder(message.length)
for((c, i) <- message.zipWithIndex) {
val index = (c + key(i % keyLength)) % 26
builder.append(Alphabet(index))
}
builder.toString()