Skip to content

Instantly share code, notes, and snippets.

View mpj's full-sized avatar

Mattias Petter Johansson mpj

View GitHub Profile
We couldn’t find that file to show.
@mpj
mpj / gist:808
Created July 22, 2008 10:27
undefined
stuff.
// This sets the bounding box of the
// resize function. If the image is bigger or smaller than this,
// it's forced to this size.
var boxWidth = 500;
var boxHeight = 370;
var jcrop;
var defaultSelection;
function initializeJCrop() {
<script type="text/javascript" src="http://golfweather.systeamhalmstad.se/GolfWeather.mvc/RenderScript"></script>
<script type="text/javascript">
// Required: weather_golf_club_id
// The GIT id of the golf club that you want weather for.
// The golf club must have the weather module enabled.
var weather_golf_club_id = "1285a58f-cae3-4654-84cf-4f687febef3d";
// Optional: Custom Images
// Any url can be inserted here.
<div id="LDAContainer" style="width: 100%; position: absolute; top: 0px; left: 0px; z-index: 10000;">
<div class="fillScreenNoJavaScript" style="width:100%;height:5000px;position:fixed;top:0px;left:0px;background-color:#ffffff;z-index:10005;text-align:center;color:gray;"><span style="width:400px;margin:100px auto 0px auto;font-size:20px;">You need Javascript enabled in your web browser to view this site.</span></div>
<div class="fillScreen"></div>
<div id="LDAPlaceHolder"></div>
<script type="text/javascript">
jQuery(".fillScreenNoJavaScript").hide();
var ldaServerPath = "http://test.absolut.com/";
var ldaBaseUrl = "lda/imheremovie/en";
@mpj
mpj / cs
Created January 25, 2010 12:50
using System;
using System.Collections;
using System.Web;
using EPiServer;
using EPiServer.Core;
namespace AbsolutCom
{
public partial class Navigation : Absolut.EPiServer.UI.PageBase
{
@mpj
mpj / aspx
Created January 25, 2010 12:51
<%@ Page Language="C#" Inherits="AbsolutCom.Navigation" CodeFile="AbsolutCom_Navigation.aspx.cs" %>
//<%= Request.QueryString.ToString() %>
function navFindSource(e)
{
return e.target ? e.target : e.srcElement;
}
function navAddListener(obj, eventName, callback)
protected override void SavePageStateToPersistenceMedium(object viewState)
{
if (Page.ToString() == "ASP.default_aspx")
{
string str = "VIEWSTATE_" + Request.UserHostAddress + "_" + DateTime.Now.Ticks.ToString();
Session[str] = viewState; // session works in web garden
//Cache.Add(str, viewState, null, DateTime.Now.AddMinutes(Session.Timeout), TimeSpan.Zero,
//CacheItemPriority.Default, null);
ClientScript.RegisterHiddenField("__VIEWSTATE_KEY", str);
@mpj
mpj / bajs
Created April 28, 2010 07:58
<object width="384" height="216" type="application/x-shockwave-flash" id="ESPN_VIDEO" data="http://espn.go.com/videohub/player/embed.swf" allowscriptaccess="always" allownetworking="all"><param name="movie" value="http://espn.go.com/videohub/player/embed.swf" /><param name="allowFullScreen" value="true" /><param name="wmode" value="opaque" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="flashVars" value="id=4982905" /></object>
delegate void SetTextCallback(Control ctrl, string value);
void SetControlText(Control ctrl, string value)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if (ctrl.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetControlText);
this.Invoke(d, new object[] { ctrl, value });