Skip to content

Instantly share code, notes, and snippets.

View Irwin1985's full-sized avatar
📕
https://leanpub.com/foxlite

易文翰 Irwin1985

📕
https://leanpub.com/foxlite
View GitHub Profile
@Irwin1985
Irwin1985 / Logger.prg
Last active July 4, 2024 19:20
Logger class for Visual FoxPro 9^
#Define LOG_ERROR 16
#Define LOG_INFO 64
#Define LOG_WARNING 48
#Define CRLF Chr(13) + Chr(10)
Define Class Logger as Custom
Hidden cLogFile
Procedure SetLogFile(tcLogFile)
this.cLogFile = tcLogFile
EndProc
Clear
Local loCrypto
loCrypto = CreateObject("CryptoFox")
?loCrypto.ComputeHash("VfpRocks!")
Release loCrypto
return
Define Class CryptoFox As Custom
Hidden cAlgTyp, oLogger, cLastErrorText
cAlgTyp = "SHA256"
@Irwin1985
Irwin1985 / api-consulta-hora-internet.prg
Created July 22, 2023 21:48
El siguiente ejemplo consulta la hora de una zona en específico usando la API worldtimeapi.prg
* ==================================================================================== *
* Este ejemplo retorna la lista de zonas horarias soportadas por worldtimeapi.org
* REQUISITOS:
* 1. JSONFox (https://github.com/Irwin1985/JSONFox)
* 2. VFPRestClient (https://github.com/Irwin1985/VFPRestClient)
* ==================================================================================== *
Local lcJSONFoxLocation, lcVFPRestClientLocation, laZonasHorarias, loTimeZone
lcJSONFoxLocation = GetFile("app", "JSONFox")
# ===================================================== #
# Diccionario con todas las texturas clasificadas
# por color (black, red, blue).
# ===================================================== #
var ducks_list: Dictionary = {
"black": {
"diagonal":
[
preload("res://assets/sprites/ducks/fly-diagonal-black-1.png"),
preload("res://assets/sprites/ducks/fly-diagonal-black-2.png"),
/*
Learn Ring in 5 minutes
Author: Irwin Rodríguez <rodriguez.irwin@gmail.com>
Date: 2023-03-19 22.14
Ring is a general purpose programming language used to create
portable software like Console, GUI, Web, Games, etc.
IMPORTANT: The language can support 3 styles of writting code so let's
learn all of them at once in every example then you can mix them or just
// comentario sencillo
/*
Comentario
múltiple
*/
// literales
123 // enteros
@Irwin1985
Irwin1985 / JS-LINQ.js
Created January 3, 2023 12:32 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// First: This version using older JavaScript notation for universal browser support (scroll down for ES6 version):
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
* ============================================================== *
* This sample reads an entry from your Registry
* ============================================================== *
* Local lcHLM As String, lcKey As String, lcEntry As String
* lcHLM = "HCU"
* lcKey = "Software\Microsoft\VisualFoxPro\9.0\Options"
* lcEntry = "EditorStringColor"
* ? GetValue(lcHLM, lcKey, lcEntry)
* ============================================================== *
* =====================================================================================
* Consulta las tasas del dolar desde el sitio web:
* https://www.datos.gov.co/resource/32sa-8pi3.json?vigenciadesde=
*
* Dependencias:
* VfpRestClient: https://github.com/Irwin1985/VFPRestClient
* JSONFox: https://github.com/Irwin1985/JSONFox
*
* NOTA:
* 1. Cambie las rutas de vfpRestClient y JSONFox por las correspondientes.
{
uTerm is a small unit to print text and background with color in your
terminal window.
Usage:
// forecolor
uTerm.Blue('This text should be printed in blue');
// backcolor
uTerm.BgBlue('This text should be printed in white with blue background');
**********************************************************************}