Skip to content

Instantly share code, notes, and snippets.

View jasonkarns's full-sized avatar
🏠
Working from home

Jason Karns jasonkarns

🏠
Working from home
View GitHub Profile
@jasonkarns
jasonkarns / Opera CSS filter
Created September 30, 2009 14:26
CSS filter for Opera
@media all and (-webkit-min-device-pixel-ratio:10000),
not all and (-webkit-min-device-pixel-ratio:0) {
/* 7.2 up */
head~body { /* 9 up */ }
:root { /* 9.5 up */ }
}
@jasonkarns
jasonkarns / Hacks
Created October 8, 2009 15:03
CSS filter for IE
/* IE6 only */
* html {}
/* IE7 only */
* + html {}
/* IE8 only */
/* IE6-7 */
@jasonkarns
jasonkarns / Inline-Block.css
Created December 2, 2009 22:06
Cross-Browser Inline-Block
/* Caveats:
- ib-block needs an explicit width
- if the whitespace between ib-block elements is not a problem, then the ib-container class isn't necessary.
- if Firefox 2 support is necessary, add display:-moz-inline-stack to the top of the .ib-block rule and wrap .ib-block's children in a div.
- The IE6/7 rules can be broken out into separate ie-only stylesheets included via conditional comments.
*/
.ib-block {
vertical-align:top;
display:inline-block;
@jasonkarns
jasonkarns / Utility.css
Created February 10, 2010 21:46
A set of base utility classes
/* A set of base utility classes */
.hidden {
display:none;
}
.phark {
text-indent: -5000px;
overflow: hidden;
display:block;
}
@jasonkarns
jasonkarns / index.html
Created February 22, 2010 21:31
JS Templating that upholds separation of concerns
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>JSHTML</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.jshtml.js"></script>
<script type="text/javascript">
jQuery(function($){
$('script.jshtml').jshtml();
console.log(some_global);
@jasonkarns
jasonkarns / MooTools.jQuery.js
Created March 5, 2010 02:04
jQuery mutator for MooTools
Class.Mutators.jQuery= function(jquery){
return jquery;
};
Class.Mutators.initialize = function(initialize){
return function(){
//console.log("add ", this.jQuery.method, " to jQuery");
jQuery.fn[this.jQuery.method] = function(){};
$splat(this.jQuery.helpers).each(function(name){
//console.log("add ", name, " as ", this[name], " to jQuery.", this.jQuery.method);
# named captures shouldn't *have* to be compared as a hash;
# MatchData still returns the captures as a plain indexed array,
# so matching against the indexed captures should still be allowed
it "matches indexed captures against named captures" do
expect(Regexp.new("(?<num>123)")).to match("a123a").with_captures("123")
end
# doesn't make sense to show the expected captures if the match itself fails; they're irrelevant at that point
it "shows plain match failure message if match itself fails" do
expect {
@jasonkarns
jasonkarns / YQL.html
Created December 15, 2010 06:01
Sample YQL demo
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>YQL</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
(function($){
CmdUtils.makeBookmarkletCommand({
name: "radbox",
url: "javascript:function%20addvid(){var%20d=document,%20z=d.createElement(%27scr%27+%27ipt%27),%20b=d.body;try%20{if(!b)%20throw(0);r=Math.floor(Math.random()*100+1);z.setAttribute(%27src%27,%20%27http://radbox.me/init/static/add.js?r=%27+r.toString());b.appendChild(z);}%20catch(e)%20{alert(%27Please%20wait%20until%20the%20page%20has%20loaded.%27);}}if(window.location.hostname.search(%27radbox%27)%20==%20-1)%20{addvid();}%20else%20{alert(%27You%20cannot%20use%20this%20bookmarklet%20in%20Radbox.%27);}void(0);"
})
@jasonkarns
jasonkarns / fiddle.css
Created June 29, 2011 19:07
Map Tooltips
#map{
background:url(/_layouts/images/advics.internet.branding/map.png) #FFFFFF;
height:448px;
position:relative;
}
#map ul {
list-style:none;
}
.maplocation {
position:absolute;