Skip to content

Instantly share code, notes, and snippets.

Avatar

Sebastien Gissinger sgissinger

View GitHub Profile
View recursive_cte.sql
DECLARE @str varchar(100) = '1721,1603,1063,1683,2049'
DECLARE @delimiter varchar(10) = ','
;
WITH mycte AS
(
SELECT 0 a, 1 b
UNION ALL
View Group_By_XML_Path.sql
with partitioned_data as
(
select dossier, dos from (
select dossier, ntile(50) over(order by dossier) as dos from [dbo].[input_legacy_excel]
) x
)
Select P.dos, SUBSTRING(STUFF(
View DynamicLinq.cs
public static IQueryable<T> OrderBy<T>(this IEnumerable<T> source, IEnumerable<ISortable> sortables, IEnumerable<string> persistentColumnNames)
{
return source.AsQueryable().OrderBy(sortables, persistentColumnNames);
}
public static IQueryable<T> OrderBy<T>(this IQueryable<T> source, IEnumerable<ISortable> sortables, IEnumerable<string> persistentColumnNames)
{
if (source == null)
throw new ArgumentNullException("source");
@sgissinger
sgissinger / GetFileAsBase64.js
Created Dec 5, 2018
Retrieve a file content as Base64 string
View GetFileAsBase64.js
/**
*
* @param blob
*/
function getBase64(blob: Blob): Promise<string> {
return new Promise<string>((resolve, reject) => {
let reader = new FileReader();
reader.onloadend = function() {
let dataUrl = reader.result as string;
let base64 = dataUrl.split(',')[1];
@sgissinger
sgissinger / MCD.puml
Created Nov 8, 2018
PlantUML with customizations
View MCD.puml
@startuml
!define table(x) class x << (T,#FFAAAA) >>
!define view(x) class x << (V,#33CCFF) >>
!define pk(x) +<u>x</u>
!define fk(x,y) ~x <i>references y</i>
!define pkfk(x,y) -<u>x</u> <i>references y</i>
hide methods
hide stereotypes
skinparam shadowing false
View IFilterable.cs
public interface IFilterable
{
string ColumnName { get; }
string Operator { get; }
string Value { get; }
}
@sgissinger
sgissinger / CustomAttributeContractResolver.cs
Last active Oct 22, 2018
Json ContractResolver using custom attribute
View CustomAttributeContractResolver.cs
public class CustomAttributeContractResolver<T> : DefaultContractResolver
where T : Attribute
{
private static List<string> typeOnePropertiesToSerialize = new List<string>();
private static List<string> typeTwoPropertiesToSerialize = new List<string>();
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
{
var properties = base.CreateProperties(type, memberSerialization).ToList();
You can’t perform that action at this time.