Skip to content

Instantly share code, notes, and snippets.

Avatar

Roman Kuzmin nightroman

  • UK
View GitHub Profile
View Update-GraphQLSchema.ps1
<#
.Synopsis
Downloads or updates GraphQL schema using local StrawberryShake.Tools.
https://gist.github.com/nightroman/f48f843483cd76a73f25cdd8a68fdd94
.Parameter Uri
The GraphQL service URL.
If it is omitted, .graphqlrc.json is used to get it.
.Parameter Path
View Expand-Diff.md

This is the diff of a change: GitHub diff

This is how it looks like after Expand-Diff on comparing "a" and "b":

ib.png

View ForEach-Parallel-vs-Split-Pipeline.ps1
# ForEach-Object -Parallel is not suitable for many input objects with
# relatively fast processing. Split-Pipeline is very suitable for this.
#requires -version 7.0
$n = $env:NUMBER_OF_PROCESSORS
$1 = {
$data | Split-Pipeline {process{ }} -Count $n
}
@nightroman
nightroman / README.md
Created January 16, 2020 15:51 — forked from atenni/README.md
How to permalink to a gist's raw file
View README.md

Problem: When linking to the raw version of a gist, the link changes with each revision.

Solution:

To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/

To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]

@nightroman
nightroman / github-pandoc.css
Last active January 16, 2020 15:48 — forked from dashed/github-pandoc.css
GitHub-like CSS for pandoc standalone HTML files (perfect for HTML5 output). Based on Marked.app's GitHub CSS. Added normalize.css (v2.1.3) in the prior to GitHub css.
View github-pandoc.css
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
@nightroman
nightroman / Search my gists.md
Created January 7, 2020 18:49 — forked from santisbon/Search my gists.md
How to search gists
View Search my gists.md

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

View Gist-with-images.md

How to make a gist with images in the same gist

Right aligned

Usual picture

ib.png

View InterfaceVsRecord.fsx
// F# call via interface vs. record
type IFace =
abstract Test: int -> string -> unit
type IRecord = {
Test: int -> string -> unit
}
let myTest i s =
@nightroman
nightroman / .Turtle-Steps.md
Last active July 14, 2017 17:50
Turtle 16: Batch processing using command objects with responses
View .Turtle-Steps.md

16: Batch processing using command objects with responses

The description is the same as the case 9 with the last disadvantage resolved. Namely

  • Only suitable when control flow is not based on the response from a previous command.
    • Case 16 solves this issue, commands have responses.

Below is the case 9 notes:

@nightroman
nightroman / Microsoft.VSCode_profile.ps1
Created May 19, 2017 14:59
My Microsoft.VSCode_profile.ps1
View Microsoft.VSCode_profile.ps1
function prompt
{
#! now: last error for the color
$color = if ($?) { 10 } else { 12 }
# debug
if ($ExecutionContext.SessionState.PSVariable.GetValue('PSDebugContext')) {
return
}