Skip to content

Instantly share code, notes, and snippets.

@rogeriotaques
rogeriotaques / sec-watcher.php
Last active July 20, 2020 01:43
Security package watcher in PHP
<?php
/**
* This script checks for security updates in the server and
* it's expected to be scheduled for a daily run.
*
* It will notify the $notify address if one or more security
* package updates are found.
*/
<?php
/**
* Echo colored strings in the terminal (PHP-CLI).
* @use Colors::write("hello word!", "green", "light_green");
*/
class Colors
{
/** @var array */
<?php
public function uploadFileFromBlobString($base64string = '', $file_name = '', $folder = '')
{
$file_path = "";
$result = 0;
// Convert blob (base64 string) back to PDF
if (!empty($base64string)) {
$base64data = base64_decode($base64string, true);
@rogeriotaques
rogeriotaques / base64topdf-working.php
Last active December 21, 2023 09:41
Converts base64 string back to a pdf file
<?php
public function uploadFileFromBlobString($base64string = '', $file_name = '', $folder = '')
{
$file_path = "";
$result = 0;
// Convert blob (base64 string) back to PDF
if (!empty($base64string)) {
@rogeriotaques
rogeriotaques / pdf2base64.ts
Last active November 26, 2019 02:19
Converts a PDF file to base64 string.
getFileInfo(evt: any): void {
const reader: FileReader = new FileReader();
const files: Array<any> = evt.target.files || evt.dataTransfer.files;
reader.addEventListener(
'load',
() => {
this.form.file_path = reader.result;
},
false
@rogeriotaques
rogeriotaques / .eslintrc
Created April 19, 2018 05:08
Standard ESLint configuration file I am using in my projects with jQuery and Gulp.
{
"env": {
"browser": true,
"node": true,
"jquery": true
},
"extends": ["airbnb-base"],
"rules": {
"arrow-parens": ["error", "always"],
"camelcase": "off",