Skip to content

Instantly share code, notes, and snippets.

View ncesar's full-sized avatar
🎯
Focusing

César Nascimento ncesar

🎯
Focusing
View GitHub Profile
@ncesar
ncesar / commands.md
Created July 1, 2020 20:38
Docker usefull command list
  1. docker container run -it --name CONTAINERNAME CONTAINERMIMAGE bash(ou sh) => it will run directly the bash of a container

  2. docker container ls => it will show running containers

  3. docker container ls -a => it will show all containers(running or not)

  4. docker container run -p PORTA:PORTA -d(detach) --name NOME -e(env) random_env=true IMAGEM

  5. docker container stats => will show stats about how much ram an image is using

@ncesar
ncesar / React.unstable_Profiler.md
Created June 30, 2020 17:06 — forked from bvaughn/React.unstable_Profiler.md
Notes about the in-development React <Profiler> component

Profiler

React 16.4 will introduce a new Profiler component (initially exported as React.unstable_Profiler) for collecting render timing information in order to measure the "cost" of rendering for both sync and async modes.

Profiler timing metrics are significantly faster than those built around the User Timing API, and as such we plan to provide a production+profiling bundle in the future. (The initial release will only log timing information in DEV mode, although the component will still render its children- without timings- in production mode.)

How is it used?

Profiler can be declared anywhere within a React tree to measure the cost of rendering that portion of the tree. For example, a Navigation component and its descendants:

In your settings.json workspace config, place:
{
"eslint.workingDirectories": ["./server", "./client"]
}
@ncesar
ncesar / checkIfComponentIsOutViewport.js
Last active February 26, 2020 13:07
Check if a React component is out the viewport
const checkIfComponentIsOutViewport = () => {
console.log('executed');
if (componentRef.current) {
const componentCurrentPosition = componentRef.current.getBoundingClientRect();
if (componentCurrentPosition.top < 0) {
console.log('top is out');
}
if (
componentCurrentPosition.bottom >
(window.innerHeight || document.documentElement.clientHeight)
/**
* @snippet Display Discount Percentage @ Loop Pages - WooCommerce
* @how-to Watch tutorial @ https://businessbloomer.com/?p=19055
* @sourcecode https://businessbloomer.com/?p=21997
* @author Rodolfo Melogli
* @compatible WooCommerce 3.5.4
* @donate $9 https://businessbloomer.com/bloomer-armada/
*/
add_action( 'woocommerce_before_shop_loop_item_title', 'bbloomer_show_sale_percentage_loop', 25 );
@ncesar
ncesar / Apps úteis para setup de dev
Created April 25, 2019 03:49
Alguns itens para não esquecer quando começar em um setup novo
Tema: Dark+(default Dark)
1. Browser Preview por Kenneth Auchenberg
2. ES7 React/Redux
3. ESLint
5. Prettier
6. VSCode Google Translate por funkyremi
----------------
nvm < para versões do nodejs e npm
{
"workbench.startupEditor": "newUntitledFile",
"explorer.confirmDelete": false,
"editor.formatOnSave": true,
"prettier": { "arrowParens": "always" }
}
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
echo '<style>
body, td, textarea, input, select {
font-family: "Lucida Grande";
font-size: 12px;
}
</style>';
}
function woo_remove_wc_account_page_noindex(){
if (!is_user_logged_in()) {
remove_action( 'wp_head', 'wc_page_noindex' );
}
}
add_action( 'init', 'YOURPREFIX_remove_wc_account_page_noindex' );
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "[vc_row full_width='stretch_row' css='.vc_custom_1546953804123{margin-top: -314px !important;padding-top: 310px !important;padding-bottom: 195px !important;background-image: url(http://homolog.mrjobs.com.br/ocktus/wp-content/uploads/2018/12/2-imoveis-alguel-interna.jpg?id=128) !important;background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;}'][vc_column][/vc_column][/vc_row][vc_row el_class='post-content' css='.vc_custom_1549045196317{margin-top: -150px !important;background-color: #fbf3f0 !important;}'][vc_column width='2/3'][vc_column_text][sliderImoveis][/vc_column_text][/vc_column][vc_column width='1/3'][vc_raw_html]JTNDcCUzRUxvcmVtJTIwaXBzdW0lMjBkb2xvciUyMHNpdCUyMGFtZXQlMkMlMjBjb25zZWN0ZXR1ciUyMGFkaXBpc2NpbmclMjBlbGl0LiUyMFN1c3BlbmRpc3NlJTIwZGlnbmlzc2ltJTIwbGFjdXMlMjB1dCUyMG1ldHVzJTIwZmluaWJ1cyUyMHByZXRpdW0uJTIwTWF1cmlzJTIwbWF1cmlzJTIwb