Skip to content

Instantly share code, notes, and snippets.

Avatar

moisescastillo

View GitHub Profile
@moisescastillo
moisescastillo / Javascript.html
Created Sep 30, 2021
To-Do App Appscript GS
View Javascript.html
<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 Sep 30, 2021
To-Do App Appscript GS
View Style.html
<style>
:root {
--color-5c: #190934;
--color-4c: #300D6E;
--color-3c: #5A18C9;
--color-2c: #905BEC;
--color-1c: #E9DFFB;
}
* {
@moisescastillo
moisescastillo / Gui.html
Created Sep 30, 2021
To-Do App Appscript GS
View Gui.html
<!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 Sep 30, 2021
To-Do App Appscript GS
View Code.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 Aug 16, 2020
Javascript fetch example 03
View JS_fetch_03.js
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 Aug 16, 2020
Javascript fetch example 02
View JS_fetch_02.js
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 Aug 14, 2020
Javascript fetch example 01
View JS_fetch_01.js
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) => {
View JS_json_request.js
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 Jul 19, 2020
Javascript modifying prototypes
View JS_object_prototype.js
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 Jul 19, 2020
Javascript, the constructor property
View JS_object_constructor.js
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');