Skip to content

Instantly share code, notes, and snippets.

View antelove19's full-sized avatar

Falah Al Fitri antelove19

View GitHub Profile
@antelove19
antelove19 / PdfParser.php
Created January 25, 2018 20:41 — forked from smalot/PdfParser.php
Use this static class to extract Text from Pdf files. It supports compressed and uncompressed Pdf (version 1.1 to 1.7) : tested It supports octal encoded (eg : \050) content, but not hexadecimal (eg : <005E>). In some cases, it works better than "pdftotext" binary tool.
<?php
/**
* @file
* Class PdfParser
*
* @author : Sebastien MALOT <sebastien@malot.fr>
* @date : 2013-08-08
*
* References :
@antelove19
antelove19 / transfer-copy.php
Created January 25, 2018 20:54 — forked from sarathlal-old/transfer-copy.php
Transfer files from server to server using PHP `copy()` function.
<?php
// Insert this file on server and go to the path from browser.
set_time_limit(0); //Unlimited max execution time
/* Source File URL */
$remote_file_url = 'http://origin-server-url/files.zip';
/* New file name and path for this file */
$local_file = 'files.zip';
@antelove19
antelove19 / upload.php
Created January 25, 2018 20:55 — forked from gayanhewa/upload.php
PHP Script to upload files via FTP
<?php
// Ref : http://php.net/manual/en/function.ftp-put.php
$name = "test.txt";
$filename = "/home/mine/Desktop/test.txt";
//-- Code to Transfer File on Server Dt: 06-03-2008 by Aditya Bhatt --//
//-- Connection Settings
$ftp_server = "server_url_here"; // Address of FTP server.
$ftp_user_name = "username_here"; // Username
@antelove19
antelove19 / embedded-file-viewer.md
Created February 1, 2018 07:29 — forked from tzmartin/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

@antelove19
antelove19 / index.php
Created February 6, 2018 07:44 — forked from abel-masila/index.php
A simple USSD registration application written in PHP
<?php
/* Simple sample USSD registration application
* USSD gateway that is being used is Africa's Talking USSD gateway
*/
// Print the response as plain text so that the gateway can read it
header('Content-type: text/plain');
/* local db configuration */
$dsn = 'mysql:dbname=dbname;host=127.0.0.1;'; //database name
@antelove19
antelove19 / pdf-thumbnail-php.md
Created February 22, 2018 17:41 — forked from umidjons/pdf-thumbnail-php.md
Creating PDF thumbnails in PHP

Creating PDF thumbnails in PHP

Install Ghostscript

Download and install right version of ghostscript. In my case my PHP was x86 architecture, so I download Ghostscript 9.14 for Windows (32 bit).

Enable ImageMagick

@antelove19
antelove19 / CodeIgniter_PDOSQLiteMySQL.php
Created August 3, 2018 06:56 — forked from yuigoto/CodeIgniter_PDOSQLiteMySQL.php
How to setup PDO and SQLite for CodeIgniter (for SQLite and MySQL). This is the `database.php` file in `the application/config` folder
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$active_group = 'default';
$query_builder = TRUE;
// FOR SQLITE
$db['default'] = array(
'dsn' => 'sqlite:[path-to-database-file]',
'hostname' => 'localhost',
@antelove19
antelove19 / config.php
Created August 14, 2018 05:50 — forked from DennisRas/config.php
Autoloader for CodeIgniter
function __autoload($class)
{
if (strpos($class, 'CI_') !== 0)
{
if (file_exists($file = APPPATH . 'core/' . $class . EXT))
{
include $file;
}
elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT))
{
@antelove19
antelove19 / simple_editor.js
Created August 17, 2018 15:38 — forked from actsasbuffoon/simple_editor.js
A very simple jQuery based textarea editor
// This is shamelessly copied from http://stackoverflow.com/questions/263743/how-to-get-cursor-position-in-textarea#answer-3373056
function getInputSelection(el) {
var start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange;
if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") {
start = el.selectionStart;
end = el.selectionEnd;
}
else {
range = document.selection.createRange();
if (range && range.parentElement() == el) {
@antelove19
antelove19 / dir_is_empty.php
Created September 2, 2018 10:01 — forked from mistic100/dir_is_empty.php
[PHP] Check if a folder is empty
<?php
/**
* Check if a directory is empty (a directory with just '.svn' or '.git' is empty)
*
* @param string $dirname
* @return bool
*/
function dir_is_empty($dirname)
{
if (!is_dir($dirname)) return false;