Skip to content

Instantly share code, notes, and snippets.

@alex2020bhmg
alex2020bhmg / SQLite-PHP-quickstart.php
Created July 12, 2018 15:35 — forked from bladeSk/SQLite-PHP-quickstart.php
SQLite3 PHP Quickstart Tutorial
<?php
// This file walks you through the most common features of PHP's SQLite3 API.
// The code is runnable in its entirety and results in an `analytics.sqlite` file.
// Create a new database, if the file doesn't exist and open it for reading/writing.
// The extension of the file is arbitrary.
$db = new SQLite3('analytics.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
//-------------------------------------------------
// youtube playlist jquery plugin
301 moved permanently (redirect):
<?php
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.example.com');
die();
?>
302 moved temporarily(redirect):
<?php
header('Location: http://www.example.com');
@alex2020bhmg
alex2020bhmg / db.json
Created May 16, 2018 11:05 — forked from tuliofaria/db.json
Servidor REST simples em PHP (Como foi construído em: https://www.youtube.com/watch?v=7s5_TmBqZR8 e em https://www.devpleno.com )
{"series":[{"name":"how i met your mother","id":"1504912239"}],"genres":[]}
@alex2020bhmg
alex2020bhmg / PID.ino
Created May 8, 2018 11:23 — forked from ivanseidel/PID.ino
Simple PID Class for Arduino Projects
// (Really Simple) PID Class by Ivan Seidel
// GitHub.com/ivanseidel
// Use as you want. Leave credits
class PID{
public:
double error;
double sample;
double lastSample;
@alex2020bhmg
alex2020bhmg / json_indent.php
Created May 7, 2018 19:33 — forked from dgoguerra/json_indent.php
json prettify in PHP
/**
* Indents a flat JSON string to make it more human-readable.
*
* http://www.daveperrett.com/articles/2008/03/11/format-json-with-php/
*/
function json_indent($json)
{
$result = '';
$pos = 0;
$strLen = strlen($json);
@alex2020bhmg
alex2020bhmg / gist:71a12ca0b67ab8f800cf848f63cd8c83
Created May 4, 2018 22:00 — forked from tonyspiro/gist:490962be30a67af923de
Curl Get, Post, Put and Delete in PHP
<?php
class Curl {
public function get($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
/*___________________________________________________________________________________________________________________________________________________
_ jquery.mb.components _
_ _
_ file: jquery.mb.YTPlayer.src.js _
_ last modified: 11/05/17 19.54 _
_ _
_ Open Lab s.r.l., Florence - Italy
@alex2020bhmg
alex2020bhmg / youtube_api.js
Created April 28, 2018 10:33 — forked from toannk/youtube_api.js
Youtube API
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
var autoPlayVideo = jQuery.session.get("autoPlayVideo");
jQuery.session.set("autoPlayVideo", '0');
$('.youtube').click(function(){
$vid = $(this).attr('data-id');
$(this).find('img').remove();
$(this).addClass('active');
$(this).append('<iframe src="https://www.youtube.com/embed/'+$vid+'?autoplay=1&rel=0" allowfullscreen></iframe>');
})
в шаблоне: