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 sendWebhook($message) { | |
$webhook_url = ""; | |
// slack webhook test | |
$data = "payload=" . json_encode(array( | |
"text" => $message | |
)); | |
$ch = curl_init($webhook_url); |
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
# this code is based on the Adafruit MCP3008 library being installed and the ADC being properly wired to your Raspberry Pi | |
# and source of analog data | |
# for math division | |
from __future__ import division | |
# Import SPI library (for hardware SPI) and MCP3008 library. | |
import Adafruit_GPIO.SPI as SPI | |
import Adafruit_MCP3008 |
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
SELECT fruit_name FROM fruits WHERE fruit_name = :fruit_name |
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 | |
$fruit_names = []; | |
$stmt = $dbh->prepare('SELECT id, fruit_name FROM fruits'); | |
if ($stmt->execute()) { | |
$result = $stmt->fetchAll(); | |
$result_count = count($result); | |
if ($result_count > 0) { | |
foreach($result as $row) { |
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 | |
// memcache test | |
$server = 'localhost'; | |
if (!empty($_REQUEST['server'])) { | |
$server = $_REQUEST['server']; | |
} | |
$memcache = new Memcache; | |
$isMemcacheAvailable = @$memcache->connect($server); |
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 | |
// memcache test | |
$server = 'localhost'; | |
if (!empty($_REQUEST['server'])) { | |
$server = $_REQUEST['server']; | |
} | |
$memcache = new Memcache; | |
$isMemcacheAvailable = @$memcache->connect($server); | |
// check memcache |
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 | |
// memcache test | |
$server = 'localhost'; | |
if (!empty($_REQUEST['server'])) { | |
$server = $_REQUEST['server']; | |
} | |
$memcache = new Memcache; | |
$isMemcacheAvailable = @$memcache->connect($server); | |
// check memcache |
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 | |
// error checking | |
ini_set('display_errors', 1); | |
// require php-defuse.phar | |
require_once('defuse-crypto.phar'); | |
use Defuse\Crypto\Crypto; | |
use Defuse\Crypto\Key; |
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
<!-- this is based on Twilio's example https://demo.twilio.com/docs/voice.xml --> | |
<Response> | |
<Say voice="alice"> | |
Your message | |
</Say> | |
</Response> |
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
/* | |
The URL is an XML file telling Twilio's phone call "bot?" what to do | |
View an example here https://gist.github.com/jdc-cunningham/af131c042309d1ccd8acd5bcc626b0de | |
The code below is from Twilio's example | |
https://www.twilio.com/docs/voice/make-calls | |
*/ | |
<?php |
OlderNewer