Skip to content

Instantly share code, notes, and snippets.

View davecowart's full-sized avatar

Dave Cowart davecowart

  • Homewood, Alabama
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
int? minValue = 5;
int? maxValue = 17;
// ==UserScript==
// @name No Comment
// @namespace http://daveandbritney.com/greasemonkey
// @description hides ALL comments on AL.com
// @include http://*.al.com/*
// ==/UserScript==
var allComments, thisComment, allReplies;
allComments = document.evaluate("//div[@class='comment']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < allComments.snapshotLength; i++) {
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CHSweb.Models.ViewModels.PropertyDetailsViewModel>" %>
<%@ Import Namespace="CHSweb.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Details
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
<script src="/Scripts/jquery.form.js" type="text/javascript"></script>
<script src="/Scripts/PropertyEditor.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
Github
Here’s the blog post about organizations on github: https://github.com/blog/674-introducing-organizations
Short version: unlimited users, pricing based off number of private repos (unlimited public) starting at $25/mo for 10 repos
Good explanation of the difference between git and svn: http://thinkvitamin.com/code/why-you-should-switch-from-subversion-to-git/
AppHarbor
Screenshot of builds list: http://screencast.com/t/f9T6ZeTi
(forgot to mention you can rollback to any previous build with one click)
Foolproof validation
@davecowart
davecowart / Alternate asset
Created February 24, 2011 20:36
The code I added to FlashAsset.ascx.cs
if (va.AlternateAssociatedLibraryAsset != null)
{
if (!String.IsNullOrEmpty(va.AlternateAssociatedLibraryAsset.FileName))
{
if (va.AlternateAssociatedLibraryAsset.FileName.StartsWith("/images/", StringComparison.CurrentCultureIgnoreCase))
this.altfilename = va.AlternateAssociatedLibraryAsset.FileName;
else
this.altfilename = ApplicationSettings.AssetLibraryImageFolder + va.AlternateAssociatedLibraryAsset.FileName;
this.altlink = va.HrefLink;
@davecowart
davecowart / IPLocation.cs
Created March 4, 2011 21:10
Geolocation logic
namespace App.Models {
public class IPLocation {
public string ZipPostalCode { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
public string City { get; set; }
public string RegionName { get; set; }
}
}
@davecowart
davecowart / SelectExtensions.cs
Created March 22, 2011 18:34
DropDown source code
namespace System.Web.Mvc.Html {
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Web;
using System.Web.Mvc.Resources;
/// <summary>
/// Create String for Google Map based on Dealer
/// </summary>
/// <param name="latitude"></param>
/// <param name="longitude"></param>
private void DisplayDealerMap(double latitude, double longitude) {
StringBuilder sbMap = new StringBuilder();
sbMap.AppendFormat(@" <script language=""javascript"" type=""text/javascript"">{0}", Environment.NewLine);
sbMap.AppendFormat(@" //<![CDATA[{0}", Environment.NewLine);
sbMap.AppendFormat(@" function loadGoogleMap(){0}", Environment.NewLine);
var directionsService = new google.maps.DirectionsService();
var directionsDisplay;
var map2;
function loadGoogleMap() {
directionsDisplay = new google.maps.DirectionsRenderer();
var myOptions = {
zoom: 18,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControl: true,
@using RazorScriptManager
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
@Script.AddScript("~/Content/Site.css", ScriptType.Stylesheet)
@Script.AddScript("~/Content/themes/base/jquery.ui.all.css", ScriptType.Stylesheet)
@Script.OutputScript(ScriptType.Stylesheet)