Skip to content

Instantly share code, notes, and snippets.

View paulovargatt's full-sized avatar
🔗
codesnip.net

Paulo paulovargatt

🔗
codesnip.net
View GitHub Profile
@chrisveness
chrisveness / utf8-regex.js
Last active May 25, 2023 01:53
Utf8 string encode/decode using regular expressions
/**
* Encodes multi-byte Unicode string into utf-8 multiple single-byte characters
* (BMP / basic multilingual plane only).
*
* Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars.
*
* Can be achieved in JavaScript by unescape(encodeURIComponent(str)),
* but this approach may be useful in other languages.
*
* @param {string} unicodeString - Unicode string to be encoded as UTF-8.
@mreschke
mreschke / nginx.conf
Last active January 3, 2025 07:03
Nginx config for multiple laravel sites based on /api/v1 url paths
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route
@btroncone
btroncone / rxjs_operators_by_example.md
Last active September 14, 2025 16:48
RxJS 5 Operators By Example
@vluzrmos
vluzrmos / paginate.php
Created July 20, 2016 14:31
Laravel Paginate Collection or Array
<?php
/**
* Gera a paginação dos itens de um array ou collection.
*
* @param array|Collection $items
* @param int $perPage
* @param int $page
* @param array $options
*
* @return LengthAwarePaginator
@vaporic
vaporic / cors-laravel.md
Last active March 22, 2021 11:26
CORS Laravel 5.1

Activar CORS Laravel 5.1

Para activar los CORS se edita el archivo /bootstrap/app.php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
if($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
@sl-digital
sl-digital / Ubuntu_16.04_LAMP_Install.txt
Created April 14, 2017 16:01
Ubuntu 16.04 LAMP Install
# CREATE USERS
sudo su <enter root password>
adduser devops
usermod -aG sudo devops
# SSH KEYGEN (LOCAL)
ssh-keygen <follow prompts and save>
cat ~/.ssh/yourkey_rsa.pub <copy contents>
# SSH KEYGEN (SERVER)
@paulovargatt
paulovargatt / rotate.js
Created July 31, 2017 13:55
Rotate Imgs - Example porn sites
$(document).on("mouseover", ".rotate", function() {
var a = $(this),
b = $(this).attr("src"),
c = b.substr(0, b.length - 5);
StartImageRotate(a, c, ".png"), $(this).mouseout(function() {
a.attr("src", b), stopImageRotate()
})
});
@FrikkieSnyman
FrikkieSnyman / readme.md
Last active September 28, 2025 16:32
GrapesJS - attributes, classes, and scripts

GrapesJS - attributes, classes, and scripts

Attributes

In order to add custom attributes to an HTML element that is generated by GrapesJS, one can simply make use of traits. For example, if you wish to produce an HTML element which contains the tag data-noout, a trait with the name data-noout can be added to a custom component.

    var domComps = editor.DomComponents;
    var dType = domComps.getType('default');
 var dModel = dType.model;
anonymous
anonymous / my.css
Created January 31, 2018 18:34
CSS Gradient Animation
background: linear-gradient(42deg, #8e0489, #042b8e);
background-size: 400% 400%;
-webkit-animation: PrimeColor 10s ease infinite;
-moz-animation: PrimeColor 10s ease infinite;
-o-animation: PrimeColor 10s ease infinite;
animation: PrimeColor 10s ease infinite;
@-webkit-keyframes PrimeColor {
    0%{background-position:56% 0%}
    50%{background-position:45% 100%}
    100%{background-position:56% 0%}
@jsanta
jsanta / index.html
Last active February 12, 2025 13:32
PWA index.html file for Android and iOS copy & paste enabled
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Ionic App</title>
<base href="/" />
<meta
name="viewport"