Skip to content

Instantly share code, notes, and snippets.

View EdCharbeneau's full-sized avatar
🏠
Working from home

Ed Charbeneau EdCharbeneau

🏠
Working from home
View GitHub Profile
@EdCharbeneau
EdCharbeneau / Prototyping Examples
Created July 5, 2012 18:23
Prototyping examples
@using Prototyping.Ipsum;
@using Prototyping.Placeholdit;
//Ipsum examples
//Random paragraph
@Html.Ipsum()
//Paragraph
@Html.Ipsum().p()
//Four paragraphs, ten sentences
@Html.Ipsum().p(4, 10)
//Paragraph with the attribute class="fancy"
@EdCharbeneau
EdCharbeneau / OrbitNavToggle.js
Created August 21, 2012 18:58
Hide/Show orbit nav with jQuery
//must wrap the orbit element in a div
// wrapper > orbit
$(window).load(function () {
$('#orbit').orbit({
timer: true,
animation: 'horizontal-slide',
bullets: true
});
$('#wrapper .slider-nav').hide();
});
@EdCharbeneau
EdCharbeneau / Add options to dropdown
Created October 3, 2013 13:50
The correct way to add items to an Html drop down list using jQuery.
optionsToAdd.forEach(function (item) {
$("<option></option>")
.html(item.myText)
.attr("value", item.myId)
.appendTo($("#targetDropDown"));
})
@EdCharbeneau
EdCharbeneau / Reflection less interface methods
Created October 3, 2013 15:56
@MLaritz: anyone know if there's a way to find in a class that implements an interface, all the public methods that aren't part of the interface? #vs
var targetType = typeof(Target);
targetType.GetMethods()
.Select(m => m.Name)
.Except(targetType.GetInterfaces()
.SelectMany(i => i.GetMethods()
.Select(im => im.Name)))
//---out
//ScoreGame
@EdCharbeneau
EdCharbeneau / CustomTextBoxFor
Last active December 24, 2015 16:29
Extending the TextBoxFor helper
public static MvcHtmlString CustomTextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> expression, string customData)
{
return htmlHelper.CustomTextBoxFor(expression, customData, (IDictionary<string, object>)null);
}
public static MvcHtmlString CustomTextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> expression, string customData, object htmlAttributes)
{
IDictionary<string, object> attributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
@EdCharbeneau
EdCharbeneau / RevealingModule stub
Last active December 25, 2015 04:39
Revealing module pattern stub
var module = function () {
//private
var someFunction = function(message){ ... },
privateFunction = function() { ... }
onInit = function(settings) { ... };
return {
//public
init: onInit
publicFunction: someFunction
@EdCharbeneau
EdCharbeneau / Close Foundation Reveal
Created October 29, 2013 21:41
Foundation Reveal. Quickly add a second close button globally (to any number of modal dialog boxes).
$(document).foundation('reveal', {
//replace .secondary-close-reveal-modal with the class name of any element or button
dismissModalClass: 'close-reveal-modal, .secondary-close-reveal-modal'
})
@EdCharbeneau
EdCharbeneau / Visual Studio Extensions
Last active December 28, 2015 11:09
Must have extensions for Visual Studio 2013
#Must have extensions for Visual Studio 2013
- [Entity Framework Power Tools (Beta)](http://msdn.microsoft.com/en-US/data/jj593170)
- [Git Diff Margin](http://visualstudiogallery.msdn.microsoft.com/cf49cf30-2ca6-4ea0-b7cc-6a8e0dadc1a8)
- [JavaScript Parser](https://code.google.com/p/js-addin/)
- [Web Essentials 2013](http://vswebessentials.com/)
- [Productivity Power Tools 2013](http://visualstudiogallery.msdn.microsoft.com/dbcb8670-889e-4a54-a226-a48a15e4cace?SRC=Home)
- [SideWaffle](http://t.co/MQXzCMPoVK)
# Nuget Packages
// --------------------------------------------------------------------------------------
// A More Modern Scale for Web Typography
// Based on this article: http://typecast.com/blog/a-more-modern-scale-for-web-typography
// --------------------------------------------------------------------------------------
$body-font-size: 1em !default;
// Adjusts body typography to be default
// for each browser.
@mixin reset-body-font-size($size: 100%, $size-adjustment: 0.5) {
class Player
def initialize
@max_health = 20
@last_health = 20
@critical_health = 10
@direction = :forward
end
def play_turn(warrior)