Skip to content

Instantly share code, notes, and snippets.

View smkamranqadri's full-sized avatar

Muhammad Kamran smkamranqadri

View GitHub Profile
@smkamranqadri
smkamranqadri / main.js
Last active September 27, 2018 19:24
Sample Electron Main.js file.
const { app, BrowserWindow } = require('electron');
const path = require('path');
const url = require('url');
require('dotenv').config();
let win = null;
function createWindow() {
// Initialize the window to our specified dimensions
{
"files.autoSave": "onFocusChange",
"editor.formatOnSave": true,
"editor.formatOnType": true,
"eslint.autoFixOnSave": true,
"eslint.enable": true,
"prettier.singleQuote": true,
}
{
"singleQuote": true
}
{
"extends": ["airbnb", "prettier", "prettier/react"],
"plugins": ["prettier"],
"rules": {
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx"]
}
],
@smkamranqadri
smkamranqadri / express-server.js
Created December 1, 2017 09:42
Two questions... 1. How you can improve this code? 2. Do you validate the param is available?
app.get('/users/:id', (req, res) => {
const userId = req.params.id
if (!userId) {
return res.sendStatus(400).json({
error: 'Missing id'
})
}
Users.get(userId, (err, user) => {
if (err) {
return res.sendStatus(500).json(err)