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 | |
class WebSocket | |
{ | |
protected $url; | |
protected $protocols; | |
protected $socket; | |
public function __construct($url, $protocols = array()) | |
{ | |
$this->url = $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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset='UTF-8' /> | |
<style type="text/css"> | |
<!-- | |
.chat_wrapper { | |
width: 500px; | |
margin-right: auto; | |
margin-left: auto; |
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 | |
// GLOBALS available: $db, $currentImplementation, $currentUser, $currentSite, $currentPage | |
// PARAMS available: $sqlArray (array), $request (Web_request) | |
// | |
// GLOBALS available: $db, $currentImplementation, $currentUser, $currentSite, $currentPage | |
// PARAMS available: $sqlArray (array), $request (Web_request) | |
// | |
$string = 'thisismystringthisismystringthisismystringthisismystringthisis' | |
. 'mystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthis' | |
. 'ismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringthisismystringth' |
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_reporting(-1); | |
$host = "your-host.tld"; // your websocket url without protocol part | |
$SecWebsocketKey = "your key from websocket connection"; // try wireshark or developer Tools to get this | |
$origin = "http://$host/"; // origin for the header | |
$host = 'localhost'; //where is the websocket 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 | |
/** | |
* Recursive function to turn a DOMDocument element to an array | |
* @param DOMDocument $root the document (might also be a DOMElement/DOMNode?) | |
*/ | |
function Dom2Array($root) { | |
$array = array(); | |
//list attributes |
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 | |
class QueryBuilder { | |
const QUERY_SELECT = 1; | |
const QUERY_INSERT = 2; | |
const QUERY_UPDATE = 3; | |
const QUERY_DELETE = 4; | |
const QUERY_REPLACE = 5; | |
const PARAMETER_STRING = 1; |
Training TensorFlow models in C++
Python is the primary language in which TensorFlow models are typically developed and trained. TensorFlow does have bindings for other programming languages. These bindings have the low-level primitives that are required to build a more complete API, however, lack much of the higher-level API richness of the Python bindings, particularly for defining the model structure.
This file demonstrates taking a model (a TensorFlow graph) created by a Python program and running the training loop in C++.
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 | |
/** | |
* Basic Session Helper Class | |
* | |
* A simple helper class for handling session consistently | |
* | |
* Usage Example: | |
* <?php | |
* require 'path/to/util.session.php'; |
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 | |
/** | |
* ALERT! There are more than ten years since I wrote the first version (adaptation) of this code with PHP 5.6, | |
* then I changed my code stack and I couldn't mantain this code anymore. Ten years ago worked like a charm. | |
* Fell free to test, use, fork, update, etc. and if possible put in the comments how to fix, | |
* if it doesn't work for you as it is, so other people could find answers. | |
**/ | |
/** | |
* Get hearder Authorization |
OlderNewer