Skip to content

Instantly share code, notes, and snippets.

View GreenStage's full-sized avatar

Eduardo Gomes GreenStage

  • Cloudflare
  • Lisboa
View GitHub Profile
public class HandleNewHR extends UntrustedElement{
@EventReceiver
public void onEvent(GraphEvent event) {
int hrValue = (Integer) event.getData();
sendEventToPort(new TextEvent(String.valueOf(hrValue),0);
sendEventToPort(new DataAppendEvent(hrValue),1);
}
}
public class HandleNewHR extends UntrustedElement{
@EventReceiver
public void onEvent(GraphEvent event) {
int hrValue = (Integer) event.getData();
sendEventToPort(new TextEvent(String.valueOf(hrValue),0);
sendEventToPort(new DataAppendEvent(hrValue),1);
}
}
public class MainActivity extends Activity {
...
private Bitmap currentPic = null;
public void onSelectImageClick(View v){
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
String[] mimeTypes = {"image/jpeg", "image/png"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
startActivityForResult(intent, REQUEST_CODE);
public class BLEService extends Service {
BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
...
public void onCharacteristicChanged(characteristic) {
mainActivity.onNewHeartRate(characteristic.getValue());
}
}
}
public class MainActivity extends Activity {

Keybase proof

I hereby claim:

  • I am greenstage on github.
  • I am greenstage (https://keybase.io/greenstage) on keybase.
  • I have a public key ASC_MTcf0HAlWIxNopvof2UI2GrMU7PJPkIpS9wbcKlwDAo

To claim this, I am signing this object:

import React from 'react';
import {CSComponent} from 'react-central-state';
class Display extends React.Component {
constructor(props){
super(props);
//Register listener for 'foo' object changes
this.fooListener = this.addCentralStateListener(prevstate=>{
alert("Foo changing from "+prevstate.foo+" to "+this.centralState.foo);
import React from 'react';
import {CSComponent} from 'react-central-state';
class _Component1 extends React.Component {
...
changeFoo(value){
this.setCentralState({foo:value});
}
...
}
import React from 'react';
import {StateComponent} from 'react-central-state';
export class Display extends StateComponent {
...
triggers(){
return ['foo','someOtherProperty','anotherOne'];
}