Skip to content

Instantly share code, notes, and snippets.

Ed Charbeneau EdCharbeneau

Block or report user

Report or block EdCharbeneau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@SteveSandersonMS
SteveSandersonMS / sequence-number.md
Last active Oct 7, 2019
Why sequence numbers should relate to code line numbers, not execution order
View sequence-number.md

Why sequence numbers should relate to code line numbers, not execution order

Or in other words, why you should hard-code sequence numbers, and not generate them programmatically.

Unlike .jsx files, .razor/.cshtml files are always compiled. This is potentially a great advantage for .razor, because we can use the compile step to inject information that makes things better or faster at runtime.

A key example of this are sequence numbers. These indicate to the runtime which outputs came from which distinct and ordered lines of code. The runtime uses this information to generate efficient tree diffs in linear time, which is far faster than is normally possible for a general tree diff algorithm.

Example

View Form Input Components
// In the form you can multiple of these:
<MTextField Text=@Text
IsAutofocus=@IsAutofocus
IsMultiline=@IsMultiline
Lines=@Lines
Value=@Value
Placeholder=@Placeholder
Suffix=@Suffix
OnChange=@OnChange
InputType=@InputType
View card-counting.cs
public HandRank GetHandRank() =>
IsRoyalFlush() ? HandRank.RoyalFlush :
IsStraightFlush() ? HandRank.StraightFlush :
IsFourOfAKind() ? HandRank.FourOfAKind :
IsFullHouse() ? HandRank.FullHouse :
IsFlush() ? HandRank.Flush :
IsStraight() ? HandRank.Straight :
IsThreeOfAKind() ? HandRank.ThreeOfAKind :
IsTwoPair() ? HandRank.TwoPair :
IsPair() ? HandRank.Pair :
View LouisvilleTechMeetups.md
@ericlathrop
ericlathrop / LouisvilleTechMeetups.md
Last active Sep 26, 2016
Louisville Tech Meetups
View LouisvilleTechMeetups.md
@datafeedr
datafeedr / replace-buy-button-with-more-details.php
Created Jan 22, 2014
Replaces "Buy" button with "More Details" button on list of products (WooCommerce). For example on category pages.
View replace-buy-button-with-more-details.php
<?php
/**
* Removes the "Buy" button from list of products (ex. category pages).
*/
add_action( 'woocommerce_after_shop_loop_item', 'mycode_remove_add_to_cart_buttons', 1 );
function mycode_remove_add_to_cart_buttons() {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
}
You can’t perform that action at this time.