Skip to content

Instantly share code, notes, and snippets.

@netomarin
netomarin / index.js
Created October 11, 2018 18:06
Using simple response for different speech and written text
conv.ask(new SimpleResponse({
speech: 'The code for ' + crypto + ' is ' + code +
'. You can say "Check ' + code +
' quote" to know the market value',
text: 'The code for ' + crypto + ' is ' + code,
}));
conv.ask(new Suggestions('Check ' + code + ' quote'));
@netomarin
netomarin / index.js
Created October 11, 2018 18:03
Adding a Suggestion Chip
conv.ask('The code for ' + crypto + ' is ' + code);
if (conv.surface.capabilities.has(
'actions.capability.SCREEN_OUTPUT')) {
conv.ask(new Suggestions('Check ' + code + ' quote'));
}
@netomarin
netomarin / char_lcd_i2c_pcf.py
Created April 20, 2017 05:53
Exemplo de uso de display LCD I2C 20x4 com módulo PCF8574 em Python para Raspberry Pi
# Classe do branch que é compativel com o modulo PCF8574
import Adafruit_CharLCD.PCF_CharLCD as LCD
# Valores de configuracao
address = 0x3f
busnum = 1
lines = 4
cols = 20
# E se estiver usando um 2x16
from borg import Borg
import json
import configparser
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
from datetime import datetime
from datetime import timedelta
import numpy
import threading
@netomarin
netomarin / onename
Last active January 14, 2016 17:51
Verifying that +netomarin is my blockchain ID. https://onename.com/netomarin
private String[] listValues = new String[]{"Brasil", "Argentina", "Bolívia", "Chile", "Colômbia",
"Equador", "Ilhas Malvinas", "Guiana Francesa", "Guiana", "Paraguai", "Peru",
"Suriname", "Uruguai", "Venezuela"};
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, listValues);
@netomarin
netomarin / IntentServiceResultReceiver.java
Last active August 29, 2015 13:56
ResultReceiver que irá receber os resulados e atualizar a Activity.
private class IntentServiceResultReceiver extends ResultReceiver {
public IntentServiceResultReceiver(Handler handler) {
super(handler);
}
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
String result = resultData.getString("result");
try {
@netomarin
netomarin / HttpIntentService-onHandleIntent.java
Last active August 29, 2015 13:56
exemplo de onHandleIntent para comunicação web
@Override
protected void onHandleIntent(Intent intent) {
ResultReceiver resultReceiver = intent.getParcelableExtra(RESULT_RECEIVER_EXTRA);
String text = intent.getStringExtra(STR_EXTRA_TEXT);
Map<String, Object> params = new LinkedHashMap<String, Object>();
if (text != null) {
params.put("text", text);
}
@netomarin
netomarin / com.blogspot.codigogoogle.simplegetpostclient.MainActivity.java
Created February 11, 2014 02:40
Código de exemplo do post sobre comunicação Web em apps Android - Parte I
package com.blogspot.codigogoogle.simplegetpostclient;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@netomarin
netomarin / robot.js
Created December 4, 2012 11:32
DroidBot
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);