Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Whinnery kwhinnery

  • Twilio
  • Saint Paul / Minneapolis
View GitHub Profile
@kwhinnery
kwhinnery / dndtool.json
Last active Sep 22, 2022
Work in progress D&D Tools built in Retool (https://www.retool.com)
View dndtool.json
{"uuid":"6aca7a34-392b-11ed-bd49-8bb70f5219e2","page":{"id":95557202,"data":{"appState":"[\"~#iR\",[\"^ \",\"n\",\"appTemplate\",\"v\",[\"^ \",\"isFetching\",false,\"plugins\",[\"~#iOM\",[\"resetDiceRoll\",[\"^0\",[\"^ \",\"n\",\"pluginTemplate\",\"v\",[\"^ \",\"id\",\"resetDiceRoll\",\"type\",\"datasource\",\"subtype\",\"JavascriptQuery\",\"namespace\",null,\"resourceName\",\"JavascriptQuery\",\"resourceDisplayName\",null,\"template\",[\"^3\",[\"queryRefreshTime\",\"\",\"lastReceivedFromResourceAt\",null,\"queryDisabledMessage\",\"\",\"successMessage\",\"\",\"queryDisabled\",\"\",\"playgroundQuerySaveId\",\"latest\",\"resourceNameOverride\",\"\",\"runWhenModelUpdates\",false,\"showFailureToaster\",true,\"query\",\"lastDiceClicked.setValue(-1);\\ndiceRolls.setValue([]);\\ndiceRollModifier.setValue(0);\\ndiceRollDisplay.setValue(`<small><i>Roll a die...</i></small>`);\\ndiceRollTotal.setValue(`## 0`);\\n\",\"playgroundQueryUuid\",\"\",\"playgroundQueryId\",null,\"error\",null,\"privateParams\",[\"~#iL\",[]],\"
View ClientOnly.js
import React from 'react';
const SSR = typeof window === 'undefined';
function _ClientOnly() {
return(
<div style={{
backgroundColor: localStorage.getItem('backgroundColor')
}}/>
);
View index.js
const http = require('http');
const express = require('express');
const bodyParser = require('body-parser');
const MessagingResponse = require('twilio').twiml.MessagingResponse;
const app = express();
app.use(bodyParser.urlencoded({ extended: false });
app.post('/sms', (req, res) => {
const twiml = new MessagingResponse();
View package.json
{
"name": "Kevin's Mod",
"version": "0.1.x",
"dependencies": {
"twilio": "4.x"
},
"engines": {
"twilioquest": "3.1.x"
},
"twilioquest": {
View app.js
app.post('/message', function(req, res, next) {
// Use the REST client to send a text message
client.messages.create({
to: req.body.to,
from: TWILIO_PHONE_NUMBER,
body: 'Good luck on your Twilio quest!'
}).then(function(message) {
// When we get a response from Twilio, respond to the HTTP POST request
res.send('Message is inbound!');
}).catch(function(error) {
View queries.js
const pool = require('./config');
require('dotenv').config()
const getUsers = (request, response) => {
pool.connect().then(client => {
client.query('SELECT * FROM users ORDER BY id ASC', (error, results) => {
if (error) {
throw error
}
response.status(200).json(results.rows)
View index.js
const express = require('express')
const app = express()
app.post('/sms', (request, response) => {
let twiml = `
<Response>
<Message>hey there, thanks for checking out my demo!</Message>
</Response>
`;
View airtable_update.js
/* global module, exports, require, process, console */
'use strict'
const Airtable = require('airtable')
// Configure Airtable database
const base = new Airtable({
apiKey: process.env.AIRTABLE_API_KEY}
).base(process.env.AIRTABLE_DATABASE)
View app.rb
require 'sinatra'
require 'twilio-ruby'
sid = ''
tkn = ''
app_sid = ''
capability = Twilio::Util::Capability.new sid, tkn
capability.allow_client_outgoing(app_sid)
View example.jade
html
head
title Socket.io Example
body
h1(class="something") Socket.io Example
input#msg(type="text")
button send message
#messages