Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View saostad's full-sized avatar
🤠

saostad

🤠
View GitHub Profile
@saostad
saostad / vscode-console.log.snipet
Created March 15, 2019 18:29
VSCode Snippet to console.log with File Name and Line number auto added
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"Print to console": {
"scope": "javascript,typescript,typescriptreact",
@saostad
saostad / git-pushing-multiple.rst
Created July 27, 2019 16:05 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

let fnDateTable = (StartDate as date, EndDate as date, FYStartMonth as number) as table =>
let
DayCount = Duration.Days(Duration.From(EndDate - StartDate)),
Source = List.Dates(StartDate,DayCount,#duration(1,0,0,0)),
TableFromList = Table.FromList(Source, Splitter.SplitByNothing()),
ChangedType = Table.TransformColumnTypes(TableFromList,{{"Column1", type date}}),
RenamedColumns = Table.RenameColumns(ChangedType,{{"Column1", "Date"}}),
InsertYear = Table.AddColumn(RenamedColumns, "Year", each Date.Year([Date]),type text),
InsertYearNumber = Table.AddColumn(RenamedColumns, "YearNumber", each Date.Year([Date])),
InsertQuarter = Table.AddColumn(InsertYear, "QuarterOfYear", each Date.QuarterOfYear([Date])),
CREATE UNIQUE NONCLUSTERED INDEX INDEX_NAME_HERE
ON TABLE_NAME_HERE(FIELD_NAME_HERE)
WHERE FIELD_NAME_HERE IS NOT NULL;
@saostad
saostad / GitHub-GraphQL-PowerBI.m
Created August 13, 2019 18:31 — forked from petrsvihlik/GitHub-GraphQL-PowerBI.m
Loading GraphQL data (GitHub API v4) into PowerBI
// This script shows how to use M language (Power Query Formula Language)
// to read data from GitHub API v4 using a POST request.
// This can come in handy when building PowerBI reports that utilize GraphQL endpoints for loading data.
let
Source = Web.Contents(
"https://api.github.com/graphql",
[
Headers=[
#"Method"="POST",
@saostad
saostad / index.js
Created October 14, 2019 15:07 — forked from akexorcist/index.js
Axios post method requesting with x-www-form-urlencoded content type
const axios = require('axios')
const qs = require('querystring')
...
const requestBody = {
name: 'Akexorcist',
age: '28',
position: 'Android Developer',
description: 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/',

generated typescript type definitions and functions to interact with ProjectSight api

Steps:

  • get ProjectSight api swagger spec and save it as file project-sight-api-spec.json
  • download latest version of swagger-codegen
  • generate type def and functions with swagger-codegen (it's a Java command line tool)
    • Oracle JRE needed to run command
  • command to generate the types java -jar swagger-codegen-cli.jar generate -l typescript-node -o ./api/ -i ./project-sight-api-spec.json --config typescript-node.json
@saostad
saostad / git-commit-prefixes.md
Last active March 16, 2021 00:30
git commit prefixes

it's recommended to have separate commit for each change

order in commit messages when multi line needed:

  • pub: x.x.x /** publish in package repository version: semver majon.minor.bugfix == breaking.feat.fix */
  • breaking: /** explanation of breaking change */
  • feat: /** added a feature */
  • fix: /** bug fix */
  • enhance: /** improve existing functionality (mostly performance) */
  • depricate: /** deprication of existing functionality */
@saostad
saostad / project-folder-structure.md
Last active April 14, 2020 13:49
project folder structure

folder name to keep all:

  • [logs]
  • [docs]
  • [dist]
  • [bin]
  • [genearated]
  • [src] parent folder
    • [services] io related codes
    • [helpers] small functions to data massage
  • [templates]
@saostad
saostad / clean-up-boot-partition-ubuntu.md
Created June 24, 2020 15:29 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r