Skip to content

Instantly share code, notes, and snippets.

View UdaraAlwis's full-sized avatar
🙈
Monkeying!

Udara Alwis UdaraAlwis

🙈
Monkeying!
View GitHub Profile
@UdaraAlwis
UdaraAlwis / FibonacciSeriesSolution.cs
Created July 26, 2020 12:57
Solving Fibonacci Series with Dynamic Programming in C#
using System;
using System.Diagnostics;
// Solving Fibonacci series with Dynamic
// Programming algorithms using C#
public class Program
{
public static void Main()
{
Console.WriteLine("Solving Fibonacci Series with Dynamic Programming in C#");
@UdaraAlwis
UdaraAlwis / YoutubeIFramePlaybackControlPage.html
Created May 10, 2020 06:13
Controlling the playback of Youtube iFrame video from Javascript...
<html>
<!-- With a bit of help from Youtube API Docs -->
<!–– https://developers.google.com/youtube/iframe_api_reference#Examples ––>
<head></head>
<body>
<p id="statusText">loading...</p>
<iframe id="existing-iframe-example" width="640" height="360" src="https://www.youtube.com/embed/M7lc1UVf-VE?enablejsapi=1" frameborder="0" style="border: solid 4px #37474f;"></iframe>
@UdaraAlwis
UdaraAlwis / XamarinNativeDisableHttpsCertValidation.cs
Created January 12, 2020 18:57
Override each Native HttpClientHandler to disable the HTTPS Certificate Validation of the endpoints that we access from our App.
iOS:
// override HTTPS Certificate Verification iOS
// In AppDelegate.cs
var iosClientHandler = new NSUrlSessionHandler();
iosClientHandler.TrustOverride += (sender, trust) =>
{
return true;
@UdaraAlwis
UdaraAlwis / SubmitToGoogleForm.cs
Created December 17, 2019 20:26
Submit form data to your Google Form from dotnet C# with ease! ;) #GoogleFormsToolkitLibrary
/// <summary>
/// Submit Form data to your Google Form
/// </summary>
/// <param name="yourGoogleFormsUrl">
/// Link to your Google Form page
/// </param>
/// <param name="formData">
/// Form data dictionary to submit
/// TKey: FieldSubmissionId - TValue: Value
/// </param>
@UdaraAlwis
UdaraAlwis / LoadGoogleFormStructure.cs
Last active February 29, 2024 06:20
Load your Google Forms page data from dotnet C# with ease! ;) #GoogleFormsToolkitLibrary
// using HtmlAgilityPack;
// using Newtonsoft.Json.Linq;
/// <summary>
/// Loading Google Form's generic information
/// and Question Field list data including
/// Question Type, Answer Options, Submission Id, etc
/// </summary>
/// <param name="yourGoogleFormsUrl"></param>
/// <returns></returns>
@UdaraAlwis
UdaraAlwis / GoogleForm.cs
Created December 16, 2019 13:32
An model class representing a Google Forms consisting all its possible properties...
/// <summary>
/// A model representing a Google Form structure
/// consist of main the properties of a Google Form
/// </summary>
public class GoogleForm
{
/// <summary>
/// Document Name of your Google Form
/// </summary>
public string FormDocName { get; set; }
@UdaraAlwis
UdaraAlwis / GoogleFormField.cs
Created December 16, 2019 13:16
An model class representing a Question Field in Google Forms...
// using System.Collections.Generic;
/// <summary>
/// A Question Field in a Google Form
/// </summary>
public class GoogleFormField
{
/// <summary>
/// Type of the Question Field
/// </summary>
@UdaraAlwis
UdaraAlwis / ScrapeOffFormSkeletonFromGoogleForms.cs
Last active September 19, 2024 17:18
Access your Google Forms page data from dotnet C#
// using HtmlAgilityPack;
// using Newtonsoft.Json.Linq;
private static async Task ScrapeOffFormSkeletonFromGoogleFormsAsync(string yourGoogleFormsUrl)
{
HtmlWeb web = new HtmlWeb();
var htmlDoc = await web.LoadFromWebAsync(yourGoogleFormsUrl);
var htmlNodes = htmlDoc.DocumentNode.SelectNodes("//script").Where(
x => x.GetAttributeValue("type", "").Equals("text/javascript") &&
@UdaraAlwis
UdaraAlwis / GoogleFormsFieldTypeEnum.cs
Last active December 9, 2019 16:36
An enum model class representing a Question Field Types Google Forms...
// using System.ComponentModel;
/// <summary>
/// Found the Field type representation values with trial
/// and error try out of blood sweat and tears lol! ;)
/// </summary>
public enum GoogleFormsFieldTypeEnum
{
[Description("Short Answer Field")]
ShortAnswerField = 0,
@UdaraAlwis
UdaraAlwis / FFMPEG_GENERATEVIDEOFROMIMAGES.bat
Last active March 17, 2023 11:03
Generate a slideshow video from images in a folder using ffmpeg
:: Generate a Video Slideshow from images in a folder on Windows
:: that's optimized for current system's screen resolution
:: Make sure your Images, ffmpeg executables, and this batch file are in the same folder
:: The images should be ".jpg" format, or you may change in the script below
:: Make sure to download ffmpeg: https://www.ffmpeg.org/download.html
:: Command Line executable code
:: Begin by getting the framerate. ex: 1/2
:: This determines time span for each image to display
:: And load the images in the current directory