Skip to content

Instantly share code, notes, and snippets.

View ahmad-moussawi's full-sized avatar
🎹
Playing 🎶

Ahmad Moussawi ahmad-moussawi

🎹
Playing 🎶
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Reflection.Emit;
using System.Collections.Concurrent;
using System.Data;
using System.Reflection;
@ahmad-moussawi
ahmad-moussawi / oracle_legacy_pagination.sql
Created January 5, 2019 07:49
Pagination in multiple databases
SELECT * FROM (
  SELECT "subquery".*, ROWNUM "row_num" FROM (
  SELECT "id", "name" from "Users"
  ) "subquery" WHERE ROWNUM <= 20
) WHERE "row_num" >= 10
@ahmad-moussawi
ahmad-moussawi / webapi_with_sqlkata.sh
Created January 30, 2019 21:56
Web Api with SqlKata
dotnet new mvc -o WebApiDemo
name code currency_code timezone
Afghanistan AF AFN Asia/Kabul
Åland Islands AX FIM Europe/Mariehamn
Albania AL ALL Europe/Tirane
Algeria DZ DZD Africa/Algiers
American Samoa AS USD Pacific/Pago_Pago
Andorra AD EUR Europe/Andorra
Angola AO AOA Africa/Luanda
Anguilla AI XCD America/Anguilla
Antarctica AQ AUD Antarctica/McMurdo
@ahmad-moussawi
ahmad-moussawi / group_where_conditions
Last active April 2, 2019 20:00
sqlkata_tips_tricks.sql
SELECT * FROM [Books]
WHERE ([Status] = 'active' AND [AuthorId] IS NOT NULL)
OR ([IsPublished] = 1 AND [PublishedDate] IS NOT NULL)
@ahmad-moussawi
ahmad-moussawi / CompilingCSharpCode.cs
Created January 29, 2020 08:40 — forked from RickStrahl/CompilingCSharpCode.cs
A few different approaches to dynamically execute C# code dynamically at runtime from a string of code.
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Scripting;
using Microsoft.CodeAnalysis.Scripting;
using Mono.CSharp;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.Dynamic;
using System.Linq;
Afghanistan (+93)
Albania (+355)
Algeria (+213)
American Samoa (+1)
Andorra (+376)
Angola (+244)
Anguilla (+1)
Antarctica (+672)
Antigua and Barbuda (+1)
Argentina (+54)
@ahmad-moussawi
ahmad-moussawi / tree_list_conversion.js
Created March 3, 2020 13:08
Tree <--> List conversion
function createTree(list) {
var map = {}, node, roots = [], i;
for (i = 0; i < list.length; i += 1) {
map[list[i].id] = i; // initialize the map
list[i].children = []; // initialize the children
}
for (i = 0; i < list.length; i += 1) {
@ahmad-moussawi
ahmad-moussawi / CSharpErrorsAndWarnings.md
Created September 25, 2020 10:22 — forked from thomaslevesque/CSharpErrorsAndWarnings.md
All C# errors and warnings. Generated by the code in this repo: https://github.com/thomaslevesque/GenerateCSharpErrors. Last updated 2019/06/14, Roslyn commit d5b8d64b4d840b26c947abd2a00b1070cbee55f0.

All C# errors and warnings

Parsed from the Roslyn source code using Roslyn.

Code Severity Message
CS0006 Error Metadata file '{0}' could not be found
CS0009 Fatal Metadata file '{0}' could not be opened -- {1}
CS0012 Error The type '{0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{1}'.
CS0016 Error Could not write to output file '{0}' -- '{1}'
@ahmad-moussawi
ahmad-moussawi / what_is_sso.md
Created November 23, 2021 11:29
What is SSO?

What is SSO

Terminology

  • SSO : Single Sign On
  • IdP : Identity Provider (Azure Ad, Okta, Auth0, JumpCloud, etc ...)
  • SP : Service Provider (TreasuryXpress, Outlook.com, Jira.com, etc ...)
  • SAML : Security Assertion Markup Language
  • ADFS : Active Directory Federation Service