Skip to content

Instantly share code, notes, and snippets.

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

Aram Koukia aramkoukia

🏠
Working from home
View GitHub Profile
@aramkoukia
aramkoukia / vue-hello-world.app.js
Created December 28, 2017 20:20
vuejs hello world
new Vue({
el: '#app',
data: {
message: 'Hello World, Vue.js!'
}
})
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://unpkg.com/vue"></script>
<script src="app.js"></script>
</head>
<body>
<div id="app">
<p>{{ message }}</p>
</div>
@aramkoukia
aramkoukia / kubernetes-manifest.yml
Created October 22, 2017 22:25
Kubernetes Manifest File
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: azure-container-service-poc
spec:
replicas: 1
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
class Program
{
static void Main(string[] args)
{
var summary = BenchmarkRunner.Run(typeof(EFCore2VsDapper));
Console.ReadLine();
}
}
public class EFCore2VsDapper
{
EFRepository _EFRepo;
DapperRepository _DapperRepo;
public EFCore2VsDapper()
{
_EFRepo = new EFRepository();
_DapperRepo = new DapperRepository();
}
public class DapperRepository
{
public List<Product> GetAllProductsByCategory(int categoryId)
{
using (IDbConnection db = new SqlConnection(@"Connection String"))
{
return db.Query<Product>
($"SELECT * From [SalesLT].[Product] INNER JOIN [SalesLT].[ProductCategory] ON [SalesLT].[ProductCategory].ProductCategoryId = [SalesLT].[Product].ProductCategoryId WHERE [SalesLT].[ProductCategory].ProductCategoryId ={categoryId}").ToList();
}
public class EFRepository
{
public List<Product> GetAllProductsByCategory(int categoryId)
{
using (var db = new EFCore2TestContext())
{
var products = db.Product
.Where(b => b.ProductCategoryId == categoryId)
.OrderBy(b => b.ProductNumber)
.Include(p => p.ProductCategory)
@aramkoukia
aramkoukia / hub-api-get-token.cs
Created July 26, 2017 16:52
Get Hub API Token
class Program
{
static void Main(string[] args)
{
var baseUrl = "http://YOUR_HOST_NAME/";
var httpClientHelper = new HttpClientHelper();
var tokenRequest = new List<KeyValuePair<string, string>>()
{
new KeyValuePair<string, string>("grant_type","password"),
@aramkoukia
aramkoukia / javascript string search.js
Last active August 3, 2020 19:28
javascript string search
// 1. includes (introduced in ES6)
var string = "string to search for substring",
substring = "sea";
string.includes(substring);
// 2. RegExp: test
var string = "string to search for substring",
expr = /sea/; // no quotes here
expr.test(string);
@aramkoukia
aramkoukia / running the benchmarks.cs
Created May 22, 2017 20:17
running the benchmarks
class Program
{
static void Main(string[] args)
{
var summary = BenchmarkRunner.Run<StringFormatVsStringInterpolation>();
summary = BenchmarkRunner.Run<StringConcatVsStringInterpolation>();
summary = BenchmarkRunner.Run<StringBuilderVsStringInterpolation>();
}