This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lgi = require('lgi') | |
local Gtk = lgi.require('Gtk', '3.0') | |
function message (title) | |
--[[ | |
Function to display messages to the user. | |
]] | |
-- Create Window | |
local window = Gtk.Dialog { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/lua5.1 | |
--[[-- | |
@package | |
@filename PngImageView.lua | |
@version 1.0 | |
@author Díaz Urbaneja Víctor Eduardo Diex <victor.vector008@gmail.com> | |
@date 22.05.2020 17:20:01 -04 | |
]] | |
local base64 = require('base64') -- github.com/iskolbin/lbase64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lgi = require('lgi') | |
local Gtk = lgi.require('Gtk', '3.0') | |
local Gdk = lgi.require('Gdk', '3.0') | |
--- I collect the value of the screen resolution | |
-- and I pick up its width and height | |
local screen = Gdk.Screen:get_default() | |
local width, height = screen:get_width(), screen:get_height() | |
-- Creates the window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lgi = require('lgi') | |
local Gtk = lgi.require('Gtk', '3.0') | |
local Gdk = lgi.require('Gdk', '3.0') | |
assert = lgi.assert -- With this function I will confirm if a file (in this case custom.css) exists. | |
--- I load my css | |
local provider = Gtk.CssProvider() | |
-- Show a message if custom.css does not exist | |
assert(provider:load_from_path('custom.css'), 'ERROR: file.css not found') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is a port of Bytes.go <https://gist.github.com/M1que4s/70965ab7ea03d85f43a379e0860d86eb> | |
function check(err, msg, ...) | |
local msg = string.format(msg, ...) | |
if err ~= nil then | |
print(msg) | |
return err | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is a port of GistsScrapper.go <https://gist.github.com/M1que4s/b92073803b658c207fbdfaebc10a1512> | |
local curl = require('cURL') -- <https://github.com/Lua-cURL/Lua-cURLv3> | |
local feedparser = require('feedparser') -- <https://github.com/slact/lua-feedparser> | |
file_exist = function (file) | |
local file_found = io.open(file, "r") | |
if (file_found == nil) then | |
return false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- I require LGI | |
local lgi = require("lgi") | |
local Gtk = lgi.require("Gtk", "3.0") | |
-- I create the application | |
local app = Gtk.Application { | |
-- The application ID | |
application_id = "com.gists.github.diazvictor.ToggleDarkMode" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local lgi = require('lgi') | |
local Gtk = lgi.require('Gtk', '3.0') | |
--- Some widgets were added to keep the initial focus on others. | |
local window = Gtk.Window { | |
title = 'TextView With Placeholder', | |
width = 400, | |
height = 400, | |
window_position = Gtk.WindowPosition.CENTER, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a practice of the <https://www.sololearn.com/learning/1024/> course. | |
var currentDate = new Date(); | |
function person (name, age) { | |
this.name = name; | |
this.age = age; | |
this.yearOfBirth = currentDate.getFullYear() - this.age; | |
this.seeInfo = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint esversion: 8 */ | |
// This example is a port of: https://gist.github.com/diazvictor/6fe3372bce79587a3c21123a19881cb1 | |
// I create the Inventory class | |
class Inventory { | |
// What to do when the class is initialized | |
constructor() { | |
this.items = []; | |
} |
OlderNewer