Skip to content

Instantly share code, notes, and snippets.

@bchiang7
bchiang7 / SassMeister-input-HTML.html
Created June 4, 2015 02:25
Generated by SassMeister.com.
<div class='container'>
<h1>SASS - Variables</h1>
<h2><span>Basic</span> - Getting Started</h2>
<p id='mypara'>Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor <br>
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi</p>
{
"name": "boilerplate",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start" : "browser-sync start --server --files '*.css, *.html, *.js'"
},
"author": "",
"license": "ISC",
@bchiang7
bchiang7 / base.scss
Last active February 5, 2019 21:48
Base Styles
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
@bchiang7
bchiang7 / UpsLinting.md
Last active March 20, 2019 16:16
Add Ups Linting Configs
touch .eslintrc prettier.config.js .editorconfig .babelrc

Default

npm install -D @upstatement/eslint-config @upstatement/prettier-config eslint babel-eslint prettier eslint-config-prettier husky pretty-quick lint-staged
@bchiang7
bchiang7 / github_signing_commits_with_gpg.md
Last active December 15, 2022 07:45
Signing GitHub Commits with GPG
// routes/index.js
const express = require('express');
const router = express.Router();
// App routes (for the mobile app)
const APP = express.Router();
router.use('/', APP);
APP.get('/users/:id', isAuthenticated, userController.getUser);
ADMIN.delete(
'/users/:id', // route path
isAuthenticated, // authentication middleware
isAdmin, // authorization middleware
adminUserController.deleteUser // controller
);
/**
* Check if a user has access to the app admin
*/
const isAdmin = async (req, res, next) => {
if (req.headers && req.headers.authorization) {
if (!req.user || !req.user.isAdmin) {
return res.status(403).json({ message: 'You must have admin permissions.' });
}
// If we get here, we're good so pass it along
next();
/**
* Delete a user with the given ID
*/
const deleteUser = async (req, res, next) => {
const { id } = req.params;
try {
await User.deleteUserById(id);
res.status(202).json({ message: `User ${id} deleted!` });
} catch (e) {
const err = new Error('Could not delete user');
@bchiang7
bchiang7 / Base.js
Last active November 12, 2019 18:25
// models/Base.js
class Base {
constructor(args) {
const results = this.validatedData(args);
Object.assign(this, results);
}
get schema() {
throw ('You must declare a schema');