Skip to content

Instantly share code, notes, and snippets.

View Kavignon's full-sized avatar
:octocat:

Kevin Avignon Kavignon

:octocat:
View GitHub Profile
package main;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.*;
import java.sql.DriverManager;
import java.sql.SQLException;
module ImageAnalyzer
open System
open System.Drawing
open Emgu.CV
open Emgu.CV.Structure
type HistComparisonCategory =
| PerfectMatch
| CloseMatch //between 75% and 100%
@Kavignon
Kavignon / Employee query
Last active December 13, 2017 16:36
Query extracting whether or not an employee is suited (qualified) for a training
@"with SomeTemporaryEmployeeTable(EmployeeID, SkillID, IsQualified)
as
(
select e.ID, jSkill.ID, case when jsQualifications.QualificationID is null then 0 else 1 end
from Employee e
join Job job on job.EmployeeID = e.ID
and job.ID = (select max(ID) from Job
where EmployeeID = job.EmployeeID)
join JobGroup jobGroup on jobGroup.ID = job.JobGroupID
join JobSkill jSkill on jSkill.JobGroupID = job.JobGroupID
using( var dbCtx = new DataContext())
{
var employeeTrainingResults = dbCtx.ExecuteQuery<EmployeeTrainingResult>(
@"@"with SomeTemporaryEmployeeTable(EmployeeID, SkillID, IsQualified)
as
(
select e.ID, jSkill.ID, case when jsQualifications.QualificationID is null then 0 else 1 end
from Employee e
join Job job on job.EmployeeID = e.ID
and job.ID = (select max(ID) from Job
@Kavignon
Kavignon / TodoListWithRedux
Created April 9, 2018 18:56
Built Todo list application with fundamental concepts in React & Redux
import createStore from "redux";
import combineReducers from "redux"
const todoItemCategoryAction = {
Add: "ADD_TODO",
Remove: "REMOVE_TODO",
Toggle: "TOGGLE_TODO",
ShowAll: "SHOW_ALL",
ShowCompleted: "SHOW_COMPLETED",
SetVisibilityFilter: "SET_VISIBILITY_FILTER"
@Kavignon
Kavignon / gist:967d41b1ab6b6f51aa62cc7e89b9773b
Created August 24, 2018 15:39
Sample content to try and load content of an attach property outside the UI thread
// Class to be inside the WPF class
public static class CustomClass
{
public static readonly DependencyProperty TextProperty = DependencyProperty.RegisterAttached(
"Text",
typeof(string),
typeof(CustomClass),
new UIPropertyMetadata(default(string)));
public static string GetText(DependencyObject obj)
$ react-scripts build -verbose
Creating an optimized production build...
Failed to compile.
./src/index.re
/usr/local/lib/node_modules/bs-platform/lib/bsb.exe: unknown option '-color'.
Usage : bsb.exe <bsb-options> -- <ninja_options>
For ninja options, try ninja -h
ninja will be loaded either by just running `bsb.exe' or `bsb.exe .. -- ..`
It is always recommended to run ninja via bsb.exe
@Kavignon
Kavignon / FoodGuideController.cs
Last active July 12, 2019 17:55
ASP.NET Core POST Request failing silently
namespace FailingPost
{
// using directives omitted.
public class FoodGuideController
{
// Code omitted...
[HttpGet]
public IActionResult Index(PageModel model) => this.View(model ?? InitialPageModel);
@Kavignon
Kavignon / PowerShell-snippets.ps1
Created February 19, 2020 16:19 — forked from martin-morin/PowerShell-snippets.ps1
My favorite PowerShell snippets
# List of usefull snipets I always reuse.
# Get all file types
$extensionList = @((Get-ChildItem -Recurse -File).Extension);
$extensionList | Select-Object -Unique
# Snippets for git support in the team
# -------------------------------------------
# When someone cannot checkout the files from lfs (whatever the user does, the file remain empty with a size of 1K)
@Kavignon
Kavignon / GameDomain.fs
Created March 27, 2020 14:19
Immutability concept with Record (value & reference) + Discriminated Union (value & reference) along with objects. The purpose of the gist is to help others understand how immutability works through the use of F#.
module GameDomain
[<Measure>] type gold
[<Measure>] type dmg // damage
[<Measure>] type ctr // critical
[<Measure>] type hl // hit limit
[<Measure>] type kg // weight in kilograms
type HeroClass =
| Archer