Skip to content

Instantly share code, notes, and snippets.

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

Steve Rogers magnatronus

🏠
Working from home
View GitHub Profile
@magnatronus
magnatronus / main.dart
Created September 13, 2018 14:08
Demo of Oscilloscope using Stream Data
/// Demo of using the oscilloscope package
/// This uses the output from the Acceleromter on a device
import 'package:flutter/material.dart';
import 'package:oscilloscope/oscilloscope.dart';
import 'package:sensors/sensors.dart';
void main() => runApp(new MyApp());
@magnatronus
magnatronus / extract.dart
Last active March 14, 2024 03:49
Extracting BBC Micro:bit accelerometer data using Flutter Blue
/// This gist assumes that Flutter Blue (https://github.com/pauldemarco/flutter_blue) is used to connect to a BBC Micro:bit
/// and is listening to the [device.onValueChanged] for the correct characteristic ("E95DCA4B-251D-470A-A062FA1922DFA9A8")
///
/// this will be something similar to
///
/// device.onValueChanged( (accChar).listen( (value){ convertRawData(value)}));
///
/// the 'raw' listen value is a List<int> of length 6 this needs to be converted into the X,Y and Z values from the
/// accelerometer and is done with the function below
///
@magnatronus
magnatronus / main.dart
Created July 23, 2018 15:00
Dart List example
void main() {
List myList = List();
myList.add({'title' :"Chocolate", 'isFavorite': true});
myList.add({'title' :"Cucumber", 'isFavorite': false});
myList.forEach( (item) {
print('${item['title']} ${(item['isFavorite'])?"is my favourite": "is not my favourite"}');
});
}
@magnatronus
magnatronus / package.json
Created July 28, 2017 13:46
Erbium package.json
{
"name": "erbium",
"version": "1.0.0",
"description": "Erbium ES6 framework for Titanium Development",
"project" :{
"name": "",
"theme": ""
},
"ti" :{
"appId": "uk.spiralarm.",
@magnatronus
magnatronus / index.js
Created July 28, 2017 11:40
Titanium iOS Hyperloop example using Erbium and ES6
/**
* Testing Hyperloop in Erbium ES6 franework
*
* This uses the Hyperloop example from the Axway blog post
* https://www.appcelerator.com/blog/2016/08/hyperloop-working-with-native-controls-in-ios/
*
* But it has been updated to use ES6
* 28 July 2017
*/
import UIButton from 'UIKit/UIButton';
@magnatronus
magnatronus / ForecastList.js
Created May 18, 2017 16:16
Example source code of ES6 test Titanium app
import React, { Component, Globals } from '/libs/erbium';
import { View, Image, Label, TableView, TableViewSection, TableViewRow } from '/libs/erbium-ui';
import Theme from '/themes/ThemeOne';
import WeatherAPI from '/components/WeatherAPI';
import moment from '/libs/moment';
class ForecastList extends Component {
componentWillMount(){
this.api = new WeatherAPI();