This file contains 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
/* | |
* 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 () { |
This file contains 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 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 |
This file contains 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
SELECT userid, avg(duration) FROM sessions GROUP BY userid HAVING COUNT(userid) > 1; |
This file contains 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
SELECT name FROM employees WHERE id NOT IN (SELECT managerId FROM employees WHERE managerId IS NOT null); |
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
/** | |
* 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++) { |
This file contains 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
<?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', |
This file contains 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
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); |
This file contains 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
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] | |
} | |
} |