Skip to content

Instantly share code, notes, and snippets.

View suissa's full-sized avatar
🏠
Working from home

Jean Carlo Nascimento suissa

🏠
Working from home
  • Suissa Corp
  • Brasil
View GitHub Profile
@suissa
suissa / create.any.object.ts
Created May 24, 2019 10:45
Crie qualquer tipo de Objeto com TypeScript sem precisar definir PORRA NENHUMA DELE!
const obj = {[k: string]: any} = {}
@suissa
suissa / free-photoshop.md
Created May 13, 2019 20:11 — forked from molcik/free-photoshop.md
Modify Photoshop to never ending trial

How Does It Work

All you have to do, to extend your trial period, is change number in TrialKey element in application.xml. This file is located in /Library/Application Support/Adobe/Adobe Photoshop/AMT. You can navigate there with this command:

cd /Library/Application\ Support/Adobe/Adobe\ Photoshop\ */AMT

Then you have to open the file and edit it. You can use just TextEdit app.

open -a TextEdit application.xml
@suissa
suissa / remove-history-git-github
Created May 6, 2019 23:18
Remova todo histórico do seu repositório git da seguinte formsa
git checkout --orphan newBranch
git add -A # Add all files and commit them
git commit
git branch -D master # Deletes the master branch
git branch -m master # Rename the current branch to master
git push -f origin master # Force push master branch to github
git gc --aggressive --prune=all # remove the old files
@suissa
suissa / git-clearHistory
Created May 6, 2019 22:44 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@suissa
suissa / wait.js
Created April 19, 2019 23:16
wait with Promise and setTimeout
const wait = (timeout) => (new Promise(resolve => setTimeout(resolve, timeout)))
const fn = () => console.log('oii')
wait(5000).then(fn)
@suissa
suissa / mysql-docker.sh
Created March 10, 2019 12:44 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@suissa
suissa / deepFreeze.mdn.js
Created January 10, 2019 22:21
deepFreeze MDN
module.exports = function deepFreeze (o) {
Object.freeze(o);
Object.getOwnPropertyNames(o).forEach(function (prop) {
if (o.hasOwnProperty(prop)
&& o[prop] !== null
&& (typeof o[prop] === "object" || typeof o[prop] === "function")
&& !Object.isFrozen(o[prop])) {
deepFreeze(o[prop]);
}
@suissa
suissa / groupBy.semantic.js
Created September 9, 2018 06:12
JavaScript - groupby - mais semantico eh nois q voa bruxaooooo
const group = (obj, field) => obj[field]
const addValue = (result, obj, field) =>
result[obj[field]] || []
const addToGroup = (result, obj, field) =>
[...(addValue(result, obj, field)), obj]
const toNewGroupUsing = (field) => (result, obj) => ({
...result,
@suissa
suissa / filter09.js
Created September 9, 2018 05:45
JavaScript - groupby - filter 09
const toNewGroup = (field) => (result, obj) => ({
...result,
[obj[field]]: [...(result[obj[field]] || []), obj]
})
const group = (list) => (field) =>
list.reduce(toNewGroup(field), {})
const groupBy = group(list)
@suissa
suissa / filter08.js
Last active August 29, 2018 21:31
JavaScript - groupby - filter 08
const toNewGroup = (field) => (result, obj) => ({
...result,
[obj[field]]: [...(result[obj[field]] || []), obj]
})
const groupBy = (list, field) =>
list.reduce(toNewGroup(field), {})
console.log(groupBy(list, "level"))