Skip to content

Instantly share code, notes, and snippets.

View ejferg's full-sized avatar

Earl Ferguson ejferg

View GitHub Profile
### Keybase proof
I hereby claim:
* I am ejferg on github.
* I am ejferg (https://keybase.io/ejferg) on keybase.
* I have a public key ASDOmmskfxnlks-HeGbiBiUDr037Km4Vly34pS4fa6LAQgo
@ejferg
ejferg / aor-firebase-auth
Last active March 26, 2018 16:53
This is also using Firestore for user profile info.
/* globals localStorage */
import { AUTH_LOGIN, AUTH_LOGOUT, AUTH_CHECK } from 'admin-on-rest'
import * as firebase from 'firebase'
const authListener = null;
function handleAuthStateChange (authUser, resolve, reject) {
if(authUser) {
authUser.getIdToken().then((firebaseToken) => {
const db = firebase.firestore();
@ejferg
ejferg / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ejferg
ejferg / ios-join-room.m
Last active August 29, 2015 14:17
iOS WebRTC Join Room
[self.signal joinRoom:kRoomNerdTalk success:^{
self.localVideoRenderer = [[RTCVideoRenderer alloc] initWithView:self.localVideoView];
self.localVideoView.layer.transform = CATransform3DMakeScale(1, -1, 1);
[self.signal.localMediaStream.videoTracks[0] addRenderer:self.localVideoRenderer];
[self.localVideoRenderer start];
...
@ejferg
ejferg / ios-initialize-simplewebrtc.m
Last active August 29, 2015 14:17
iOS - Initialize SimpleWebRTC
self.signal = [[TLKSocketIOSignaling alloc] initAllowingVideo:YES];
self.signal.delegate = self;
[self.signal connectToServer:kUrlSignalMaster port:kServerPort secure:NO success:^{
[self join];
NSLog(@"Connection: Successful");
} failure:^(NSError *error) {
@ejferg
ejferg / join-room.js
Last active August 29, 2015 14:17
WebRTC Join Room
this.webrtc.joinRoom(NTApp.ROOM_NERD_TALK, function() {
console.info('Join: Successful');
});
@ejferg
ejferg / ready-to-call.js
Last active August 29, 2015 14:17
WebRTC readyToCall
this.webrtc.on(NTApp.EVENT_READY_TO_CALL, readyToCallHandler);
@ejferg
ejferg / initialize-simplewebrtc.js
Last active August 29, 2015 14:17
Initialize SimpleWebRTC
root.NTApp = function(configurations) {
this.webrtc = new SimpleWebRTC({
localVideoEl: configurations.localVideo,
remoteVideosEl: configurations.removeVideoContainer,
autoRequestMedia: true,
url: configurations.url || NTApp.URL_SIGNAL_MASTER
});
this.addEventListeners();
@ejferg
ejferg / webrtc-container.html
Last active August 29, 2015 14:17
WebRTC Container HTML
<body>
<div id="localVideoView">
<video id="localVideo"></video>
</div>
<div id="remoteVideoView"></div>