Skip to content

Instantly share code, notes, and snippets.

View rslhdyt's full-sized avatar
🎯
Focusing

Risal Hidayat rslhdyt

🎯
Focusing
View GitHub Profile
@rslhdyt
rslhdyt / esign_stamping.php
Created September 14, 2023 04:33
Send stamping request
<?php
// Function to convert a file to base64
function fileToBase64($filePath) {
if (file_exists($filePath)) {
$fileData = file_get_contents($filePath);
if ($fileData !== false) {
return base64_encode($fileData);
} else {
return false; // Error reading file
@rslhdyt
rslhdyt / convert_magic.sh
Created April 18, 2023 22:01
Convert PDF page to image using image magick
# create magick shell command to convert the first page of PDF file into image format
# Usage: convert_magic.sh <PDF file> <image format> <output name>
# convert_magic.sh input.pdf png output.png
# check if the PDF file exists
if [ ! -f $1 ]; then
echo "File $1 does not exist"
exit 1
fi
@rslhdyt
rslhdyt / http-status-response
Created September 2, 2022 10:02
List of symbol of http status response
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
2xx Success
200 :ok
201 :created
202 :accepted
203 :non_authoritative_information
@rslhdyt
rslhdyt / function.php
Created August 9, 2022 14:59
Cloud function for forwarding request to whatsapp API
use Psr\Http\Message\ServerRequestInterface;
function product(ServerRequestInterface $request)
{
$name = "Banana";
$phoneNumber = "62812334444"
$queryString = $request->getQueryParams();
$name = $queryString['name'] ?? $name;
header("Location: https://api.whatsapp.com/send?phone=" . $phoneNumber . "&text=" . $name);
@rslhdyt
rslhdyt / README.md
Last active March 23, 2022 02:16
The API wrapper example for https://reqres.in/ in ruby

Reqres.in API

please see the link (https://reqres.in/) for list of endpoints

Dependencies

This API wrapper use Faraday client, please install faraday client in your local env

gem install faraday
@rslhdyt
rslhdyt / filter_parameter_logging.rb
Created June 9, 2021 10:52
Manually filter parameters or hash based on filter parameter logging config in ruby on rails application
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += %i[
passw password vendorable_id
]
@rslhdyt
rslhdyt / pos.vue
Created February 1, 2020 05:12
POS
<div>
<div class="container-fluid">
<div class="row">
<div class="col-md-8">
<b-card class="mb-3">
<b-form inline>
<label class="sr-only" for="inline-form-input-username">Cari Produk</label>
<b-input-group class="mb-2 mr-sm-2 mb-sm-0" size="lg" style="width: 50%">
<b-input id="search-product" placeholder="Cari produk..."></b-input>
<b-input-group-append>
@rslhdyt
rslhdyt / hello-vue.js
Last active November 30, 2019 06:25
[Hello Vue] Initialize vue js #vuejs
<!DOCTYPE html>
<html>
<head>
<title>Hello Vue</title>
</head>
<body>
<div id="app">
<h1>{{ message }}</h1>
</div>
</body>
@rslhdyt
rslhdyt / App.vue
Last active November 30, 2019 06:25
[watch nested data] vue js watch nested data #vuejs #javascript #vuewatch
<script>
export default {
data: () => ({
form: {
id: 1
text: 'ABC'
}
}),
watch:{
'form.id': function (newVal, oldVal){
@rslhdyt
rslhdyt / DateFormater.php
Last active September 12, 2019 16:29
[Date Mutator] Traits helper to format date object #laravel #php #traits
<?php
namespace App\Models\Traits;
use Carbon\Carbon;
trait DateFormater
{
public function appDate($attribute, $format = null)
{