Skip to content

Instantly share code, notes, and snippets.

View rihardn's full-sized avatar

Rihard Novačan rihardn

  • Slovenia
View GitHub Profile
@rihardn
rihardn / play-pause-promises.md
Last active May 24, 2023 05:50
Play and Pause HTMl video with promises

How to play and pause HTML video with promises

const video = document.getElementById('myVideo');
const playBtn = document.getElementById('playBtn');
const pauseBtn = document.getElementById('pauseBtn');

function playVideo() {
  return new Promise((resolve, reject) => {
@rihardn
rihardn / chrome-flags-for-tools.md
Last active August 15, 2023 08:23
Chrome Flags for Tooling

Chrome Flags for Tooling

Many tools maintain a list of runtime flags for Chrome to configure the environment. This file is an attempt to document all chrome flags that are relevant to tools, automation, benchmarking, etc.

All use cases are different, so you'll have to choose which flags are most appropriate.

Here's a Nov 2022 comparison of what flags all these tools use.

Commonly unwanted browser features

@rihardn
rihardn / flexboxes.html
Created March 24, 2023 08:57
Css Flexboxes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flexboxes</title>
</head>
<body>
@rihardn
rihardn / css_news_scroller.html
Last active December 23, 2022 13:22
CSS News Scroller
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>News scroller</title>
</head>
<body>
<style>

Devices

List all connected devices - adb devices

Select a particular device - adb -s <device name> <command>

Shell

Android shell - adb shell

@rihardn
rihardn / android-set-ntp-server.md
Created December 2, 2022 14:05 — forked from xujiaao/android-set-ntp-server.md
Set the NTP server of your android device
tags
Android
Android Things

Set the NTP server of your android device

@rihardn
rihardn / .gitattributes
Created November 25, 2022 08:11 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@rihardn
rihardn / Migrate3DProjectToGitLFS.md
Created November 24, 2022 19:42 — forked from dpschen/Migrate3DProjectToGitLFS.md
Migrate Unity / Unreal Project to Git LFS

Migrate Unity / Unreal Project to Git LFS

Note

  • If you convert to LFS for an existing repository, you will change the history, so the SHA of changed commits changes!!
  • That is fine for archiving purposes, as long as it is only about looking up the history.
  • All historic states should still work, but you can no longer reference them via SHA.
  • You should not use bfg-repo-cleaner because it's not as well supported and maintained anymore compared to git lfs migrate

Steps

@rihardn
rihardn / evenlyDistribute.js
Last active May 31, 2023 09:23
Evenly, uniformly distribute array data
// var arr1 = ["A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B", "B", "C", "C", "C", "C", "D", "D", "E"];
// var arr1New = _evenlyDistribute(arr1);
// console.dir(arr1New.join());
// Should output: ABACABADABACABAEABACABADABACABA
var _evenlyDistribute = function (data) {
var _arrayMerge = function (a, b) {
var c1 = a.length;