Skip to content

Instantly share code, notes, and snippets.

View jarodreyes's full-sized avatar

Jarod Reyes jarodreyes

View GitHub Profile
/** @type {PostLoginAction} */
module.exports = async (event, context) => {
const approveLogin = () => {
return {
user: {
appMetadata: {
actions: 'got-callback'
},
userMetadata: {
@jarodreyes
jarodreyes / hello.cs
Last active February 20, 2018 23:48
Twilio Code DevIntersection
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
namespace DevIntersection
{
class SendSMS
{
Twilio.Client.Init(
"accountSid",
"authToken"
// This #include statement was automatically added by the Particle IDE.
#undef MBEDTLS_ECDSA_C
// This #include statement was automatically added by the Particle IDE.
#include <MQTT-TLS.h>
// This #include statement was automatically added by the Particle IDE.
#include <ArduinoJson.h>
#include "certificate.h"
@jarodreyes
jarodreyes / functions.js
Last active October 18, 2017 01:25
functions.js
// Handles incoming messages. Goal is to pair random people who have texted the number. Like anonymous comms.
let _ = require('lodash');
exports.handler = function(context, event, callback) {
let client = context.getTwilioClient();
let createPair = require(Runtime.getFunctions()['pair-friends'].path);
let twilioNumber = event.To;
console.log(`Incoming: ${event.Body} - ${event.From}`)
client.messages.list({to: twilioNumber }).then((list) => {
let cleanedList = _.uniqBy(list, 'from');
@jarodreyes
jarodreyes / slack-bot.js
Created June 28, 2017 16:41
Slack to twilio Threads
...
rtm.on(RTM_EVENTS.MESSAGE, function handleRtmMessage(message) {
var isAdmin = _.contains(admins, message.user);
if (message.thread_ts) {
sendMessageToThread(message).then((message) => {
console.log('Message Sent to user.');
});
return;
}
@jarodreyes
jarodreyes / Hackpack Animations
Last active May 25, 2017 17:39
Custom animations for the hackpackv3 at SIGNAL.
// Creates a scrolling rainbow
uint32_t rainbow_animation_lut[][16] = {
{ 0xff0000,0x101010,0x101010,0x101010,
0xff0000,0x101010,0x101010,0x101010,
0xff0000,0x101010,0x101010,0x101010,
0xff0000,0x101010,0x101010,0x101010}, //Frame1
{ 0xffff01,0xff0000,0x101010,0x101010,
0xffff01,0xff0000,0x101010,0x101010,
0xffff01,0xff0000,0x101010,0x101010,
# save file
# open a console and type:
# ruby dads-night-scrambler.rb
dads = ['Bruno', 'Evan', 'Geoff', 'Dan', 'Spencer', 'David', 'Kashaka', 'John', 'Sean', 'Andrew', 'Nick', 'Jarod']
puts dads.shuffle
# Example Output:
# John
# Andrew
@jarodreyes
jarodreyes / mission-control.bs
Last active September 17, 2016 21:17
Starting up Mission Control
cd ~/mission-control
# update the app
git pull origin master
# start the app, game does not start automatically
nodemon index.js
# open a new tab in terminal -> cmd+t
# start the public tunnel to this server for admin use
@jarodreyes
jarodreyes / test_template_tags.py
Last active April 8, 2016 12:13
Wagtail Unit Test - Template tag
def test_subnav_use_root_menu(self):
# Arrange
api_reference = Page.objects.get(url_path='/docs/api/')
lookups = Page.objects.get(url_path='/docs/api/lookups/')
mock_context = {'request': 'Request data'}
parent = lookups.get_site().root_page
menuitems = parent.get_children().live().in_menu()
# Act
nav_data = subnav(mock_context, lookups)
@jarodreyes
jarodreyes / ValidateAuthyRequest.php
Created October 27, 2015 17:23
Validating an Authy OneTouch request using PHP/Laravel. Twilio.
<?php namespace App\Http\Middleware;
use Closure;
class ValidateAuthyRequest {
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request