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
@bryanl
bryanl / campfire-emoji.txt
Created January 27, 2011 16:34
campfire emoji
Surround these with : e.g. :calling:
+1
-1
bulb
calling
clap
cop
email
feet
@remy
remy / gist:804414
Created January 31, 2011 17:24
Simple CSS parser
function parseCSS(str) {
function trim(str) {
return (str||'').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
var i, j, k,
split = '}',
cur_key = '',
cur_key_split,
css = str.replace(/\t*/g, '').replace(/\s{2}/, ' ').replace(/[\n|\r]/g, ' ').replace(/\/\*.*?\*\//g, '').split(split),
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@nathos
nathos / twitterbutton.sass
Last active September 26, 2015 18:17
Scalable twitter button
.twitterbutton
// change size to any (reasonable) percentage/px you want
// font-size: 200%
color: #4e839e
font-family: "Helvetica Neue", Arial, sans-serif
font-weight: 300
line-height: 1em
text-decoration: none !important
text-rendering: optimizeLegibility
padding: 0.5em 0.7em
@alanta
alanta / CmdHttpModule.cs
Created August 23, 2011 08:08
Fix Sitefinity url handling and rewriting
using System;
using System.Configuration;
using System.Web;
using Telerik.Cms.Web;
namespace Alanta.Sitefinity
{
public class CmsHttpModule : IHttpModule
{
private Telerik.Cms.Web.CmsHttpModule _cmsHttpModule;
@jpoehls
jpoehls / BaseController.cs
Created December 2, 2011 19:38
Newtonsoft Json Results for MVC
using System;
using System.Linq;
using System.Web.Mvc;
public abstract class BaseController : Controller
{
protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding)
{
return new JsonNetResult
{
@samuelcole
samuelcole / jquery.preload_background_image.js
Created March 23, 2012 21:06
A little plugin for preloading background images (for spinners 'n stuff).
(function ($) {
function background_image_url($object) {
var string = $object.css('backgroundImage'),
url_regex = /[("]([^()"]+)[")]/;
return url_regex.exec(string)[1];
}
$.fn.preload_background_image = function () {
return $(this).each(function () {
(new Image()).src = background_image_url($(this));
@jpoehls
jpoehls / output.txt
Created March 26, 2012 16:48
PowerShell benchmarking function. Or, the Windows equivalent of Unix's `time` command.
PS> time { ping -n 1 google.com } -Samples 10 -Silent
..........
Avg: 62.1674ms
Min: 56.9945ms
Max: 87.9602ms
PS> time { ping -n 1 google.com } -Samples 10 -Silent -Long
..........
Avg: 00:00:00.0612480
Min: 00:00:00.0572167
@bennadel
bennadel / trigger.htm
Created April 26, 2012 14:32
Mouse vs. Keyboard - Determining Click Initiator Using A jQuery Custom Event
<!DOCTYPE html>
<html>
<head>
<title>Determine Link Trigger Method With jQuery</title>
</head>
<body>
<h1>
Determine Link Trigger Method With jQuery
</h1>
@RedWolves
RedWolves / gist:2664255
Created May 12, 2012 05:06
Another implementation to @dieseltravis compare jQuery version strings gist https://gist.github.com/2662417 Demo in comments.
var jQueryVer = {
isEqual: function (test, act) {
this.version = test || this.version;
if (this.version) {
//if actual jquery version is passed in use that if not get it.
act = act || jQuery.fn.jquery;
return this._compare(act);
}
},
//Boolean value on if the actual jQuery Version is greater then the test version.