Skip to content

Instantly share code, notes, and snippets.

View moisescastillo's full-sized avatar

moisescastillo

View GitHub Profile
@moisescastillo
moisescastillo / Javascript.html
Created September 30, 2021 17:58
To-Do App Appscript GS
<script>
// OnLoad GUI
window.addEventListener("load", initGui, true);
const tarea = document.getElementById('tarea');
const btnRegistrar = document.getElementById('registrar');
function initGui() {
getData();
}
@moisescastillo
moisescastillo / Style.html
Created September 30, 2021 17:57
To-Do App Appscript GS
<style>
:root {
--color-5c: #190934;
--color-4c: #300D6E;
--color-3c: #5A18C9;
--color-2c: #905BEC;
--color-1c: #E9DFFB;
}
* {
@moisescastillo
moisescastillo / Gui.html
Created September 30, 2021 17:56
To-Do App Appscript GS
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
<?!= include('Style'); ?>
</head>
<body>
@moisescastillo
moisescastillo / Code.gs
Created September 30, 2021 17:54
To-Do App Appscript GS
const ss = SpreadsheetApp.getActiveSpreadsheet();
function onOpen() {
let ui = SpreadsheetApp.getUi();
// Add custom menu
ui.createMenu('ToDo App')
.addItem('Open', 'showModal')
.addToUi();
}
@moisescastillo
moisescastillo / JS_fetch_03.js
Created August 16, 2020 00:36
Javascript fetch example 03
fetch("https://jsonplaceholder.typicode.com/posts/")
.then(function(response) {
if (response.status !== 200) {
console.log('Error en la respuesta HTTP');
return;
}
return response.json();
})
.then(function(dataJson) {
@moisescastillo
moisescastillo / JS_fetch_02.js
Created August 16, 2020 00:21
Javascript fetch example 02
fetch("https://jsonplaceholder.typicode.com/posts/")
.then(function(response) {
if (response.ok) {
response.json().then(function(dataJson) {
dataJson.forEach((value, index) => {
console.log(value.id);
console.log(value.title);
console.log(value.body);
console.log(value.userId);
});
@moisescastillo
moisescastillo / JS_fetch_01.js
Created August 14, 2020 04:18
Javascript fetch example 01
fetch('https://jsonplaceholder.typicode.com/posts/')
.then(
function(response) {
if (response.status !== 200) {
console.log(response.status);
return;
}
response.json().then(function(data) {
data.forEach((value, index) => {
@moisescastillo
moisescastillo / JS_json_request.js
Created August 13, 2020 03:25
Example JSON request
var requestJSON = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json';
let request = new XMLHttpRequest();
request.open('GET', requestJSON);
request.responseType = 'json';
request.send();
request.onload = function() {
let data = request.response;
@moisescastillo
moisescastillo / JS_object_prototype.js
Created July 19, 2020 21:59
Javascript modifying prototypes
function Person(name) {
this.name = name;
this.greeting = function() {
console.log(`Hi I'm ${this.name}`);
}
}
let person1 = new Person('Peter');
let person2 = new person1.constructor('Sarah');
@moisescastillo
moisescastillo / JS_object_constructor.js
Created July 19, 2020 21:42
Javascript, the constructor property
function Person(name) {
this.name = name;
this.greeting = function() {
console.log(`Hi I'm ${this.name}`);
}
}
let person1 = new Person('Peter');
let person2 = new person1.constructor('Sarah');