Skip to content

Instantly share code, notes, and snippets.

@halgatewood
halgatewood / convert_sbv_to_srt.php
Last active Feb 22, 2020
PHP Function to Convert SBV to SRT
View convert_sbv_to_srt.php
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
View testimonial_rotator_boxed.css
/*----------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 Sep 26, 2017
A simple template for the Awesome Weather Widget Pro that shows text only. (68°F / 20°C Partly Cloudy)
View awe-text.php
<?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 Aug 4, 2017
Alexa Code for handling AudioPlayer Events
View bibletalk_event_handler.php
/*
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 Aug 4, 2017
My Lambda Code for Alexa with support for the AudioPlayer
View bibletalk_alexa.js
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
Change the text of the wind speed from "m/s" to "mph" in the Awesome Weather Widget
View hg_wind_speed_text.php
function hg_awesome_weather_wind_speed_text( )
{
return "mph";
}
add_filter('awesome_weather_wind_speed_text', 'hg_awesome_weather_wind_speed_text');
View awe_simple.php
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
Awesome Weather Wind Speed
View awe_wind_speed.php
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 Apr 13, 2017
Crontab: * * * * * /bin/bash /var/relaunch.sh
View reboot_mysql.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
View hg_plugin_locale.php
function hg_plugin_locale()
{
return 'es_ES';
}
apply_filters('plugin_locale','hg_plugin_locale');