Skip to content

Instantly share code, notes, and snippets.

🦀

Tiago Celestino tcelestino

🦀
Block or report user

Report or block tcelestino

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tcelestino
tcelestino / anagram.js
Created Jul 17, 2019
solutions to code interviews
View anagram.js
// helper function that builds the
// object to store the data
const buildCharObject = str => {
const charObj = {}
for(let char of str.replace(/[^\w]/g).toLowerCase()) {
// if the object has already a key value pair
// equal to the value being looped over,
// increase the value by 1, otherwise add
// the letter being looped over as key and 1 as its value
charObj[char] = charObj[char] + 1 || 1
@tcelestino
tcelestino / essentials-docker-commands.md
Last active Jun 14, 2019
Essentials Docker commands -
View essentials-docker-commands.md

Essentials Docker commands

List all essentials command to use Docker. Based on https://hackernoon.com/docker-commands-the-ultimate-cheat-sheet-994ac78e2888

Running Docker

  • docker start [container]: Start a particular container.
  • docker stop [container]: Stop a particular container.
  • docker exec -ti [container] [command]: Run a shell command inside a particular container.
  • docker run -ti — image [image] [container] [command]: Create and start a container at the same time, and then run a command inside it.
@tcelestino
tcelestino / delete-files-netstorage.js
Created Jun 3, 2019
remove files in images directory at Akamai NetStorage
View delete-files-netstorage.js
const deleteImagesFolder = () => {
ns.dir('/cpCode/front-app-home/images', (error, res, body) => {
if (error) {
throw new Error(`Error, ${error.message}`);
}
if (body.stat !== undefined) {
const { file: files } = body.stat;
files.forEach(file => {
@tcelestino
tcelestino / docker-clean.sh
Created May 20, 2019
alias to docker clean out
View docker-clean.sh
# docker
alias dockercleand='docker rmi $(docker images -q)' #delete all images
alias dockercleanu='docker rmi $(docker images -q -f dangling=true)' # delete all untagged images
alias dockercleans='docker rm $(docker ps -a -q)' #delete all stopped images
@tcelestino
tcelestino / sanitize.js
Created May 14, 2019
remove accents, switch white-space from hifen and transform string in lowercase
View sanitize.js
const sanitize = str => str.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(' ', '-').toLowerCase();
@tcelestino
tcelestino / dark-mode-css.css
Created May 3, 2019
dark mode website with CSS
View dark-mode-css.css
@media (prefers-color-scheme: dark) {
body {
background: black;
color: white;
}
}
@tcelestino
tcelestino / file-loader-config.js
Created Apr 19, 2019
webpack file-loader settings to next.js
View file-loader-config.js
const staticPrefix = '_next/static/';
{
test: /\.(eot|woff2?|ttf|svg|jpe?g|png|svg|gif|ico)$/,
use: [
{
loader: 'file-loader',
options: {
name: IS_PROD ? '' : '[path][name].[ext]',
publicPath: nextConf.assetPrefix.length
@tcelestino
tcelestino / disable-checkpoint-vpn-autostart.md
Last active Jan 17, 2019
disable autostart Checkpoint's VPN on macOS
View disable-checkpoint-vpn-autostart.md

How can I stop Checkpoint's VPN program from automatically starting on my Mac? Then how do start it manually

To stop it from starting automatically, edit /Library/LaunchAgents/com.checkpoint.eps.gui.plist and change:

<key>RunAtLoad</key>
<true/>

To:

@tcelestino
tcelestino / index.html
Created Dec 3, 2018
customize checkbox
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Checkbox customizado</title>
<style>
label {
display: block;
position: relative;
@tcelestino
tcelestino / composer-install.md
Last active Mar 1, 2019
how to install composer globally on macOS
View composer-install.md

Downloading directly from the composer website

Copy and paste that link – https://getcomposer.org/composer.phar – to your browser. It’s always the latest version of Composer.

After getting it, open your terminal to test it. You need just run that command:

php ~/Downloads/composer.phar --version

I assume that you don’t want to write … every time when you need to use a composer. Let’s move it to bin directory.

You can’t perform that action at this time.