Skip to content

Instantly share code, notes, and snippets.

# Insomnia Configuration
## Run the test query
{
shop {
id
name
}
}
# Query Structure Examples
@coderdiaz
coderdiaz / app.js
Created October 8, 2020 13:07 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@coderdiaz
coderdiaz / server.js
Created September 5, 2019 06:20 — forked from nodkz/apolloServer2019.ts
GraphQL error tracking with sentry.io
/* eslint-disable no-console, import/first */
import path from 'path';
import express from 'express';
import expressStaticGzip from 'express-static-gzip';
import graphqlHTTP from 'express-graphql';
import PrettyError from 'pretty-error';
import bodyParser from 'body-parser';
import raven from 'raven';
import morgan from 'morgan';
import { graphqlBatchHTTPWrapper } from 'react-relay-network-layer';
@coderdiaz
coderdiaz / npm-cheat-sheet.md
Created March 28, 2018 07:28 — forked from AvnerCohen/npm-cheat-sheet.md
Node.js - npm Cheat Sheet

Node.js - npm Cheat Sheet

(Full description and list of commands at - https://npmjs.org/doc/index.html)

##List of less common (however useful) NPM commands

######Prepand ./bin to your $PATH Make sure to export your local $PATH and prepand relative ./node_modules/.bin/:

@coderdiaz
coderdiaz / agnoster.zsh-theme
Created November 22, 2017 18:11 — forked from elijahmanor/agnoster.zsh-theme
Custom Agnoster Zsh Theme to Add Node & Npm Versions
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@coderdiaz
coderdiaz / agnoster.zsh-theme
Created November 22, 2017 18:11 — forked from elijahmanor/agnoster.zsh-theme
Custom Agnoster Zsh Theme to Add Node & Npm Versions
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@coderdiaz
coderdiaz / setup-elementary.sh
Created February 7, 2017 00:56 — forked from floriancourgey/setup-elementary.sh
Things to do after installing elementary OS Loki 0.4
# chromium
sudo apt install -y chromium-browser
# dev (php, docker, git, node, bower, electron, composer)
sudo apt install -y \
php php-curl php-mysql \
docker.io \
git \
nodejs npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
@coderdiaz
coderdiaz / ui-datepicker.vue
Created June 22, 2016 04:35 — forked from Phunky/ui-datepicker.vue
VueJS DatePicker
<style>
.ui-datepicker .md-icon {
flex: 0 0 auto;
margin-right: 8px;
width: 18px;
height: 18px;
}
</style>
<style lang="sass" scoped>
@coderdiaz
coderdiaz / routes.php
Created February 21, 2016 06:23 — forked from lukemartin/routes.php
Output checkboxes with appropriate 'checked' attributes in Laravel
Route::get('edit', function() {
// fetch our post, and it's associated categories
$post = Post::with('cats')->where('id', '=', $id)->first();
// fetch all of our categories
$cats = Cat::all();
// create our empty array
$post_cats = array();
@coderdiaz
coderdiaz / app.js
Created February 2, 2016 22:24 — forked from jdnichollsc/app.js
SQLite plugin with ngCordova in Ionic Framework => Using service pattern (Works for litehelpers/Cordova-sqlite-storage and MSOpenTech/cordova-plugin-websql) Code => http://1drv.ms/1Ono0Ys
angular.module('Demo', ['ionic', 'Demo.controllers', 'Demo.services', 'ngCordova'])
.run(function ($ionicPlatform, sqliteService) {
$ionicPlatform.ready(function () {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);