Skip to content

Instantly share code, notes, and snippets.

View ryumada's full-sized avatar
🤔
What should I code?

Rizuki Ryumada ryumada

🤔
What should I code?
  • garasijogi
  • Indonesia
View GitHub Profile
@ryumada
ryumada / daterange_oneMonthLater.js
Last active October 25, 2021 02:45
get daterange one month javascript
const getDaterangeOneMonth = () => {
let date = new Date();
let dateLater = new Date();
dateLater.setDate(date.getDate() + 30);
return `${date.toISOString().split("T")[0]} - ${dateLater.toISOString().split("T")[0]}`;
}
console.log(getDaterangeOneMonth); // 2021-10-25 - 2021-11-24
@ryumada
ryumada / office_word-fix_blackedout_numbering.md
Last active November 8, 2021 04:59
Fix blacked out numbering in microsoft word

You can fix that by following these steps:

  1. Place your cursor into the styles with blacked-out numbering. image

  2. Press ctrl + shift + S, then a popup will be showed up like the screenshot below image

  3. Without changing anything, just press reapply button and your numbering will be back to normal again.

  4. If not, you must remake again your multilevel list

@ryumada
ryumada / sql-CheatSheet.md
Last active October 5, 2021 01:50
My SQL Cheatsheet
@ryumada
ryumada / git-shell-commands.sh
Last active September 27, 2021 09:22
Important git shell commands
# refresh local branches to remote server
git remote update origin --prune
# remove cloned branch item
# remove staged branch item
git rm -rf
# remove files in origin after add it to .gitignore
# remove cached file in origin
git rm --cached file1.txt
@ryumada
ryumada / index.html
Created February 2, 2021 01:41
summernote jquery validation and swal toast
<div class="container pt-5">
<div class="row">
<div class="col-lg-8">
<form class="form-validate-summernote">
<div class="form-group">
<label>Name</label>
<input class="form-control" name="form2-name" type="text" required="required" data-msg="Please enter your name"/>
</div>
<div class="form-group">
<label>Text</label>
@ryumada
ryumada / javascript-php-html-char-escape.js
Created February 1, 2021 13:37
print html native tag to javascript variable using php echo
let string = <?php echo "`" . trim(preg_replace('/\s\s+/', ' ', nl2br($summary_notes[$whoami]['text']))) . "`"; ?>;
console.log(string);
@ryumada
ryumada / generate_words.js
Created January 24, 2021 02:26
Generate any title words with javascript
// generates random words
function createRandomWord(length) {
var consonants = 'bcdfghjlmnpqrstv',
vowels = 'aeiou',
rand = function(limit) {
return Math.floor(Math.random()*limit);
},
i, word='', length = parseInt(length,10),
consonants = consonants.split(''),
vowels = vowels.split('');
@ryumada
ryumada / laravel-call-other-command.php
Last active January 20, 2021 10:44
Using call command to call single seeder file on laravel 7
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
class RefreshDatabaseCommand extends Command
{
@ryumada
ryumada / jquery-swal-scroll.js
Last active November 13, 2020 06:46
this is jquery script to scroll on swal modal close.
Swal.fire({
title: 'Form Validation Error',
html: "Please fill the required input form.",
icon: 'warning',
showCancelButton: false,
// confirmButtonColor: '#99FF99',
// cancelButtonColor: '#d33',
confirmButtonText: 'Ok, I wiil check it.',
allowOutsideClick: false,
allowEscapeKey: false,
@ryumada
ryumada / php_convert-to-csv.php
Last active February 7, 2021 01:52
function to create an associative array from csv file using fgetcsv.
<?php
// add some classes or add this function to your class
public function convertToCsv(){
$file = fopen(base_url('mycsv.csv'), 'r'); // take file location
$arr = array(); $x = 0; $index = array(); // prepare variable for container and index
while (($line = fgetcsv($file)) !== FALSE) { // iteration on each line of csv
//$line is an array of the csv elements
if($x == 0){ // for the first line, use it as index
foreach($line as $k => $v){ // iterate the first line