Skip to content

Instantly share code, notes, and snippets.

View fajarwz's full-sized avatar
👨‍💻
Working from anywhere

Fajar Windhu Zulfikar fajarwz

👨‍💻
Working from anywhere
View GitHub Profile
@fajarwz
fajarwz / qna.md
Last active September 10, 2024 06:29
Questions from IxDF
  1. Please describe an interest, favorite activity, or hobby of yours. It could be anything: just something you enjoy doing. For this particular answer, please only write up to 60 words and do it in a way that captivates your readers (us!).

    I have a dream of becoming a top software engineer, so I love discovering new technologies and honing my skills. Whether it’s coding for personal projects or learning the latest trends in software engineering, I’m always looking for ways to level up. I don't have much free time, so I accelerate my growth by investing in well-designed courses on platforms like Udemy.

  2. What is most important to you when you look for a new job? Please be completely honest and transparent about your situation and season of life; we’re not looking for “the right answer”. The more you tell us, the better we can align.

When I look for a new job, career growth and competitive salary are both important factors for me. At this stage of my career, I am focused on oppor

@fajarwz
fajarwz / binarySearch.php
Created November 19, 2023 06:51
search for a value in a sorted array using Binary Search, the best searching algorithm for a sorted array
<?php
function binarySearch($arr, $target) {
$left = 0;
$right = count($arr) - 1;
while ($left <= $right) {
$mid = floor(($left + $right) / 2);
// Check if the target is present at the middle
@fajarwz
fajarwz / README.md
Created October 13, 2023 03:34
notes for CD with Github Actions

How to create CD with Github Actions

  • using appleboy/ssh-action@master for cd
  • see cd.yml for the yml example
  • make sure the SSH_KEY is correct. Use the SSH private key. create SSH key in your server and copy the private key to Github Secrets
  • make sure to write your public key to authorized keys in server. you can use this command to do that: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  • make sure that the server dont ask password while we git pulling it manually. Use this command: "git config credential.helper store" or "git config --global credential.helper store" to store the git credential in cache. after we once again pulling the repo in the server, the git cache our credential. with that when github actions try to pull the repo automatically, it doesnt need to write credentials
@fajarwz
fajarwz / simple-nginx.conf
Created October 2, 2023 02:30
Simple Nginx Configuration
server {
listen 80;
# server_name _;
root /var/www/laracuss/public; # project-name/public
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
@fajarwz
fajarwz / toPascalCase.php
Created July 14, 2022 15:07
Solution for a "Convert words to PascalCase" challenge
<?php
// For example: if str is "BOB loves-coding" then your program should return the string bobLovesCoding.
function toPascalCase($str) {
$separators = [' ', '-', '%', '*'];
$separatorsInString = implode('', $separators);
return str_replace($separators, '', ucwords(strtolower($str), $separatorsInString));
}
<?php
// https://coderbyte.com/algorithm/stock-maximum-profit
function StockPicker($arr) {
$buyPrice = 0;
$sellPrice = 0;
$maxProfit = -1;
$changeBuyIndex = true;
@fajarwz
fajarwz / helpers.php
Last active July 2, 2022 07:07
API Response for PHP / Laravel with meta properties
<?php
// app/helpers.php in Laravel
// add this file to "files" in composer.json
// "autoload": {
// "psr-4": {
// ...
// },
// "files": [
// "app/helpers.php"
@fajarwz
fajarwz / min_dice_flip_count.php
Created February 21, 2022 16:08
get minimum dice flip count
<?php
function flip_count($arr) {
$flip_count;
$min_flip_count = 9999999;
foreach ($arr as $value) {
$flip_count = 0;
foreach ($arr as $value2) {
if ($value == $value2) {
@fajarwz
fajarwz / opposite_dice_problem.php
Created February 21, 2022 15:55
get the opposite number of a dice
<?php
// dice problem
function get_the_opposite($n) {
return 7 - $n;
}
echo get_the_opposite(3);
@fajarwz
fajarwz / install-laravel-swoole
Last active December 22, 2023 15:50
install laravel swoole on Ubuntu 21.04
# using Ubuntu
# install laravel first
laravel new my-app
# get laravel octane package
composer require laravel/octane
# maybe you encountering an error such as "require ext-curl". You can install it with this command
sudo apt-get install php-curl
# then install it again using "composer require laravel/octane"