Skip to content

Instantly share code, notes, and snippets.

View ricardoreis's full-sized avatar

Ricardo Reis ricardoreis

  • Santa Cruz do Sul, Brasil, RS
View GitHub Profile
<?php
session_start();
echo '<br>token: ' . $token = isset( $_POST[ 'token' ] ) ? $_POST[ 'token' ] : '';
echo '<br>';
if ( empty( $_SESSION[ "cpf" ] ) ) {
/* 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 16:28
JavaScript examples
/* 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) {
<?php
echo 'oi';
require __DIR__ . '/vendor/autoload.php';
$options = array(
'cluster' => 'us2',
'useTLS' => true
);
$pusher = new Pusher\Pusher(
'18d514638e535062bd73',
<?php
$setmode17 = shell_exec("/usr/local/bin/gpio -g mode 17 out");
$gpio_off = shell_exec("/usr/local/bin/gpio -g write 17 0");
?>
<?php
$setmode17 = shell_exec("/usr/local/bin/gpio -g mode 17 out");
$gpio_on = shell_exec("/usr/local/bin/gpio -g write 17 1");
?>
<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>
<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',
@ricardoreis
ricardoreis / 2.php
Last active June 23, 2018 18:54
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');
}
@ricardoreis
ricardoreis / 1.php
Last active March 11, 2019 15:44
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');
}