Skip to content

Instantly share code, notes, and snippets.

View nikhresna's full-sized avatar

Nikhresna nikhresna

View GitHub Profile
@nikhresna
nikhresna / script.js
Last active September 28, 2016 18:07
Javascript currency formatter
function format(num) {
let arr = num.toString().split('').reverse();
let j = 0;
let result = '';
for(let i = 0; i < arr.length; i++) {
j = i % 3;
result = arr[i] + result;
if(j == 2 && (i < arr.length - 1)) {
@nikhresna
nikhresna / Vagrantfile
Last active December 28, 2017 16:40
Vagrantfile & provisioning for Wordpress installation
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# this will be db name and the directory project resides
!^ first argument
!$ last argument
!* all arguments
!:2 second argument
!:2-3 second to third arguments
!:2-$ second to last arguments
!:2* second to last arguments
!:2- second to next to last arguments
@nikhresna
nikhresna / appscript
Created November 2, 2017 15:46
GAPPS base64 Encoder
function encodeEmail() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var range = sheet.getDataRange();
var lastRow = range.getLastRow();
var values = range.getValues();
var col = values[0].indexOf('Email');
var colValues = sheet.getRange(2, col + 1, lastRow - 1).getValues();
server {
listen 80;
listen [::]:80;
server_name 172.105.222.69;
root /var/www/kementrian-front-end;
index index.html;
location / {
try_files $uri /index.html;
#!/bin/bash
# add nginx signing key
sudo wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
echo '================================'
# install nginx
cd /etc/apt