Skip to content

Instantly share code, notes, and snippets.

View brenopolanski's full-sized avatar
🦙
Llama Llama

Breno Polanski brenopolanski

🦙
Llama Llama
View GitHub Profile
@brenopolanski
brenopolanski / merge-pdf-ghostscript.md
Last active April 27, 2024 03:00
Merge multiple PDFs using Ghostscript

A simple Ghostscript command to merge two PDFs in a single file is shown below:

gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf

Install Ghostscript:

Type the command sudo apt-get install ghostscript to download and install the ghostscript package and all of the packages it depends on.

@brenopolanski
brenopolanski / export-svg-inkscape.md
Created December 26, 2017 13:29
Exporting an object as svg from inkscape
  1. Select the object(s) to export
  2. Open the document properties window (Ctrl+Shift+D)
  3. Select "Resize page to drawing or selection"
  4. File > Save As Copy...
  5. Select Optimized SVG as the format if you want to use it on the web
@brenopolanski
brenopolanski / README.md
Created April 30, 2021 14:37
firebase x nextjs ReferenceError: navigator is not defined
> Build error occurred
ReferenceError: navigator is not defined
    at Object.areCookiesEnabled (/vercel/28f5c7d0/node_modules/@firebase/util/dist/index.node.cjs.js:650:5)
if (!firebase.apps.length) {
  firebase.initializeApp(firebaseConfig);
 firebase.analytics();
@brenopolanski
brenopolanski / file-upload.tsx
Created May 5, 2021 00:37 — forked from Sqvall/file-upload.tsx
File Upload with Chakra UI and react-hook-form
import { ReactNode, useRef } from 'react'
import { Button, FormControl, FormErrorMessage, FormLabel, Icon, InputGroup } from '@chakra-ui/react'
import { useForm, UseFormRegisterReturn } from 'react-hook-form'
import { FiFile } from 'react-icons/fi'
type FileUploadProps = {
register: UseFormRegisterReturn
accept?: string
multiple?: boolean
children?: ReactNode
@brenopolanski
brenopolanski / tips-tricks-ffmpeg.md
Last active September 4, 2023 20:11
Tips & Tricks FFmpeg
@brenopolanski
brenopolanski / vue-axios-cors.md
Last active August 14, 2023 10:10
Vue.js + Axios + CORS

Proxy requests using Webpack dev server to avoid cors in development mode.

In your webpack.config file add:

"devServer":{
  "proxy": {
    "/api": {
    "target": 'https://my-target.com',
    "pathRewrite": { '^/api': '' },
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.94 Chrome/37.0.2062.94 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9
Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H321 Safari/600.1.4
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:40.0)
@brenopolanski
brenopolanski / tailwind.responsive-font.js
Created February 23, 2021 19:24 — forked from leMaur/tailwind.responsive-font.js
Responsive font-size for Tailwindcss
const plugin = require('tailwindcss/plugin')
module.exports = plugin(function ({ addBase, theme }) {
addBase({
':root': {
'--min-fs': theme('variable-font.min-fs'),
'--max-fs': theme('variable-font.max-fs'),
'--min-vw': theme('variable-font.min-vw'),
'--max-vw': theme('variable-font.max-vw'),
'--min-fs-rem': 'var(--min-fs) * 1rem',
@brenopolanski
brenopolanski / slugify.js
Created November 30, 2022 12:44 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@brenopolanski
brenopolanski / nextcloud-cors-with-php-headers.md
Last active April 24, 2023 23:09
Nextcloud Cors with PHP Headers

Update nextcloud/remote.php:

try {
        require_once __DIR__ . '/lib/base.php';

        // All resources served via the DAV endpoint should have the strictest possible
        // policy. Exempted from this is the SabreDAV browser plugin which overwrites
        // this policy with a softer one if debug mode is enabled.
        header("Content-Security-Policy: default-src 'none';");