Skip to content

Instantly share code, notes, and snippets.

View timhobbs's full-sized avatar

Tim Hobbs timhobbs

View GitHub Profile
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@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">
@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}}
@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;}
@artero
artero / launch_sublime_from_terminal.markdown
Last active January 25, 2024 16:57 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@navinpai
navinpai / convert.bat
Created November 23, 2011 16:14
Convert M4A to MP3 With VLC
@ECHO OFF
REM Use this to convert m4a's to mp3's using VLC (http://www.videolan.org/vlc/).... Had to find this to convert songs
REM downloaded with https://github.com/navinpai/8Tracks-Downloader :P :)
:START
FOR /R %%G IN (*.m4a) DO (CALL :SUB_VLC "%%G")
FOR /R %%G IN (*.m4a.mp*) DO (CALL :SUB_RENAME "%%G")
FOR /R %%G IN (*.m4a) DO (del "%%G")
sleep 1000
GOTO :START
GOTO :eof
@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"
@johnmegahan
johnmegahan / functions.php
Created January 12, 2012 01:50
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown menus in Wordpress.
<?php
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );
@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 ";
@duanecilliers
duanecilliers / wp-bootstrap-walker-class.php
Created February 13, 2012 14:45
Extended Walker Class for Twitter Bootsrap Navigation Wordpress Integration
<?php
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth ) {
//In a child UL, add the 'dropdown-menu' class
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";