This file contains hidden or 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
<template> | |
<div> | |
<div class="row"> | |
<div class="col s12 center-align"> | |
<h1><i class="medium material-icons">verified_user</i> Login</h1> | |
</div> | |
</div> | |
<div class="row" v-if="request.token === ''"> | |
<form v-on:submit.prevent class="col s12"> | |
<div class="row center-align"> |
This file contains hidden or 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
#!/usr/bin/node | |
if (process.env.NODE_ENV != 'production') require('dotenv').config(); | |
// Set up Algolia | |
const algolia = require('algoliasearch'); | |
const client = algolia( | |
process.env.AG_APPLICATION_ID, | |
process.env.AG_API_WRITE_KEY | |
); |
This file contains hidden or 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
index.addObject(object, function(err, content) { | |
index.waitTask(content.taskID, function(err) { | |
if (!err) { | |
// Create an object of the input text, source lang and target lang | |
let objectToTranslate = { | |
text: content.description_en, // The words to be translated | |
source: 'en', // The language they are in | |
target: 'es' // The language you want them to be | |
}; |
This file contains hidden or 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
SELECT sum(query_count) | |
FROM (( | |
SELECT query_count | |
FROM rollups_5min | |
WHERE timestamp >= $1 AND timestamp < $2 AND app_id = $3 | |
) UNION ALL ( | |
SELECT query_count | |
FROM rollups_1day | |
WHERE timestamp >= $1 AND timestamp < $2 AND app_id = $3 | |
)) a... |
This file contains hidden or 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
CREATE OR REPLACE FUNCTION compute_5min_rollups(start_time TIMESTAMP, end_time TIMESTAMP) | |
RETURNS void LANGUAGE PLPGSQL AS $function$ | |
BEGIN | |
EXECUTE $$ | |
INSERT INTO rollups_5min | |
SELECT | |
date_trunc('seconds', (timestamp - TIMESTAMP 'epoch') / 300) * 300 + TIMESTAMP 'epoch' AS minute, | |
app_id, | |
timestamp, | |
count(*) AS query_count, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
var sendgrid = require('sendgrid')(api_key); | |
var moment = require('moment'); // I use this for time cos it's ace | |
var userInfo = require('./test.json'); // for example purposes this would be the JSON you sent me, you would probably be getting this from a DB or via another call... | |
var email = new sendgrid.Email({to: userInfo.emailData.email}); // Set up the initial email object, we're sending to Andy. | |
var timeToSend = moment(userInfo.send_time).unix(); // Scheduled send takes a UNIX timestamp, I used MomentJS to make it | |
email.setSendAt(timeToSend); // Set the scheduled send time | |
email.setUniqueArgs({user: userInfo.User}); // Let's pass the username via a unique arg, you'll get this back via the Event Webhook, helps to uniquify tracking |
This file contains hidden or 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
// This is the example from https://github.com/sendgrid/sendgrid-php#headers | |
// but slight modifications have been made to include code for IP Pooling | |
$email = new SendGrid\Email(); | |
->addTo('[email protected]') | |
->addTo('[email protected]') | |
->setFrom('[email protected]') | |
->setSubject('Subject goes here') | |
->setText('Hello World!') |
This file contains hidden or 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 replyWithCard(email, callback){ | |
var cardEmail = new sendgrid.Email({ | |
to: email, | |
from: process.env.FROM_ADDRESS, | |
fromname: process.env.FROM_NAME, | |
subject: process.env.SUBJECT, | |
html: '<h2>Thanks for requesting a business card!</h2>', // <%body%> tag for text | |
text: 'Thanks for asking for a business card, sorry I didn\'t have any on me!' // <%body%> tag for html |
This file contains hidden or 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 replyWithCard(email, callback){ | |
var text_block = "Thanks for asking for a business card, sorry I didn\'t have any on me!\n\n"; | |
text_block += "Here are my details:\n\n"; | |
text_block += "Name: "+process.env.FROM_NAME+"\n"; | |
text_block += "Twitter: "+process.env.TWITTER+"\n"; | |
text_block += "Email: "+process.env.FROM_ADDRESS+"\n\n"; | |
text_block += "You can reply to this email to contact me directly.\n\n"; | |
text_block += process.env.SIGN_OFF+"\n\n"; | |
text_block += process.env.SIGNATURE; |
NewerOlder