Skip to content

Instantly share code, notes, and snippets.

View mplacona's full-sized avatar

Marcos Placona mplacona

View GitHub Profile
#include <Bounce2.h>
#define BUTTON_PIN PB4
#define led1Pin PB0
#define led2Pin PB1
#define led3Pin PB2
#define led4Pin PB3
#define switchPin PB4
#define delayInterval 100
Bounce debouncer = Bounce(); // Instantiate a Bounce object
#include <avr/sleep.h>
#include <avr/interrupt.h>
#include <Heart.h>
/*
Android Beating Heart V2- Sketch
Marcos Placona 2019
*/
const int switchPin = 3;
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
- val myData = DataSource()
- tvMagicNumber.text = myData.getMagicNumber().toString()
+ val model = ViewModelProviders.of(this).get(DataSource::class.java)
+ tvMagicNumber.text = model.getMagicNumber().toString()
}
package uk.co.placona.jetpackdemo1
- class DataSource {
+ import android.arch.lifecycle.ViewModel
+
+ class DataSource: ViewModel() {
private val tag = MainActivity::class.java.simpleName
private lateinit var myRandomNumber:Number
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ def lifecycle_version = "1.1.1"
+ implementation "android.arch.lifecycle:extensions:$lifecycle_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
private fun createMagicNumber(){
myRandomNumber = (1..42).shuffled().first()
}
exports.handler = function (context, event, callback) {
/***** configuration *****/
const phoneNumber = 'YOUR_PHONE_NUMBER';
const timeout = event.Timeout || 12;
const secureRecordingLinks = false;
const voiceOpts = {
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message to="YOUR_PHONE_NUMBER">
{{From}}: {{Body}}
</Message>
</Response>
@mplacona
mplacona / Program.cs
Created February 21, 2018 19:42
Twilio Voice & SMS
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
namespace Pamphlet
{
internal static class Program
{
private static void Main(string[] args)
@mplacona
mplacona / cleanup.sh
Last active July 31, 2017 14:31
Cleanup space from node_modules
# cd to your project folder
# How much space is it using?
find . -type d -maxdepth 3 -name node_modules | xargs du -hcs | grep total
# Get rid of them
find . -type d -maxdepth 3 -name node_modules | xargs -p rm -rf # Will prompt before deleting. answer y/n