Skip to content

Instantly share code, notes, and snippets.

View ppolyzos's full-sized avatar

Paris Polyzos ppolyzos

View GitHub Profile
@ppolyzos
ppolyzos / azure_webapp.tf
Last active July 28, 2021 12:24
Create a resource group in azure that contains a windows web app running .net 5.0 and is connected to a storage account and application insights
# We strongly recommend using the required_providers block to set the
# Azure Provider source and version being used
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.46.0"
}
}
}
@ppolyzos
ppolyzos / DotNetTips.ConcurrentDictionary.Lazy.cs
Created July 10, 2020 16:18
DotNetTips: ConcurrentDictionary and Lazy
using System;
using System.Collections.Concurrent;
using System.Threading;
using System.Threading.Tasks;
namespace DotNetTips
{
class Program
{
private static int _visitorCount = 0;
@ppolyzos
ppolyzos / settings.json
Last active June 5, 2020 16:16
Windows Terminal Settings
// This file was initially generated by Windows Terminal 1.0.1401.0
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
// Installations:
// -- https://github.com/PowerShell/PowerShell/releases
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
@ppolyzos
ppolyzos / azure_web_api-cli.sh
Last active October 13, 2017 17:22
Create an Azure Web App using azure cli from a public repository in github
#!/bin/bash
webappname=<you_web_ann_name>
# Replace the following URL with a public GitHub repo URL
gitrepo=https://github.com/indyone/CodingSchool.TodoAPI.git
# Create a resource group.
az group create --location westeurope --name az-coding-school
# Create an App Service plan in `FREE` tier.
@ppolyzos
ppolyzos / extensions_sort_collection.cs
Last active May 21, 2021 13:43
C#: Sort one collection based on another
/// <summary>
/// Sort one collection based on keys defined in another
/// </summary>
/// <returns>Items sorted</returns>
public static IEnumerable<TResult> SortBy<TResult, TKey>(
this IEnumerable<TResult> itemsToSort,
IEnumerable<TKey> sortKeys,
Func<TResult, TKey> matchFunc)
{
return sortKeys.Join(itemsToSort,
@ppolyzos
ppolyzos / gist:df6d77360732a3c68106
Created January 12, 2016 08:54
TSQL: Generate Random String of desired length
DECLARE @DesiredLength AS INT = 10;
select Lower(substring(replace(newID(), '-', ''), cast(RAND() * (31 - @DesiredLength) AS INT),
@DesiredLength)) AS randomString;
@ppolyzos
ppolyzos / database_cleanup.sql
Created January 30, 2015 16:39
Clean database from all tables, indexes, foreign keys... Applies to sql server
/* Drop all non-system stored procs */
DECLARE @name VARCHAR(128)
DECLARE @SQL VARCHAR(254)
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name])
WHILE @name is not null
BEGIN
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']'
EXEC (@SQL)
@ppolyzos
ppolyzos / css_resources.md
Created January 16, 2014 13:43 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@ppolyzos
ppolyzos / javascript_resources.md
Created January 16, 2014 13:43 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage