Skip to content

Instantly share code, notes, and snippets.

View punit9l's full-sized avatar
:octocat:
Exploring

Puni punit9l

:octocat:
Exploring
View GitHub Profile
@punit9l
punit9l / app.js
Created May 22, 2020 15:11 — forked from stongo/app.js
Joi validation in a Mongoose model
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
var db = mongoose.connection;
db.on('error', function() {
return console.error.bind(console, 'connection error: ');
});
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="15dp" />
<solid android:color="#FFFFFF" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_margin="32dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
private void showAlertDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
// Get the layout inflater
LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(R.layout.alert_dialog, null);
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder.setView(view);