Skip to content

Instantly share code, notes, and snippets.

View Gabri3l's full-sized avatar

Gabriele Cimato Gabri3l

View GitHub Profile
var spiralize = function(size) {
let spiral = [];
for(let i=0;i<size;i++) {
spiral[i] = Array(size).fill(0);
}
let min = 0;
let max = size;
while (min < max ) {
for(let i=min;i<max;i++) {
function Primes(){
let primeNumbers = [2];
const first = (n) => {
if (primeNumbers.length >= n) return primeNumbers.slice(0, n + 1);
let value = primeNumbers[primeNumbers.length - 1] + 1;
let isPrime;
while (primeNumbers.length < n) {
isPrime = true;
primeNumbers.some((prime) => {
/*
This gist is to show a differnet approach on the merging task. Some
conditions might be missing but I just wanted to present a different
implementation, adding or editing a constraint is pretty straighforward.
*/
'use strict';
const constraint = (passingCondition, consequence) => ({
passed: passingCondition,
applyConsequence: consequence