This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Based on http://jsfiddle.net/i_like_robots/W2DA8/ | |
(function(name, context, definition) { | |
if (typeof define === 'function' && define.amd) { | |
define(definition); | |
} | |
else if (typeof module !== 'undefined' && module.exports) { | |
module.exports = definition(); | |
} | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function table_from_array( $cols, $tableclass = 'info' ) { | |
$content = "<table class=\"" . $tableclass . "\">\n"; | |
$i = 1; | |
foreach ( $cols as $key => $value ) { | |
if ( !empty( $value ) ) { | |
$i++; | |
if ( $i % 2 === 0 ) { | |
$content .= "<tr>"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//With locationbar.visible check if not in a webview (like an open web app) | |
if (locationbar.visible) { | |
//mozApps used for the open web app and with the user agent check if have MObile (used in Firefox OS) | |
if (navigator.userAgent.indexOf('Firefox') > -1 && navigator.userAgent.indexOf("Mobile") > -1) { | |
//Check Firefox OS | |
} else if (navigator.userAgent.indexOf('Firefox') > -1 && navigator.userAgent.indexOf("Android") > -1) { | |
//Check Firefox for Android | |
} else if (navigator.userAgent.indexOf("Firefox") > -1) { | |
//Check Firefox Desktop | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sortArrayByArray( $array, $orderArray ) { | |
$order = array(); | |
foreach ( array_keys( $array ) as $index ) { | |
foreach ( array_keys( $orderArray ) as $key ) { | |
$order[ $index ][ $key ] = $array[ $index ][ $key ]; | |
} | |
} | |
return $order; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "Parsing Freemius Webhook"; | |
// Get Freemius data | |
$json = file_get_contents('php://input'); | |
$data = json_decode($json, true); | |
if( isset($data['objects']['user']) ) { | |
// Let's call our opensupports instance | |
$name = $data['objects']['user']['first'] . ' ' . $data['objects']['user']['last']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getVersion() { | |
if (navigator.userAgent.match(/(mobile|tablet)/i)) { | |
var ffVersionArray = (navigator.userAgent.match(/Firefox\/([\d]+\.[\w]?\.?[\w]+)/)); | |
if (ffVersionArray.length === 2) { | |
//Check with the gecko version the Firefox OS version | |
//Table https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference | |
var hashVersion = { | |
'18.0': '1.0.1', | |
'18.1': '1.1', | |
'26.0': '1.2', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
locale=$1 | |
function replace() { | |
sed -i.bak s#https://"$1".wordpress.org/forums/#https://forums.classicpress.net/c/support#g /tmp/"$1"-"$2".po | |
sed -i.bak s/WordPress.org/ClassicPress.net/g /tmp/"$1"-"$2".po | |
sed -i.bak s/WordPress/ClassicPress/g /tmp/"$1"-"$2".po | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('rest_authentication_errors', function ($result) { | |
if (!empty($result)) { | |
return $result; | |
} | |
$access = is_user_logged_in(); | |
if ( !$access ) { | |
if ( !isset($_GET['iwantthem']) || isset($_GET['iwantthem']) && $_GET['iwantthem'] !== 'yes' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Alert Last Login | |
* Plugin URI: | |
* Description: | |
* Version: 1.0.0 | |
* Author: Codeat | |
* Author URI: http://codeat.it | |
* License: GPL-2.0+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function extract() { | |
echo "Estraggo $1.rar" | |
unrar e "./$1.rar" \*.txt \*.wav './clips-mitads/' -o+ | |
} | |
if [ ! -d './clips-mitads' ]; then | |
mkdir './clips-mitads' | |
fi |
OlderNewer