Skip to content

Instantly share code, notes, and snippets.

View ElliotWood's full-sized avatar

Elliot Wood ElliotWood

  • Lab3
  • Australia
  • 13:52 (UTC +10:00)
View GitHub Profile
@ElliotWood
ElliotWood / Clippy.txt
Created July 31, 2019 12:47
Extra large text
var clippy={};clippy.Agent=function(a,b,c){this.path=a,this._queue=new clippy.Queue($.proxy(this._onQueueEmpty,this)),this._el=$('<div class="clippy"></div>').hide(),$(document.body).append(this._el),this._animator=new clippy.Animator(this._el,a,b,c),this._balloon=new clippy.Balloon(this._el),this._setupEvents()},clippy.Agent.prototype={gestureAt:function(a,b){var c=this._getDirection(a,b),d="Gesture"+c,e="Look"+c,f=this.hasAnimation(d)?d:e;return this.play(f)},hide:function(a,b){this._hidden=!0;var c=this._el;this.stop();if(a){this._el.hide(),this.stop(),this.pause(),b&&b();return}return this._playInternal("Hide",function(){c.hide(),this.pause(),b&&b()})},moveTo:function(a,b,c){var d=this._getDirection(a,b),e="Move"+d;c===undefined&&(c=1e3),this._addToQueue(function(d){if(c===0){this._el.css({top:b,left:a}),this.reposition(),d();return}if(!this.hasAnimation(e)){this._el.animate({top:b,left:a},c,d);return}var f=$.proxy(function(e,f){f===clippy.Animator.States.EXITED&&d(),f===clippy.Animator.States.WAITING&&th
@ElliotWood
ElliotWood / gist:5260063
Created March 28, 2013 02:32
Rename-SQLDatabase powershell
Function Rename-SQLDatabase {
param (
[string] $ServerName,
[string] $SourceDb,
[string] $DestDb
)
$connection = New-Object System.Data.SqlClient.SqlConnection
$command = New-Object System.Data.SqlClient.SqlCommand
@ElliotWood
ElliotWood / gist:5260059
Created March 28, 2013 02:31
Build a SharePoint 2013 Farm and Provision all the service apps
$configType = read-host "Do you wish to create a new farm? (Y/N)"
if ($ConfigType -eq "N") {
$DatabaseServer = read-host "Preparing to join existing farm. Please specify the name of your SQL Server";
$ConfigDB = read-host "Next, specify the name of your Farm Configuration Database";
$Passphrase = read-host "Finally, please enter your Farm passphrase" -assecurestring
if((Get-PSSnapin | Where {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) {
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue;
}
@ElliotWood
ElliotWood / gist:5260048
Created March 28, 2013 02:30
Here is what I did... Web App with signalR .net4.0, then your SharePoint Web App .net 2. Add this to the global.asax in your Signalr project RouteTable.Routes.MapHttpHandlerRoute("spproxy","spproxy/{*operation}", new SharePointRProxyHandler()); If you want to raise an event from SharePoint you can do a http POST to this new route URL for example…
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace System.Web.Routing
{
public class HttpHandlerRoute : IRouteHandler
{
private String _virtualPath = null;
@ElliotWood
ElliotWood / gist:5260034
Last active December 15, 2015 12:28
Calculating Distance between two Latitude and Longitude GeoCoordinates
public static double Calculate(double sLatitude,double sLongitude, double eLatitude,
double eLongitude)
{
var sLatitudeRadians = sLatitude * (Math.PI / 180.0);
var sLongitudeRadians = sLongitude * (Math.PI / 180.0);
var eLatitudeRadians = eLatitude * (Math.PI / 180.0);
var eLongitudeRadians = eLongitude * (Math.PI / 180.0);
var dLongitude = eLongitudeRadians - sLongitudeRadians;
var dLatitude = eLatitudeRadians - sLatitudeRadians;
@ElliotWood
ElliotWood / gist:5260029
Created March 28, 2013 02:25
AI Game Behavior Tree's
public static class Behavior
{
//Branch
public static Action Selector(Func<bool> cond, Action ifTrue, Action ifFalse) {
return () => { if (cond()) { ifTrue(); } else { ifFalse(); } };
}
public static Action Sequencer(Action a, Action b) {
return () => { a(); b(); }
}
@ElliotWood
ElliotWood / gist:5260019
Created March 28, 2013 02:23
Fast Data Sync - Technical Specification
First you define some data. This will be the data that will define how one player differs to another.
class PlayerDetails {
var TotalHP : float = 100.0;
var HP : float = 100.0;
var EXP : int = 0;
var jumpSpeed:float = 8.0;
var runSpeed:float = 5.0;
var attackSpeed: float = 1.0;
@ElliotWood
ElliotWood / gist:5259979
Created March 28, 2013 02:15
This is sort of a Part II of SharePoint Content Query Webpart - Auto CommonViewFields
//In SP Header template xslt have you ever noticed the attribute mode
<xsl:template name="someTemplateName" match="*[@GroupStyle='someTemplateName']" mode="header">
//well there is another option mode="footer" now by default it isnt hooked up so you need to copy CallHeaderTemplate or modify CallFooterTemplate to the following:
<xsl:template name="OuterTemplate.CallFooterTemplate">
<xsl:value-of disable-output-escaping="yes" select="$EndList" />
<xsl:apply-templates select="." mode="footer">
</xsl:apply-templates>
<xsl:value-of disable-output-escaping="yes" select="$EndListItem" />
@ElliotWood
ElliotWood / gist:5259955
Created March 28, 2013 02:12
SharePoint Content Query Webpart - Auto CommonViewFields
public class ContentDisplayWebPart : ContentByQueryWebPart
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
string headerlink = "/Style%20Library/XSL%20Style%20Sheets/CustomXsl/______.xsl";
string itemlink = "/Style%20Library/XSL%20Style%20Sheets/CustomXsl/______.xsl";
if (this.HeaderXslLink != headerlink) { this.HeaderXslLink = headerlink; }
if (this.ItemXslLink != itemlink) { this.ItemXslLink = itemlink; }
if (this.CommonViewFields != (string)HttpContext.Current.Cache[this.Title + "_CommonViewFields"])
@ElliotWood
ElliotWood / gist:5259949
Created March 28, 2013 02:11
Simple script to restart SharePoint 2010 Services
@echo off
@echo Stopping SharePoint 2010 services...
iisreset /stop /noforce
net stop "SharePoint 2010 User Code Host"
net stop "SharePoint 2010 Timer"