This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | |
<title>Tweedle</title> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,200,300,600,700,900' rel='stylesheet' type='text/css'> | |
<link rel="stylesheet" type="text/css" href="/style.css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends '../partials/master' %} | |
{% block content %} | |
<div class="__band"> | |
<div class="__text"> | |
<p><b>Tweedle</b> is a place to share your tech stories in 140 characters. It is built on top of <a href="http://adonisjs.com/"> AdonisJs </a></p> | |
</div> | |
<div class="button__area"> | |
<a href="/signup" class="__button">Join us</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toSentence (strings, ...values) { | |
const nouns = values[0] || '' | |
const noun = values[1] || '' | |
const verb = values[2] instanceof Array === true ? (nouns.length ? values[2][1] : values[2][0]) : '' | |
const mappedString = strings.map((char, index) => { | |
if (index === 0 && !nouns) { | |
return `${char}${noun}` | |
} else if (index === 1 && !nouns) { | |
return '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const _ = use('lodash') | |
/** | |
* JSONAPI serializer for lucid models. | |
* | |
* NOTE: The implementation is not complete yet. | |
* | |
* @class JsonAPISerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const nodemailer = require('nodemailer') | |
const got = require('got') | |
const FormData = require('form-data') | |
class MailGunTransporter { | |
send (mail, callback) { | |
const form = new FormData() | |
form.append('to', '<TO_EMAIL>') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<nav class="navbar navbar-expand navbar-light bg-light"> | |
<a class="navbar-brand" href="#">AdonisJs</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Database = use('Database') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All users | |
await Database.from('users').select('*') | |
// Get admin users | |
await Database.from('users').where('role', 'admin') | |
// Inactive users | |
await Database | |
.from('users') | |
.where('status', 'inactive') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await Database | |
.table('users') | |
.insert({ username: 'virk', role: 'admin', password: 'secret' }) | |
// Bulk inserts | |
await Database | |
.table('users') | |
.insert([ | |
{ username: 'virk', role: 'admin', password: 'secret' }, | |
{ username: 'nikk', role: 'guest', password: 'secret' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Display categories in the blog header | |
const categories = await Database.table('categories').select('*') | |
// Fetch posts for a category where category_id = 1 | |
const posts = await Database | |
.table('posts') | |
.innerJoin('category_posts', 'posts.id', 'category_posts.post_id') | |
.where('category_posts.category_id', categoryId) | |
// Select author for a given post |
OlderNewer