Skip to content

Instantly share code, notes, and snippets.

View cDoru's full-sized avatar
💭
I may be slow to respond.

Doru Cioclea cDoru

💭
I may be slow to respond.
  • Cluj-Napoca
View GitHub Profile
@cDoru
cDoru / elasticsearch.yml
Created October 9, 2019 17:59 — forked from reyjrar/elasticsearch.yml
ElasticSearch config for a write-heavy cluster
##################################################################
# /etc/elasticsearch/elasticsearch.yml
#
# Base configuration for a write heavy cluster
#
# Cluster / Node Basics
cluster.name: logng
# Node can have abritrary attributes we can use for routing
@cDoru
cDoru / shadow-dom.md
Created October 12, 2018 18:28 — forked from praveenpuglia/shadow-dom.md
Everything you need to know about Shadow DOM

I am moving this gist to a github repo so more people can contribute to it. Also, it makes it easier for me to version control.

Please go to - https://github.com/praveenpuglia/shadow-dom-in-depth for latest version of this document. Also, if you find the document useful, please shower your love, go ⭐️ it. :)

Shadow DOM

Heads Up! It's all about the V1 Spec.

In a nutshell, Shadow DOM enables local scoping for HTML & CSS.

@cDoru
cDoru / presentations_final_list.md
Created May 2, 2018 19:35 — forked from oana-sipos/presentations_final_list.md
Presentations @ JSHeroes 2018
@cDoru
cDoru / manage-indexes.sql
Created February 13, 2018 10:41
List all indexes with Drop/Create formatting
SELECT I.name as IndexName,
-- Uncommnent line below to include checking for index exists as part of the script
--'IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = '''+ I.name +''') ' +
'CREATE ' + CASE WHEN I.is_unique = 1 THEN ' UNIQUE ' ELSE '' END +
I.type_desc COLLATE DATABASE_DEFAULT + ' INDEX [' +
I.name + '] ON [' + SCHEMA_NAME(T.schema_id) + '].[' + T.name + '] (' + STUFF(
(SELECT ', [' + C.name + CASE WHEN IC.is_descending_key = 0 THEN '] ASC' ELSE '] DESC' END
FROM sys.index_columns IC INNER JOIN sys.columns C ON IC.object_id = C.object_id AND IC.column_id = C.column_id
WHERE IC.is_included_column = 0 AND IC.object_id = I.object_id AND IC.index_id = I.Index_id
FOR XML PATH('')), 1, 2, '') + ') ' +
@cDoru
cDoru / list-constraints.sql
Created February 13, 2018 10:40
List all user defined constraints with details
SELECT I.name as IndexName,
CASE WHEN I.is_unique = 1 THEN 'Yes' ELSE 'No' END as 'Unique',
I.type_desc COLLATE DATABASE_DEFAULT as Index_Type,
'[' + SCHEMA_NAME(T.schema_id) + ']' as 'Schema',
'[' + T.name + ']' as TableName,
STUFF((SELECT ', [' + C.name + CASE WHEN IC.is_descending_key = 0 THEN '] ASC' ELSE '] DESC' END
FROM sys.index_columns IC INNER JOIN sys.columns C ON IC.object_id = C.object_id AND IC.column_id = C.column_id
WHERE IC.is_included_column = 0 AND IC.object_id = I.object_id AND IC.index_id = I.Index_id
FOR XML PATH('')), 1, 2, '') as Key_Columns,
Included_Columns,
@cDoru
cDoru / GetCoreInfo.ps
Created February 9, 2018 13:55
Gets the .net core sdk versions
Function Get-CoreInfo {
if(Test-Path "$env:programfiles/dotnet/"){
try{
[Collections.Generic.List[string]] $info = dotnet
$versionLineIndex = $info.FindIndex( {$args[0].ToString().ToLower() -like "*version*:*"} )
$runtimes = (ls "$env:programfiles/dotnet/shared/Microsoft.NETCore.App").Name | Out-String
@cDoru
cDoru / Validator.cs
Last active November 28, 2017 13:51
Uber simple validator in C#
public sealed class Validate
{
public static IValidator<TSource> For<TSource>(TSource source,
[CallerMemberName] string memberName = "",
[CallerFilePath] string sourceFilePath = "",
[CallerLineNumber] int sourceLineNumber = 0)
{
return new InnerValidator<TSource>(source, memberName, sourceFilePath, sourceLineNumber);
}
@cDoru
cDoru / ApiClient.cs
Created August 21, 2017 08:21 — forked from aliozgur/ApiClient.cs
Xamarin.Forms : ModernHttpClient wrapper for API calls
using System;
using System.Threading.Tasks;
using ModernHttpClient;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading;
using System.Text;
namespace MyNamespace
{
@cDoru
cDoru / Cache.cs
Last active August 1, 2017 12:06
Cache implementation using MemoryCache
/// <summary>
/// Simple cache store implementation
/// </summary>
public class Cache
{
#region Implementation
/// <summary>
/// Default caching in hours if no valid timespan is associated with the factory
/// </summary>
@cDoru
cDoru / WatiNHelper.cs
Created June 26, 2017 07:53 — forked from pagebrooks/WatiNHelper.cs
This helper class adds Eval so that you can obtain the result of a JavaScript function. This functionality is not native to WatiN. Forked from: http://blog.ashmind.com/2007/09/05/evaluating-javascript-in-watin
// Forked from: http://blog.ashmind.com/2007/09/05/evaluating-javascript-in-watin/
// This helper class adds Eval so that you can obtain the result of a JavaScript
// function. This functionality is not native to WatiN.
/*
* Usage:
* var browser = new IE();
* var foo = browser.NativeDocument.Eval<bool>("isFoo()");
*/