Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'json'
require 'cgi'
require 'find'
require 'net/http'
class Movie
$(function() {
$('a[id$="mainLink"]').attr("rel", "#overlay").overlay({
effect: 'apple',
onBeforeLoad: function() {
var linkEl = this.getOverlay().find("#passthrough"),
link = this.getTrigger().attr("href"),
iframe = this.getOverlay().find("#iframe");
@danshearmur
danshearmur / gist:994931
Created May 27, 2011 09:28
Redirect to correct domain in IIS
<!--
- Redirect to correct domain in IIS
- Useful if you have more than one domain
- for example: maindomain.com, maindomain.co.uk, www.maindomain.co.uk, testingdomain.dev
- inspired by https://github.com/paulirish/html5-boilerplate-server-configs/blob/master/web.config#L192
-->
<rewrite>
<rules>
<rule name="Correct Domain" stopProcessing="true">
@danshearmur
danshearmur / gist:994979
Created May 27, 2011 09:59
Weird IIS 404s
<!--
- Everything in "/Files/" was 404'ing. copied files to "/legacy/" and made this
-->
<rule name="files_folder" stopProcessing="true">
<match url="^Files/(.*)$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="legacy/{R:1}" />
@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;}
javascript:(function(F,i,r,e,b,u,g,L,I,T,E){if(F.getElementById(b))return;E=F[i+'NS']&&F.documentElement.namespaceURI;E=E?F[i+'NS'](E,'script'):F[i]('script');E[r]('id',b);E[r]('src',I+g+T);E[r](b,u);(F[e]('head')[0]||F[e]('body')[0]).appendChild(E);E=new%20Image;E[r]('src',I+L);})(document,'createElement','setAttribute','getElementsByTagName','FirebugLite','4','content/firebug-lite-dev.js','skin/xp/sprite.png','http://fbug.googlecode.com/svn/lite/branches/flexBox/','#startOpened');
@danshearmur
danshearmur / gist:1327839
Created October 31, 2011 16:05
Nice building a style tag
//https://github.com/addyosmani/github-watchers-button/blob/master/github-watchers.js
applyCss: function (css) {
var style = document.createElement('style');
style.type = 'text/css';
try {
style.appendChild(document.createTextNode(css));
} catch (e) {
if (style.styleSheet) {
@danshearmur
danshearmur / data-markdown.user.js
Created November 8, 2011 22:05 — forked from paulirish/data-markdown.user.js
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
Array.prototype.forEachG = function(f) {
for (var i = 0; i < this.length; i++) {
f(this[i], i, this);
}
}
@danshearmur
danshearmur / document_write.js
Created March 7, 2012 15:11
Replace document.write so that embedding gist script tags doesn't block the page
document._write = document.write;
document.write = function(str){
if (str.indexOf('<div id=\"gist-') != 0) {
if(str.indexOf('https://gist.github.com/stylesheets/gist/embed.css') == -1) {
// if you got this far it's not a github document.write call
document._write(str);
}
return;
}