Skip to content

Instantly share code, notes, and snippets.

@tuamtium
tuamtium / .gitignore
Created May 9, 2020 22:52 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@tuamtium
tuamtium / functions-upload.php
Created February 9, 2018 03:06
PHP function: Upload file to specific folder
<?php
/***** Upload File *****/
function upload($file_id, $folder="", $types="") {
if(!$_FILES[$file_id]['name']) return array('','No file specified');
$file_title = $_FILES[$file_id]['name'];
//Get file extension
$ext_arr = explode(".",basename($file_title));
$ext = strtolower($ext_arr[count($ext_arr)-1]); //Get the last extension
@tuamtium
tuamtium / functions-client.php
Last active February 9, 2018 03:05
Useful PHP functions to get client's IP address, OS and browser
<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];
/***** Get client's IP address *****/
function getIP() {
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP')){
$ipaddress = getenv('HTTP_CLIENT_IP');
}else if(getenv('HTTP_X_FORWARDED_FOR')){
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install