Skip to content

Instantly share code, notes, and snippets.

View brandonsueur's full-sized avatar

brandonsueur

View GitHub Profile

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@jhermann
jhermann / git-commit-emojis.md
Last active September 23, 2023 07:09
Useful emoji for git commit messages

Useful emoji for git commit messages

If you add emoji to your commit messages for a GitHub repo, they become less boring, and you can convey the kind of change you're adding. See the full set of GitHub supported emoji here (also useful for easy copy&paste via a simple click).

Example commit message

The following is a possible scheme to use:

@bloodyowl
bloodyowl / gist:5d8adcf50e890ebafb95
Last active September 30, 2023 16:49
ES6 tl;dr; for beginners
// ES6 tl;dr; for beginners
// 1. variables
// `const` & `let` are scoped at the block level
if(true) {
let foo = "bar"
}
foo // ReferenceError
public function add()
{
$user = $this->Users->newEntity();
if ($this->request->is('post')) {
$user = $this->Users->patchEntity($user, $this->request->data);
if ($this->Users->save($user)) {
$this->Flash->success(__('The user has been saved.'));
return $this->redirect(['action' => 'index']);
} else {
$this->Flash->error(__('The user could not be saved. Please, try again.'));
@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) => {
@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');
@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:

@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
@kyleshevlin
kyleshevlin / partialApplication.js
Created April 27, 2019 17:38
Partial Application via Bind
// Can't use curried functions for some reason?
// Never fear, partial application via the bind() method is here!
const getFromAPI = (baseURL, endpoint, callback) =>
fetch(`${baseURL}${endpoint}`)
.then(res => res.json())
.then(data => callback(data))
// Partially apply the baseURL
const getFromGithub = getFromAPI.bind(null, 'https://api.github.com')
@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. --