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 / criteoTags.js
Last active November 12, 2018 10:26
This is a sample tags script from criteo, the script should be implement on DFP
/* This script adding after tags DFP
* googletag.defineSlot('/95250053/LIPUTAN6_LB_HEALTH', [[728, 90], [970, 90]], 'div-gpt-ad-1435336898160-0').addService(googletag.pubads());
*/
var crtg_split = (crtg_content || '').split(';');
var pubads = googletag.pubads();
for (var i=1;i<crtg_split.length;i++){
pubads.setTargeting("" + (crtg_split[i-1].split('='))[0] + "", "" + (crtg_split[i-1].split('='))[1] + "");
}
@Risyandi
Risyandi / nodeStaticServer.js
Last active November 12, 2018 10:10 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@Risyandi
Risyandi / tokenizeString.js
Last active November 12, 2018 10:07
This is a assignment for Tokenize String Program using javascript
// Input words
var words = "Ketua DPP Partai Hanura Inas Nasrullah Zubir mengungkapkan, dalam mitos Jawa, genderuwo merupakan bangsa jin atau makhluk halus yang berwujud manusia. Genderuwo memiliki tubuh besar dan suka menghisap darah manusia";
// ways 1
// breaks words into tokenize with define spaces
var words_temp = [''],
indexj = 0;
function tokenize(words, delimeter) {
for (let index = 0; index < words.length; index++) {
// appear indexing
@Risyandi
Risyandi / asterikPyramid.js
Created November 14, 2018 07:09
This is assignment for Asterik Pyramid Program using javascript
function asterikPyramid(rows, symbol1, symbol2) {
for (let index = 0; index < rows; index++) {
// console.log(index, "index");
// this is step one to print empty spaces
var space = "";
for (let indexj = 0; indexj < (rows - index - 1); indexj++) {
// console.log(indexj, "indexj");
space += symbol2;
}
@Risyandi
Risyandi / asterikPyramidMiddle.js
Created November 15, 2018 10:42
This is assignment for Asterik Pyramid Program Finding Middle of Coloumn using javascript
function asterikPyramidMiddle(rows, symbol1, symbol2, symbol3) {
for (let index = 0; index < rows; index++) {
console.log(index, "identity-row");
// (1) this is step one print symbol blank
var space = "";
for (let indexj = 0; indexj < (rows - index - 1); indexj++) {
console.log(index, "value-loops-step1");
console.log(indexj, "print-col-step1");
space += symbol3;
@Risyandi
Risyandi / reverseTokenizeString.js
Last active November 28, 2018 03:32
This is a assignment for Reverse Tokenize String Program using javascript
// Declare a global variable for the function reverse()
var words = "Ketua DPP Partai Hanura Inas Nasrullah Zubir mengungkapkan, dalam mitos Jawa, genderuwo merupakan bangsa jin atau makhluk halus yang berwujud manusia. Genderuwo memiliki tubuh besar dan suka menghisap darah manusia";
// function reverse with decrement
function Reverse(words) {
var wordsLength = words.length;
// console.log(wordsLength, "words length");
var reverseWords = "";
for (let index = wordsLength - 1; index >= 0; index--) {
reverseWords += words[index];
@Risyandi
Risyandi / gulpfile.js
Last active February 17, 2019 08:31 — forked from darylldoyle/gulpfile.js
This is a default code for automation gulp
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var autoprefixer = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
@Risyandi
Risyandi / keybase.md
Created May 1, 2019 06:28
this is a my identity on keybase.io

Keybase proof

I hereby claim:

  • I am risyandi on github.
  • I am risyandi (https://keybase.io/risyandi) on keybase.
  • I have a public key whose fingerprint is 0232 BECC 5844 F032 F841 9F79 7BEF 6DAF F960 F13F

To claim this, I am signing this object:

@Risyandi
Risyandi / modalDialogWithoutJS
Last active August 13, 2019 16:02
Jawaban untuk Jawa Barat Digital Services, tentang modal dialog tanpa menggunakan javascript
<!--
catatan :
1. untuk menampilkan modal dialog di bootstrap tanpa menggunakan javascript. bisa menggunakan atribute.
<data-toggle="modal" data-target="#dialog">
2. dan untuk menutup kembali dialog dengan menambahkan atribute
<data-dismiss="modal">
created by @Risyandi
-->
<!DOCTYPE html>
@Risyandi
Risyandi / AppendChildUsingLoop
Last active August 13, 2019 16:01
Jawaban untuk Jawa Barat Digital Services, tentang fixing bugs di append sebuah element menggunakan looping.
/*
* catatan : untuk memperbaiki bugs di appenChild ini ada 2 cara yaitu
* 1. bisa mengubah method get element nya dengan method
* var allDivs = document.querySelectorAll("div");
* 2. menggunakan method yang sama akan tetapi membuat variable tambahan untuk menampung sebuah length, dan hasil tampungan
* tersebut bisa digunakan sebagai jumlah limit loop nya.
* var allDivs = document.getElementsByTagName("div");
* var length = allDivs.length;
* created by @Risyandi
*/