Skip to content

Instantly share code, notes, and snippets.

View yonisetiawan's full-sized avatar

YONI SETIAWAN yonisetiawan

View GitHub Profile
function hacktiv(x){
var peserta = [];
var nama = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
for (var i = 0; i < x; i++) {
peserta.push(nama[i])
}
var hasil = [];
for (var j = 0; j < peserta.length; j++) {
for (var i = 1; i < peserta.length; i++) {
if(peserta[j]!==peserta[i]){
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
var peserta = [];
function pertanyaan(x){
"use strict"
class hacktiv{
constructor(siswa){
this.siswa = siswa;
}
pasangan(){
var peserta = [];
var nama = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
@yonisetiawan
yonisetiawan / topkeywords.js
Created October 13, 2016 12:38 — forked from elliotbonneville/topkeywords.js
Find top keywords associated with a Google search with this Node.js application.
var request = require("request"),
cheerio = require("cheerio"),
url = "https://www.google.com/search?q=data+mining",
corpus = {},
totalResults = 0,
resultsDownloaded = 0;
function callback () {
resultsDownloaded++;
@yonisetiawan
yonisetiawan / deretBilangan.js
Created January 12, 2017 08:46
LiveCoading Hacktiv8 Soal 1
function deretBilangan(input) {
var arr = []
for (var i = 1; i <= input; i++) {
arr.push(i * 3)
}
for (var i = 0; i < arr.length; i++) {
if (arr[i] % 5 == 0 && arr[i] % 6 == 0) {
arr[i] = "KASKUS"
} else if (arr[i] % 5 == 0) {
arr[i] = "KAS"
@yonisetiawan
yonisetiawan / solvePola.js
Created January 12, 2017 08:47
LiveCoading Hacktiv8 Soal 2
function solvePola(str) {
//write your code here
var tmp = str.split(" ")
var arr1 = tmp[0].split("")
var arr2 = Number(str.match(/\d{3} /g)[0].trim())
var arr3 = tmp[tmp.length-1].split("")
var hasil = []
@yonisetiawan
yonisetiawan / polaSpiral.js
Created January 12, 2017 08:49
LiveCoading Hacktiv8 Soal 3a
var array_masalah = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12],
[13, 14, 15, 16]
]
function spriral(input) {
var hasil = []
for (var i = 0; i < input[0].length; i++) {
@yonisetiawan
yonisetiawan / polaSpiral2.js
Last active January 13, 2017 02:50
LiveCoading Hacktiv8 Soal 3b
var masalah2 = [
[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10],
[11, 12, 13, 14, 15],
[16, 17, 18, 19, 20],
[21, 22, 23, 24, 25]
]
var hasil = []
@yonisetiawan
yonisetiawan / grabreceiptpromousage.gs
Created October 24, 2017 04:19 — forked from hapr05/grabreceiptpromousage.gs
Grab promo usage report script
//inspired by https://gist.github.com/oshliaer/70e04a67f1f5fd96a708
var SHEET_ID = 'YOUR_SHEET_ID';
var CREDIT_LIMIT = 500000; //YOUR GRAB LIMIT
//gmail before and after filter, read: https://support.google.com/mail/answer/7190
var after_date = '2017/09/25'; //this date is included in filter result
var before_date = '2017/10/25'; //this date is excluded in filter result
function getEmails(query,sheet){
@yonisetiawan
yonisetiawan / send-whatsapp.js
Created March 29, 2018 00:58 — forked from whatsmate/send-whatsapp.js
Sending a WhatsApp message in Node.js
#!/usr/bin/env node
var http = require('http');
var instanceId = "YOUR_INSTANCE_ID_HERE"; // TODO: Replace it with your gateway instance ID here
var clientId = "YOUR_CLIENT_ID_HERE"; // TODO: Replace it with your Forever Green client ID here
var clientSecret = "YOUR_CLIENT_SECRET_HERE"; // TODO: Replace it with your Forever Green client secret here
var jsonPayload = JSON.stringify({
number: "12025550108", // TODO: Specify the recipient's number here. NOT the gateway number