Skip to content

Instantly share code, notes, and snippets.

View diberry's full-sized avatar
πŸ’­
Enjoying the sun

Dina Berry (MSFT) diberry

πŸ’­
Enjoying the sun
View GitHub Profile
@diberry
diberry / what_has_changed.sh
Created October 14, 2025 14:09
What has changed
git log --name-status --since="$(date -d 'last month' '+%Y-%m-01')" --until="$(date -d 'last month' '+%Y-%m-31')" --diff-filter=AM --pretty=format:"%ad" --date=short -- . | awk '
BEGIN { date="" }
/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/ { date=$0; next }
/^[AM]/ {
file=$2
action=$1
if (file in files) {
if (files[file] != action) {
files[file] = "both"
}
@diberry
diberry / GitHub GraphQL - all repos in org
Created November 28, 2022 14:16
GitHub GraphQL JavaScript HTTP only - all repos in org
/// package.json
{
"name": "github-graphql-node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node ./src/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));

Azure Data Explorer (Kusto) query Regex

To remove locale like /en-us/ from URLs I use this function:

Most Docs locales are like en-us / ja-jp / de-de with 2 letters separated by a dash, however there are others with 3-4 letters, and some with 3 tuples with 2 dashes.

let unloc=(arg0:string) { let extract1=extract(@"^https?:\/\/docs\.microsoft\.com\/[A-Za-z]{2,3}-[A-Za-z]{2,4}-?[A-Za-z]{0,3}\/(\S*)", 1, arg0); case(isnotempty(extract1),strcat("https://docs.microsoft.com/", extract1),arg0) };
# ms.date by date - match year of 2020
ms\.date: \d{2}\/\d{2}\/2020
# ms.date by date - match month range of 1-8
ms\.date: [0][1-8]{1}\/\d{2}\/2022
@diberry
diberry / gist:2beee74adbd25931881599fbd564966d
Created October 21, 2021 23:03
VS Code Launch.json for Azure Functions debugging
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Node Functions",
"type": "node",
"request": "attach",
"port": 9229,
"preLaunchTask": "func: host start"
}

Adding prettier to a CRA project

Previously, I've had some problem to reliaby configure code formatting with Prettier in VSCode, in the context of a create-react-app proejct. Today, it worked like a charm, and this is what I did.

Preconditions:

  • react-scripts: "3.1.1"
  • react: "^16.9.0"
  • react-dom: "^16.9.0"
  • Dirk Baeumer's ESLint VSCode extension installed and running
@diberry
diberry / find_unpublished_npm.ps1
Created August 14, 2020 16:51 — forked from scbedd/find_unpublished_npm.ps1
Of JS Packages, which ones are unpublished to docs.ms.com?
# assumes that NPM is installed and available
$indexUrl = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/releases/latest/js-packages.csv"
$interrogativeUrl = "https://docs.microsoft.com/en-us/javascript/api"
$content = (Invoke-RestMethod -Method GET -Uri $indexUrl)
# assumes that the location is common
$results = $content.Split("`n") | ? { $_ }
$results = $results[1..($results.Length-1)]
$indexPackages = @{}
@diberry
diberry / client.js
Created July 28, 2019 16:09 — forked from PaulMougel/client.js
File upload in Node.js to an Express server, using streams
// node: v0.10.21
// request: 2.27.0
var request = require('request');
var fs = require('fs');
var r = request.post("http://server.com:3000/");
// See http://nodejs.org/api/stream.html#stream_new_stream_readable_options
// for more information about the highWaterMark
// Basically, this will make the stream emit smaller chunks of data (ie. more precise upload state)
var upload = fs.createReadStream('f.jpg', { highWaterMark: 500 });
@diberry
diberry / gist:6873a625bb401a2c89e2941b148ec231
Created January 17, 2019 17:20 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue: