Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcos Placona mplacona

View GitHub Profile
View CoronaBadge.ino
#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
View ArduinoBeatingHeart.ino
#include <avr/sleep.h>
#include <avr/interrupt.h>
#include <Heart.h>
/*
Android Beating Heart V2- Sketch
Marcos Placona 2019
*/
const int switchPin = 3;
View jetpack-demo-1.2.diff
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()
}
View jetpack-demo-1.1.diff
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
View jetpack-demo-1.diff
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'
View jetpack-demo-1.kt
private fun createMagicNumber(){
myRandomNumber = (1..42).shuffled().first()
}
View personal-voicemail.js
exports.handler = function (context, event, callback) {
/***** configuration *****/
const phoneNumber = 'YOUR_PHONE_NUMBER';
const timeout = event.Timeout || 12;
const secureRecordingLinks = false;
const voiceOpts = {
View TwiML.xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message to="YOUR_PHONE_NUMBER">
{{From}}: {{Body}}
</Message>
</Response>
@mplacona
mplacona / Program.cs
Created Feb 21, 2018
Twilio Voice & SMS
View Program.cs
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 Jul 31, 2017
Cleanup space from node_modules
View cleanup.sh
# 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