Instantly share code, notes, and snippets.

View init.coffee
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
View avgitemsize.aspx
<%@ Page language="c#" %>
<%@ Import Namespace="Sitecore.Data.Items" %>
<!DOCTYPE html>
<html>
<head>
<title>Cache Admin</title>
<link rel="shortcut icon" href="/sitecore/images/favicon.ico" />
<%
var db = Sitecore.Configuration.Factory.GetDatabase("master");
Func<Item[]> ReturnAllItems = () =>
View ItemExtensions.cs
public static Item GetFallbackItem(this Item item)
{
Assert.IsNotNull(item, "item cannot be null");
var success = false;
int iterations = 0, maxIterations = 5;
while (iterations++ < maxIterations)
{
var fallbackLang = item.Language.GetFallbackLanguage(item.Database);
if (fallbackLang != null &&
View myplate-improvements.tamper.js
// ==UserScript==
// @name MyPlate Improvements
// @namespace http://glompix.com/
// @version 0.1
// @description A small set of improvements for LiveStrong's MyPlate app.
// @match http://www.livestrong.com/myplate/dashboard/*
// @copyright 2014, Stuart Branham
// ==/UserScript==
View bootstrap-tab-order.js
/* tab-order.js
Preserve tab order within Bootstrap tabbables.
*/
(function ($) {
var _tabKeyCode = 9;
var _tabbableSelector = ':input:not([type="hidden"]),a[href]'; // Links can be tabbed to too!
function getTabbableElements($el) {
return $el.find(_tabbableSelector);
}
View bootstrap-combobox.js
jQuery.fn.editableSelect = function () {
var selects = $(this).filter('select');
selects.each(function () {
// Add an edit button to the select control, bootstrap style.
var select = $(this);
select.wrap('<div class="input-append" />');
var editButton = $('<button class="btn" type="button" title="Enter your own value"><i class="icon-edit"></i></button>');
select.parent().append(editButton);
editButton.click(function () {
View FuzzyStringComparer.cs
namespace Poop
{
public class FuzzyStringComparer
{
/// <summary>Computes lexical similarity of two strings, case insensitive.</summary>
/// <returns>Lexical similarity value in the range [0,1].</returns>
/// <remarks>http://www.catalysoft.com/articles/StrikeAMatch.html</remarks>
public static double CompareLexical(this string str1, string str2)
{
if (str1 == str2)