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
@josegonzalez
josegonzalez / subdomain.php
Created December 19, 2011 21:00
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',
@jesusprubio
jesusprubio / gist:4066845
Last active March 15, 2023 11:47
Kamailio.cfg with SIP over websockets support included.NOTE: For GRUU support change (line 363): modparam("registrar", "gruu_enabled", 1)
#!KAMAILIO
#
# Kamailio (OpenSER) SIP Server v4.1 - default configuration script
# - web: http://www.kamailio.org
# - git: http://sip-router.org
#
# Direct your questions about this file to: <[email protected]>
#
# Refer to the Core CookBook at http://www.kamailio.org/wiki/
# for an explanation of possible statements, functions and parameters.
@irazasyed
irazasyed / Install Composer using MAMP's PHP.md
Last active August 6, 2024 16:43
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

@jasny
jasny / flip.js
Created March 27, 2014 13:32
Turn text upside down with JavaScript
//this script is based on coding by Reverse Fad http://www.revfad.com
function flip() {
var result = flipString(document.f.original.value.toLowerCase());
document.f.flipped.value = result;
}
function flipString(aString) {
var last = aString.length - 1;
var result = new Array(aString.length)
for (var i = last; i >= 0; --i) {
var c = aString.charAt(i)
@digitaldrummerj
digitaldrummerj / IonicSetup
Last active September 16, 2023 05:21
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.
#########################
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active November 19, 2024 18:49
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
{
"ab":{
"name":"Abkhaz",
"nativeName":"аҧсуа"
},
"aa":{
"name":"Afar",
"nativeName":"Afaraf"
},
"af":{
@dseerapu
dseerapu / gist:b768728b3b4ccf282c7806a3745d0347
Last active October 25, 2022 15:04
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) {
<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]
@MartinMuzatko
MartinMuzatko / beautify-sql-schema.js
Last active April 27, 2024 05:41
Create SQLITE schema and format it
const sqlFormatter = require('sql-formatter')
const promisify = require('promisify-node')
const fs = promisify('fs')
const path = require('path')
const INDENT = '\t'
const SCHEMAFILE = path.resolve(__dirname, 'schema.sql')
(async () => {
try {