Skip to content

Instantly share code, notes, and snippets.

// default settings is located at: %userprofile%\scoop\apps\windows-terminal\current\defaults.json
// This file was initially generated by Windows Terminal (Unpackaged) 1.1.200810003-release1.1
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
CREATE PROCEDURE dbo.USP_DROPANDRECREATEUSER
(@username VARCHAR(100),
@domain varchar(100))
AS
BEGIN
DECLARE @loginName VARCHAR(200) = @domain + '\' + @username;
DECLARE @script VARCHAR(MAX);
IF EXISTS (SELECT 1 FROM sys.database_principals AS s WHERE s.name = @username)
BEGIN
@karkianish
karkianish / UIChallenges.txt
Last active February 15, 2019 16:39
some UI challenges to improve my web design skills
-- some UI that I would like to learn how it is done.
- Pluralsight - Edit Your Intrest page has bunch of 'pills' at the bottom that you could click and it will fill with a color to indicate selected.
- StackOverflow - tags - I like it how you can type on an input box and list of possible tags appear
- Toast Notification indicating something was saved or being saved or error
- Twitter - In update email notification - as you check boxes to opt in or opt out of email notification and circle with a tick mark appears indicating save was successful
- Angular survey - on angular survey, there was a page with list of items that was important, user could drag item up and down and change the order
- Facebook reactions
- sliding menu with animation (like in angular docs)
@karkianish
karkianish / setFocus.ts
Last active February 5, 2019 19:24
Set Focus to Input Element - Angular 2 +
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
import { FormGroup, FormBuilder } from '@angular/forms';
// thanks to the article https://codeburst.io/focusing-on-form-elements-the-angular-way-e9a78725c04f
/*
key idea is:
identify the element from the dom tree (we accomplish this by giving id to the element and using ViewChild('id') to retrieve the element.
once we have the element as ElementRef (learn more about that), we can call focus() method on it.
*/
@karkianish
karkianish / angular-pipe.ts
Created February 1, 2019 18:47
How to use pipe in component class?
// import desired pipe and add it to the provider array in your module
import {CurrencyPipe} form "@angular/common";
@NgModule({
imports: [],
declarations: [],
exports: [],
providers: [ CurrencyPipe ]
})
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, FormArray } from '@angular/forms';
@Component({
selector: 'app-tag',
templateUrl: `<div>
<form [formGroup]='tagForm'>
<label for="tag-input">Category</label>
<input type="text" id="tagInput" formControlName='tagInput' (keyup)="onKeyUp($event)" >
<ul class="tag-list">
public class ErrorLoggerMiddleware
{
private readonly RequestDelegate m_NextDelegate;
private readonly IEventLogger m_EventLogger;
private readonly IDbLogger m_DbLogger;
public ErrorLoggerMiddleware(RequestDelegate next, IEventLogger eventLogger, IDbLogger dbLogger)
{
m_NextDelegate = next;
m_EventLogger = eventLogger;
#SingleInstance force ;this supresses the dialogue box that confirms about running a new instance when an instance is already running.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
;this is useful when using Vimium and I need to escape the entry field; my fav is when escaping intellisense help in VS
Capslock::Esc
;since we decided to use double quotes in our code-base, this is to skip having to hit shift all the damn time
;"::'
class TimesheetCalculator {
constructor(shiftDurations) {
this.shiftDurations = shiftDurations;
}
getCalculatedTime() {
const durationsWithMinsInDecimal = this.shiftDurations.split(' ');
const durationsWithMins = [];
for (let duration of durationsWithMinsInDecimal) {
const hourPart = duration.split('.')[0];