Skip to content

Instantly share code, notes, and snippets.

View ultrox's full-sized avatar
🏠
Working from home

Marko Vujanic ultrox

🏠
Working from home
View GitHub Profile
model User {
  id        Int      @id @default(autoincrement())
  email     String   @unique
  role      Role      // normal Relation field 
  profile   Profile?  // Relation field part of 0-1 relation
}

model Profile {
 id Int @id @default(autoincrement())
@ultrox
ultrox / groupAnagrams.js
Created April 6, 2020 23:46
groupAnagrams.js
// Given an array of strings, group anagrams together.
/**
* @param {string[]} strs
* @return {string[][]}
* @description Given an array of strs, group anagrams together.
* @note inputs will be in lowercase.
The order of your output does not matter.
*/
@ultrox
ultrox / maxSubArray.js
Created April 4, 2020 14:01
maxSubArray
// Cubic O(n³)
// https://www.youtube.com/watch?v=2MmGzdiKR9Y Feb: 01/2019
function maxSubArray(nums) {
let maximumSubArraySum = Number.NEGATIVE_INFINITY;
/*
We will use these outer 2 for loops to investigate all
windows of the array.
We plant at each 'left' value and explore every
@ultrox
ultrox / resetFieldset.css
Created March 6, 2020 11:30 — forked from nicolasrenon/resetFieldset.css
Reset fieldset and legend styles
/* From http://thatemil.com/blog/2015/01/03/reset-your-fieldset/ by Emil Björklund */
legend {
display: table;
padding: 0;
}
fieldset {
border: 0;
margin: 0;
min-width: 0;
@ultrox
ultrox / @@INTRO.md
Created August 3, 2019 01:15 — forked from djmitche/@@INTRO.md
My use of Taskwarrior

Getting Started

My Usage

I've been using this for several years now, so here are some of the ways I have set it up to be most productive. See my taskrc below for implementation details.

In general, I've had the most success by keeping lists of tasks short and to the point, avoiding the anxiety of seeing 100 tasks and feeling like I'm going to drown.

@ultrox
ultrox / git-rmf
Last active June 26, 2019 09:23
Permanently remove any file from repository!
#!/bin/bash
FILE=$1
if [[ -f $FILE ]]; then
git filter-branch -f --index-filter "git rm -r --cached $FILE --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all
else
echo File required
fi
@ultrox
ultrox / elon_musk_first_principles.md
Created April 30, 2019 17:09
How to think in first principles

First principles battery

  • what are the materials constituents of batteries

  • what is spot market value of the material constituents

  • Cobalt, nickel, aluminium, carbon and polymers for separation and steel can.

Break that down on a material basis and say okay if we bought that in London metal exchange, what would each of those things cost. Its $80 per kilowatt hour

@ultrox
ultrox / self-signed-certificate-with-custom-ca.md
Created November 4, 2018 10:07 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@ultrox
ultrox / webpack.config.babel.js
Created October 27, 2018 08:02
From how to build open source lib - Kent C. Dodds
//https://egghead.io/lessons/javascript-add-a-browser-build-to-an-npm-module
import { join } from "path";
export default {
entry: "./src/index.js",
output: {
path: join(__dirname, "dist"),
libraryTarget: "umd",
library: "starWarsNames"
},
/* begin table creation */
create table department
(dept_id smallint unsigned not null auto_increment,
name varchar(20) not null,
constraint pk_department primary key (dept_id)
);
create table branch
(branch_id smallint unsigned not null auto_increment,