Skip to content

Instantly share code, notes, and snippets.

View erowsika's full-sized avatar

Edi erowsika

  • Makassar, Indonesia
View GitHub Profile
@erowsika
erowsika / excel_report.php
Created December 7, 2022 02:58
spatie/simple-excel example
<?php
use Spatie\SimpleExcel\SimpleExcelWriter;
$username = "blabla";
$pass = "3CVzq8MmV8U3TXDL";
$host = "localhost";
$db = "db_arsip";
<?php
// simpan fungsi ini di mana kek. contoh di arspi/helpers.php
// trus panggil ki di setiap pemanggilan echo
if (! function_exists('e')) {
function e($value, $doubleEncode = true)
{
return htmlspecialchars($value ?? '', ENT_QUOTES, 'UTF-8', $doubleEncode);
}
}
<?php
function e($value, $doubleEncode = true) {
return htmlspecialchars($value ?? '', ENT_QUOTES, 'UTF-8', $doubleEncode);
}
function dd($var) {
$backTrace = debug_backtrace();
$file = $backTrace[0]['file'];
$line = $backTrace[0]['line'];
@erowsika
erowsika / my.cnf
Created January 1, 2022 11:38 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
$request = null;
$('form').on('submit', function(event) {
event.preventDefault();
if ($request != null) {
$request.abort();
$request = null;
}
@erowsika
erowsika / esnextbin.md
Created December 30, 2021 13:37 — forked from peduarte/esnextbin.md
Vanilla Debounce
@erowsika
erowsika / .htaccess
Last active January 4, 2022 05:42
apache secure upload assets folder
#
# secure directory by disabling script and html execution
#
<filesMatch "\.(php|php3|php4|php5|php6|php7|php8|pl|py|jsp|asp|htm|html|xhtml|shtml|sh|cgi)$">
Order Deny,Allow
Deny from All
</filesMatch>
@erowsika
erowsika / std.md
Created December 30, 2021 08:58 — forked from turbo/std.md
Git Commit Message Standard

Merged from https://github.com/joelparkerhenderson/git_commit_message and https://chris.beams.io/posts/git-commit/

General Rules

  • Commit messages must have a subject line and may have body copy. These must be separated by a blank line.
  • The subject line must not exceed 50 characters
  • The subject line should be capitalized and must not end in a period
  • The subject line must be written in imperative mood (Fix, not Fixed / Fixes etc.)
  • The body copy must be wrapped at 72 columns
  • The body copy must only contain explanations as to what and why, never how. The latter belongs in documentation and implementation.
<?php
// copied from https://raw.githubusercontent.com/DataTables/DataTables/master/examples/server_side/scripts/ssp.class.php
function array_pluck($a, $prop)
{
$out = array();
for ( $i=0, $len=count($a) ; $i<$len ; $i++ ) {
if(empty($a[$i][$prop])){
continue;
<?php
// file ssp.class.php
// https://raw.githubusercontent.com/DataTables/DataTables/master/examples/server_side/scripts/ssp.class.php
/*
* Helper functions for building a DataTables server-side processing SQL query
*
* The static functions in this class are just helper functions to help build
* the SQL used in the DataTables demo server-side processing scripts. These