Skip to content

Instantly share code, notes, and snippets.

View jrusbatch's full-sized avatar

Justin Rusbatch jrusbatch

View GitHub Profile
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@beccasaurus
beccasaurus / README.markdown
Created May 5, 2011 19:37
Adds hooks to jQuery.validate's form/element validation methods (via trigger())

jQuery Validate Hooks

If you're using [ASP.NET MVC3][], it uses [jQuery Validate][] to do client-side validations. Instead of using [jQuery Validate][] directly, however, it wraps it with its own jQuery plugin called [jQuery.Validate.Unobtrusive][]. [jQuery.Validate.Unobtrusive][] sets up [jQuery Validate][] for you, behind the scenes, so you don't have an opportunity to customize your [jQuery Validate][] settings at all!

We've been running into trouble with this when we've been doing our own custom client-side validations. We need a way to integrate with the build-in [ASP.NET MVC3][] validation so we can:

@prabirshrestha
prabirshrestha / DocumentsIISExpressconfigapplicationhost.config
Created September 18, 2012 13:30 — forked from duncansmart/add urlacl.cmd
Allows IISExpress site to be externally accessed (e.g. by VM or iOS device)
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="C:\PathToWebSite" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":1151:localhost" />
<binding protocol="http" bindingInformation="*:1151:pswin8mac.local" />
</bindings>
</site>

Assuming you have the following object:

public class Person { 
    
    public string Name { get; set; }
    public string Surname { get; set; }
    public int Age { get; set; }
}

and got a PATCH request as below:

@khalidabuhakmeh
khalidabuhakmeh / RavenDB.cs
Created November 6, 2012 15:15
RavenDB If extension method
// usage
_db.Query<Story, Stories_Search>()
.If(status.HasValue, q => q.Where(x => x.Status == status))
.If(!curatorId.IsEmpty(), q => q.Where(x => x.CuratorId == curatorId))
.If(publicationDate.HasValue, q => q.Where(x => x.ProposedPublicationDate == publicationDate.Value.Date))
.OrderByDescending(x => x.CreatedAt)
.ToPagedList(page, size);
@filipw
filipw / gist:4502859
Last active October 30, 2023 21:14
Generic EF repository
public class GenericRepository<TEntity> : IGenericRepository<TEntity> where TEntity : class, IId
{
internal DbContext Context;
internal DbSet<TEntity> DbSet;
public ICache Cache { get; set; }
public GenericRepository(DbContext context)
{
Context = context;
@briandoll
briandoll / A_toast_to_you.md
Last active March 19, 2022 01:17
Toasts! - scripts to convert images attached to GitHub issues into an animated gif for serious celebratory purposes

To toast:

  • Make sure you have ImageMagick installed (brew install imagemagick)
  • Change line 7 of toast.rb to the repository name you're working with
  • toast!
$ bundle install
$ ./get_token [user] [pass]
$ export GHUSER=[myuser]
// Struct Store
//
// Version 1: We may have written...
DocumentDatabase db = new DocumentDatabase();
User user = new User();
user.Id = 123;
user.FirstName = ....;
user.LastName = ....;
user.Bio = ....;
@shiftkey
shiftkey / duchess.md
Last active December 14, 2015 01:38
Some words about a project idea codenamed Duchess - the goal is to make a replacement for Sandcastle and make creating documentation for open source project cool again

Burn Sandcastle to the Ground

Addressing The Documentation Problem

I've had lots of discussions with people over the past few days around how open source projects in the .NET space have poor documentation (if it exists). So how do we fix this?

At a high-level, I've got these goals in mind:

  • make it easy
  • make it cool
@KevinT
KevinT / fullnames.csx
Created April 25, 2013 13:53
Talking to ActiveDirectory using ScriptCS. Purpose: Iterates over a file listing DOMAIN\USER credentials and spits out a file that includes their full names.
#r "System.DirectoryServices"
using System.DirectoryServices;
using System.IO;
var fullNames = new List<string>();
foreach (var credential in File.ReadAllLines("credentials.txt"))
{
if (credential.IndexOf('\\') > 0)