Skip to content

Instantly share code, notes, and snippets.

"""
Wealth Dynamics: Married vs Single with Random Shocks
This simulation explores the dynamics of wealth accumulation for married couples and single individuals over a 100-year time period. It incorporates random financial shocks that can negatively impact wealth. The model parameters include:
Mean return for investment (0.08)
Fixed volatility factor (0.15)
Probability of a shock occurring in a given time step (0.05)
Magnitude of wealth reduction due to shock (0.2)
Additive contributions from individual A and individual B (both set to 5000)
@SeloSlav
SeloSlav / ParseUser.cs
Created June 23, 2018 23:58
ParseUser.cs
#region Assembly Parse, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// C:\Users\marti\.nuget\packages\parse\2.0.0\lib\netstandard2.0\Parse.dll
#endregion
using System.Threading;
using System.Threading.Tasks;
namespace Parse
{
//
@SeloSlav
SeloSlav / ParseObject.cs
Created June 13, 2018 23:38
ParseObject
#region Assembly Parse, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// C:\Users\marti\.nuget\packages\parse\2.0.0\lib\netstandard2.0\Parse.dll
#endregion
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.CompilerServices;
@SeloSlav
SeloSlav / Page.cshtml
Last active June 13, 2018 07:45
A sample CSHTML page to render your batched list (from https://gist.github.com/SeloSlav/4236f034fbf76ed11f0558939daedabe)
@foreach (var batch in Model.List.Batch(4))
{
<div class="row"> // Bootstrap.css row
@foreach (var item in batch)
{
<div class="col-lg-3">item.ObjectId</div> // Bootstrap.css column, i.e. col-lg-3 is 4 columns at screen resolution 'large'
}
</div>
}
@SeloSlav
SeloSlav / BatchList.cs
Last active June 13, 2018 07:39
A utility class that chunks up a list to help you display your data in columns.
using System.Collections.Generic;
using System.Linq;
namespace YeetClub.WebPlatform.Application.Utilities
{
public static class BatchList
{
public static IEnumerable<IEnumerable<TSource>> Batch<TSource>(
this IEnumerable<TSource> source, int size)
{
public class IndexModel : PageModel
{
public void OnGet()
{
Task<int> task = GetYeetsAsync();
}
private async Task<int> GetYeetsAsync()
{
var query = ParseObject.GetQuery("Yeet");