Skip to content

Instantly share code, notes, and snippets.

View DaveVoyles's full-sized avatar

Dave Voyles DaveVoyles

View GitHub Profile
@DaveVoyles
DaveVoyles / gist:e51d84d6afad3554eff7
Created March 13, 2015 01:11
polymer-ready event
<head>
<link rel="import" href="path/to/x-foo.html">
</head>
<body>
<x-foo></x-foo>
<script>
window.addEventListener('polymer-ready', function(e) {
var xFoo = document.querySelector('x-foo');
xFoo.barProperty = 'baz';
});
@DaveVoyles
DaveVoyles / gist:22e518e6b7461a631c00
Last active August 29, 2015 14:16
index.html polymer
<header>
<h1>article header h1</h1>
<p>This web app takes advantage of Web Components and Polymer to enable new HTML features in the browser.</p>
<p>
In this particular case, we are using <a href="https://github.com/passy/x-pokemon">
the x-pokemon web component </a> to pull the images from a database, as well as the
<a href="http://zenorocha.github.io/voice-elements/">voice-elements web component</a> to speak the name of the pokemon we entered.
</p>
<h2>Change the accent</h2>
<x-radial-buttons id="radial-button-template"></x-radial-buttons>
(function (pokemonApp) {
// Grab inputs and button for speech-to-text
var form = document.querySelector('#player-form'),
input = document.querySelector('#player-input'),
playerElement = document.querySelector('#player-element'),
xPokemon = document.querySelector('#x-pokemon'),
btnChangeAccent = document.querySelector('#btn-change-accent'),
radialButtonTemplate = document.querySelector("#radial-button-template"),
playerAccent = playerElement.getAttribute("accent");
@DaveVoyles
DaveVoyles / gist:6ab1a8aae38b7c9b0879
Created March 10, 2015 01:28
x-radial-buttons Polymer
<link href="bower_components/polymer/polymer.html" rel="import">
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<polymer-element name="x-radial-buttons">
<!-- Shadow DOM -->
<template>
<style>
#paper_radio_group {
@DaveVoyles
DaveVoyles / designer.html
Last active August 29, 2015 14:16
designer
<link rel="import" href="../paper-radio-group/paper-radio-group.html">
<link rel="import" href="../paper-radio-button/paper-radio-button.html">
<polymer-element name="x-radial-buttons">
<template>
<style>
#paper_radio_group {
left: 690px;
top: 380px;
@DaveVoyles
DaveVoyles / AngularWinJSController
Created February 17, 2015 23:07
Illustrates how to execute WinJS code from within an Angular controler
"use strict";
(function () {
console.log("HomePageController loaded");
angular.module('app')
.controller('HomePageController', thingsandstuff);
function thingsandstuff() {
var vm = this;
vm.Title = "FSharp Web Kit";
vm.GitHubID = "GitHubID"; //TODO: set this w/ a Get call to retrieve GitHub ID from user
@DaveVoyles
DaveVoyles / WinJS ANgular
Created February 17, 2015 23:04
HTML sample for WinJS in the browser
<button id="btn_submit" data-win-control="WinJS.UI.Tooltip" data-win-options="{innerHTML: 'Submit your Order'}">
{{HomePage.GitHubID}}
</button>
@DaveVoyles
DaveVoyles / Kinect Prepose
Created January 29, 2015 17:39
Kinect Prepose
// Declare a Prepose program named “soccer”
APP soccer:
 
       // We are building the “ola” or “wave” gesture
       // An app can have multiple gestures
@DaveVoyles
DaveVoyles / NextWeapon
Created December 16, 2014 14:30
Switching to the next weapon in a weapon inventory
/// <summary>
/// Switch to the next weapon in our inventory
/// </summary>
private void NextWeapon()
{
// Store the value of the next weapon
currentWeaponIndex ++;
// Reached the end of the array, start from the beginning
if (currentWeaponIndex >= weaponInventory.Length)
/// <summary>
/// Check for pickup type and set powerup effect on the player
/// Play a particle effect when touching a player, and despawn afterwards
/// </summary>
/// <param name="other">What are we colliding with? Should only check for player</param>
private void OnTriggerEnter(Collider other)
{
if (!other.gameObject.CompareTag("Player")) return;
SpawnTextWhenTouched();