Skip to content

Instantly share code, notes, and snippets.

View aznoisib's full-sized avatar

aznoisib aznoisib

View GitHub Profile
@aznoisib
aznoisib / About.md
Created August 29, 2019 12:37 — forked from edm00se/About.md
Progress bar indicator (jQuery).
@aznoisib
aznoisib / browser_detect.js
Created August 29, 2019 10:10 — forked from Fl0pZz/browser_detect.js
JavaScript: Detect Browser
// browser detect
var BrowserDetect = {
init: function(userAgent, appVersion) {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(userAgent) || this.searchVersion(appVersion) || "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function(data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
@aznoisib
aznoisib / xhr.js
Last active February 19, 2021 19:42 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@aznoisib
aznoisib / gist:00d72915b513c2e6b9a1f35df8427008
Created August 2, 2019 09:07 — forked from voskobovich/gist:15ad5fc71e957bbe87d45cd88295f5b8
Video streamer from remote server by HTTP on PHP (Yii2)
/**
* @param $url
*/
public function actionStreamVideoFromCdn($url)
{
$headersCollection = Yii::$app->request->getHeaders();
$responseHeaders = [];
$chInfo = curl_init();
curl_setopt($chInfo, CURLOPT_URL, $url);
@aznoisib
aznoisib / attachment.php
Created August 2, 2019 09:07 — forked from ssut/attachment.php
UTF-8 file download function, support remote file passing(proxy) with http range header
<?php
/**
* PHP File download function.
* Version 1.4
*
* Copyright (c) 2014 성기진 Kijin Sung
* Modified by ssut
*
* License: MIT License (a.k.a. X11 License)
@aznoisib
aznoisib / ftp_download.php
Created August 2, 2019 04:48 — forked from staatzstreich/ftp_download.php
Download a directory from an FTP Server
<?php
// ftp_sync - copy directory and file structure
// based on http://www.php.net/manual/es/function.ftp-get.php#90910
// main function witch is called recursivly
function ftp_sync($dir, $conn_id) {
if ($dir !== '.') {
if (ftp_chdir($conn_id, $dir) === FALSE) {
echo 'Change dir failed: ' . $dir . PHP_EOL;
return;
@aznoisib
aznoisib / download_file.php
Created August 2, 2019 02:57 — forked from saleemkce/download_file.php
PHP File Download Script - Download large file in chunks.
<?php
/*ini settings*/
set_time_limit(0);
ini_set('memory_limit', '512M');
//DOWNLOAD SCRIPT
$filePath = "G:/Software/versions/..PATH TO DOWNLOAD FILE...zip"; // set your download file path here.
download($filePath); // calls download function
function download($filePath)
{
@aznoisib
aznoisib / unzip.php
Created August 1, 2019 23:50 — forked from kirtan403/unzip.php
PHP script to remotely zip/unzip archives of your FTP
<?php
function show($str){
echo $str . "<br/>\n";
flush();
ob_flush();
}
$archiveDir = "temp";
@aznoisib
aznoisib / codeiginter-server-config.md
Created April 23, 2019 18:06 — forked from yidas/codeiginter-server-config.md
Codeigniter 3 server configuration for Nginx & Apache

Codeigniter 3 server configuration for Nginx & Apache

Web Server Site Configuration

Recommended Apache Configuration

Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot and ServerName fit to your environment: