Skip to content

Instantly share code, notes, and snippets.

View dvlden's full-sized avatar
🧨
I am the error that you should catch!

Nenad Novaković dvlden

🧨
I am the error that you should catch!
View GitHub Profile
@dvlden
dvlden / No_DS_Files.sh
Created January 24, 2022 19:30
Disable `.DS_Store` file creation on Network & USB
# Disable `.DS_Store` file creation on Network & USB
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Check the current policy
defaults read com.apple.desktopservices
@dvlden
dvlden / 1.js
Last active April 13, 2019 22:03
JavaScript Algorithm
// Find missing numbers in the array
const numbers = [1, 2, 7, 3, 5, 4, 9]
let missing = []
for (var i = 1; i <= Math.max(...numbers); i++) {
if (!numbers.includes(i)) {
missing.push(i)
}
}
@dvlden
dvlden / index.js
Created August 5, 2018 16:14
MutationObserver in JavaScript
/**
* Sometimes, an element that you might need to retrieve
* is not visible right away. It might be added later on
* via an asynchronous action.
*
* This is where MutationObserver in JS comes in
* and here you can learn from example.
*
* Example will retrieve video element from the web page.
*/
@dvlden
dvlden / index.js
Created April 10, 2018 18:23
Just testing the "call, apply and bind"...
// I never really understood them, but now I think I got it...
let anObject = {
name: 'Nenad',
age: 25
};
let myArguments = ['Serbia', 'Valjevo', 'in a relationship'];
let anFunction = function (country, city, relationshipStatus) {
@dvlden
dvlden / extract-cookies.php
Last active September 25, 2023 13:49
Quickly Extract "Netscape HTTP Cookie File" to "JSON" (from ".txt" to ".json" format)
<?php
function extractCookies ($string) {
$cookies = array();
$lines = explode("\n", $string);
// iterate over lines
foreach ($lines as $line) {
// we only care for valid cookie def lines
@dvlden
dvlden / dummy.js
Created October 14, 2017 13:42
Some JS Testing...
const getSiblings = element => {
let siblings = []
let sibling = element.parentNode.firstChild
while (sibling = sibling.nextSibling) {
if (sibling.nodeType === 1 && sibling !== element) {
siblings.push(sibling)
}
}
@dvlden
dvlden / ffmpeg.md
Last active March 17, 2024 04:52
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
@dvlden
dvlden / snippet.js
Last active September 11, 2017 17:05
ITAcademy/LinkLearning - Skip time waiting on lessons
(function ($) {
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
@dvlden
dvlden / macOS - Terminal.md
Last active September 8, 2018 05:08
I tried to simplify all the keystrokes / shortcuts and common terminal commands that I use daily myself... I hope it helps anyone, spent too much time writing this.

Don’t be afraid of Terminal on any OS, let me simplify things for you! I’ve been using Terminal a lot lately, yet I remember the time when I was entirely afraid of even typing anything in it...

Whenever I needed something on my Mac, that required Terminal commands, I had a tough time figuring what does it mean, how does it work; especially when it's a very long one. Well, it was worth it, not just copy/pasting the command, seeing it works and continuing with my day.


Key Representation

VISUAL KEY DESCRIPTIVE KEY
@dvlden
dvlden / 01 - macOS Workspace Setup.md
Last active October 22, 2023 12:57
My complete macOS Workspace Setup Tutorial!

Setting up workspace for web development...

If you are planning to use everything from this guide, do it in exact order, otherwise install only what you need...


Try my automated macOS setup... It will configure all of these automatically for you. If you don't want everything, feel free to clone repo and modify what you want/need!

dvL-den macOS Setup