Skip to content

Instantly share code, notes, and snippets.

View Kjaer's full-sized avatar
👷‍♂️
Code Janitor

Halil Kayer Kjaer

👷‍♂️
Code Janitor
View GitHub Profile
@Kjaer
Kjaer / 1-setup.md
Created November 11, 2022 12:17 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS

Methods of Signing with a GPG Key on MacOS

Last updated September 21, 2022

This Gist explains how to do this using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

There has been a number of comments on this gist regarding some issues around the pinentry-program and M1 Macs. I've finally gotten a chance to try things out on an M1 and I've updated the documentation in 2-using-gpg.md to reflect my findings.

@Kjaer
Kjaer / proxy.js
Created February 7, 2020 12:46 — forked from beradrian/proxy.js
CORS proxy with node-http-proxy
/** If you want to use the local development environment with the dev backend,
* this will create a proxy so you won't run into CORS issues.
* It accepts the following command line parameters:
* - port the port where the proxy will listen
* - target the DEV backend target to contact.
* Example: If you set the port to 3000 and target to https://dev.nibo.ai then
* your actual "resourceBaseUrl" in NiboSettings should be http://localhost:3000/api/v1
*/
// Define the command line options
const optionDefinitions = [

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
@Kjaer
Kjaer / revert-a-commit.md
Created March 7, 2019 13:23 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@Kjaer
Kjaer / .gitconfig
Last active September 15, 2023 11:34 — forked from salimkayabasi/.gitconfig
# credit: http://haacked.com/archive/2014/07/28/github-flow-aliases/
[user]
name = Halil Kayer
email = kayer.halil@gmail.com
signingkey = 60C52C88E94A6EB1
[core]
editor = micro
pager = delta
excludesfiles = /Users/u132515/.gitignore
[commit]
@Kjaer
Kjaer / HashTable.js
Created November 19, 2017 20:21 — forked from alexhawkins/HashTable.js
Correct Implementation of a Hash Table in JavaScript
var HashTable = function() {
this._storage = [];
this._count = 0;
this._limit = 8;
}
HashTable.prototype.insert = function(key, value) {
//create an index for our storage location by passing it through our hashing function
var index = this.hashFunc(key, this._limit);
@Kjaer
Kjaer / filter.js
Created November 19, 2017 06:54 — forked from vpalos/filter.js
JS: A simple search function designed for filtering large lists of strings.
/**
* Demo: http://vpalos.com/sandbox/filter.js/
*
* A generic search algorithm designed for filtering (very) large lists of strings; when an input string
* contains all the parts (words or characters; whitespace is ignored) of the query, spread-out over the text
* then the string is considered to be a match. It works with the way internet browsers (e.g. Firefox, Google
* Chrome) filter address-bar suggestions on user input. It is also quite fast; on my i7 laptop, filtering
* 1) a list of ~23000 items takes around 50ms (yes, milliseconds!);
* 2) a list of ~1 million text items took under 1 second.
* It works both in NodeJS as well as in browser environments (so far I only tested FF and GC).