Skip to content

Instantly share code, notes, and snippets.

Avatar
🙈
Monkeying!

Udara Alwis UdaraAlwis

🙈
Monkeying!
View GitHub Profile
@UdaraAlwis
UdaraAlwis / FibonacciSeriesSolution.cs
Created Jul 26, 2020
Solving Fibonacci Series with Dynamic Programming in C#
View FibonacciSeriesSolution.cs
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
Controlling the playback of Youtube iFrame video from Javascript...
View YoutubeIFramePlaybackControlPage.html
<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 Jan 12, 2020
Override each Native HttpClientHandler to disable the HTTPS Certificate Validation of the endpoints that we access from our App.
View XamarinNativeDisableHttpsCertValidation.cs
iOS:
// override HTTPS Certificate Verification iOS
// In AppDelegate.cs
var iosClientHandler = new NSUrlSessionHandler();
iosClientHandler.TrustOverride += (sender, trust) =>
{
return true;
@UdaraAlwis
UdaraAlwis / SubmitToGoogleForm.cs
Created Dec 17, 2019
Submit form data to your Google Form from dotnet C# with ease! ;) #GoogleFormsToolkitLibrary
View SubmitToGoogleForm.cs
/// <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 Dec 17, 2019
Load your Google Forms page data from dotnet C# with ease! ;) #GoogleFormsToolkitLibrary
View LoadGoogleFormStructure.cs
// 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 Dec 16, 2019
An model class representing a Google Forms consisting all its possible properties...
View GoogleForm.cs
/// <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 Dec 16, 2019
An model class representing a Question Field in Google Forms...
View GoogleFormField.cs
// 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 Dec 15, 2019
Access your Google Forms page data from dotnet C#
View ScrapeOffFormSkeletonFromGoogleForms.cs
// 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 Dec 9, 2019
An enum model class representing a Question Field Types Google Forms...
View GoogleFormsFieldTypeEnum.cs
// 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 Dec 9, 2019
Generate a slideshow video from images in a folder using ffmpeg
View FFMPEG_GENERATEVIDEOFROMIMAGES.bat
:: 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
You can’t perform that action at this time.