Skip to content

Instantly share code, notes, and snippets.

View hoganlong's full-sized avatar

Hogan Long hoganlong

View GitHub Profile
@hoganlong
hoganlong / test.cs
Last active December 18, 2015 20:39
For stackoverflow question at http://stackoverflow.com/questions/17242522/linq-not-trivial-group-by To run use linqpad and set it to C# program
void Main()
{
Person p1 = new Person();
p1.Groups = new List<Group>();
p1.Groups.Add(new Group { GroupType = GroupTypesEnum.a });
p1.Groups.Add(new Group { GroupType = GroupTypesEnum.b });
Message m1 = new Message();
m1.Recipient = p1;
Person p2 = new Person();
@hoganlong
hoganlong / solution.cs
Last active December 18, 2015 17:39
For stackoverflow question at http://stackoverflow.com/questions/17204123/linq-retrieve-non-repeated-values#17204179 To run use linqpad and set it to C# program
void Main()
{
List<Event_Day> Days = new List<Event_Day>();
Days.Add(new Event_Day(420,120,1,new DateTime(2013,6,20)));
Days.Add(new Event_Day(421,120,2,new DateTime(2013,6,21)));
Days.Add(new Event_Day(422,120,3,new DateTime(2013,6,22)));
List<Event_Session> Sessions = new List<Event_Session>();
Sessions.Add(new Event_Session(170,120,420));
Sessions.Add(new Event_Session(171,120,420));
void Main()
{
Dictionary<int,int> skillList = new Dictionary<int,int>();
skillList.Add(1,1);
skillList.Add(2,2);
skillList.Add(3,1);
skillList.Add(4,1);
#first install the compiler
yum install gcc gcc-c++ autoconf automake
#install zlib-devel as it's a dependency
yum install zlib-devel
#then get and build git from source
cd /usr/lib
wget "https://git-core.googlecode.com/files/git-1.8.2.2.tar.gz"
tar xzvf git-1.8.2.2.tar.gz
(function($) {
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
progress: $.noop,
xhr: function() {
var req = originalXhr(), that = this;
if (req) {
if (typeof req.addEventListener == "function") {
req.addEventListener("progress", function(evt) {
that.progress(evt);
000
00100
0010100
space: 00101010
00101011
001011
00110
00111000
burger: 00111001
0011101
bacon: 10010000
space: 00101010
pong: 10000001
simone: 11010011
eightbit: 01010011
song: 11011011
synth: 10001000
ascii: 01111111
bowling: 01110101
rocket: 01000101
@hoganlong
hoganlong / dabblet.css
Last active December 11, 2015 13:48 — forked from LeaVerou/dabblet.css
/**
* Clip image to hexagon
*/
img {
max-width: 200px;
max-height: 200px;
}
@hoganlong
hoganlong / test.cs
Last active December 11, 2015 00:59
Testing some different ways to check type vs property. IS wins. (yay?)
class TestMe
{
public string test = "test";
}
void Main()
{
List<TestMe> aList = new List<TestMe>();
for (int index = 0; index < 10000000;index++)
void Main()
{
List<offer> OfferList = new List<offer>() {
new offer() { id=1, f=new DateTime(2011,1,1), t=new DateTime(2011,1,31),status=true},
new offer() { id=1, f=new DateTime(2011,2,1), t=new DateTime(2011,2,28), status=false},
new offer() { id=2, f=new DateTime(2011,2,1), t=new DateTime(2011,2,28), status=false},
new offer() { id=3, f=new DateTime(2011,1,1), t=new DateTime(2011,1,31), status=true },
new offer() { id=3, f=new DateTime(2011,1,1), t=new DateTime(2011,1,26), status=true },
new offer() { id=4, f=new DateTime(2011,1,1), t=new DateTime(2011,1,31), status=true },
new offer() { id=1, f=new DateTime(2011,3,1), t=new DateTime(2011,3,31), status=false},