Skip to content

Instantly share code, notes, and snippets.

View Hugoberry's full-sized avatar

Igor Cotruta Hugoberry

View GitHub Profile
// Function to wrangle data into the required format
function wrangle(data) {
let charactersMap = {};
// Helper function to get characters by ID
function characterById(id) {
if (!charactersMap[id]) {
charactersMap[id] = data.characters.find(character => character.id === id);
}
return charactersMap[id];
<head>
<script type="text/javascript">
mxBasePath = 'https://jgraph.github.io/mxgraph/javascript/src';
</script>
<script type="text/javascript" src="https://jgraph.github.io/mxgraph/javascript/src/js/mxClient.js"></script>
<script type="text/javascript">
function wrangle(data) {
var charactersMap = {};
return data.scenes.map(function(scene) {
return {
let
Source = {"B", "F", "T"},
n = List.Count(Source),
combinations = Number.Power(2,n)-1,
CreateCombination = (mask as number) as list =>
List.Select(List.Transform(List.Positions(Source), (position) =>
if Number.BitwiseAnd(mask, Number.Power(2, position)) <> 0 then Source{position} else null),
each _ <> null),
@Hugoberry
Hugoberry / ABF_tabular_file_types.md
Last active September 6, 2023 15:20
ABF structure of files located under a datamodel file in PBIX. #PowerBI #tabular

{Table} ({TableID}).tbl folders contains the following

  • #.{Table} ({TableID}).Column ({ColumnID}).dictionary file for all the HASH encoded columns
  • #.H${Table} ({TableID})${Column} ({ColumnID}).hidx hash index files for all the VALUE encoded columns
  • {PartitionID}.prt partition folder with:
    • #.{Table} ({TableID).{Column} ({ColumnID}).0.idf column data storage file
    • #.{Table} ({TableID).{Column} ({ColumnID}).0.idfmeta column data storage metadata file

H${Table} ({TableID})${Column} ({ColumnID})$({SystemTableID}).tbl hierarchy folders

  • {PartitionID}.prt
  • #.H${Table} ({TableID})$Column ({ColumnID}).{ID_TO_POS|POS_TO_ID}.0.idf Column Hierarchy Position–to–Identifier or Identifier–to–PositionFile
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"$id": {
"type": "string"
},
"DaxModelVersion": {
"type": "string"
},
@Hugoberry
Hugoberry / CodeWindow.html
Created July 5, 2023 10:30
Tailwindcss play link https://play.tailwindcss.com/jJ7APsi5d8 ide window prime for embedding some code
<section class="container mx-auto mt-8 w-full max-w-none md:mt-10 lg:mt-12 xl:max-w-screen-2xl xl:px-16">
<div class="before:bg-marketing-gradient-brand before:-z-high after:z-high safari:before:will-change-transform xl:after:border-marketing-divider relative relative col-span-12 flex select-none font-sans will-change-transform before:pointer-events-none before:absolute before:inset-0 before:hidden before:rounded-[20%] before:opacity-[0.12] before:blur-3xl after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] md:h-[min(70vw,90vh)] md:max-h-[600px] xl:max-h-[800px] xl:rounded-xl xl:before:block xl:after:border">
<div class="xl:bg-marketing-surface-base relative flex flex-1 flex-col overflow-hidden xl:rounded-[inherit]">
<div class="border-marketing-divider hidden h-12 flex-none grid-cols-[1fr_auto_1fr] border-b xl:grid">
<div class="flex items-center gap-4 pl-4">
<div class="group flex gap-2">
<div class="h-3 w-3 rounded-full bg-white/10"></div
@Hugoberry
Hugoberry / d2-layout-pre.sql
Last active May 23, 2023 22:02
sqlite query to surface the relationships from metadata.sqlite in PowerBI
with cte as (SELECT
ta.name as ta , tb.name as tb
FROM
'relationship' rel
join 'table' ta on rel.Fromtableid = ta.id
join column ca on rel.fromcolumnid = ca.id
join 'table' tb on rel.totableid = tb.id and tb.systemflags =0
join column cb on rel.tocolumnid = cb.id)
select ta from cte
union select tb from cte

[MS-XLDM]:

Spreadsheet Data Model File Format

Intellectual Property Rights Notice for Open Specifications Documentation

  • Technical Documentation. Microsoft publishes Open Specifications documentation ("this documentation") for protocols, file formats, data portability, computer languages, and standards support.
@Hugoberry
Hugoberry / ABF.cs
Created March 22, 2023 22:56
Data structures from Analysis Services Backup file format
using System.Xml.Serialization;
[Serializable]
[XmlRoot("BackupLog")]
public class BackupLogHeader{
[XmlElement("BackupRestoreSyncVersion")]
public int BackupRestoreSyncVersion { get; set; }
[XmlElement("Fault")]
public bool Fault { get; set; }
@Hugoberry
Hugoberry / abf.ksy
Created March 7, 2023 12:05
The Kaitai definition of ABF SQL Server Analysis Services backup file. The structure defined in [MS-XLDM] open spec document.
meta:
id: abf
endian: le
title: Spreadsheet Data Model File
seq:
- id: bom
type: bom_t
- id: stream_signature
type: stream_signature_t