Skip to content

Instantly share code, notes, and snippets.

View Aldhanekaa's full-sized avatar
🎏
Make Indonesia great again!

Al∂haneka、アルダネカ Aldhanekaa

🎏
Make Indonesia great again!
View GitHub Profile
@Aldhanekaa
Aldhanekaa / E.js
Last active November 5, 2020 21:20
my FreeCodeCamp Basic Algorithm Scripting, Chunky Monkey
function chunkArrayInGroups(arr, size) {
var newArray = [];
for (let i = 0; i<arr.length; i++) {
// console.log(i)
if (i == 0) {
newArray.push(arr.slice(i, size ))
}else if (i % size == 0 && i != 0) {
// console.log('HEY!')
// console.log(arr[i])
// console.log(arr.indexOf(arr[i]))
function getIndexToIns(arr, num) {
let result;
if (arr.indexOf(num) == -1) {
let N = Math.min(...arr.filter(e => e > num));
console.log(N);
N = arr.indexOf(N)
console.log(N)
result = N;
// console.log(arr.indexOf(r))
}else {
@Aldhanekaa
Aldhanekaa / Understand the Hazards of Using Imperative Code.js
Last active October 14, 2020 23:30
Functional Programming: Understand the Hazards of Using Imperative Code : Using my solution
// tabs is an array of titles of each site open within the window
var Window = function(tabs) {
this.tabs = tabs; // We keep a record of the array inside the object
};
// When you join two windows into one window
Window.prototype.join = function (otherWindow) {
console.log(this.tabs)
this.tabs = this.tabs.concat(otherWindow.tabs);
return this;
// tabs is an array of titles of each site open within the window
var Window = function(tabs) {
this.tabs = tabs; // We keep a record of the array inside the object
};
// When you join two windows into one window
Window.prototype.join = function (otherWindow) {
this.tabs = this.tabs.concat(otherWindow.tabs);
return this;
};
// The global variable
var watchList = [
{
"Title": "Inception",
"Year": "2010",
"Rated": "PG-13",
"Released": "16 Jul 2010",
"Runtime": "148 min",
"Genre": "Action, Adventure, Crime",
"Director": "Christopher Nolan",
const squareList = (arr) => {
// Only change code below this line
if (Array.isArray(arr)) { // check if the arr is an arrat
console.log('hello world')
arr = arr.filter(element => typeof parseInt(element) == 'number')
.filter(element => element > 0 && element.toString().indexOf('.') == -1)
.map(element => element ** 2);
console.log(arr)
return arr;
}else
@Aldhanekaa
Aldhanekaa / my first redux app.js
Created October 25, 2020 00:27
First Redux app
const INCREMENT = 'INCREMENT', // Define a constant for increment action types
DECREMENT = 'DECREMENT', // Define a constant for decrement action types
MULTIPLY = 'MULTIPLY',
DIVIDE = 'DIVIDE';
const counterReducer = (state= 0, action) => {
switch(action.type) {
case INCREMENT :
return state + 1
@Aldhanekaa
Aldhanekaa / Java Library List.md
Last active November 5, 2020 21:44
Java Library

Library Date : Link

Doc : Link


Scanner :

import java.util.Scanner;
'use strict';
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
@Aldhanekaa
Aldhanekaa / bmi.cpp
Last active January 17, 2021 06:43
#include <iostream>
#include <stdlib.h>
using namespace std;
// g++ bmi.cpp -o bmi && ./bmi
int main()
{
// bmi = weight / height ** 2