Skip to content

Instantly share code, notes, and snippets.

/**
* In need of help! I've got the following function that gives me
* a log value given a number between 0 - 100, but I also need to
* go the other way, i.e. give it 100 and get 0 out, or give it
* 10000000 and get 100 out (i.e. the log value to the original).
* Help me Obi-Wan, you're my only hope.
*/
function logslider(value) {
// value will be between 0 and 100
@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}}
@davidwhitney
davidwhitney / gist:1027181
Created June 15, 2011 14:08
Rss feed formatter ActionResult for ASP.NET MVC
using System;
using System.IO;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Text;
using System.Web.Mvc;
using System.Xml;
using System.Xml.Linq;
@scottmessinger
scottmessinger / gist:1033617
Created June 19, 2011 00:09
Backbone.js todos vs knockout.js todos
We couldn’t find that file to show.
@bsatrom
bsatrom / addSpeaker-brief.html
Created July 1, 2011 20:07
Moving from markup-based KnockoutJS bindings to unobtrusive bindings (After)
<form id="addSpeaker">
<fieldset>
<legend>Speaker Info</legend>
Name: <input type="text" id="name" /> <br />
Bio: <textarea id="bio"></textarea> <br />
Twitter Handle: <input type="text" id="twitterHandle" /> <br />
State: <input type="text" id="state" /> <br />
Photo Url: <input type="text" id="photoUrl" />
</fieldset>
<fieldset>
@augustoproiete
augustoproiete / CleanUp.ps1
Created December 12, 2011 11:32
PowerShell script to remove files generated by Visual Studio, ReSharper, etc...
Write-Host "Cleaning up..."
$foldersToRemove =
"bin",
"obj",
"TestResults",
"_ReSharper.*"
$filesToRemove =
"Thumbs.db",
@peternixey
peternixey / securing_rails_updates.md
Created March 5, 2012 13:10
How Homakov hacked GitHub and how to protect your application by Peter Nixey

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey


@chrisortman
chrisortman / ImportedFilePathResolver.cs
Created March 8, 2012 19:48
ASP.NET Optimization Minifiers
public class ImportedFilePathResolver : IPathResolver
{
private string currentFileDirectory;
private string currentFilePath;
/// <summary>
/// Initializes a new instance of the <see cref="ImportedFilePathResolver"/> class.
/// </summary>
/// <param name="currentFilePath">The path to the currently processed file.</param>
public ImportedFilePathResolver(string currentFilePath)
@haacked
haacked / ServiceResolverAdapter.cs
Created March 11, 2012 19:34
ServiceResolverAdapter: Allows you to use the ASP.NET MVC DependencyResolver for ASP.NET Web API
public class ServiceResolverAdapter : IDependencyResolver
{
private readonly System.Web.Mvc.IDependencyResolver dependencyResolver;
public ServiceResolverAdapter(System.Web.Mvc.IDependencyResolver dependencyResolver)
{
if (dependencyResolver == null) throw new ArgumentNullException("dependencyResolver");
this.dependencyResolver = dependencyResolver;
}
@reybango
reybango / gist:3182689
Created July 26, 2012 15:25
Results from the Main List
jQuery 916 89%
Modernizr 525 51%
Git 489 47%
HTML5 Boilerplate 439 43%
Sublime Text 2 442 43%
jQuery UI 421 41%
Bootstrap 346 34%
Sass 316 31%
JSFiddle 261 25%
Underscore 245 24%