Skip to content

Instantly share code, notes, and snippets.

View brenopolanski's full-sized avatar
🔥
Building...

Breno Polanski brenopolanski

🔥
Building...
View GitHub Profile
@brenopolanski
brenopolanski / readme.md
Created July 1, 2019 13:01
Add e remover usuário Windows 10

Crie um novo usuário:

1. Pressione as teclas Windows + X e clique em Prompt de Comando (Admin).

2. Digite os comandos abaixo, seguido de Enter para execução:

net user nome-da-conta /add

net localgroup administrators nome-da-conta /add
@brenopolanski
brenopolanski / reset.css
Created May 18, 2019 16:06 — forked from simonausten/reset.css
Email CSS Reset
<style type="text/css">
/****** EMAIL CLIENT BUG FIXES - BEST NOT TO CHANGE THESE ********/
.ExternalClass {
width: 100%;
}
/* Forces Outlook.com to display emails at full width */
.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div { line-height: 100%; }
/* Forces Outlook.com to display normal line spacing, here is more on that: http://www.emailonacid.com/forum/viewthread/43/ */
@brenopolanski
brenopolanski / react-event-target.md
Created March 25, 2019 11:17
Using event.target with React components

event.target gives you the native DOMNode, then you need to use the regular DOM APIs to access attributes. For instance getAttribute or dataset.

<button 
  data-space="home" 
  className="home" 
  data-txt="Home" 
  onClick={ this.props.onClick } 
/> 
 Button
@brenopolanski
brenopolanski / curl.md
Created February 25, 2019 23:43 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@brenopolanski
brenopolanski / install-kc-no-https.md
Last active February 26, 2019 17:08
Install Keycloak and disable HTTPS (for development mode)
  1. Download Keycloak Server: https://www.keycloak.org/downloads.html
  2. Create user via CLI. e.g: ./bin/add-user-keycloak.sh -u admin
  3. Disable HTTPS on H2 database:
java -cp modules/system/layers/base/com/h2database/h2/main/h2-1.4.193.jar org.h2.tools.Shell -url "jdbc:h2:./standalone/data/keycloak" -user sa -password sa -sql "update REALM set ssl_required='NONE' where id = 'master'"
  1. Run server. e.g: ./bin/standalone.sh -b 139.59.177.39
@brenopolanski
brenopolanski / sample.md
Created February 15, 2019 16:19
Getting previous month first day and future month last day using moment.js
const prevMonthFirstDay = moment().subtract(1, 'months').date(1);

const nextMonthLastDay = moment().add(2, 'months').date(0);

or

const prevMonthFirstDay = moment().subtract(1, 'months').startOf('month');
@brenopolanski
brenopolanski / wget-jdk-oracle-install-example.txt
Created February 14, 2019 14:23 — forked from sr75/wget-jdk-oracle-install-example.txt
wget command to install Oracle JAVA JDK from stupid oracle website for centos and ubuntu
http://d.stavrovski.net/blog/post/how-to-install-and-setup-oracle-java-jdk-in-centos-6
# rpm
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.rpm" \
-O jdk-7-linux-x64.rpm
# ubuntu
@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';");
@brenopolanski
brenopolanski / Iframe.js
Created January 15, 2019 13:20
React iframe component
/*
INIT: ensure Babel/Eslint/Flow is configured for ES Class Fields & Static Properties
JSX USAGE: <Iframe src='http://web.site' onLoad={myOnloadFunction}/>
*/
import React, { Component, PropTypes } from 'react'
import ReactDOM from 'react-dom'
class Iframe extends Component {
static propTypes: Object = {
@brenopolanski
brenopolanski / Sortable.jsx
Created January 10, 2019 01:40 — forked from superKalo/ Sortable.jsx
How to use jQuery UI with React JS? You can use this approach to integrate almost any jQuery plugin! Full details and explanation here: http://stackoverflow.com/a/40350880/1333836
class Sortable extends React.Component {
componentDidMount() {
// Every React component has a function that exposes the
// underlying DOM node that it is wrapping. We can use that
// DOM node, pass it to jQuery and initialize the plugin.
// You'll find that many jQuery plugins follow this same pattern
// and you'll be able to pass the component DOM node to jQuery
// and call the plugin function.