Skip to content

Instantly share code, notes, and snippets.

@possan
possan / gist:659521
Created November 2, 2010 11:41
sso notes
======================================================================
SSO: Logged in at global domain:
======================================================================
z.se hej.se
<--------------
check local cookie at global domain
logged in here
--------------->
global usertoken
/*
* TextureRepository.cpp
* SafeDriverApp1
*
* Created by Per-Olov Jernberg on 5/30/10.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include "TextureRepository.h"
@possan
possan / gist:663987
Created November 5, 2010 11:08
autogenerated flashbanner display code from adtech
__ADTECH_CODE__ = "";
__theDocument = document;
__theWindow = window;
__bCodeFlushed = false;
if( m_new_award > m_old_award )
{
switch( m_new_award )
{
case MEDAL_BRONZE:
messagepart1 = [NSString stringWithFormat:@"Your TOTAL SCORE of %d won you the BRONZE MEDAL.", m_new_highscore];
messagepart2 = [NSString stringWithFormat:@"Score more than %d to win the SILVER MEDAL!", m_silver_level];
break;
case MEDAL_SILVER:
@possan
possan / gist:988864
Created May 24, 2011 14:58
Zitiz OAuth code
using System;
using System.Collections.Generic;
using System.Threading;
using System.Web;
using JsonFx.Json;
using log4net;
using OAuth;
using Zitiz.Types.Interfaces.IO;
using Zitiz.Types.Interfaces.Security;
using Zitiz.Types.Interfaces.UI;
@possan
possan / background.ps1
Created December 21, 2011 14:32
Background web worker with colorizing output
param (
$mode = $null,
$num = 1,
$url = $null
)
if( $mode -eq $null -or $url -eq $null ) {
write-host "Syntax: background.ps1 [start|loop] [1-100] [url]"
exit 1
}

före

d = $('#dicesvalue').val().split(',')

_web.reportDices [
  parseInt(d[0]),
  parseInt(d[1]),
 parseInt(d[2]),
@possan
possan / sendform.php
Created February 13, 2012 03:06
Simple post data mailer - sends all posted fields and uploaded files by email.
<?php
//
// Simple post data mailer - sends all posted fields and uploaded files by email.
//
// USAGE:
// curl -F field1=value1 -F field2=value2 -F file1=@/tmp/test.txt http://example.com/script.php
//
// TODO: check for spam post
@possan
possan / gist:1986051
Created March 6, 2012 12:38
Overdoing it? structuremap command query separation...
public class ModuleRegistry : Registry
{
public ModuleRegistry()
{
For<ICommandValidator<SubmitVideoBasicsCommand>>().Use<SubmitVideoBasicsCommandValidator>();
For<ICommandHandler<SubmitVideoBasicsCommand>>().Use<SubmitVideoBasicsCommandHandler>();
For<IQueryHandler<SubmitVideoMetaQuery, SubmitVideoMetaQueryResponse>>().Use<SubmitVideoMetaQueryHandler>();
For<ICommandValidator<SubmitVideoMetaCommand>>().Use<SubmitVideoMetaCommandValidator>();
For<ICommandHandler<SubmitVideoMetaCommand>>().Use<SubmitVideoMetaCommandHandler>();
}
@possan
possan / cqs.cs
Created March 6, 2012 14:27
Minimal command query separation
namespace MakeMyDay
{
public interface ICommand { }
public interface ICommandHandler<T> where T : ICommand
{
void Handle(T cmd);
}
public interface ICommandValidator<T> where T : ICommand