Skip to content

Instantly share code, notes, and snippets.

[HttpGet]
[AvailableFor(UserRole.Administrator, UserRole.RegionalRepresentative)]
public ActionResult UnapprovedUser(string id)
{
var user = ModelContext.GetService<User>().Get(id);
return View(new UnapprovedUserViewModel { Operand = user });
}
[HttpPost, AutoTransaction]
[AvailableFor(UserRole.Administrator, UserRole.RegionalRepresentative)]
public DeliveryService(ModelContext context)
{
_modelContext = context;
_itemSender = context.Get<EmailDeliverItemSender>();
if (TestMode)
{
_itemSender = context.Get<FileDeliveryItemSender>();
}
}
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using ChessOk.ModelFramework;
using ChessOk.ModelFramework.Web.ClientEvents;
namespace ChessOk.ChessSchool.Web.ClientEvents.Storage
@odinserj
odinserj / gist:3793894
Created September 27, 2012 13:09
Coffee
CreditCard =
cleanNumber: (number) -> number.replace /[- ]/g, ""
validNumber: (number) ->
total = 0
number = @cleanNumber(number)
for i in [(number.length-1)..0]
n = +number[i]
if (i+number.length) % 2 == 0
n = if n*2 > 9 then n*2 - 9 else n*2
$(function () {
$("#e6").select2({
placeholder: "Search for a movie",
minimumInputLength: 1,
ajax: { // instead of writing the function to execute the request we use Select2's convenient helper
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
dataType: 'jsonp',
data: function (term, page) {
return {
q: term, // search term
jQuery ->
$("#e6").select2
placeholder: "Search for a movie"
minimumInputLength: 1
ajax: # instead of writing the function to execute the request we use Select2's convenient helper
url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json"
dataType: 'jsonp'
data: (term, page) ->
return {
@odinserj
odinserj / foo.js
Created October 2, 2012 16:11 — forked from mvasilkov/foo.js
TypeScript as a JS pretty print tool
/* Original code */
var s = 'foo.bar', im = new Image
im.src = s; s = im.src
console.log(s)
/* TypeScript output */
var s = 'foo.bar';
var im = new Image();
@odinserj
odinserj / foo.js
Created October 2, 2012 16:20 — forked from mvasilkov/foo.js
TypeScript as a JS pretty print tool
/* Original code */
var s = 'foo.bar', im = new Image
im.src = s; s = im.src
console.log(s)
/* TypeScript output */
var s = 'foo.bar';
var im = new Image();
@odinserj
odinserj / FuncJobActivator.cs
Last active August 29, 2015 14:03
Hangfire job activator based on ServiceStack IoC container
public class FuncJobActivator : JobActivator
{
private readonly Container _container;
public FuncJobActivator(Container container)
{
if (container == null) throw new ArgumentNullException("container");
_container = container;
}
// Zero-Clause BSD (more permissive than MIT, doesn't require copyright notice)
//
// Permission to use, copy, modify, and/or distribute this software for any purpose
// with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
// OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER