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 lookupUser = (tweet) => { | |
const authorId = tweet.data.author_id; | |
let author = {}; | |
for (const user of tweet.includes.users) { | |
if (user.id === authorId) { | |
author = user; | |
return user; | |
} | |
} | |
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 BearerTokenKey = 'twitterBearerToken'; | |
function onOpen() { | |
SpreadsheetApp | |
.getUi() | |
.createMenu('Twitter') | |
.addItem('Set Bearer token', 'helpers.requestBearerToken') | |
.addItem('Sign out', 'helpers.logout') | |
.addToUi(); | |
} |
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 qs = require('querystring'); | |
const request = require('request'); | |
const readline = require('readline').createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
const util = require('util'); | |
const get = util.promisify(request.get); | |
const post = util.promisify(request.post); |
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 bearer_token () { | |
local CONSUMER_API=$1 | |
local CONSUMER_SECRET=$2 | |
| |
if [ -z "$CONSUMER_API" ] || [ -z "$CONSUMER_SECRET" ] ; then | |
echo "Usage: ${FUNCNAME[0]} <consumer_api_key> <consumer_secret>" | |
return 1 | |
fi | |
| |
curl -s -XPOST -H "Authorization: Basic $(echo -n $CONSUMER_API:$CONSUMER_SECRET | base64)" -H "Content-type: application/x-www-form-urlencoded; charset: utf-8" -d "grant_type=client_credentials" https://api.twitter.com/oauth2/token | jq -r .access_token |
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
<?hh | |
class AverageController extends BaseController { | |
// Use this if the user needs a valid login | |
use AuthenticationTrait; | |
protected function init() { | |
// The constructor | |
} | |
// Validate request parameters. For example, if the route is |
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
/* Implement and call when the user adds an item to the cart */ | |
protected void addedItemToCart() { | |
Carnival.logEvent("Add To Cart"); | |
AttributeMap attributes = new AttributeMap(); | |
attributes.putBoolean("add_to_cart", true); | |
attributes.putBoolean("checkout_complete", false); | |
Carnival.setAttributes(attributes, new Carnival.AttributesHandler() { | |
@Override | |
public void onSuccess() { | |
// Success |
We can't make this file beautiful and searchable because it's too large.
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
ISO Code,Name | |
AU,Australia | |
CN,China | |
AU,Australia | |
CN,China | |
JP,Japan | |
CN,China | |
JP,Japan | |
TH,Thailand | |
CN,China |
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
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> | |
<style> | |
body {font-family: "Open Sans"} | |
span {font-size: 11px; color: #474a54;} | |
</style> | |
<div><span class="version"></span><span class="release-date"></span></div> | |
<script> | |
$.get('https://api.github.com/repos/carnivalmobile/carnival-ios-sdk/releases/latest', function(r) { |