Skip to content

Instantly share code, notes, and snippets.

View milinmestry's full-sized avatar

Milin Mestry milinmestry

View GitHub Profile
@milinmestry
milinmestry / OfferStatusCodeClass.php
Created July 11, 2018 10:47
Use of Interface, Abstract class and Inheritance example
<?php
namespace classes;
use interfaces\OfferStatusCode as interfaceOSC;
/**
* Abstract class Offers Status Code
*
*
@milinmestry
milinmestry / genre.js
Created September 21, 2017 09:25
Handle unique column validation in ExpressJs
// Filepath: models/genre.js
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var GenreSchema = Schema({
name: {type: String, required: true, min:3, max: 100, unique: true},
description: {type: String, max: 500},
});
@d3noob
d3noob / data.csv
Last active January 13, 2022 23:00
Scatterplot with v4
date close
1-May-12 58.13
30-Apr-12 53.98
27-Apr-12 67.00
26-Apr-12 89.70
25-Apr-12 99.00
24-Apr-12 130.28
23-Apr-12 166.70
20-Apr-12 234.98
19-Apr-12 345.44
@dhbradshaw
dhbradshaw / gist:e2bdeb502b0d0d2acced
Last active August 16, 2023 17:50
Rename field using migrations in django 1.7
To change a field name in django 1.7+
1. Edit the field name in the model (but remember the old field name: you need it for step 3!)
2. Create an empty migration
$ python manage.py makemigrations --empty myApp
3. Edit the empty migration (it's in the migrations folder in your app folder, and will be the most recent migration) by adding
migrations.RenameField('MyModel', 'old_field_name', 'new_field_name'),
to the operations list.