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 / 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)
{
@rslhdyt
rslhdyt / AppServiceProvider.php
Last active June 25, 2019 03:28
[Socialite Custom Driver Test] Mock socialite with custom driver #laravel #php #socialite #mock #phpunit
// app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Services\FooApp\FooAppSocialite;
class AppServiceProvider extends ServiceProvider
@rslhdyt
rslhdyt / disable_only_full_group_by.sql
Created May 24, 2019 11:51
[Disable only_full_group_by mysql] How to disable only_full_group_by in mysql 5.* #mysql #troubleshooting #setup
set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';