Skip to content

Instantly share code, notes, and snippets.

View dieseltravis's full-sized avatar
🆗
I'm ok

Travis Hardiman dieseltravis

🆗
I'm ok
View GitHub Profile
@dieseltravis
dieseltravis / cached-xml.cs
Last active August 29, 2015 17:34
Caching an XML document with a file dependency
XmlDocument xDoc = null;
string xmlPath = "~/App_Data/SomeXml.xml";
if (HttpContext.Current.Cache[xmlPath] == null) {
string cacheFilePath = HttpContext.Current.Server.MapPath(xmlPath);
xDoc = new XmlDocument();
xDoc.Load(cacheFilePath);
HttpContext.Current.Cache.Insert(xmlPath, xDoc, new CacheDependency(cacheFilePath));
} else {
xDoc = (XmlDocument)HttpContext.Current.Cache[xmlPath];
@unruthless
unruthless / CSS for <sup> and <sub>
Created May 26, 2010 01:31
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
@rkatic
rkatic / jQuery.checkVersion.js
Created July 1, 2010 04:22
jQuery.checkVersion
jQuery.checkVersion = function( min, max ) {
var current = jQuery.fn.jquery + 'zz';
max = ( max || min ) + 'zz';
min += '0.0.0zz'.substr( min.length );
return min <= current && current <= max;
};
// This one will also handle 'pre' suffix as minor of 'alpha' and 'beta'.
jQuery.checkVersion = (function(){
@cowboy
cowboy / jquery.ba-isversion.js
Created July 1, 2010 17:36
Test jQuery version WIP UNTESTED
/*!
* jQuery isVersion - v0.1 - 07/02/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){
using System;
using System.Linq;
using Newtonsoft.Json.Linq;
namespace FacebookChallenge
{
class Program
{
static readonly string accessToken = "GET YOUR OWN FOO";
static readonly string baseUrl = "https://graph.facebook.com/{0}/{1}?access_token={2}";
// ----------------------------------------------------------
// 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) {}
#!/usr/bin/env ruby
require 'ftools'
require 'fileutils'
require 'rubygems'
require 'RMagick'
include Magick
require 'open3'
def merge( files = [] )
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
//dynamically generated by ASP.NET for the language passed in.
var labels = {
language: 'English',
objectOverlay: {
closeX: 'Close X',
fallback: 'Video for {vid}'
},
global: {
label1: 'label1',
label2: 'label2'
@jsjohnst
jsjohnst / comment_flag_in.css
Created December 27, 2010 05:45
Pure CSS (without extra HTML markup) comment speech bubbles for SquareSpace blogs.
.journal-comment-area-wrapper .comment .signature:before {
font-size: 10px;
content: '';
display: block;
height: 0;
width: 0;
border-right: 2em solid #666;
border-bottom: 2em solid #000;
border-bottom: 2em solid transparent;
position: absolute;