Skip to content

Instantly share code, notes, and snippets.

@csim
csim / index.html
Last active December 27, 2015 15:09
<a name="{{ post.url }}"></a>
<h1><a href="{{ post.url }}">{{ post.title }}</a></h1>
<div class="post-date">{{ post.date | date: "%-d %B %Y" }}</div>
{{ post.content }}
<div class="post-separator"></div>
@csim
csim / BaseFieldControl.cs
Last active August 29, 2015 13:58
SharePoint Field Control
namespace MyProject.Web.UI.FieldControls
{
using System;
using System.Web.UI;
using Microsoft.SharePoint.WebControls;
public abstract class UserControlFieldBase : BaseFieldControl
{
private SPFieldUserControlBase _usercontrol;
@csim
csim / web.config.xml
Last active August 29, 2015 13:58
Sharepoint HttpModule
<?xml version="1.0" encoding="utf-8" ?>
<actions>
<add path="configuration/system.web/httpModules"
id="{8DD2A7B1-0223-4be8-B1B5-339B642EFB21}">
<add name="MyHttpModule"
type="MyHttpModule, MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a1df43608d33992f" />
</add>
</actions>
@csim
csim / embed.html
Created April 9, 2014 15:28
SharePoint Video Embed
<object id="video" type="application/x-silverlight-2"
data="data:application/x-silverlight-2," width="100%" height="100%">
<param name="source" value="/_layouts/clientbin/mediaplayer.xap" />
<param name="enableHtmlAccess" value="true" />
<param name="windowless" value="true" />
<param name="background" value="#80808080" />
<param name="initParams"
value="mediaTitle=,mediaSource={VIDEO URL},previewImageSource={VIDEO PREVIEW IMAGE},autoPlay=true" />
<param name="onresize" value="video" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
@csim
csim / RapidCachedDataAdapterBase.cs
Last active August 29, 2015 13:58
SharePoint Content Database as a Cache
public abstract class RapidCachedDataAdapterBase<TData>
where TData : class
{
protected Guid SiteID;
protected virtual bool AutoRefreshCache;
protected virtual string CacheKey;
protected virtual string CacheExpireKey;
protected virtual int CacheTimeoutMinutes;
public virtual TData CachedData;
@csim
csim / div.html
Last active August 29, 2015 13:58
Embed tweets to blog
<div id="tweet"></div>
@csim
csim / clock_angle.js
Last active November 23, 2015 21:27
Clock Problem Solution
var angle = function(hour, minute) {
var hourAngle = parseFloat(hour * 30);
// take into account the movement of the hour hand between hours
hourAngle = hourAngle + parseFloat((minute / 60) * 5);
var minuteAngle = parseFloat(minute * 6);
var angle = Math.abs(hourAngle - minuteAngle);
return (angle > 180) ? 360 - angle : angle;
};
alert(angle(3, 0));
alert(angle(3, 10));
@csim
csim / edit.ps1
Created April 9, 2014 15:59
Edit Powershell Function
function Edit {
$SublimePath = "{your path}\sublime_text.exe"
if ($args.length -eq 0) {
& $SublimePath $pwd
} else {
& $SublimePath $args
}
}
@csim
csim / keyboard.reg
Created April 9, 2014 15:59
Keyboard register settings
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response]
"AutoRepeatDelay"="250"
"AutoRepeatRate"="20"
"BounceTime"="0"
"DelayBeforeAcceptance"="0"
"Flags"="59"
@csim
csim / bootstrap_size_indicator.html
Created June 6, 2014 15:55
Bootstrap size indicator
<div style="position: fixed; top: 0px; left: 0px; z-index: 10000;" class="btn btn-default">
<div class="visible-xs">Extra Small (xs)</div>
<div class="visible-sm">Small (sm)</div>
<div class="visible-md">Medium (md)</div>
<div class="visible-lg">Large (lg)</div>
</div>