Skip to content

Instantly share code, notes, and snippets.

@kidchenko
kidchenko / 201704121800_CreateAspNetCoreIdentity.cs
Created April 24, 2017 23:10
ASP .NET Identity Core + FluentMigrator
Create.Table("AspNetRoles")
.WithColumn("Id").AsString().PrimaryKey("PK_AspNetRoles").NotNullable()
.WithColumn("ConcurrencyStamp").AsString().Nullable()
.WithColumn("Name").AsString(256).NotNullable()
.WithColumn("NormalizedName").AsString(256).Nullable()
.Indexed("RoleNameIndex");
Create.Table("AspNetUserTokens")
.WithColumn("UserId").AsString().PrimaryKey("PK_AspNetUserTokens").NotNullable()
@ZkHaider
ZkHaider / expand-collapse.java
Last active January 30, 2022 02:31
Simple Expand / Collapse RecyclerView Item
public static class ExampleViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener {
private int originalHeight = 0;
private boolean isViewExpanded = false;
private YourCustomView yourCustomView
public ExampleViewHolder(View v) {
super(v);
v.setOnClickListener(this);
@skalinets
skalinets / .gitconfig
Created October 11, 2012 14:13
Git aliases
[alias]
prep = !git clean -ffd && git submodule foreach 'git reset --hard && git clean -ffd && git fetch --all' && git submodule update --init
lg = log --graph --date-order --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
pr = pull --rebase
[difftool "kdiff3"]
path = C:/Program Files/KDiff3/kdiff3.exe
trustExitCode = false
[difftool]
### Check me into the root of the repo
### as .gitattributes
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
@SlyNet
SlyNet / gist:2036300
Created March 14, 2012 13:01
Making asp.net validation work with twitter bootstrap
$.validator.setDefaults({
highlight: function (element) {
$(element).closest(".control-group").addClass("error");
},
unhighlight: function (element) {
$(element).closest(".control-group").removeClass("error");
}
});
$(function () {
$('span.field-validation-valid, span.field-validation-error').each(function () {
@kolesnick
kolesnick / mspec-equality-tests.cs
Created February 29, 2012 17:09
ReSharper template for MSpec tests of Equals method and == operator
/*
Please remove this comment only after placing this template to ReSharper template editor.
Existance of this comment during paste will automatically align macroses in shown order.
Macroses:
$Entity$ - EntityName
$entity$ - entityName
$entity_in_when_part$ - entity_name
$entities_in_when_part$ - entity_name_in_plural
$usage_of_initial_parameters_in_ctor$ - arguments of factory method supplied to constructor
@NOtherDev
NOtherDev / ModelMapperWithNamingConventions.cs
Created January 6, 2012 10:17
NHibernate mapping-by-code naming convention resembling Fluent's
// NHibernate mapping-by-code naming convention resembling Fluent's
// See the blog post: http://notherdev.blogspot.com/2012/01/mapping-by-code-naming-convention.html
public class ModelMapperWithNamingConventions : ConventionModelMapper
{
public const string ForeignKeyColumnPostfix = "_id";
public const string ManyToManyIntermediateTableInfix = "To";
public const char ElementColumnTrimmedPluralPostfix = 's';
private readonly List<MemberInfo> _ignoredMembers = new List<MemberInfo>();
@alfeg
alfeg / GenericHelpers.cs
Created October 13, 2011 11:02
Html helper for script jquery templates
public static class GenericHelpers
{
public static HtmlTemplate HtmlTemplate(this HtmlHelper html, object htmlAttributes)
{
return new HtmlTemplate(html, htmlAttributes);
}
}
@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}}