Skip to content

Instantly share code, notes, and snippets.

View AdrianSkar's full-sized avatar

Adrian Skar AdrianSkar

View GitHub Profile
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adriarod <adriarod@student.42madrid> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/23 12:23:21 by adriarod #+# #+# */
/* Updated: 2024/04/20 12:43:26 by adriarod ### ########.fr */
/* */
@AdrianSkar
AdrianSkar / c-bubble-sort.c
Last active April 19, 2024 09:35
bubble sort in C
# include <stdio.h>
// bubble sort example
void ft_sort_arr(int *arr, int size)
{
int i = 0; // number of passes
int j; // index of the array
int temp; // temporary variable to store the value of the array
int swap_count = -1; // number of swaps in each pass, -1 to enter the loop
@AdrianSkar
AdrianSkar / rev-names.js
Created October 16, 2022 15:39
reversed and sortered Array of names
const people = [
'Bernhard, Sandra',
'Bethea, Erin',
'Becker, Carl',
'Bentsen, Lloyd',
'Beckett, Samuel',
'Blake, William',
'Berger, Ric',
'Beddoes, Mick',
'Beethoven, Ludwig',
@AdrianSkar
AdrianSkar / trakt-backup.php
Created January 22, 2022 16:25 — forked from darekkay/trakt-backup.php
Trakt.tv backup script
<?php
/*
Backup script for trakt.tv (API v2).
Live demo: https://darekkay.com/blog/trakt-tv-backup/
*/
// create a Trakt app to get a client API key: http://docs.trakt.apiary.io/#introduction/create-an-app
$apikey = "CLIENT_API_KEY";
@AdrianSkar
AdrianSkar / array.entries.js
Created May 28, 2021 14:37
[JS] Array.entries()
const arr = ['html', 'css', 'js'];
const iter = arr.entries();
for (let value of iter) {
console.log(value); // [ 0, 'html' ], [ 1, 'css' ], [ 2, 'js' ]
}
@AdrianSkar
AdrianSkar / forEach.js
Created May 28, 2021 14:15
[JS] Array.forEach()
const arr = ["html", "css", "js"];
arr.forEach(ele => {
console.log(ele); // html, css, js
});
@AdrianSkar
AdrianSkar / zoomInBrowser.js
Last active May 29, 2020 14:55
Reveal a button to run a Zoom meeting in the browser without having to clic on download first.
window.addEventListener("load", function(){
var curU = window.location.href; // get current URL
var newU = curU.replace('/j/', '/wc/join/'); // Set URL for running metting in the browser
var browMe = document.createElement('a');
browMe.setAttribute('href', newU);
browMe.innerHTML = 'Run in browser';
document.querySelector('div[role="main"]').appendChild(browMe); // Add button to Zoom's content
});
@AdrianSkar
AdrianSkar / toggleMSVendorsOutlook.js
Last active December 27, 2019 17:51
Toggle off Outlook advertising vendors
// https://stackoverflow.com/questions/2705583/how-to-simulate-a-click-with-javascript
function eventFire(el, etype){
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
}
}
@AdrianSkar
AdrianSkar / main.js
Created September 2, 2018 11:01
Comparison with the equality operator created by AdrianSkar - https://repl.it/@AdrianSkar/Comparison-with-the-equality-operator
function testEqual(val) {
if (val == 12) { // Change this line
return "Equal";
}
return "Not Equal";
}
// Change this value to test
testEqual(10);
@AdrianSkar
AdrianSkar / index.html
Created July 31, 2018 12:21
[RWD] Project: Build a technical doc page
<head><link href="https://fonts.googleapis.com/css?family=Inconsolata:400,700" rel="stylesheet">
</head>
<body>
<nav id="navbar">
<header>FCC's RWD cert.</header>
<ul>
<a href="#Basic_HTML_and_HTML5" class="nav-link"><li>Basic HTML and HTML5</li></a>
<a href="#Basic_CSS" class="nav-link"><li>Basic CSS</li></a>
<a href="#Applied_visual_design" class="nav-link"><li>Applied visual design</li></a>