This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Merge sorted arrays unique | |
* | |
* Function merges two sorted arrays A & B and produces a new sorted array C | |
* with all elements of A and B without repetitions. | |
* | |
* For instance, if | |
* A = [1, 1, 2, 2, 5, 7, 16] and | |
* B = [2, 5, 10, 10, 11, 12, 14, 16], | |
* then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Find elements in an sorted array $a with a specific distance $k | |
* | |
* @param integer $k | |
* @param array $a | |
* @param integer $i | |
* @param integer $j | |
* @return array | |
*/ | |
public static function recfindElementsByDistance($k, array $a = [], $i = 0, $j = 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Find elements in a sorted array $a with a specific distance $k iteratively and | |
* return the matching values or an empty array if no pair was found. The boolean value | |
* false is returned, if the array is not sorted. | |
* | |
* @param integer $k | |
* @param array $a | |
* @return mixed (array|boolean) | |
*/ | |
function findElementsByDistance($k, array $a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getJoke() { | |
var req = new XMLHttpRequest(); | |
req.onreadystatechange = function() { | |
if (4 == req.readyState && 200 == req.status) { | |
var reponse = JSON.parse(req.responseText); | |
console.log(reponse); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ------------------------------------------------------------------------------ | |
# Get the message of the day :) | |
# ------------------------------------------------------------------------------ | |
motd=`curl --silent -H "Accept: text/plain" https://api.chucknorris.io/jokes/random 2>&1 /dev/null` | |
echo -e "\n\n$motd\n\n\033[0;31m¯\_(ツ)_/¯ Have a good day dude ...\033[0m\n\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="wrapper"> | |
<div class="arrow left"> </div> | |
<br /> | |
<div class="arrow right"> </div> | |
</div> | |
<style> | |
body { | |
padding: 0; | |
margin: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# ----------------------------------------------------------------------------- | |
# This script generates an unique image with an uuid and an embedded qr code | |
# Usage `./gen_unique_image.sh unique_image.(jpg|jpeg|png|gif|bmp)` | |
# ----------------------------------------------------------------------------- | |
readonly PACKAGE='gen_unique_image' | |
readonly COLOR_BACKGROUND='0F3244' | |
readonly COLOR_BLUE='58C0F9' | |
readonly COLOR_FOREGROUND='FFFFFF' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* Calculate the wind chill factor | |
* @see https://www.weather.gov/media/epz/wxcalc/windChill.pdf | |
* | |
* @param {Float} temperature - temperature in Fahrenheit | |
* @param {Float} windSpeed - wind speed in miles per hour | |
* @return {Float} | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Convert wind direction in angles to cardinal direction | |
* @see https://en.wikipedia.org/wiki/Cardinal_direction | |
* | |
* @param {Number} degree | |
* @return {String} | |
*/ | |
function degreeToCardinalDirection(degree) { | |
const val = Math.floor(0.5 + (degree / 22.5)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HAI 1.2 | |
I HAS A AGE ITZ 0 | |
I HAS A ENDOFLIFE ITZ 80 | |
IM IN YR LOOP UPPIN YR AGE TIL BOTH SAEM AGE AN ENDOFLIFE | |
VISIBLE "Eat, poop, sleep, laugh, observe, teach ..." | |
IM OUTTA YR LOOP | |
VISIBLE "Well done, you're now dead at an age of " AGE ". Hope you've enjoyed the experience" | |
KTHXBYE |
OlderNewer