Skip to content

Instantly share code, notes, and snippets.

<nav role="custom-dropdown">
<input type="checkbox" id="button">
<label for="button" onclick></label>
<ul>
<li><a target="_blank" rel="noopener noreferrer" href=" https://determined-dijkstra-ee7390.netlify.app/">JOB SEARCH</a></li>
<li><a target="_blank" rel="noopener noreferrer" href="https://links4242.netlify.app/ ">Links</a></li>
<li><a target="_blank" rel="noopener noreferrer" href="#">Markdown Templates</a></li>
<li><a target="_blank" rel="noopener noreferrer" href="#">Sidebar Blog(nextjs)</a></li>
<li><a target="_blank" rel="noopener noreferrer" href="https://friendly-amaranth-51833.netlify.app/ ">Norwex Ecommerce </a></li>

Getting started with the Git Database API

The Git Database API gives you access to read and write raw Git objects to your Git database on GitHub and to list and update your references (branch heads and tags). Overview

This basically allows you to reimplement a lot of Git functionality over our API - by creating raw objects directly into the database and updating branch references you could technically do just about anything that Git can do without having Git installed.

Git Database API functions will return a 409 Conflict if the Git repository is empty or unavailable. An unavailable repository typically means GitHub is in the process of creating the repository. For an empty repository, you can use the "Create or update file contents" endpoint to create content and initialize the repository so you can use the Git Database API. Contact GitHub Support if this response status persists.

git database overview

const wordCondenser = /(?:^|\s)\S(?:(\s+)\S)(?:\1\S)*(?:$|\s)/g;
const spaceCondenser = /\s{2,}/g;
const condenseSpaces = msg => {
return msg
.replace(wordCondenser, m => m.replace(/\s+/g, ''))
.replace(spaceCondenser, ' ');
};
const fs = require('fs-extra');
const gutil = require('gulp-util');
const puppeteer = require('puppeteer');
function delay(timeout) {
return new Promise(function(resolve) {
setTimeout(resolve, timeout);
})
};
function search(array, term) {
for (let i = 0; i < array.length; i++) {
if (array[i] === term) {
return i;
}
}
return -1;
}
function tabFib(n) {
let table = new Array(n);
table[0] = 0;
table[1] = 1;
table[2] = 1;
for (i = 3; i <= n; i++) {
table[i] = table[i - 1] + table[i - 2];
console.log(table);
}
return table[n];
function fib(n, memo) {
memo = memo || {};
if (memo[n]) return memo[n];
if (n <= 2) return 1;
return (memo[n] = fib(n - 1, memo) + fib(n - 2, memo));
}
function fibMemo(n, memo = { 0: 0, 1: 1 }) {
if (n in memo) return memo[n];
memo[n] = fibMemo(n - 1) + fibMemo(n - 2);
return memo[n];
}
function fib(n) {
let mostRecentCalcs = [0, 1];
if (n === 0) return mostRecentCalcs[0];
for (let i = 2; i <= n; i++) {
const [secondLast, last] = mostRecentCalcs;
mostRecentCalcs = [last, secondLast + last];
}
return mostRecentCalcs[1];
}
function fastFib(n, memo = {}) {
if (n in memo) return memo[n];
if (n === 1 || n === 2) return 1;
memo[n] = fastFib(n - 1, memo) + fastFib(n - 2, memo);
return memo[n];
}
fastFib(6); // => 8
fastFib(50); // => 12586269025