Skip to content

Instantly share code, notes, and snippets.

View halgatewood's full-sized avatar

Hal Gatewood halgatewood

View GitHub Profile
@halgatewood
halgatewood / convert_sbv_to_srt.php
Last active February 22, 2020 15:39
PHP Function to Convert SBV to SRT
function convert_sbv_to_srt( $lines )
{
if( !$lines ) return "";
// BREAK LINES ON RETURN
$lines = explode("\n", $lines);
// ADD A BLANK SPACE AT THE BEGINNING,
// I USE BLANK SPACES TO DETERMINE BETWEEN THE DIFFERENT TEXT BLOCKS
/*----------Testimonial Slider Plugin------------ */
.testimonial_rotator .has-image .img img, .testimonial_rotator_single.has-image .img img {
width: 100%;
max-width: 150px;
height: auto;
border-radius: 100px;
}
.testimonial_rotator .has-image .img {
@halgatewood
halgatewood / awe-text.php
Last active September 26, 2017 21:17
A simple template for the Awesome Weather Widget Pro that shows text only. (68°F / 20°C Partly Cloudy)
<?php if( isset($weather->data['current'])) { ?>
<div class="awe-weather">
<?php if($weather->show_icons) { ?><i class="<?php echo $weather->data['current']['icon']; ?>"></i><?php } ?>
<?php echo $weather->data['current']['temp']; ?>&deg;F &nbsp;/&nbsp; <?php echo awe_f_to_c($weather->data['current']['temp']); ?>&deg;C
&nbsp; <?php echo $weather->data['current']['description']; ?>
</div>
<?php } ?>
@halgatewood
halgatewood / bibletalk_event_handler.php
Last active August 4, 2017 15:48
Alexa Code for handling AudioPlayer Events
/*
DATABASE STRUCTURE
CREATE TABLE `alexa_events` (
`id` bigint(33) NOT NULL,
`user_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`item_id` int(33) NOT NULL,
`offsetInMilliseconds` int(33) NOT NULL,
`status` varchar(25) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@halgatewood
halgatewood / bibletalk_alexa.js
Last active August 4, 2017 15:50
My Lambda Code for Alexa with support for the AudioPlayer
exports.handler = function (event, context)
{
try
{
if (event.session.application.applicationId !== "YOUR APP ID")
{
context.fail("Invalid Application ID");
}
@halgatewood
halgatewood / hg_wind_speed_text.php
Last active May 11, 2017 18:32
Change the text of the wind speed from "m/s" to "mph" in the Awesome Weather Widget
function hg_awesome_weather_wind_speed_text( )
{
return "mph";
}
add_filter('awesome_weather_wind_speed_text', 'hg_awesome_weather_wind_speed_text');
Weather:
<?php echo $weather->data['current']['temp']; ?><sup>&deg;</sup>
<?php if($weather->show_icons) { ?><i class="<?php echo $weather->data['current']['icon']; ?>"></i><?php } ?>
@halgatewood
halgatewood / awe_wind_speed.php
Last active May 9, 2017 15:01
Awesome Weather Wind Speed
function hg_awesome_weather_wind_speed( $wind_speed_ms )
{
return number_format($wind_speed_ms / 0.44704, 0);
}
add_filter('awesome_weather_wind_speed', 'hg_awesome_weather_wind_speed');
function hg_awesome_weather_wind_speed_text( )
{
return "mph";
@halgatewood
halgatewood / reboot_mysql.sh
Created April 13, 2017 05:34
Crontab: * * * * * /bin/bash /var/relaunch.sh
#!/bin/bash
LOGFILE="/var/crons.log"
UP=$(pgrep mysql | wc -l);
if [ "$UP" -ne 1 ];
then
echo "restarting mysql at $(date)" >> $LOGFILE
sudo service mysql restart
fi
function hg_plugin_locale()
{
return 'es_ES';
}
apply_filters('plugin_locale','hg_plugin_locale');