Skip to content

Instantly share code, notes, and snippets.

View amarodeabreu's full-sized avatar

newInstanceOfObject() amarodeabreu

View GitHub Profile
Function DeTabString(p_strInput)
Const TAB_SIZE = 8
Const FILLER = " "
Dim strInput, intCounter
'Initialise
strinput = p_strInput
DeTabString = ""
// Function to display UIAlert when "Hit Me!" button is clicked
@IBAction func showAlert(){
//New instance of UIAlertController - Apple view controller
let showAlert = UIAlertController(title: "Hello, World", message: "This is my first swift app", preferredStyle: .alert)
//New instance of UIAlertAction - Apple view controller action
let action = UIAlertAction(title: "Awesome sauce", style: .default, handler: nil)
//Add action to view controller
showAlert.addAction(action)
//Present action on view controller with animation
@amarodeabreu
amarodeabreu / Generic SQL Get
Created October 29, 2021 08:54
Generic SQL with T
/// <summary>
/// Generic type SQL Query Fetch
/// </summary>
/// <typeparam name="T">Generic</typeparam>
/// <param name="connectionString">SQL Connection string</param>
/// <param name="sql">SQL select query</param>
/// <returns>List Object of type inferred</returns>
public async Task<IEnumerable<T>> QueryTask<T>(string connectionString, string sql)
{
using IDbConnection db = new SqlConnection(connectionString);