Skip to content

Instantly share code, notes, and snippets.

View johnsage25's full-sized avatar
🏠
Working from Office

John Nwanosike johnsage25

🏠
Working from Office
View GitHub Profile
@johnsage25
johnsage25 / gist:ba6d37465185911232528e8adf9a55a8
Created July 7, 2017 18:40 — forked from nghuuphuoc/gist:7801133
Install ImageMagick on Centos 6
// Install ImageMagick
$ yum install ImageMagick ImageMagick-devel
// Install php imagick extension
$ yum --enablerepo=remi,remi-test install php-pecl-imagick
@johnsage25
johnsage25 / subdomain.php
Created April 26, 2018 21:28 — forked from josegonzalez/subdomain.php
subdomain component for cakephp that depends on a model
<?php
class SubdomainComponent extends Object {
var $__settings = array(
'base' => 'example.com',
'domains' => array(),
'param' => 'subdomain',
'redirect' => true,
'redirectTo' => 'http://example.com',
'model' => 'DomainPrefix',
@johnsage25
johnsage25 / Cordova Windows Setup
Last active September 23, 2018 16:27 — forked from digitaldrummerj/IonicSetup
Setup script to install everything needed for Ionic Framework using Chocolatey.
#########################
# This gist is meant to be used to install everything needed to get up and running with the Ionic Framework on Windows using Chocolatey (http://chocolatey.org)
# Read "How to use this Gist File" section below for instructions.
#########################
#########################
# NOTE : for those familiar with Chocolatey, there are a couple of custom packages used as part of the install that are not published and are waiting on maintainers to make updates to their packages.
#########################
@johnsage25
johnsage25 / Update VestaCP to PHP 7.1 on CentOS 7
Created November 4, 2018 18:45
his guide is very similar to our other guide on installing PHP 7 since we’re using the same method although this time, as the title suggests we’ll be using the latest stable version of PHP instead, 7.1.
sudo yum update
php -v
sudo yum install yum-utils
sudo yum-config-manager --enable remi-php71
sudo yum update
After the process has finished your server will now have PHP 7.1 installed, we need to restart our web server for it to take effect however.
If you have Apache and NGINX installed, or just Apache installed run
sudo service httpd restart
@johnsage25
johnsage25 / gist:37e70a88101d94bb8a31619732601fbf
Created July 7, 2019 20:41 — forked from dseerapu/gist:b768728b3b4ccf282c7806a3745d0347
Android app inactivity timeout | Android Logout timer
public class LogOutTimerUtil {
public interface LogOutListener {
void doLogout();
}
static Timer longTimer;
static final int LOGOUT_TIME = 600000; // delay in milliseconds i.e. 5 min = 300000 ms or use timeout argument
public static synchronized void startLogoutTimer(final Context context, final LogOutListener logOutListener) {
@johnsage25
johnsage25 / abbreviate.php
Created October 15, 2019 22:58
Abbreviate a string using PHP. This function returns a string containing only the first letters of each word in an input string capitalized.
function abbreviate($string){
$abbreviation = "";
$string = ucwords($string);
$words = explode(" ", "$string");
foreach($words as $word){
$abbreviation .= $word[0];
}
return $abbreviation;
}
@johnsage25
johnsage25 / gist:2de3c7f291f3ba05fd9fe6afd5a32a67
Last active March 15, 2020 20:42
How to Install Python 3.6.4 on CentOS 7
How to Install Python 3.6.4 on CentOS 7
========================
We’ll show you how to install Python 3.6.4 on CentOS 7. Python is at the core of many popular websites and programs – YouTube,
Instagram, and even Yum on CentOS, to name a few. They all rely on Python’s reliability and performance to complete many tasks at a time.
Python is a general-purpose object-oriented
programming language designed to be used as a software solution for almost all kinds of problems.
However, the pre-installed version of Python found on CentOS 7 is a much older version.
In order to have the latest version of Python, the user will have to install it manually.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
@johnsage25
johnsage25 / ffmpeg-compress-mp4
Created June 14, 2020 21:18 — forked from lukehedger/ffmpeg-compress-mp4
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@johnsage25
johnsage25 / react-native-offline-bundling-android
Created June 26, 2020 22:30 — forked from erikyuntantyo/react-native-offline-bundling-android
Build react-native offline bundling into android
# create assets folder in the current project
$ mkdir android/app/src/main/assets
# create bundle script
$ react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
# execute command to run android to create debug apk
$ react-native run-android
# Or change to android folder