Skip to content

Instantly share code, notes, and snippets.

View EdCharbeneau's full-sized avatar
🏠
Working from home

Ed Charbeneau EdCharbeneau

🏠
Working from home
View GitHub Profile
@EdCharbeneau
EdCharbeneau / sequence.js
Last active May 31, 2016 20:18
Check for a sequence in JavaScript
var assert = require('chai').should();
function* mapProgressive(a, fn) {
for (let index = 0; index < a.length - 1; ++index) {
yield fn(a[index], a[index + 1]);
}
}
function isArrayInSequence(a) {
return Array.from(mapProgressive(a, (x,y) => {return x + 1 == y})).every(n => n == true)
public HandRank GetHandRank() =>
IsRoyalFlush() ? HandRank.RoyalFlush :
IsStraightFlush() ? HandRank.StraightFlush :
IsFourOfAKind() ? HandRank.FourOfAKind :
IsFullHouse() ? HandRank.FullHouse :
IsFlush() ? HandRank.Flush :
IsStraight() ? HandRank.Straight :
IsThreeOfAKind() ? HandRank.ThreeOfAKind :
IsTwoPair() ? HandRank.TwoPair :
IsPair() ? HandRank.Pair :
@EdCharbeneau
EdCharbeneau / mobile-revolution.md
Last active September 7, 2016 15:45
old blog post

Just a month and a half in to the year and the mobile software industry has been turned on its head. The market that once belonged to Nokia (Symbian) and BlackBerry has been taken over by Google’s Android Apple’s iPhone (iOS) and exploded in to an all out war. HP’s Web OS This week HP announced it’s new tablet, the TouchPad along side two new phones, the Veer and Palm 3 . While all three devices are running HP’s own Web OS, this will be the first time that Web OS has been used in the tablet market. Set to release in “Summer 2011”, the TouchPad will go up against competition from Apple’s iPad (iOS) and the Motorola Zoom (Android). HP’s Veer and Pal

@EdCharbeneau
EdCharbeneau / gulpfile.js
Last active September 27, 2016 23:35
Add gulp sass in ASP.NET Core 1.0.1
"use strict";
var gulp = require("gulp"),
...
sass = require("gulp-sass"), // Add
bundleconfig = require("./bundleconfig.json"); // make sure bundleconfig.json doesn't contain any comments
...
// Add
@EdCharbeneau
EdCharbeneau / app.component.ts
Last active November 28, 2016 20:26
Sample data for the Kendo UI for Angular 2 Sortable demo
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'Sortable Demo';
@EdCharbeneau
EdCharbeneau / Loan Granting Binary Classification.csv
Created May 17, 2017 14:27
Loan Granting Binary Classification data
We can't make this file beautiful and searchable because it's too large.
Loan ID,Customer ID,Loan Status,Current Loan Amount,Term,Credit Score,Years in current job,Home Ownership,Annual Income,Purpose,Monthly Debt,Years of Credit History,Months since last delinquent,Number of Open Accounts,Number of Credit Problems,Current Credit Balance,Maximum Open Credit,Bankruptcies,Tax Liens
6cf51492-02a2-423e-b93d-676f05b9ad53,7c202b37-2add-44e8-9aea-d5b119aea935,Charged Off,12232,Short Term,7280,< 1 year,Rent,46643,Debt Consolidation,777.39,18,10,12,0,6762,7946,0,0
552e7ade-4292-4354-9ff9-c48031697d72,e7217b0a-07ac-47dd-b379-577b5a35b7c6,Charged Off,25014,Long Term,7330,10+ years,Home Mortgage,81099,Debt Consolidation,892.09,26.7,NA,14,0,35706,77961,0,0
9b5e32b3-8d76-4801-afc8-d729d5a2e6b9,0a62fc41-16c8-40b5-92ff-9e4b763ce714,Charged Off,16117,Short Term,7240,9 years,Home Mortgage,60438,Home Improvements,"1,244.02",16.7,32,11,1,11275,14815,1,0
5419b7c7-ac11-4be2-a8a7-b131fb6d6dbe,30f36c59-5182-4482-8bbb-5b736849ae43,Charged Off,11716,Short Term,7400,3 years,Rent,34171,Debt Consolidation,990
.Events(ev =>
{
ev.Select("foo");
ev.Show("bar");
})
function foo() {
// do selection code stuff
}
@EdCharbeneau
EdCharbeneau / pseudoCodeInterop.cs
Last active August 29, 2018 17:44
Working with the Blazor JavaScript Interop
using Microsoft.JSInterop;
public class ExampleJsInterop
{
public static Task<T> MethodName(TArgs args)
{
// Implemented in exampleJsInterop.js
return JSRuntime.Current.InvokeAsync<T>("scope.jsMethod", args);
}
}
@EdCharbeneau
EdCharbeneau / promptInterop.js
Last active August 29, 2018 17:44
Working with the Blazor JavaScript Interop 2
window.myNamespace = {
showPrompt: function (message) {
return prompt(message, 'Type anything here');
},
anotherFunction: function(args) { 
// do stuff 
}
};
@EdCharbeneau
EdCharbeneau / PromptInterop.cs
Created August 29, 2018 17:41
Working with the Blazor JavaScript Interop 3
using Microsoft.JSInterop;
public class PromptInterop
{
/// <summary>
/// Invokes a browser prompt and returns the user's input.
/// </summary>
public static Task<string> PromptAsync(string message) {
return JSRuntime.Current.InvokeAsync<string>("myNamespace.showPrompt",message);
}