Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Tailoring the future...

Nenad Novaković dvlden

💭
Tailoring the future...
View GitHub Profile
@dvlden
dvlden / 1.js
Last active Apr 13, 2019
JavaScript Algorithm
View 1.js
// 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 Aug 5, 2018
MutationObserver in JavaScript
View index.js
/**
* 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 Apr 10, 2018
Just testing the "call, apply and bind"...
View index.js
// 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 Nov 3, 2020
Quickly Extract "Netscape HTTP Cookie File" to "JSON" (from ".txt" to ".json" format)
View extract-cookies.php
<?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 Oct 14, 2017
Some JS Testing...
View dummy.js
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 Jan 12, 2021
Convert video files to MP4 through FFMPEG
View ffmpeg.md

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 Sep 11, 2017
ITAcademy/LinkLearning - Skip time waiting on lessons
View snippet.js
(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 Sep 8, 2018
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.
View macOS - Terminal.md

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 Dec 22, 2020
My complete macOS Workspace Setup Tutorial!
View 01 - macOS Workspace Setup.md

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

macOS

@dvlden
dvlden / snippet.js
Last active Sep 11, 2017
Load any Script files - The asynchronous way
View snippet.js
/* Example of how to load Facebook SDK */
loadAsync(document, 'script', '//connect.facebook.net/en_US/sdk.js', 'facebook-jssdk', successCallback);
function successCallback () {
console.log('Facebook\'s SDK successfully loaded.');
}
/* Asynchronously load any script files */
function loadAsync ( doc, elem, source, id, cb ) {
var ready = false,
You can’t perform that action at this time.