Skip to content

Instantly share code, notes, and snippets.

View eastenluis's full-sized avatar

Martin Lai eastenluis

View GitHub Profile
@eastenluis
eastenluis / settings.json
Created February 5, 2018 20:21
Basic VSCode Django Workspace Settings
{
"python.linting.pep8Enabled": false,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.pylintArgs": [
"--load-plugins",
"pylint_django"
],
"python.pythonPath": "{Path to python/virtual env}"
@eastenluis
eastenluis / map-item.js
Created December 6, 2017 15:18
Mongoose GeoJSON schema example
const mapItemSchema = new mongoose.Schema({
name: String,
location: {
// It's important to define type within type field, because
// mongoose use "type" to identify field's object type.
type: {type: String, default: 'Point'},
// Default value is needed. Mongoose pass an empty array to
// array type by default, but it will fail MongoDB's pre-save
// validation.
coordinates: {type: [Number], default: [0, 0]}
@eastenluis
eastenluis / remove-branches-with-no-remote-trakcing.js
Last active August 17, 2016 20:37
Remove local branches that do not have remote tracking branches.
var exec = require('child_process').exec;
exec('git branch -l', function (error, stdout, stderr) { // retrieve local branches
var branchesWithoutTrack = [];
var localBranches = stdout.split('\n')
.map(function (branchName) {
return branchName.trim();
})
.filter(function (branchName) {
return branchName.length > 0;