Skip to content

Instantly share code, notes, and snippets.

View leonardssh's full-sized avatar
:shipit:
<Esc>:wq!<Ret>

Narcis-Ionuț B. leonardssh

:shipit:
<Esc>:wq!<Ret>
View GitHub Profile
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active May 10, 2024 10:00
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
@jung-kim
jung-kim / map-perf.js
Last active May 25, 2023 07:01
es6 map vs array vs obj performance test
"use strict";
let looper = (callback) => {
let n = 2000000;
while (n > 0) {
callback(n);
n--;
}
}
@brennanMKE
brennanMKE / hero.ts
Last active April 1, 2024 16:16
Example of Mongoose with TypeScript and MongoDb
import * as mongoose from 'mongoose';
export let Schema = mongoose.Schema;
export let ObjectId = mongoose.Schema.Types.ObjectId;
export let Mixed = mongoose.Schema.Types.Mixed;
export interface IHeroModel extends mongoose.Document {
name: string;
power: string;
@brennanMKE
brennanMKE / repository.ts
Created April 19, 2016 21:50
Mongoose/Mongo Repository with TypeScript
'use strict';
import * as mongoose from 'mongoose';
import * as Utils from '../../modules/utils';
export let ReadyState = {
Disconnected: 0,
Connected: 1,
Connecting: 2,
"Walking on water and developing software from a specification are easy if both are frozen."
- Edward V Berard
"Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter."
- Eric S. Raymond
"Talk is cheap. Show me the code."
- Linus Torvalds
"In God we trust. All others must bring data."
@wojteklu
wojteklu / clean_code.md
Last active May 17, 2024 21:46
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@ghermans
ghermans / pedrelationship.md
Last active March 27, 2023 01:54
FiveM Ped Relations
Relationship hash name Like Dislike Respect Hate
ARMY ARMY COP
AGGRESSIVE_INVESTIGATE HATES_PLAYER
AGGRESSIVE_INVESTIGATE
PLAYER
AMBIENT_GANG_BALLAS AMBIENT_GANG_BALLAS
GUARD_DOG
AMBIENT_GANG_CULT AMBIENT_GANG_CULT
GUARD_DOG
AMBIENT_GANG_FAMILY AMBIENT_GANG_FAMILY
GUARD_DOG
AMBIENT_GANG_LOST AMBIENT_GANG_LOST
GUARD_DOG
AMBIENT_GANG_MARABUNTE AMBIENT_GANG_MARABUNTE
GUARD_DOG
AMBIENT_GANG_MEXICAN AMBIENT_GANG_MEXICAN GUARD_DOG
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 17, 2024 19:04
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

interface OperationQueue {
queue: Promise<void>;
}
export function makeOperationQueue(): OperationQueue {
return {queue: Promise.resolve()};
}
export function queuedOperation(operationQueue: OperationQueue) {
return function(_target: any, _key: string, descriptor: TypedPropertyDescriptor<(...args: any[]) => any>) {