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); |
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
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
# 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
<?php | |
// made this way so it only has to be called once | |
// did a dumb thing using a date/time storage with separate date time fields in MySQL with hourly period in the time part | |
// harder to sort natively with MySQL | |
function split_date_time($cur_date_time) { | |
// split date_time components | |
$date_time_split = explode(' ', $cur_date_time); | |
// return array |
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
.flex { | |
display: flex; | |
} | |
/* alignment */ | |
/* top */ | |
.flt { | |
justify-content: flex-start; /* x-axis */ | |
align-items: flex-start; /* y-axis */ | |
} | |
.fct { |
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); |
NewerOlder