Skip to content

Instantly share code, notes, and snippets.

View irsyadrdp's full-sized avatar

Irsyad Riandri irsyadrdp

  • Bandung, Indonesia
View GitHub Profile
@irsyadrdp
irsyadrdp / palindrome.php
Created January 3, 2019 02:16
Palindrome
<?php
class Palindrome
{
public static function isPalindrome($word)
{
$word = strtolower($word); // String lowercase
return ($word == strrev($word)) ? true : false; // Check palindrome, return result
}
}
@irsyadrdp
irsyadrdp / pipeline.php
Last active January 3, 2019 03:40
Pipeline
<?php
class Pipeline
{
public static function make_pipeline(...$funcs)
{
return function($arg) use ($funcs)
{
// Call each function in loop
foreach($funcs as $func) (!isset($param)) ? $param = $func($arg) : $param = $func($param);
return $param;
@irsyadrdp
irsyadrdp / workers.sql
Created January 3, 2019 07:07
Workers
-- Write only the SQL statement that solves the problem and nothing else.
-- Solution 1
SELECT a.name FROM employees a LEFT JOIN employees b ON a.id = b.managerId WHERE B.managerId is null;
-- Solution 2
SELECT name FROM employees WHERE id NOT IN (SELECT DISTINCT managerId FROM employees WHERE managerId IS NOT NULL);
@irsyadrdp
irsyadrdp / merge_names.php
Last active January 3, 2019 07:16
Merge Names
<?php
class MergeNames
{
public static function unique_names($array1, $array2)
{
// Join array, distinct array (removes duplicate)
return array_unique(array_merge($array1, $array2));
}
}
@irsyadrdp
irsyadrdp / conventional_commit_messages.md
Created February 13, 2023 16:27 — forked from qoomon/conventional-commits-cheatsheet.md
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@irsyadrdp
irsyadrdp / Drive rename.js
Created January 12, 2024 11:46 — forked from edoan/Drive rename.js
Remove "Copy of" filename prefix when copying an entire folder from one Google Drive account to another Google Drive account
/* Need to copy an entire folder from one Google Drive account to another Google Drive account?
* 1. Right-click on original folder in Google Drive
* 2. Share with the destination Google account
* 3. Go into destination account's Google Drive
* 4. Find the shared folder under "Shared with me"
* 5. Select all the files (Ctrl-A / Cmd-A)
* 6. Right-click, Make a copy
* 7. Create a New Folder in destination account's Google Drive
* 8. Go to Recent
* 9. Select all recently copied files and move to the new folder