Skip to content

Instantly share code, notes, and snippets.

View goesredy's full-sized avatar

Ida Bagus Redy Santiawan goesredy

View GitHub Profile
@goesredy
goesredy / bs4-tabs-accordion-example.html
Created March 31, 2023 03:53 — forked from filkris/bs4-tabs-accordion-example.html
Bootstrap 4 Responsive Tabs to Accordion Snippet
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Responsive Nav Tabs to Accordion Snippet">
<meta name="author" content="Filkris">
<title>Bootstrap 4 Responsive Nav Tabs to Accordion Snippet</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<!-- Snippet start -->
<?php
$str_path = '/PATH/';
$cls_rii = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator( $str_path ),
\RecursiveIteratorIterator::CHILD_FIRST
);
$ary_files = array();
@goesredy
goesredy / mac-homebrew-lamp.md
Created August 10, 2022 19:27 — forked from kitloong/mac-homebrew-lamp.md
Mac - Install Apache, PHP, MySQL + phpMyAdmin with Homebrew

!!! This guide was created with Macbook Pro M1. Path may vary for different or even same machine.

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Install PHP

@goesredy
goesredy / withAndWhereHas.php
Created February 18, 2021 13:00 — forked from cartoonclouds/withAndWhereHas.php
Laravel - WithAndWhereHas Scope
public function scopeWithAndWhereHas($query, $relation, $constraint){
return $query->whereHas($relation, $constraint)
->with([$relation => $constraint]);
}
@goesredy
goesredy / embedded-file-viewer.md
Created January 15, 2021 10:39 — forked from wheelcomplex/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@goesredy
goesredy / install-composer.sh
Created October 1, 2019 12:58 — forked from virbo/install-composer.sh
Install Composer on CWP (Centos 7)
#!/bin/bash
# Install Composer on Centos, Ubuntu, Debian
# Author Yusuf Ayuba
user_allow="root"
if [ "$(whoami)" != $user_allow ]; then
echo "==================================================================="
echo " Installasi gagal. Install composer harus menggunakan user: "$user_allow" ="
echo "==================================================================="
@goesredy
goesredy / dl.php
Created August 16, 2019 16:07 — forked from fzerorubigd/dl.php
A simple download script with resume and multi-part support
<?php
date_default_timezone_set('GMT');
//1- file we want to serve :
$data_file = "/home/f0rud/Aalto Talk with Linus Torvalds [Full-length].mp4";
$data_size = filesize($data_file); //Size is not zero base
$mime = 'application/otect-stream'; //Mime type of file. to begin download its better to use this.
$filename = basename($data_file); //Name of file, no path included
@goesredy
goesredy / gist:f3ff35c0ee1a38f70ba25862c047c2f7
Created August 10, 2019 19:13 — forked from branneman/gist:951847
array_find() - A case insensitive array_search() with partial matches
<?php
/**
* Case in-sensitive array_search() with partial matches
*
* @param string $needle The string to search for.
* @param array $haystack The array to search in.
*
* @author Bran van der Meer <branmovic@gmail.com>
* @since 29-01-2010
*/
@goesredy
goesredy / letsencrypt_apache_2018.md
Created August 10, 2019 18:05 — forked from omushpapa/letsencrypt_apache_2018.md
How to configure SSL using LetsEncrypt and Certbot on Apache in Ubuntu 16.04

How to setup Let's Encrypt for Apache on Ubuntu 16.04

In the following, we're setting up mydomain.com.

Challenges are served from /var/www/letsencrypt.

Apache snippets

First we create two snippets (to avoid duplicating code in every virtual host configuration).

@goesredy
goesredy / build-tree.php
Created August 10, 2019 06:05 — forked from vyspiansky/build-tree.php
PHP: convert object / array to tree structure
<?php
/*
* Source: http://goo.gl/p2GybZ
*/
// for object
function buildTree($items) {
$childs = array();
foreach($items as $item)