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 / README.md
Created January 26, 2021 17:45
Inkscape: convert text to object

First Ctrl+K (path combine), then Ctrl+J (dynamic offset) will work.

@brenopolanski
brenopolanski / uselayouteffect-ssr.md
Created January 5, 2021 17:48 — forked from gaearon/uselayouteffect-ssr.md
useLayoutEffect and server rendering

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded.

You might see a warning if you try to useLayoutEffect on the server. Here's two common ways to fix it.

Option 1: Convert to useEffect

If this effect isn't important for first render (i.e. if the UI still looks valid before it runs), then useEffect instead.

function MyComponent() {
@brenopolanski
brenopolanski / index.html
Created November 21, 2015 23:45
Start, Stop and Reset Javascript SetInterval
<div class="btns">
<a href="" id="set" class="btn">Set/Reset</a>
<a href="" id="stop" class="btn">Stop</a>
</div>
<div id="container"></div>
@brenopolanski
brenopolanski / xampp-virtualhost.md
Created September 27, 2020 00:16 — forked from ibrahimtuzlak0295/xampp-virtualhost.md
Create virtual host in XAMPP, Ubuntu 16.04/18.04/20.04

I’ll go step-by-step on how to create a virtual host in the XAMPP environment. As we know, the default http://localhost points to /opt/lampp/htdocs as the root directory. The desired result is to be able to visit http://examplevhost.local, with the root directory being /opt/lampp/htdocs/examplevhost.

Note: The steps below are done on Ubuntu 16.04, but they should also work on most other Linux distributions (Debian, Mint, Arch).

Note: I’ll assume that XAMPP is installed in /opt/lampp/. If it’s different on your setup, please read carefully and adjust accordingly.

Enable virtual hosts in apache configuration file

Note: This should be done only once per XAMPP installation. If you want to add another virtual host later you can skip to the next step.

@brenopolanski
brenopolanski / .eslintrc
Created May 19, 2018 23:26 — forked from yaminmhd/.eslintrc
Prettier/eslint configuration in create-react-app
{
"extends": ["react-app", "plugin:prettier/recommended"]
}
@brenopolanski
brenopolanski / error-refspec.md
Created April 17, 2015 01:23
GitHub - error: src refspec your_name_branch matches more than one
git push origin refs/heads/your_name_branch:refs/heads/your_name_branch
@brenopolanski
brenopolanski / string-utils.js
Created April 13, 2020 17:48 — forked from jonlabelle/string-utils.js
Useful collection of JavaScript string utilities.
// String utils
//
// resources:
// -- mout, https://github.com/mout/mout/tree/master/src/string
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str) {
return str.toLowerCase();

update object

var state = {
    id: 1,
    points: 100,
    name: "Goran"
};

var newState = {
@brenopolanski
brenopolanski / docker-cp-container-host.md
Created November 2, 2017 17:37
Docker - copy file from container to host

In order to copy a file from a container to the host, you can use the command:

docker cp <containerId>:/file/path/within/container /host/path/target
@brenopolanski
brenopolanski / vuejs-getters-and-setters.md
Last active March 19, 2020 12:47
Filter VueJS getters and setters
log: function(d) {
    console.log(Object.assign({}, this.form));
}

// if you have jQuery
log: function(d) {
    console.log($.extend({}, this.form));
}