Skip to content

Instantly share code, notes, and snippets.

View ProbablePrime's full-sized avatar
😍
Making memes

ProbablePrime ProbablePrime

😍
Making memes
View GitHub Profile
@ProbablePrime
ProbablePrime / events.md
Last active October 31, 2016 02:47
Example Beam.pro Events

Sample Beam.pro liveloading events

Follow

On The user level - "user:000:followed"

{"following":true,"channel":{"id":000,...usual channel object}}

Channel Level - "channel:50772:followed"

@ProbablePrime
ProbablePrime / gen.js
Created February 29, 2016 12:10
Easily update a control set on beam quickely.
var WsabiClient = require('wsabi-client-bacon');
var mcBoard = [
[
{
key: 'Replace Item',
cost: 50
//cooldown: 5 * 1000
},
{
var Client = require('wsabi-client-bacon');
var client = new Client("wss://realtime.beam.pro");
client.socket.on("open", function () {
console.log("Socket connection open!");
// Send requests to the server with get, put, post, delete, or request.
client.get("/api/v1/channels/Youplay").then(function(res) {
// Subscribe to a live event
client.live('channel:'+res.id+':update').then(function(res) {

Whispers

Send

{"type":"method","method":"whisper","arguments":["userName?", "msg"], "id": "..."}

const Beam = require('beam-client-node');
const Tetris = require('beam-interactive-node');
const stream = 1234;
const username = 'connor';
const password = 'password';
const beam = new Beam();
beam.use('password', {
username,
var Beam = require('beam-client-node');
var Tetris = require('beam-interactive-node');
const readline = require('readline');
var stream = <channelID>;
var auth = {
username: 'username',
password:'passs'
};
const rl = readline.createInterface({
var WsabiClient = require('wsabi-client-bacon');
var wsabi = new WsabiClient('https://beam.pro');
wsabi.liveUrl = '/api/v1/live';
wsabi.socket.on('open', doIt);
function login(username, password) {
console.log('login');
return wsabi.post('/api/v1/users/login', {username, password});
@ProbablePrime
ProbablePrime / hex.python
Created June 30, 2016 19:35
decode a protobuff packet to space delimited hex bytes
print(' '.join(hex(x)[2:] for x in 'hello world!'))
@ProbablePrime
ProbablePrime / button.py
Created July 1, 2016 03:07
example progress events in python
import asyncio
import binascii
from requests import Session
from beam_interactive import start
from beam_interactive import proto
path = "https://beam.pro/api/v1"
auth = {
"username": "Merlin",
"password": "D"
const Packets = require('beam-interactive-node/dist/robot/packets').default;
robot.send(new Packets.ProgressUpdate(
tactile: [new Packets.ProgressUpdate.TactileUpdate({
id: <id>,
cooldown: <cooldown>,
fired: <fired>,
progress: <progress>
})]);