Skip to content

Instantly share code, notes, and snippets.

View NoriSte's full-sized avatar

Stefano Magni NoriSte

View GitHub Profile
@iansu
iansu / README.md
Last active March 1, 2021 08:40
Create React App 4.0 Alpha Testing

Create New App

JavaScript Template

npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app

TypeScript Template

npx create-react-app@next --scripts-version=@next --template=typescript@next my-ts-app

var immer = require("immer")
var produce = immer.produce;
var patches=[];
var state0 = {a:1};
var state1 = produce(state0, function(draft){draft.b=9;}, function(p){patches.push(...p)});
var state2 = produce(state1, function(draft){draft.a=3;}, function(p){patches.push(...p)});
var state3 = produce(state2, function(draft){draft.b=99;}, function(p){patches.push(...p)});
var state4 = produce(state3, function(draft){draft.a=5;}, function(p){patches.push(...p)});

4. Specialize in the New

You already know the value of a niche - you go up in market value the more specialized you are in anything. So what do you specialize in?

There are many schools of thought, including ones where you could be a generalist that doesn't specialize in anything. I find one rule to be simplest and most effective above all: Specialize in the New.

Didn't we just agree to avoid FOMO? Well yes, thats an important distinction - don't specialize in everything new. Specializing means you have to say no to a lot of things. Just pick something new that fascinates you, and hopefully many others as well. Since you're learning in public, you'll know when you hit on a real nerve. Budget in the idea that you'll fail a few times before you find Your Thing.

Then the other big objection: There are plenty of jobs/money/etc in (fill in the blank older technology) too! This is usually followed by some big numbers and anecdata. "My brother's cousin's roommate's friend took this COBOL job and now he's ear

@swyxio
swyxio / 7rules-for-intemediate-developers-3.md
Last active October 28, 2021 19:29
Clone Open Source Apps

3. Clone Open Source Apps

You already know you should be making projects to learn things and potentially add to your portfolio. You've read your Malcolm Gladwell, you know that you need 10,000 hours of deliberate practice. Given you're just starting out, I have a slightly contentious suggestion for you: DON'T make anything new.

Your decision-making is a scarce resource. You start every day with a full tank, and as you make decisions through the day you gradually run low. We all know how good our late-late-night decisions are. Making a new app involves a thousand micro decisions - from what the app does, to how it should look, and everything in between. Decide now: Do you want to practice making technical decisions or product decisions?

Ok so you're coding. You know what involves making zero product decisions? Cloning things. Resist the urge to make your special snowflake (for now). Oh but then who would use yet another Hacker News clone? I've got news for you: No one was gonna use your thing anyway. You

@sebmarkbage
sebmarkbage / The Rules.md
Last active May 23, 2024 19:22
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

@joseluisq
joseluisq / stash_dropped.md
Last active May 23, 2024 14:45
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@gitjs77
gitjs77 / git-reset.md
Created August 7, 2017 12:25 — forked from remboo/git-reset.md
Git Reset (soft, mixed, hard)

alt text

Удаление коммитов до c14809fa, т.е. мы удалили просто предыдущие коммиты, но изменения в файлах, сделанные в коммитах, остались. Удалились только сами коммиты. Если мы закомиттимся(commit), то все изменения удаленных комиттов, добавятся как 1 коммит.

git reset --soft c14809fa

Удаление коммитов до c14809fa, аналогичный с soft функционал. но файлы необходимо также проиндексировать, а потом закоммитить(commit).
@0xjac
0xjac / private_fork.md
Last active May 26, 2024 23:29
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@joseluisq
joseluisq / terminal-git-branch-name.md
Last active May 21, 2024 22:05
Add Git Branch Name to Terminal Prompt (Linux/Mac)

Add Git Branch Name to Terminal Prompt (Linux/Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@ecasilla
ecasilla / clear_mongo.js
Last active December 25, 2021 20:44
Clear mongo db before mocha specs
var config = require('path/to/config');
var mongoose = require('mongose');
process.env.NODE_ENV = 'test';
before(function (done) {
function clearCollections() {
for (var collection in mongoose.connection.collections) {
mongoose.connection.collections[collection].remove(function() {});