Skip to content

Instantly share code, notes, and snippets.

View devdays's full-sized avatar

Bruce D Kyle devdays

View GitHub Profile
@devdays
devdays / html5-fiieldset.html
Created November 30, 2014 18:29
HTML5 fieldset, legend, label Tags
<form>
<fieldset name="userinfo">
<legend>User information</legend>
<label for="name">Name</label>
<input type="text" name="name" id="name" size="40" required>
<br />
<label for="address">Address</label>
<input type="text" name="address" id="address" size="40">
<br />
<label for="phone">Phone</label>
@devdays
devdays / html5-forms-modernizr.html
Last active August 29, 2015 14:10
HTML5 Forms with Modernizr
<script src="Scripts/modernizr-2.5.3.min.js" type="text/javascript"></script>
<script>
Modernizr.load({
test: Modernizr.input.placeholder,
nope: function () {
Modernizr.load('Scripts/yourplaceholderpolyfill.js');
}
});
</script>
@devdays
devdays / webshim-polyfill.html
Last active August 29, 2015 14:10
Webshim polyfill
<!-- add your version of jQuery first -->
<script src="Scripts/jquery-1.7.1.min.js"></script>
<script src="Scripts/js-webshim/minified/polyfiller.js"></script>
<script>$.webshims.polyfill('forms forms-ext');</script>
@devdays
devdays / jQuery-HTMLForms.html
Created November 30, 2014 18:33
jQuery HTMLForms
<!-- jQuery (HTML5Forms requires jQuery 1.4 and higher) -->
<script src="Scripts/jquery-1.7.1.min.js"></script>
<!-- jQuery.html5form plugin -->
<script src="Scripts/jquery.html5form-1.5-min.js"></script>
<script>
$(document).ready(function () {
$('#myform').html5form();
});
@devdays
devdays / html5-websocket.html
Created November 30, 2014 19:15
Web Socket client
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>WebSocket Test</title>
<script type="text/javascript">
var wsUri = 'ws://' + window.location.hostname +
window.location.pathname.replace('index.html', 'ws.ashx');
var output;
var socket;
@devdays
devdays / websocket-endpoint.js
Created November 30, 2014 19:19
Dynamically configures the code to point to my WebSocket server
var wsUri = 'ws://' + window.location.hostname +
window.location.pathname.replace('index.htm', 'ws.ashx');
using System;
using System.Web;
using Microsoft.Web.WebSockets;
namespace MyWebSocket
{
public class ws : IHttpHandler
{
public bool IsReusable
{
@devdays
devdays / websocket-isrequestforwebsocket.cs
Created November 30, 2014 19:27
Check HttpContext if request is of WebSocket -type
if(context.IsWebSocketRequest){
// Do something
}
@devdays
devdays / websockets-implement-WebSocketHandler.cs
Created November 30, 2014 19:30
Implement WebSocketHandler
using System;
using Microsoft.Web.WebSockets;
namespace MyWebSocket
{
public class MyWebSocketHandler : WebSocketHandler
{
private int clientsConnectCount;
public override void OnOpen()
@devdays
devdays / websockets-override-these-methods.cs
Created November 30, 2014 19:34
Communicate with Your Client In Your WebSocket Handler
public virtual void OnClose();
public virtual void OnError();
public virtual void OnMessage(byte[] message);
public virtual void OnMessage(string message);
public virtual void OnOpen();