Skip to content

Instantly share code, notes, and snippets.

View ermish's full-sized avatar
🍜
feels good to code.

Philip Ermish ermish

🍜
feels good to code.
View GitHub Profile
@ermish
ermish / MVCActionFinder.cs
Created March 12, 2018 00:28
Helper Utility to find all actions on a .NET MVC Project. Useful for API Documentation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web.Mvc;
using Microsoft.Ajax.Utilities;
namespace Helpers.Web
{
public class ControllerDesc
@ermish
ermish / docker-build.sh
Created March 22, 2018 05:41
Useful dotnet core docker scripts
#Go to root dir
docker build -t my-image-name-here -f ./deploy/dockerfile ./
@ermish
ermish / vscode_usersettings.json
Last active August 1, 2018 04:04
Shared vs code user settings
{
"window.zoomLevel": 0,
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1200,
"git.confirmSync": false,
"workbench.iconTheme": "vscode-icons",
"explorer.openEditors.visible": 0,
"editor.matchBrackets": true,
"editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
@ermish
ermish / ForEachAsync.cs
Last active April 16, 2018 21:21
C# ForEachAsync. Allows you to do sequential awaited tasks.(Set paralllelism to 1)
public static async Task<IEnumerable<U>> ForEachAsync<T, U>(this IEnumerable<T> items, Func<T, Task<U>> func, int _degreeOfParallelism = 100)
{
var results = new List<U>();
using (var semaphore = new SemaphoreSlim(_degreeOfParallelism))
{
var tasks = items.Select(async item =>
{
await semaphore.WaitAsync();
try
{
@ermish
ermish / FireAndForget.cs
Created April 17, 2018 23:04
Fire and Forget Async Methods in C#
public static async void FireAndForget<T>(this Task task, ILogger<T> logger)
{
try
{
await task;
}
catch (Exception e)
{
logger.LogError(e, $"An exception occured during the fire and forget task: {e.GetBaseException()}");
}
@ermish
ermish / .stylelintrc
Last active July 15, 2018 21:25
A reusable stylelint config
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-order",
"stylelint-scss"
],
"rules": {
"at-rule-no-unknown": null,
"color-hex-length": "short",
"color-named": "never",
@ermish
ermish / codingguidelines.md
Last active July 4, 2021 11:58
a collection of coding guidelines/bestpractices/standards/goodthingstodo!

Coding Guidelines

Sass and html-y things

  • Don't use classes in html based on styles
    • i.e. instead of .table .table-lined .shift-right .moar-styling use user-table and use sass %placeholders instead.
  • Place @media queries within each related component
  • Use em's and rem's instead of px. (there's handy sass functions to convert px)
  • 99% of the time, avoid tables. instead, use divs to avoid the underlying styling challenges when using table.
  • Don't nest reusable styles in shared scss files. This makes it difficult to see the impact of what styles are inherited and forces the consumer to override unwanted nested styles.
@ermish
ermish / logger.js
Created June 25, 2021 10:07
Simple js logger
const createLogger = () => {
console.log("made it");
const isProdMode =
process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production"
? true
: false;
//TODO: move this var to env file or a parameter
// level 1 = debug
@ermish
ermish / .eslintrc.js
Created October 23, 2022 13:09
common eslint config for vue
module.exports = {
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2022,
sourceType: 'module',
extraFileExtensions: ['.json']
},
env: {
node: true,
@ermish
ermish / .stylelingrc
Created November 3, 2022 11:52
Stylelint Config - Vue
{
"extends": [
"stylelint-config-standard-scss",
"stylelint-config-recommended-vue"
],
"plugins": [
"stylelint-order"
],
"rules": {
"color-hex-length": "short",