Skip to content

Instantly share code, notes, and snippets.

Muhammad Kamran smkamranqadri

Block or report user

Report or block smkamranqadri

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@smkamranqadri
smkamranqadri / main.js
Last active Sep 27, 2018
Sample Electron Main.js file.
View main.js
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
View vscode_setting_eslint_prettier
{
"files.autoSave": "onFocusChange",
"editor.formatOnSave": true,
"editor.formatOnType": true,
"eslint.autoFixOnSave": true,
"eslint.enable": true,
"prettier.singleQuote": true,
}
View .eslintrc
{
"extends": ["airbnb", "prettier", "prettier/react"],
"plugins": ["prettier"],
"rules": {
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx"]
}
],
@smkamranqadri
smkamranqadri / express-server.js
Created Dec 1, 2017
Two questions... 1. How you can improve this code? 2. Do you validate the param is available?
View express-server.js
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)
You can’t perform that action at this time.