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 / 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;
}
<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
{
"ab":{
"name":"Abkhaz",
"nativeName":"аҧсуа"
},
"aa":{
"name":"Afar",
"nativeName":"Afaraf"
},
"af":{
@johnsage25
johnsage25 / firestoreTransforms.js
Created July 28, 2020 16:39 — forked from samthecodingman/firestoreTransforms.js
A collection of helper functions for transforming the results of Firebase Cloud Firestore Queries.
/*! firestoreTransforms.js | Samuel Jones 2019 | MIT License | gist.github.com/samthecodingman */
/**
* @file A file containing common firestore idioms used with queries
* @author Samuel Jones 2017 (github.com/samthecodingman)
* @license MIT
* @module firestore-transforms
*/
/**