Skip to content

Instantly share code, notes, and snippets.

View ribafs's full-sized avatar
❤️
Estudando e Trabalhando

Ribamar FS ribafs

❤️
Estudando e Trabalhando
View GitHub Profile
@ribafs
ribafs / unit-testing-model-using-dbunit-extension.md
Created December 13, 2021 14:59 — forked from umidjons/unit-testing-model-using-dbunit-extension.md
Unit testing model using DBUnit PHPUnit extension

Unit testing model using DBUnit PHPUnit extension

I assume, that you already have phpunit installed and added into PATH. Create guestbook database in mysql. Create guestbook table in that database.

Create model to test

File src\Guestbook.php

<?php
@ribafs
ribafs / rant.md
Created December 10, 2021 21:49 — forked from DaveRandom/rant.md
Why you should not use relative paths when working with files in PHP

TL;DR do what the last section tells you to do

What is the difference between a relative path and an absolute path?

An absolute path is one which includes all path components from the root of the file system. It starts with a leading / on unix-like operating systems, or a drive letter on Windows.

Unix: /full/path/to/file.php

Windows C:\full\path\to\file.php

@ribafs
ribafs / upload.php
Created December 10, 2021 14:27 — forked from taterbase/upload.php
Simple file upload in php
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
@ribafs
ribafs / PDOFunctionsDemo.php
Created November 28, 2021 12:47 — forked from MuhammadFaizanKhan/PDOFunctionsDemo.php
Insert, Update, Delete and Select with PHP, PDO and MySQL
<?php
/**
* Created by PhpStorm. * User: Faizan Khan * Date: 1/2/2018 * Time: 10:51 AM
*/
/*Script Motive: The purpose of the file is to present different PDO Functions for DML and DDL operations
Sample Table
Table Name: UserTbl
Columns: Id, UserName, Email, RecordAddDate
*/
@ribafs
ribafs / gist:b7346f9d5723a25d113e63b2fac68bf1
Created November 28, 2021 12:40 — forked from grsouzafilho/gist:7207710
Métodos CRUD do PDO
/**
* @Method responsável por fazer o insert utilizando PDO
* @method: insert
* @param array $dados
* @param string $tabela
* @return boolean
*/
public function insert( Array $dados, $tabela = NULL )
{
@ribafs
ribafs / pdo_mysql_backup.php
Created November 27, 2021 16:14 — forked from cp6/pdo_mysql_backup.php
PHP PDO MySQL backup script with compression
<?php
$backup_config = array(
'DB_HOST' => '127.0.0.1',////Database hostname
'DB_NAME' => 'test_db',//Database name to backup
'DB_USERNAME' => 'root',//Database account username
'DB_PASSWORD' => '',//Database account password
'INCLUDE_DROP_TABLE' => false,//Include DROP TABLE IF EXISTS
'SAVE_DIR' => '',//Folder to save file in
'SAVE_AS' => 'test_db-',//Prepend filename
'APPEND_DATE_FORMAT' => 'Y-m-d-H-i',//Append date to file name
@ribafs
ribafs / html5_websql_stickynotes.html
Created September 18, 2021 00:09 — forked from sivagao/html5_websql_stickynotes.html
HTML5: WebSQL - stickynotes
<!doctype html>
<html manifest="StickyNotes.manifest">
<head>
<title>WebKit HTML 5 SQL Storage Notes Demo</title>
<style>
body {
font-family: 'Lucida Grande', 'Helvetica', sans-serif;
}

CakePHP via composer

composer.json

{
  "name": "assando-sites",
  "require": {
    "cakephp/cakephp": ">=2.5.0",
    "ext-apcu": "*",
@ribafs
ribafs / hex2dec.js
Last active May 18, 2021 18:27 — forked from ghalimi/HEX2DEC.js
HEX2DEC Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function hex2dec(number) {
// Return error if number is not hexadecimal or contains more than ten characters (10 digits)
if (!/^[0-9A-Fa-f]{1,10}$/.test(number)) return '#NUM!';
// Convert hexadecimal number to decimal
var decimal = parseInt(number, 16);
// Return decimal number

How to install Laravel globally in Ubuntu

===================================================================

Open your terminal using Ctrl+Alt+T and type the following commands

Step 1: Install Laravel

composer global require "laravel/installer"