Skip to content

Instantly share code, notes, and snippets.

View mccarlosen's full-sized avatar
:octocat:

Carlos Meneses mccarlosen

:octocat:
View GitHub Profile
<?php
class SumRecursive
{
public $num;
public function __construct($num)
{
$this->num = $num;
}
@mccarlosen
mccarlosen / Boleta.xml
Created July 26, 2018 19:28 — forked from giansalex/Boleta.xml
Comprobantes Facturacion Electronica SUNAT UBL 2.1 (Factura, Boleta, Nota de Crédito, Nota de Débito)
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ext:UBLExtensions>
<ext:UBLExtension>
<ext:ExtensionContent>
</ext:ExtensionContent>
</ext:UBLExtension>
</ext:UBLExtensions>
<cbc:UBLVersionID>2.1</cbc:UBLVersionID>
<cbc:CustomizationID>2.0</cbc:CustomizationID>
@mccarlosen
mccarlosen / bitly_api_v3_shorten.php
Created September 10, 2018 21:34 — forked from xhezairbey/bitly_api_v3_shorten.php
BitLy API v3 Shorten PHP
<?php
function bitly_shorten($url) {
$login = "bitly_login";
$apikey = "bitly_apikey";
$format = "json";
$query = array("login" => $login,
"apiKey" => $apikey,
"longUrl" => urlencode($url),
"format" => $format);
@mccarlosen
mccarlosen / getBrowser.php
Created September 13, 2018 15:32 — forked from james2doyle/getBrowser.php
a PHP function to sniff the user agent of the browser and return a nice object with all the information
<?php
// http://www.php.net/manual/en/function.get-browser.php#101125
function getBrowser() {
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";
// First get the platform?
if (preg_match('/linux/i', $u_agent)) {
@mccarlosen
mccarlosen / remove_xml_tag.php
Last active January 20, 2019 15:07
Quitar cabecera <?xml version="1.0" encoding="UTF-8" standalone="no"?> de un xml, svg
<?php
$str = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg4619"
@mccarlosen
mccarlosen / strong-passwords.php
Created July 4, 2020 21:50 — forked from tylerhall/strong-passwords.php
A user friendly, strong password generator PHP function.
<?PHP
// Generates a strong password of N length containing at least one lower case letter,
// one uppercase letter, one digit, and one special character. The remaining characters
// in the password are chosen at random from those four sets.
//
// The available characters in each set are user friendly - there are no ambiguous
// characters such as i, l, 1, o, 0, etc. This, coupled with the $add_dashes option,
// makes it much easier for users to manually type or speak their passwords.
//
// Note: the $add_dashes option will increase the length of the password by
@mccarlosen
mccarlosen / EventSystem.js
Created July 21, 2020 15:44 — forked from simonberger/EventSystem.js
Global event system for React.js
class EventSystem {
constructor() {
this.queue = {};
}
publish(event, data) {
let queue = this.queue[event];
if (typeof queue === 'undefined') {
return false;
use App\Http\Livewire\Component;
Route::middleware('auth:web')->group(function () {
Route::get('/zona-privilegiada/{id}', Component::class)->name('routeName');
});
@mccarlosen
mccarlosen / PDFViewer.php
Created March 7, 2021 20:14
PDFViewer Livewire Component
<?php
namespace App\Http\Livewire\Components;
use Livewire\Component;
class PdfViewer extends Component
{
public $openModal = false;
public $titleModal = "PDF Viewer";
@mccarlosen
mccarlosen / git-snippets
Last active November 25, 2021 16:45
Git Snippets
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Delete and recreate the tag locally
git tag -d {tagname}
git tag {tagname}
3) Delete and recreate the tag remotely
git push origin :{tagname} // deletes original remote tag