Skip to content

Instantly share code, notes, and snippets.

View brandonsueur's full-sized avatar

brandonsueur

View GitHub Profile
@iksose
iksose / restAPI.markdown
Last active September 21, 2023 06:39
Creating a REST API using Node.js, Express, and MongoDB

###Creating a REST API using Node.js, Express, and MongoDB

####Installing Node.js

Go to http://nodejs.org, and click the Install button. Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at /usr/local/bin/node and npm was installed at /usr/local/bin/npm. At this point node.js is ready to use. Let’s implement the webserver application from the nodejs.org home page. We will use it as a starting point for our project: a RESTful API to access data (retrieve, create, update, delete) in a wine cellar database.

Create a folder named nodecellar anywhere on your file system. In the wincellar folder, create a file named server.js.

@brandonsimpson
brandonsimpson / osx_uninstall_mysql_install_mariadb_homebrew.md
Last active August 19, 2023 22:55
OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

OSX How To: Uninstall native MySQL and install MariaDB via Homebrew

This is a short overview on how to completely remove any old mysql server installs in OSX and upgrade to MariaDB without conflicts. Things can get a bit weird when you have various old installs of MySQL server floating around, and utilizing homebrew to install and upgrade MariaDB as a drop in replacement for MySQL has worked well, especially if you're used to managing MySQL installs via yum in linux.

First: Backup Your Data!

Backup all of your current databases with mysqldump

This isn't a tutorial on backups, and there are many ways to do it. You should know how to backup your data anyway. For this example, we'll do a full backup of our InnoDB databases.

@sdesalas
sdesalas / jwt.server.js
Created March 9, 2017 03:59
Node JSON Web Token API authentication
// @see https://scotch.io/tutorials/authenticate-a-node-js-api-with-json-web-tokens
// =======================
// get the packages we need ============
// =======================
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var morgan = require('morgan');
var mongoose = require('mongoose');
@rahuldass
rahuldass / Perfect Full Page Background Image.md
Last active May 7, 2023 16:43
Perfect Full Page Background Image #css

###Perfect Full Page Background Image

We can do this purely through CSS thanks to the background-size property now in CSS3. We'll use the html element (better than body as it's always at least the height of the browser window). We set a fixed and centered background on it, then adjust it's size using background-size set to the cover keyword.

CSS

html { 
  background: url(images/bg.jpg) no-repeat center center fixed; 
 -webkit-background-size: cover;
@hexablob
hexablob / guide-installation-debian.md
Last active March 19, 2023 16:06
Installation d'un serveur Debian ; de A à Z.

Installation d'un serveur Debian ; de A à Z.

⚙️ Installation & Configuration du système d'exploitation

La première étape consiste à sélectionner la distribution système Debian 10 dans le menu déroulant lors de la commande de votre nouveau Serveur dédié / VPS chez votre hébergeur préféré.

Procédez ensuite à l'installation de votre serveur avec les paramètres par défaut et veillez à ne pas personnaliser la répartition de l'espace disque des partitions systèmes.

Une fois l'installation effectuée, connectez-vous au serveur en SSH avec les identifiants que vous aurez normalement reçus par mail (en toute logique le login par défaut est debian, s'il ne s'agit pas là dans certains cas des identifiants root.) -- pas de soucis, l'utilisateur par défaut fait dans une grande majorité des cas déjà parti des sudoers système. --

@kigiri
kigiri / aligning-images.md
Created September 18, 2018 09:11 — forked from DavidWells/aligning-images.md
Guide to aligning images in github readme.md files

Aligning images

left alignment

This is the code you need to align images to the left:

@dmh2000
dmh2000 / bcrypt-promise.js
Last active May 18, 2021 09:58
Using bcrypt with promises to hash a password and then verify it
const bcrypt = require("bcrypt");
// use this library in case your version of node doesn't support Promise
// const Promise = require("promise");
let password = "hello";
let stored_hash = "";
// first generate a random salt
function genSalt(password) {
return new Promise((resolve, reject) => {
import React, { useState, useEffect, useCallback } from 'react';
import { useFormikContext } from 'formik';
import _ from 'lodash';
const AutoSave = ({ debounceMs = 1000 }) => {
const formik = useFormikContext();
const [isSaved, setIsSaved] = useState(null);
const debouncedSubmit = useCallback(
_.debounce(() => {
return formik.submitForm().then(() => setIsSaved(true));
@hadnazzar
hadnazzar / .eslintrc.json
Created April 14, 2020 11:01
React & nextjs eslint setup
{
"root": true,
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:jsx-a11y/recommended",
"plugin:react-hooks/recommended",
@bayareawebpro
bayareawebpro / LaravelArtisanMacros.md
Last active October 13, 2019 09:56
Laravel Artisan Macros for Development

Artisan Macros for Development

Place in the routes/console.php file.

Install Application

The install macro will migrate / seed the database and link the storage directory.
Be sure to enter your database credentials in the .env file first.

php artisan install