Skip to content

Instantly share code, notes, and snippets.

Avatar

Ricardo Reis ricardoreis

  • Santa Cruz do Sul, Brasil, RS
View GitHub Profile
View telefone
<?php
session_start();
echo '<br>token: ' . $token = isset( $_POST[ 'token' ] ) ? $_POST[ 'token' ] : '';
echo '<br>';
if ( empty( $_SESSION[ "cpf" ] ) ) {
View splice.js
/* Syntax:
* Deleting elemts
* Array.splice(position, num);
*
* Inserting elements
* Array.splice(position, 0, new_element_1, new_element_2, ...);
*/
let colors = ['red','green','blue'];
@ricardoreis
ricardoreis / queue.js
Last active May 23, 2020
JavaScript examples
View queue.js
/* Implementing a JavaScript queue using an array
* English > https://www.javascripttutorial.net/javascript-queue/
* Portugues > https://medium.com/@ricardoreis_22930/queue-fila-9a7cf32c1132
*/
function Queue(){
this.elements = []
}
// enqueue method adds an element at the end of the queue
Queue.prototype.enqueue = function (e) {
View notification.php
<?php
echo 'oi';
require __DIR__ . '/vendor/autoload.php';
$options = array(
'cluster' => 'us2',
'useTLS' => true
);
$pusher = new Pusher\Pusher(
'18d514638e535062bd73',
View stop_pump.php
<?php
$setmode17 = shell_exec("/usr/local/bin/gpio -g mode 17 out");
$gpio_off = shell_exec("/usr/local/bin/gpio -g write 17 0");
?>
View start_pump.php
<?php
$setmode17 = shell_exec("/usr/local/bin/gpio -g mode 17 out");
$gpio_on = shell_exec("/usr/local/bin/gpio -g write 17 1");
?>
View payment_received.html
<html>
<head>
<script src="jquery-3.3.1.min.js"></script>
</head>
<body style="margin:0px; padding:0px">
<video autoplay>
<source src="coke.mp4" type="video/mp4">
</video>
<script>
View index.html
<html>
<head>
<script src="https://js.pusher.com/4.3/pusher.min.js"></script>
<script>
// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;
var pusher = new Pusher('18d514638e535062bd73', {
cluster: 'us2',
View 2.php
<?php
session_start();
if(!isset($_SESSION['val'])){
exec("gpio -g mode 18 pwm && gpio pwm-ms && gpio pwmc 192 && gpio pwmr 2000");
}
function giraMotor(){
exec('gpio -g pwm 18 60');
}
View 1.php
<?php
session_start();
if(!isset($_SESSION['val'])){
exec("gpio -g mode 18 pwm && gpio pwm-ms && gpio pwmc 192 && gpio pwmr 2000");
}
function inicio(){
exec('gpio -g pwm 18 240');
}