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
platform :ios, '11.0' | |
use_frameworks! | |
target 'PubNub Demo' do | |
pod 'PubNub', '~> 4.0' | |
end |
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
// FOR A PUBNUB SERVERLESS ENV. | |
// Learn More: https://api.slack.com/incoming-webhooks | |
export default (request, response) => { | |
const xhr = require('xhr'); | |
// Message | |
let message = `Hello World!`; | |
// Slack Webhook URL | |
const url = "SLACK-WEBHOOK-URL-HERE"; | |
// Basic Slack Post | |
const http_options = { |
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
// DO NOT USE THIS CODE CLIENT SIDE. FOR A PUBNUB SERVERLESS ENV ONLY. | |
// Set the module event type to "On Request". | |
// Create a token with Stripe.JS: https://stripe.com/docs/stripe-js | |
// Or use a test token: token=tok_visa | |
export default (request, response) => { | |
const vault = require("vault"); | |
const xhr = require("xhr"); | |
const token = request.params.token; | |
return vault.get("stripe_secret_key").then((apiKey) => { | |
const http_options = { |
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
export ANDROID_HOME=$HOME/Library/Android/sdk | |
export PATH=$PATH:$ANDROID_HOME/tools | |
export PATH=$PATH:$ANDROID_HOME/tools/bin | |
export PATH=$PATH:$ANDROID_HOME/platform-tools |
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
import React, {Component} from 'react'; | |
import {Platform, StyleSheet, Text, View} from 'react-native'; | |
type Props = {}; | |
export default class App extends Component<Props> { | |
render() { | |
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
void loop() { | |
sensorTimer = (sensorTimer + 1); // Add a second to the sensor timer. | |
if (sensorTimer == 60) { // Check sensor. | |
sensorTimer = 0; // Reset timer. | |
sendTimer = (sendTimer + 1); // Add a minute to sendTimer. | |
if (sendTimer == 10) { // Reset timer after 10 minutes. | |
sendTimer = 0; // Reset timer. | |
} | |
sensorValue = analogRead(A0); // Read sensor. Convert to UV index. | |
if ((sensorValue >= 0) && (sensorValue < 20)) { |
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
#include <ESP8266WiFi.h> | |
#define PubNub_BASE_CLIENT WiFiClient | |
#include <PubNub.h> | |
const static char ssid[] = "Sensor Network"; | |
const static char pass[] = "sens0rpassw0rd"; | |
int rled = 14; // The PWM pins the LED is attached to. | |
int gled = 12; | |
int bled = 15; |
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
#include <ESP8266WiFi.h> | |
#define PubNub_BASE_CLIENT WiFiClient | |
#include <PubNub.h> | |
const char* ssid = "YourSSID"; | |
const char* password = "YourPASSWORD"; | |
const char* channelName = "hello_world"; | |
void setup() { | |
Serial.begin(9600); |
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
package main | |
import "fmt" | |
func main() { | |
n := 15 | |
for i:=1; i<=n; i++ { | |
if (i%3 == 0) && (i%5 == 0) { | |
fmt.Println("FizzBuzz") | |
} else if i%3 == 0 { |
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
package main | |
import "fmt" | |
func main(){ | |
fmt.Println(isPrime(4)) | |
fmt.Println(isPrime(7)) | |
fmt.Println(isPrime(1616161)) | |
} | |
/** |