Skip to content

Instantly share code, notes, and snippets.

View bbqchickenrobot's full-sized avatar

Troy bbqchickenrobot

View GitHub Profile
@bbqchickenrobot
bbqchickenrobot / bst.rs
Created January 31, 2022 05:44 — forked from Wesleysaur/bst.rs
A very simple binary search tree in rust
use std::io;
#[derive(Debug)]
struct BSTNode {
value: i32,
left: Option<Box<BSTNode>>,
right: Option<Box<BSTNode>>
}
impl BSTNode {

Keybase proof

I hereby claim:

  • I am bbqchickenrobot on github.
  • I am bbqchickenrobot (https://keybase.io/bbqchickenrobot) on keybase.
  • I have a public key ASAP6e4sf5n4olAlfjMEbclG5hL3NmjAH-Gl5pXP3DobGwo

To claim this, I am signing this object:

public class Hasher
{
protected int num = 0;
protected int len = 0;
protected readonly IEnumerable<object> dict = new List<object>();
public static object it(object data, int len=32, string format="utf8", IEnumerable<object> dict=null)
{
var hash = create(len, dict);
hash.update((IEnumerable<object>) data);
using System;
namespace WebApplication1
{
public interface IDoSomething
{
void DoSomething(object param);
}
public class DoerOfSomething : IDoSomething
@bbqchickenrobot
bbqchickenrobot / ApplicantList.razor
Last active October 17, 2022 08:32
Blazorise DataGrid Example
@using Workflows.Models.FairChance
@inject NavigationManager NavigationManager
<br />
<br />
<Button Color="Color.Info" Clicked="OpenModal" class="float-right" style="background-color:mediumseagreen">
+Assessment
</Button>
<br />
<br />
@bbqchickenrobot
bbqchickenrobot / example.cs
Created October 29, 2020 17:24
Blazorise DataGrid Validation
private async Task RowInserting(CancellableRowChange < FeatureToggle, Dictionary < String, Object >> e)
 {
log.LogInformation($ "values = {e.Values.ToJson()}");
log.LogInformation($ "validating feature {e.Item.Feature}");

if (string.IsNullOrEmpty(e.Item.Feature))
 {
log.LogError($ "validation failed for rule {e.Item.Dump()}");
toastService.ShowError($ "validation failed for {nameof(FeatureToggle)}. Feature name is required.");
e.Cancel = true;

}

else
 {
e.Cancel = false;

}

}

private async Task RowUpdating(CancellableRowChange < FeatureToggle, Dictionary < String, Object >> e)
 {
log.LogInformation($ "values = {e.Values.ToJson()}");
log.LogInformation($ "validating feature {e.Item.Feature}");

if (string.IsNullOrEmpty(e.Item.Feature))
 {
log.LogError($ "validation failed for rule {e.Item.Dump()}");
toastService.ShowError($ "validation failed for {nameof(FeatureToggle)}. Feature name is required.");
e.Cancel = true;

}

else
 {
e.Cancel = false;

}

@bbqchickenrobot
bbqchickenrobot / Main.cs
Last active May 3, 2019 01:24
FlattenJaggedArray
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
var jagged = new object[]{
new object[]{
1, 2, new object[]{3}
@bbqchickenrobot
bbqchickenrobot / Main.cs
Last active January 21, 2019 22:12
Flatten Array - Citrus Byte
using System;
using System.Collections;
public static class Program{
public static void Main(string[] args = null){
var list = new object[]{1, 2, new int[]{3, 5}, 4, new object[]{34, 4, null, 23, 0}, null};
object[] flatten(object obj){
var flattend = new List<object>();
if(obj != null && obj.GetType().IsArray){
// There is no 'Main' class here as I used Xamarin Workbooks
// https://docs.microsoft.com/en-us/xamarin/tools/workbooks/install?tabs=windows
#r "Newtonsoft.Json"
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
void displayTuple((int count, string value) val){
Console.WriteLine($"Count: {val.count} - Value: {val.value}");
}
@bbqchickenrobot
bbqchickenrobot / MultiTenantConfigurator.cs
Created June 21, 2018 23:19
Azure Elastic Scale Client w/ Entity Framework Core (EFCore) 2.1
using System;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement;
using Microsoft.EntityFrameworkCore;
namespace eftest
{
// todo - convert public accessors to appropriate access level