Skip to content

Instantly share code, notes, and snippets.

View jefBinomed's full-sized avatar

Jean-François Garreau - Binomed jefBinomed

View GitHub Profile
@jefBinomed
jefBinomed / gist:3b94d59e48de32153f9d
Created June 17, 2015 14:53
Programmez-07/08_2015-PortalWebrtc-10
function drawEllipse(ctx, x,y, w, h) {
varkappa = .5522848,
ox = (w /2)*kappa, // controlpointoffset horizontal
oy = (h /2)*kappa, // controlpointoffsetvertical
xe = x + w, // x-end
ye = y + h, //y-end
xm = x + w /2, // x-middle
ym = y + h /2; //y-middle
ctx.beginPath();
ctx.moveTo(x,ym);
@jefBinomed
jefBinomed / gist:f6826c4fd26661ba12f5
Created June 17, 2015 14:54
Programmez-07/08_2015-PortalWebrtc-11
var timeOut = 7;
varangleInc = 360/ (timeOut*100);
varangle = 0;
var lastTime = 0;
@jefBinomed
jefBinomed / gist:83ab0f24bada20476d2e
Created June 17, 2015 14:54
Programmez-07/08_2015-PortalWebrtc-12
//draw colormap->palettevalues toscreen
vardraw = function()
{
// render theimagedatatotheoffscreen buffer...
bufferContext.putImageData(imageData,0,0);
// ...then draw it toscaletotheonscreen canvas
// Imagedebaseen bas !
var timeStamp = new Date().getTime();
angle += angleInc*((lastTime- timeStamp) /100);
angle = angle % 360;
@jefBinomed
jefBinomed / gist:4101de57ab41bbed1037
Created June 17, 2015 14:55
Programmez-07/08_2015-PortalWebrtc-13
var color = 'red';
this.init = function(colorToApply,dim)
{
if (colorToApply){
color = colorToApply;
}
context = this.canvas.getContext('2d');
width = Math.round(this.canvas.width / scale);
height = Math.round(this.canvas.height / scale);
if (dim){
@jefBinomed
jefBinomed / 0_reuse_code.js
Created August 29, 2016 15:03
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
@jefBinomed
jefBinomed / myo.cpp
Created December 8, 2017 08:36
2014-12-16-myo-c++
// Class qui écoute les événements provenant du sdk
class DataCollector : public myo::DeviceListener {
public:
...
// Appelé pour donner les données sur l'orientation,
void onOrientationData(myo::Myo* myo, uint64_t timestamp, const myo::Quaternion<float>& quat)
{
using std::atan2;
using std::asin;
using std::sqrt;
@jefBinomed
jefBinomed / 2014-12-16-package.json
Created December 8, 2017 08:38
Gist for article of 2014-12-16
{
"author": "jefBinomed",
"name": "MyoEV3",
"version": "1.0.0",
"dependencies": {},
"devDependencies": {
"bluetooth-serial-port": "1.1.4", // Utilisé pour la communication bluetooth
"express" : "3.x" // Utilisé pour la partie serveur
}
}
@jefBinomed
jefBinomed / 2014-12-16-server.js
Created December 8, 2017 08:39
Code server for article 2014-12-16
var app = express()
.use(express.static('public'))
.use(function(req, res){
...
});
http.createServer(app).listen(8090);
console.log('-------------------------------');
console.log('Start Http server on port : '+8090);
<link rel="import"
href="/components/polymer/polymer.html">
<polymer-element name="ready-element">
<template>
This element has a ready() method.
<span id="el">Not ready...</span>
</template>
<script>
Polymer({
owner: "Daniel",
components.directive('leapMouseMove', ['$rootScope'
,function ($rootScope) {
var directiveDefinitionObject = {
restrict: 'A',
scope: false,
link: function postLink($scope, iElement, iAttrs) {
var element = iElement[0];
var boundingRect = element.getBoundingClientRect();
console.log('Id : '+element.id);
console.log(boundingRect);