Instantly share code, notes, and snippets.

View reverseTokenizeString.js
// 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];
View asterikPyramidMiddle.js
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;
View asterikPyramid.js
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;
}
View tokenizeString.js
// 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
View nodeStaticServer.js
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);
View criteoTags.js
/* 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] + "");
}