Skip to content

Instantly share code, notes, and snippets.

View derek-baker's full-sized avatar
🏠
Working from home

Derek Baker derek-baker

🏠
Working from home
View GitHub Profile
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@cheynewallace
cheynewallace / ExportSchema.ps1
Last active March 21, 2024 07:08
Export MSSQL schema with PowerShell. This script will export your schema definitions for tables, stored procs, triggers, functions and views to .sql files
# Usage: powershell ExportSchema.ps1 "SERVERNAME" "DATABASE" "C:\<YourOutputPath>"
# Start Script
Set-ExecutionPolicy RemoteSigned
# Set-ExecutionPolicy -ExecutionPolicy:Unrestricted -Scope:LocalMachine
function GenerateDBScript([string]$serverName, [string]$dbname, [string]$scriptpath)
{
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") | Out-Null
@vors
vors / GenericMethods.ps1
Created November 6, 2015 20:20
Workaround to call to a generic method OfType<T>() in PowerShell, when PowerShell cannot figure out <T> from the context
# PowerShell can infer generic <T> for method calls for your, when it has a parameter of the same type <T>
# Example: Enumerable.Distinct<TSource>(IEnumerable<TSource>)
# TSource can be inferred from the argument
[System.Linq.Enumerable]::Distinct([int[]]@(1,2,3,1,2))
# Let's say you want to call a generic method without ability to infer types.
# Example: Enumerable.OfType<TResult>()
# Idially you may expect syntax like this
# [System.Linq.Enumerable].OfType[int](@(,@(1,2,'a'))
# where you tell PowerShell type explicitly.
@jeffhollan
jeffhollan / PullAllLocalBranches.ps1
Last active January 6, 2022 05:30
PowerShell script to pull all local branches
function PullAllBranches() {
$branches = git branch
foreach($branch in $branches){
$fixedBranch = $branch.Substring(2, $branch.Length - 2)
$trackedExpression = "branch." + $fixedBranch + ".merge"
$trackedBranch = git config --get $trackedExpression
# Write-Host($trackedBranch)
if(![string]::IsNullOrEmpty($trackedBranch))
{
Write-Host('Pulling branch: ' + $fixedBranch)
@lbssousa
lbssousa / MyComponentJsDoc.vue
Last active July 13, 2022 11:32
A little cheatsheet of how to write type-safe Vue single file components, using either TypeScript or JSDoc comments (reference: https://blog.usejournal.com/type-vue-without-typescript-b2b49210f0b)
<template>
<div>
<slot/>
</div>
</template>
<script>
// @ts-check
/**
@swlaschin
swlaschin / effective-fsharp.md
Last active July 23, 2024 10:39
Effective F#, tips and tricks

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
  • Keep IO at edges