Skip to content

Instantly share code, notes, and snippets.

View PureKrome's full-sized avatar
💭
🦘🕺🏻🎶🕹

Justin Adler PureKrome

💭
🦘🕺🏻🎶🕹
View GitHub Profile
@PureKrome
PureKrome / gist:5626014
Created May 22, 2013 08:13
Sample kml data for Bribie Island, QLD.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Bribie Island, QLD</name>
<description><![CDATA[]]></description>
<Style id="style1">
<LineStyle>
<color>40000000</color>
<width>3</width>
</LineStyle>
@PureKrome
PureKrome / gist:5719709
Created June 6, 2013 06:31
Is this safe?
// Counter.
int count = 0;
// Do some shit, in parallel .. for some collection.
Parallel.ForEach(lotsOfThings,
something =>
{
DoSomething(count);
}});
@PureKrome
PureKrome / gist:5820290
Last active December 18, 2015 17:39
JabbR: Admin kick.
// ==UserScript==
// @name JabbR: Admin Kick Banned Users
// @namespace http://jabbr.net.admin/
// @version 0.1
// @description Kick mother bitches from JabbR who have been a pesk.
// @match https://jabbr.net/*
// @copyright 2013+, JabbR people
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
@PureKrome
PureKrome / gist:5915801
Last active December 19, 2015 06:59
RavenDb Bulk Insert question
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Raven.Abstractions.Data;
using Raven.Client;
using Raven.Client.Document;
using Raven.Tests.Helpers;
using Xunit;
DECLARE @SomeTable TABLE (Id INTEGER PRIMARY KEY NOT NULL IDENTITY,
ProductCompanyId INT NOT NULL, -- Company where the product is from.
ProductId VARCHAR(100) NOT NULL, -- Unique ProductId .. but unique -per- company.
Name VARCHAR(50),
Price MONEY
);
@PureKrome
PureKrome / gist:6025579
Created July 17, 2013 23:46
Problem with Inheritance.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
// Retrieve all the Associations.
var associations = documentSession
.Include<Account>(x => x.Devices.Keys)
.Load<Account>(existingUser.Associations
.Where(x => x.AcceptedOn.HasValue)
.Select(x => x.AccountId))
.Select(x => new
{
AccountId = x.Id,
x.User.DisplayName,
@PureKrome
PureKrome / gist:6437778
Created September 4, 2013 14:31
Really quick and nasty error page to find some Reflection errors occuring.
@using System.Reflection
@model System.Web.Mvc.HandleErrorInfo
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>Error</title>
@PureKrome
PureKrome / gist:6791947
Created October 2, 2013 10:50
New World-Domination to SimpleAuthentication rebranding readme for nuget package.
W O R L D - D O M I N A T I O N
A U T H E N T I C A T I O N
This package has now had a REBRANDING.
@PureKrome
PureKrome / gist:7353122
Created November 7, 2013 11:25
Converting some user query (eg. auto complete input text) to a lucene query, for some RavenDb love.
public static class SystemExtensions
{
public static string[] ToLuceneQuery(this string query, bool isWildCardAppended = true)
{
if (string.IsNullOrEmpty(query))
{
return null;
}
// Remove any 'crap' characters.