Skip to content

Instantly share code, notes, and snippets.

View timhobbs's full-sized avatar

Tim Hobbs timhobbs

View GitHub Profile
@rasmuskl
rasmuskl / create-site.ps1
Created December 15, 2011 20:17
PowerShell: Creating IIS7 site + AppPool
param([string]$site=$(throw "Site argument is required."))
function vdir-exists([string]$name)
{
if((Test-Path -path $name) -eq $False)
{
return $False
}
(Get-Item $name).GetType().Name -eq "ConfigurationElement"
@michaeljacobdavis
michaeljacobdavis / Adapter.js
Created August 7, 2012 05:19
NotEqual Fluent Validation validator with client side validation
(function ($) {
$.validator.addMethod("notequal", function (value, element, param) {
return this.optional(element) || value != $(param).val();
}, "This has to be different...");
$.validator.unobtrusive.adapters.add("notequal", ["field"], function (options) {
options.rules["notequal"] = options.params.field;
if (options.message) options.messages["notequal"] = options.message;
});
})(jQuery);
@offsky
offsky / NewMacConfig.md
Last active July 3, 2017 15:50
Setup new mac for web development (Updated for Yosemite)
@gsherman
gsherman / IIS7: rewrite cookies to be httponly
Created January 20, 2011 22:40
a rewriting rule that adds "HttpOnly" to any out going "Set-Cookie" headers
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!--
Rewrite any outgoing "Set-Cookie" headers to be "HttpOnly"
Requires the IIS7 URL Rewrite Module, available from: http://www.iis.net/download/urlrewrite
-->
<rewrite>
<outboundRules>
<rule name="Add HttpOnly" preCondition="No HttpOnly">
@robnyman
robnyman / Fullscreen API, fullscreenchange.js
Last active March 9, 2018 19:51
Fullscreen API, fullscreenchange
document.addEventListener("fullscreenchange", function () {
fullscreenState.innerHTML = (document.fullscreen)? "" : "not ";
}, false);
document.addEventListener("mozfullscreenchange", function () {
fullscreenState.innerHTML = (document.mozFullScreen)? "" : "not ";
}, false);
document.addEventListener("webkitfullscreenchange", function () {
fullscreenState.innerHTML = (document.webkitIsFullScreen)? "" : "not ";
@rossholdway
rossholdway / activated-route-stub.ts
Last active May 19, 2020 20:11
Stub Angular 2+ routers activatedRoute.
import {
DefaultUrlSerializer,
convertToParamMap,
ParamMap,
Params,
UrlSegment,
UrlSegmentGroup,
PRIMARY_OUTLET
} from '@angular/router';
import { ReplaySubject } from 'rxjs';
@joelnet
joelnet / example.html
Created June 3, 2011 18:03
Unobtrusive Knockout support library for jQuery
Choose a ticket class: <select id="tickets"></select>
<p id="ticketOutput"></p>
<script id="ticketTemplate" type="text/x-jquery-tmpl">
{{if chosenTicket}}
You have chosen <b>${ chosenTicket().name }</b>
($${ chosenTicket().price })
<button data-bind="click: resetTicket">Clear</button>
{{/if}}
@esergueev
esergueev / BackgroundWorker.cs
Created October 22, 2012 06:27
ASP.NET MVC background worker for long running tasks
public interface IBackgroundWorker
{
Task<TOutput> Run<TInput, TOutput>(Func<TInput, TOutput> action);
Task Run(Action action);
Task Run<TInput>(Action<TInput> action);
}
public sealed class BackgroundWorker : IBackgroundWorker
{
public Task<TOutput> Run<TInput, TOutput>(Func<TInput, TOutput> action)
@danshearmur
danshearmur / colorbox.less
Created September 12, 2011 15:31
Using colorbox with bootstrap
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:10001; overflow:hidden;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
.cboxPhoto{float:left; margin:auto; border:0; display:block;}
.cboxIframe{width:100%; height:100%; display:block; border:0;}
@gabonator
gabonator / api.txt
Created January 16, 2016 10:04
tvheadend json api calls for version 4.0.8
http://admin:admin@192.168.1.239:9981/api/serverinfo
{"sw_version": "4.0.8~wheezy","api_version": 15,"name": "Tvheadend","capabilities": ["caclient","tvadapters","satip_client","satip_server","trace"]}
http://admin:admin@192.168.1.239:9981/api/epg/events/grid
- returns tv listings guilde
http://admin:admin@192.168.1.239:9981/api/channel/list
- returns list of all tv/radio channels
{"entries":[ {"key": "8da5751f0c30fc8317d7d5875ce87bd4","val": "Markiza"}, ... }