Skip to content

Instantly share code, notes, and snippets.

View chrisnicola's full-sized avatar

Chris Nicola chrisnicola

View GitHub Profile
# Provides angular filters for lodash or underscore functions
module = angular.module('_filters', [])
_(_).functions().each (name) ->
n = name
module.filter '_' + n, -> _[n]
@chrisnicola
chrisnicola / xirr.rb
Last active August 29, 2015 14:02 — forked from sapient/xirr.rb
Performs XIRR calculations using Ruby's Newton#nlsolve
require 'date'
require 'bigdecimal/newton'
require 'bigdecimal/math'
class XIRR
include Newton
def initialize(trans)
@trans = trans
@zero = 0.to_d
| <script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;
s.src='https://widget.intercom.io/widget/#{ENV['INTERCOM_APP_ID']}';
var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
require 'active_support/key_generator'
module ActionDispatch
module Session
class JWTStore < AbstractStore
GENERATOR_KEY = "action_dispatch.key_generator".freeze
JWT_SECRET_SALT = "jwt secret salt".freeze
def initialize
super
protected static HttpPostedFileBase MockFileUpload(ControllerBase controller)
{
var request = MockRepository.GenerateStub<HttpRequestBase>();
var context = MockRepository.GenerateStub<HttpContextBase>();
var server = MockRepository.GenerateStub<HttpServerUtilityBase>();
var postedfile = MockRepository.GenerateMock<HttpPostedFileBase>();
var postedfilesKeyCollection = MockRepository.GenerateStub<HttpFileCollectionBase>();
var fakeFileKeys = new List<string> { "image", "file" };
context.Stub(ctx => ctx.Request).Return(request);
context.Stub(ctx => ctx.Server).Return(server);
<% using (Html.BeginForm("Create", "Login")) {%>
//Creates
<form action="/login/create" method="post">
<% using (Html.BeginForm<LoginController>(x => x.Create(Model))) {%>
//Creates
<form action="/Login/Create?model=Graphite.Web.Controllers.Login.LoginViewModel" method="post">
@chrisnicola
chrisnicola / rrbug.cs
Created May 2, 2010 20:10
Restful routning bug
//This is the route definition
public class Routes : RouteSet{
public Routes() {
Map("").To<HomeController>(x => x.Index());
Area<HomeController>("", () =>
Map("").To<HomeController>(x => x.Index()));
Map("rss").To<FeedController>(x => x.Rss());
Map("atom").To<FeedController>(x => x.Atom());
Resources<PostController>(
() => {
public abstract class DomainEventTestBase<T> : IEventHandler<T> where T : DomainEvent
{
protected T Result;
protected InProcessEventBus DomainEventBus;
#region IEventHandler<T> Members
public void Handle(T evnt)
{
Result = evnt;
00000000000000000003
5b406bc7-2f68-4e97-bfe2-75e179571b31;634163655158954274;Ncqrs.Eventing.Storage.NoDB.Tests.Fakes.CustomerCreatedEvent, Ncqrs.Eventing.Storage.NoDB.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null;1.0;adc02213-cde3-4eaf-942e-1ef4d5adb406;0;{ "Name": "Foo", "Age": 35}
59e9e60b-dba5-4b96-97a2-90ae64b17e48;634163655158974275;Ncqrs.Eventing.Storage.NoDB.Tests.Fakes.CustomerNameChanged, Ncqrs.Eventing.Storage.NoDB.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null;1.0;adc02213-cde3-4eaf-942e-1ef4d5adb406;1;{ "CustomerId": "adc02213-cde3-4eaf-942e-1ef4d5adb406", "NewName": "Name2"}
df092cec-9857-4f6c-b6ff-32110ebc0d75;634163655158984276;Ncqrs.Eventing.Storage.NoDB.Tests.Fakes.CustomerNameChanged, Ncqrs.Eventing.Storage.NoDB.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null;1.0;adc02213-cde3-4eaf-942e-1ef4d5adb406;2;{ "CustomerId": "adc02213-cde3-4eaf-942e-1ef4d5adb406", "NewName": "Name3"}
// ==UserScript==
// @author Chris
// @co-author None
// @name Timer
// @namespace myTest
// @description eRepublik Advanced Tools
// @version 1.0.0
// @include *
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==