Skip to content

Instantly share code, notes, and snippets.

View elbruno's full-sized avatar
💭
@Home rocking some AI projects

El Bruno elbruno

💭
@Home rocking some AI projects
View GitHub Profile
@elbruno
elbruno / ElBrunoJoystickCalculateDirections
Created July 5, 2014 19:41
El Bruno - XBoxOne Joystick Calculate Directions
public static MoveDirections CalculateDirectionY(float y, int yCoeficient)
{
var locationY = MoveDirections.DownFar;
var currentLocationY = y * yCoeficient;
if (currentLocationY > 20000)
{
locationY = MoveDirections.UpFar;
}
else if (currentLocationY > 10000)
{
@elbruno
elbruno / ElBrunoXboxOneControllerProcessMovements
Created July 5, 2014 19:43
El Bruno - XboxOne Controller ProcessMovements for Rocket Launcher
private void ProcessMovements(MoveDirection moveDirection, bool fire)
{
switch (moveDirection.CombinedXy)
{
case MoveDirections.Center:
_rocket.StopMovements();
break;
case MoveDirections.Left:
case MoveDirections.LeftFar:
_rocket.MoveLeft();
@elbruno
elbruno / ElBrunoSignalRHtmlClientOnConnectedOnHubI
Last active August 29, 2015 14:04
El Bruno - SignalR, Html Client not raise OnConnected on Hub (I)
public override System.Threading.Tasks.Task OnConnected()
{
// some weird stuff here
return base.OnConnected();
}
public void JoinToArea(string area)
{
Groups.Add(Context.ConnectionId, area);
}
@elbruno
elbruno / ElBrunoSignalRHtmlClientOnConnectedOnHubII
Last active August 29, 2015 14:04
ElBruno - SignalR Html Client OnConnected On Hub II
<script type="text/javascript">
var hub;
$(window).ready(function () {
console.log("windows ready para SignalR");
hub = $.connection.SampleHub;
$.connection.hub.start().done(
function () {
var area = 'default';
console.log("hub started, area:" + area);
hub.server.JoinToArea(area);
@elbruno
elbruno / ElBrunoSignalRHtmlClientOnConnectedOnHubIII
Created July 25, 2014 18:21
ElBruno - SignalR Html Client On Connected On Hub III
<script type="text/javascript">
var hub;
$(window).ready(function () {
console.log("windows ready para SignalR");
hub = $.connection.SampleHub;
// dummy call to force the [OnConnected()] method on signalR hub
hub.client.foo = function () { };
$.connection.hub.start().done(
function () {
var area = 'default';
@elbruno
elbruno / ElBrunoConnectToPairedBlueToohDeviceUsingPIN
Last active August 29, 2015 14:04
El Bruno - Connect to paired BlueTooh Device using PIN
private static void Main()
{
BluetoothAddress arduinoAdress = null;
_blueToothClient = new BluetoothClient();
var devices = _blueToothClient.DiscoverDevices();
foreach (var device in devices.Where(device => device.DeviceName == "IoT Arduino - Mainframe Bridge"))
{
arduinoAdress = device.DeviceAddress;
Console.WriteLine("Device found, Address:" + arduinoAdress.ToString());
}
@elbruno
elbruno / PebbleCommunicationToSmartPhone02C
Created October 2, 2014 18:51
Pebble - Comunication between the pebble smartwatch and a smartphone
#include <pebble.h>
static Window *window;
static TextLayer *text_layer;
enum {
KEY_EXCHANGEDATA = 0,
};
// END Interaction with JS
@elbruno
elbruno / ElBrunoLealLetdemo
Created December 5, 2014 16:30
El Bruno LealLet demo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
</head>
<body>
<h2>El Bruno - LeafLet demo 01</h2>
@elbruno
elbruno / ElBrunoKinectV2GetBodies
Created January 2, 2015 11:04
El Bruno - Kinect V2 Get Tracked Bodies
/// <summary>
/// Array for the bodies
/// </summary>
private readonly Body[] _bodies;
private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
var dataReceived = false;
var hasTrackedBody = false;
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string name = "Valentino";
int age = 7;