Skip to content

Instantly share code, notes, and snippets.

View igorcaldeira's full-sized avatar
🔥

Igor Caldeira igorcaldeira

🔥
View GitHub Profile
@igorcaldeira
igorcaldeira / maskContent.js
Created May 10, 2024 00:53
JS Function to format a string based on mask (with imask)
// how to use :)
// mask: "(00) 0 0000-0000"
// input: "31999699601"
// result: "(31) 9 9969-9606"
export const maskContent = (mask, input) => {
const m = IMask.createMask({
mask,
});
@igorcaldeira
igorcaldeira / MessageHandler.js
Last active April 2, 2019 23:06
The relevant parts of a section of code using reactjs that shows part of a message handler component. This component handle various types of messages that appears fixed and above the main menu of a system. It has some rules like show the message only for 3 seconds each and group messages with the same content. Hope you like it!
import React from 'react'
import { translate } from 'react-i18next'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { simpleId } from 'utils/utility'
import * as actions from 'store/messages/messages.useCases'
import './MessageHandler.scss'
import { ReactComponent as IcCheck } from 'assets/icons/message/check.svg'
@Mohamed3on
Mohamed3on / batchPrettier.md
Last active April 5, 2024 17:03
Run prettier on all JS files in a directory
  1. Install prettier
  2. Make a .prettierignore file, and add directories you'd like prettier to not format, for example: **/node_modules
  3. Run prettier --write "**/*.js" *Don't forget the quotes.
  4. Optional: if you want to format JSON/SCSS files too, replace js with json/scss.
@ravipudi
ravipudi / electron-creating-portable-windows-application.md
Last active June 18, 2024 15:04
Electron - Creating a windows portable executable

How to create a portable windows application without an installer from an electron project:

  1. Clone the electron-quick-start repo:
git clone https://github.com/electron/electron-quick-start
  1. yarn
  2. Make your application - probably edit main.js to navigate to some URL
  3. yarn add electron-packager
  4. Edit package.json - update the 'name' and add a new script 'packager':
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active July 17, 2024 18:24
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@denji
denji / nginx-tuning.md
Last active July 17, 2024 13:48
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.