Skip to content

Instantly share code, notes, and snippets.

View dimasandhk's full-sized avatar

Dimas Andhika Diputra dimasandhk

View GitHub Profile
for(let i = 1; i <= 100; i++) {
const str = (i % 3 ? '' : 'Fizz') + (i % 5 ? '' : 'Buzz');
console.log(str || i);
}
extension Sorting on List<int> {
List<int> sortAsc() {
List<int> list = this; // Selection sort algorithm
int length = this.length;
for (int i = 0; i < length - 1; i++) {
int min = i;
for (int j = i + 1; j < length; j++) {
if (list[j] < list[min]) {
min = j;
String.prototype.capitalize = function() {
return `${this[0].toUpperCase()}${this.slice(1)}`
}
console.log('ini teks'.capitalize()) // => 'Ini teks'
@dimasandhk
dimasandhk / kata-5kyu-the-hashtag-generator.js
Created June 15, 2021 11:01
Kata Solution (Codewars) 5 KYU The Hashtag Generator with Javascript
// ************************************************************************************
// https://www.codewars.com/kata/the-hashtag-generator
// The marketing team is spending way too much time typing in hashtags.
// Let's help them with our own Hashtag Generator!
// Here's the deal:
// It must start with a hashtag (#).
// All words must have their first letter capitalized.
@dimasandhk
dimasandhk / swal-custom.scss
Last active May 2, 2021 13:58
My own custom styling for sweetalert
.swal-modal {
.swal-icon--info {
&::before,
&::after {
background-color: #a5dc86;
}
color: rgba(57, 57, 64, 0.95);
border: 4px solid #a5dc86;
}
.swal-title,