Skip to content

Instantly share code, notes, and snippets.

View rizkiandrianto's full-sized avatar
🏠
Working from home

Rizki Andrianto rizkiandrianto

🏠
Working from home
View GitHub Profile
@rizkiandrianto
rizkiandrianto / hijri-date-sample.js
Created September 21, 2021 11:33 — forked from irfanbaigse/hijri-date-sample.js
convert Gregorian to Hijri date in javascript
import { gregorianToJulian, julianToHijri } from './hijri-util-date.js';
/**
* Gregorian to Hijri
* * First convert to Julian
* * then convert to hijri
*/
const futureDate = dayjs('2019-10-24').add(1, 'year');
// .format('YYYY-MM-DD');
const y = futureDate.year();
const d = futureDate.day();
@rizkiandrianto
rizkiandrianto / test.json
Last active October 21, 2020 02:58
Test
{
"ok": true
}
@rizkiandrianto
rizkiandrianto / number-to-words.js
Created October 7, 2020 03:41 — forked from ForbesLindesay/number-to-words.js
Convert number to words, english
function comvert(num){
var ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine',
'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen',
'seventeen', 'eighteen', 'nineteen'];
var tens = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty',
'ninety'];
var numString = num.toString();
if (num < 0) throw new Error('Negative numbers are not supported.');
@rizkiandrianto
rizkiandrianto / number-pad-zero.js
Created December 25, 2019 15:17 — forked from endel/number-pad-zero.js
Simplest way for leading zero padding in JavaScript
Number.prototype.pad = function(size) {
var s = String(this);
while (s.length < (size || 2)) {s = "0" + s;}
return s;
}
(1).pad(3) // => "001"
(10).pad(3) // => "010"
(100).pad(3) // => "100"
@rizkiandrianto
rizkiandrianto / webstoemp-gulpfile.js
Created August 27, 2019 06:53 — forked from jeromecoupe/webstoemp-gulpfile.js
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@rizkiandrianto
rizkiandrianto / rmDir.js
Created August 27, 2019 04:48 — forked from laazebislam/rmDir.js
Node Js Directory remove
var fs = require("fs");
var rmDir = function(dir, rmSelf) {
var files;
rmSelf = (rmSelf === undefined) ? true : rmSelf;
dir = dir + "/";
try { files = fs.readdirSync(dir); } catch (e) { console.log("!Oops, directory not exist."); return; }
if (files.length > 0) {
files.forEach(function(x, i) {
if (fs.statSync(dir + x).isDirectory()) {
rmDir(dir + x);
@rizkiandrianto
rizkiandrianto / Instagram CSS Gradient BG
Last active March 25, 2024 04:25 — forked from gottalovelattes/Instagram CSS Gradient BG
Instagram Theme CSS gradient background. Usually used in user avatar border as they has new story.
background: #f09433;
background: -moz-linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
background: -webkit-linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
background: linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f09433', endColorstr='#bc1888',GradientType=1 );
@rizkiandrianto
rizkiandrianto / SimpleSpotifyTimer
Last active November 7, 2018 15:09
Spotify Timer to Sleep
display dialog "Set minutes before turning off:" default answer "60"
set the time_before_sleep to the text returned of the result
delay time_before_sleep * minutes
tell the application "Spotify"
delay (duration of the current track) - the player position
pause
end tell
@rizkiandrianto
rizkiandrianto / sms_security.ino
Created October 26, 2018 03:54
Sistem Keamanan Kendaraan Dengan Menggunakan Layanan Pesan Singkat Berbasis Arduino + GSM Shield
#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"
//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
@rizkiandrianto
rizkiandrianto / inject.js
Last active June 26, 2018 03:44
Injection To Live Preview
// Here You can type your custom JavaScript...
let template = '<div class="livepreview-wrapper">' +
'<a id="minimizer"><span class="fa fa-minus"></span></a>' +
'<a id="copy">Copy To Clipboard</a>' +
'<div id="textarea-livepreview" rows="4"></div>' +
'</div>';
let style = '<style>#textarea-livepreview { width: 100%; height: 100%; position: relative }</style>'
$('body').append(template);
$('body').append(style);