Skip to content

Instantly share code, notes, and snippets.

View Risyandi's full-sized avatar
🌴
Everyday is a vacation

Risyandi Risyandi

🌴
Everyday is a vacation
View GitHub Profile
@Risyandi
Risyandi / triggerScroll.js
Created October 25, 2019 04:17
a method trigger when scrolling and minimum height of display.
/*
* targetId : is target of element, get based on ID/class/query element.
* htmlBody : count all body HTML.
*/
function triggerScroll() {
let targetId = document.getElementById('topStickyWrapper');
let htmlBody = document.documentElement;
window.addEventListener('scroll', function () {
function patternGenerator(rows, symbol1, symbol2, symbol3) {
for (let index = 0; index < rows; index++) {
// (1) this is step one print symbol blank
var space = "";
for (let indexj = 0; indexj < (rows - index - 1); indexj++) {
space += symbol3;
}
// (2) this is step two print symbol oval
@Risyandi
Risyandi / data-engineer-SQL#1.sql
Last active January 9, 2020 14:13
Jawaban soal data engineer Jabar Digital Services
SELECT userid, avg(duration) FROM sessions GROUP BY userid HAVING COUNT(userid) > 1;
@Risyandi
Risyandi / data-engineer-SQL#2.sql
Last active January 9, 2020 14:13
Jawaban soal data engineer Jabar Digital Services
SELECT name FROM employees WHERE id NOT IN (SELECT managerId FROM employees WHERE managerId IS NOT null);
@Risyandi
Risyandi / data-engineer-Python#1.py
Last active January 9, 2020 14:13
Jawaban soal data engineer Jabar Digital Services
def unique_names(names1, names2):
set_Name1 = set(names1)
set_Name2 = set(names2)
return list(set_Name1.union(set_Name2))
names1 = ["Ava", "Emma", "Olivia"]
names2 = ["Olivia", "Sophia", "Emma"]
print(unique_names(names1, names2)) # should print Ava, Emma, Olivia, Sophia
@Risyandi
Risyandi / data-engineer-Python#2.py
Last active January 9, 2020 14:20
Jawaban soal data engineer Jabar Digital Services
def pipeline(*funcs):
def helper(arg):
for func in funcs:
arg = func(arg)
return arg
return helper
fun = pipeline(lambda x: x * 3, lambda x: x + 1, lambda x: x / 2)
print(fun(3)) #should print 5.0
/**
* created by : risyandi @2020
*/
function countBits(num, bitNum) {
let binary = Number(num).toString(2);
let temp = "";
let result = null;
for (let index = 0; index < binary.length; index++) {
@Risyandi
Risyandi / configurationParameter.php
Created November 13, 2020 02:10
configuration prestashop 1.7x in source folder /app/config/parameters.php
<?php return array (
'parameters' =>
array (
'database_host' => 'localhost',
'database_port' => '',
'database_name' => 'database-name',
'database_user' => 'database-user',
'database_password' => '@@@@@',
'database_prefix' => 'psod_',
'database_engine' => 'InnoDB',
@Risyandi
Risyandi / swiper-react.js
Created December 10, 2020 07:24
example swiper in react
import {SwiperSlide, Swiper} from 'swiper/react';
import SwiperCore, {Pagination, Autoplay} from 'swiper';
SwiperCore.use([Pagination, Autoplay]);
const Home = (props) => {
const [banner, setBanner] = useState([])
// get data from api
setbanner(API_DATA);
@Risyandi
Risyandi / findNumberMax.js
Last active April 15, 2021 07:57
find number maximum in array using javascript solution
let arr = [4,3,5,5,6,1,2,7,1];
let start = 0;
let max = arr[start];
for (let index = 0; index < arr.length; index++) {
if (arr[index] > max) {
max = arr[index]
}
}