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
// https://app.codility.com/programmers/lessons/1-iterations/binary_gap/ | |
function solution(N) { | |
return N. | |
toString(2). | |
split(/1+|1*0*$/g). | |
reduce((acc, cur) => Math.max(acc, cur.length), 0); | |
// const str = N.toString(2); | |
// let maxGap = 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
build:install-vendor: | |
stage: build | |
image: <any-image-with-composer> | |
before_script: | |
- composer config -g cache-dir "$(pwd)/.composer-cache" | |
script: | |
- composer install --ignore-platform-reqs --no-dev --optimize-autoloader --no-ansi --no-interaction --no-progress | |
cache: | |
paths: | |
- .composer-cache/ |
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
version: '3' | |
services: | |
greeter: | |
image: alpine:latest | |
volumes: |
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
export VAR1="foo" | |
export VAR2="bar" | |
envsubst < docker-compose-template.yml > docker-compose.yml | |
docker-compose -f docker-compose.yml pull | |
docker-compose -f docker-compose.yml up -d |
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 getZoom(bounds, width, height, maxZoom = 15) { | |
var WORLD_DIM = { height: 256, width: 256 }; | |
function latRad(lat) { | |
var sin = Math.sin(lat * Math.PI / 180); | |
var radX2 = Math.log((1 + sin) / (1 - sin)) / 2; | |
return Math.max(Math.min(radX2, Math.PI), -Math.PI) / 2; | |
} | |
function zoom(mapPx, worldPx, fraction) { |
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
#define LED 13 | |
#define FRAME 20000ul // 20000us => 50Hz | |
#define PERIOD 1000000ul // 1s | |
void setup() { | |
pinMode(LED, OUTPUT); | |
} |