Skip to content

Instantly share code, notes, and snippets.

View robertosljunior's full-sized avatar

Bob Junior robertosljunior

View GitHub Profile
@PBIQueryous
PBIQueryous / table_spec.json
Last active December 28, 2023 15:28
table_spec
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {"url": "data/penguins.json"},
"transform": [
{
"window": [
{
"op": "row_number",
"as": "row_num"
}
Sparkline Column Categorical Axis =
// Static column color - use %23 instead of # for Firefox compatibility
VAR BarColor = "%2301B8AA"
VAR BarOutlineColor = "%23DDDDDD"
VAR BarOutlineWidth = 2
// Obtain number of columns - width generated based on column count (~20 column maximum for bar chart)
VAR BarCount = DISTINCTCOUNT('Table'[Customer Segment])
VAR BarWidth = INT(DIVIDE(100,BarCount))
// Obtain overall min and overall max measure values when evaluated for each column
VAR YMinValue = MINX(VALUES('Table'[Customer Segment]),CALCULATE([Measure Value]))
@deldersveld
deldersveld / RGBDecimalColorToHex.dax
Created July 13, 2018 11:59
DAX - RGB Decimal Color to Hex
RGB Decimal Color to Hex =
// Manually enter components of RGB decimal color value, e.g. "RGB(1,184,170)"
VAR RedDecimalColorValue = 1
VAR GreenDecimalColorValue = 184
VAR BlueDecimalColorValue = 170
//Decimal to Hex
VAR RedPosition0Dec = MOD(RedDecimalColorValue,16)
VAR RedPosition0Div = INT(RedDecimalColorValue / 16)
VAR RedPosition1Dec = MOD(RedPosition0Div,16)
VAR RedPosition1Div = INT(RedPosition0Div / 16)
@tdraganidis
tdraganidis / PowerBiEmbeddedManager.cs
Last active August 9, 2020 15:24
Copy a pbix template report to a tenant app workspace
using Microsoft.Azure.Management.ResourceManager;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.PowerBI.Api.V2;
using Microsoft.PowerBI.Api.V2.Models;
using Microsoft.Rest;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
@sayedihashimi
sayedihashimi / dotnet-new-ux.ps1
Last active March 1, 2018 12:24
dotnet new user interaction
[cmdletbinding()]
param()
# to run this script:
# (new-object Net.WebClient).DownloadString("https://gist.githubusercontent.com/sayedihashimi/899ed1a47953ea6a45f60220687cfdd6/raw/b3ad6ab230b5c4a9cf5b39d3142fc7b36df8c54f/run-dotnetnew-ux.ps1") | iex
function StartDefault{
[cmdletbinding()]
param()
process{
@jherax
jherax / filterArray.js
Last active May 6, 2024 09:35
Filters an array of objects with multiple match-criteria.
/**
* Filters an array of objects using custom predicates.
*
* @param {Array} array: the array to filter
* @param {Object} filters: an object with the filter criteria
* @return {Array}
*/
function filterArray(array, filters) {
const filterKeys = Object.keys(filters);
return array.filter(item => {
@demisx
demisx / gulpfile.js
Last active July 14, 2022 16:06
Gulp 4 gulpfile.js
// Gulp 4
var gulp = require('gulp');
var using = require('gulp-using');
var grep = require('gulp-grep');
var changed = require('gulp-changed');
var del = require('del');
var coffee = require('gulp-coffee');
var less = require('gulp-less');
var coffeelint = require('gulp-coffeelint');
var sourcemaps = require('gulp-sourcemaps');
@roundand
roundand / OpenWithSublimeText3.bat
Last active March 13, 2024 17:38 — forked from mrchief/LICENSE.md
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.