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
@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 / 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 / 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.
*/
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 / debugger pause beforeunload
Created November 24, 2020 16:28 — forked from carcinocron/debugger pause beforeunload
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@ultrox
ultrox / yell-starter.scm
Created December 25, 2020 15:47
yell function - first non guided function
;; yell-starter.rkt
; PROBLEM:
;
; DESIGN a function called yell that consumes strings like "hello"
; and adds "!" to produce strings like "hello!".
;
; Remember, when we say DESIGN, we mean follow the recipe.
;
; Leave behind commented out versions of the stub and template.
@ultrox
ultrox / pluralize.scs
Last active December 25, 2020 15:50
Guided pluralize functions
; Problem: Design a function that pluralizes a given word.
; (Pluralize means to convert the word to its plural form.)
; For simplicity you may assume that just adding s is enough to pluralize a word
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; What is an appropriate signature for this function?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; PROBLEM:
;; Create function that satisfiy following example
(check-expect (number-list (list "first" "second" "third"))
(list "1: first" "2: second" "3: third"))
(define (number-list n) empty) ; stub
;; #1 Objective:
;; - Satisfy all design elements (or as much as posible)
@ultrox
ultrox / nixos.md
Created July 23, 2021 03:41 — forked from martijnvermaat/nixos.md
Installation of NixOS with encrypted root
@ultrox
ultrox / search-git-history.md
Created July 28, 2021 11:12 — forked from lyoshenka/search-git-history.md
Search Git commit history for a string and see the diffs

Searching Git commit history

This should be one of the core features of Git, but for some reason it's impossible to figure out how to search for a string in your commit history and see the diffs that that string is in. Here's the best I've come up with:

To find which commits and which files a string was added or removed in:

git log -S'search string' --oneline --name-status

To see the diff of that