Skip to content

Instantly share code, notes, and snippets.

View MagnusThor's full-sized avatar
🏠
Working from home

Magnus 'Bagzy' Thor MagnusThor

🏠
Working from home
  • Freelancer & member of coloquium
  • Sweden
View GitHub Profile
@MagnusThor
MagnusThor / gist:7020559
Created October 17, 2013 07:28
An example of how to capture the screen, attach it to the current RTCPeerConnection and do a re-negotiation using the XSockets.NET WebRTC APIS.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<!-- Get the JS files from - https://github.com/XSockets/WebRTC -->
<script src="/Scripts/jquery-1.9.1.js"></script>
<script src="/Scripts/XSockets.latest.min.js"></script>
<script src="Client/Scripts/XSockets.WebRTC.latest.js"></script>
<script>
@MagnusThor
MagnusThor / HanderController.cs
Created October 17, 2013 10:35
Simple XSocketsContorller and JS Client - Answers question from A.Kovalchuk .
using System;
using System.Collections.Generic;
using XSockets.Core.Common.Socket;
using XSockets.Core.Common.Socket.Event.Arguments;
using XSockets.Core.Common.Socket.Event.Attributes;
using XSockets.Core.XSocket;
using XSockets.Core.XSocket.Helpers;
using XSockets.Core.XSocket.Model;
namespace Chat.Controllers
@MagnusThor
MagnusThor / Foo.cshtml
Created October 18, 2013 09:05
Sneak peak of how to run XSockets.NET on top of IIS8 and Windows 2012/Windows 8 using the built-in WebSockets Protocol - Using a MVC4+ View ,Razor. and the coming XSocketsControllerBase<IXBaseSocket> class. More info about XSockets.NET on http://xsockets.net
@{
ViewBag.Title = "Index";
}
<h2>This is the RazorView for the RealtimeMVC Controller - XSocketsControllerBase<Foo> </h2>
<p>This is a realtime MVC Controller</p>
<div>
<input /><span></span>
@MagnusThor
MagnusThor / MyBinaryController.cs
Created October 29, 2013 20:53
This is an example how to "wrap" binary objects using JavaScript and pass them to the XSocketsController.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using XSockets.Core.Common.Socket.Event.Arguments;
using XSockets.Core.XSocket;
using XSockets.Core.XSocket.Helpers;
namespace XSockets.Example.BinaryWrapper
String.prototype.capitalize = function () {
return this.replace(/(^|\s)([a-z])/g, function (m, p1, p2) {
return p1 + p2.toUpperCase();
});
};
var RTCPeerConnection = null;
var getUserMedia = null;
var attachMediaStream = null;
var reattachMediaStream = null;
@MagnusThor
MagnusThor / gist:16245ac659e6df1b6668
Created September 2, 2014 11:02
DOM VisibilityChange
var Sandvik = Sandvik || { Utils: {} };
Sandvik.Utils.VisibilityChange = (function() {
function ctor(cb) {
var self = this;
this.visibilityState = true;
var visProp = (function() {
var prefixes = ['webkit', 'moz', 'ms', 'o'];
if ('hidden' in document) return 'hidden';
for (var i = 0; i < prefixes.length; i++) {
if ((prefixes[i] + 'Hidden') in document)
@MagnusThor
MagnusThor / Noc.beta.js
Created July 4, 2015 12:40
Old Goats Tule
var $ = function(selector,context) {
if (!context) context = document;
return context.querySelector(selector);
};
window.requestAnimFrame = (function () {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame ||
function (callback) {
window.setTimeout(callback, 1000 / 60);
<!DOCTYPE html>
<html>
<head>
<title>Old Guys Rule | Man Myth Legend</title>
<link href="css/default.css" rel="stylesheet" />
<script>
var basePath = "/audio/";
var Effects = {};
</script>
</head>
scenes.forEach(function (scene) {
scene.entity.push = scene.start;
engine.addEntity(scene.entity);
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Custom Geo Binder</title>
</head>
<body>
<div id="app">