Skip to content

Instantly share code, notes, and snippets.

View carloshm's full-sized avatar
🥏
do legendary shit

Carlos carloshm

🥏
do legendary shit
View GitHub Profile
@carloshm
carloshm / intl-example.py
Created April 16, 2021 18:07
Python Simple Internationalization
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Carlos de Huerta <carlos.hm@live.com>
# Distributed under the MIT License (https://opensource.org/licenses/MIT)
from intl import intl
# Pi Weather Rock labels have been translated and included in the json file resources.lang.json
mytext = intl()
# get text for the label feels_like in english
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
#install/check dependencies for Ubuntu
sudo apt install poppler-utils
# convert -version
sudo apt install imagemagick
# create images from pdf
pdftoppm -png inclusive_toolkit_activities.pdf document
# mirror in the vertical axis:
# mogrify -flip *.png
@carloshm
carloshm / vce.tcl
Created February 5, 2023 10:54 — forked from juster/vce.tcl
VCE Exam Taker
package require Tk
proc initTop {} {
menu .topMenu
menu .topMenu.fileMenu -tearoff 0
.topMenu.fileMenu add command -label Open... -command selectVCEPath
.topMenu add cascade -label File -menu .topMenu.fileMenu
. configure -menu .topMenu
@carloshm
carloshm / Programming-chatGPT.md
Last active February 20, 2023 14:19
Internal exception class and use it within a public class

In C# I can't throw an internal exception from the private method of a public class, even if I absolutely always catch it so it doesn't get exposed outside of the assembly... any workaround for this other than making the exception class public?

In C#, internal exceptions are designed to only be visible within the assembly where they are defined. However, since you cannot throw an internal exception from a private method of a public class, one workaround is to define a custom exception class that is visible within the assembly, but not outside of it.

Note: Check visibility at https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.internalsvisibletoattribute?view=net-7.0

Here's an example of how you can define an internal exception class and use it within a public class:

// Define an internal exception class within the assembly