Skip to content

Instantly share code, notes, and snippets.

View geoffreymcgill's full-sized avatar

Geoffrey McGill geoffreymcgill

View GitHub Profile
// 1. Update using statements:
// Old Bridge.Html5
using Bridge.Html5;
// New Retyped
using static Retyped.dom;
// 2. Class names should be the same:
// Create a new Button Element
var button = new HTMLButtonElement();
// Set the Button text
button.innerHTML = "Click Me";
// Add a Click event handler
button.addEventListener("click", () =>
{
// Write a message to the Console
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>MyApp</title>
<script src="bridge.js"></script>
<script src="bridge.console.js"></script>
<script src="demo.js"></script>
{
"html": {
"disabled": true
}
}
Product product = new Product();
product.Name = "Apple";
product.ExpiryDate = new DateTime(2008, 12, 28);
product.Price = 3.99M;
product.Sizes = new string[] { "Small", "Medium", "Large" };
string output = JsonConvert.SerializeObject(product);
//{
// We need the Timer reference to have access to it in the callback
public static Timer timer;
// A flag of changing the Timer's due time and period
public static bool timerChanged;
public static void Main()
{
// The Timer callback
TimerCallback callback = (state) =>
var watch = Stopwatch.StartNew();
Console.WriteLine(watch.ElapsedMilliseconds);
Console.WriteLine("Waiting...");
Global.SetTimeout(() =>
{
Console.WriteLine(watch.ElapsedMilliseconds);
}, 2000);
var watch = System.Diagnostics.Stopwatch.StartNew();
Console.WriteLine(watch.ElapsedMilliseconds);
Thread.Sleep(2000); // Block for 2 seconds
Console.WriteLine(watch.ElapsedMilliseconds);
public class App
{
public static void Main()
{
Random rnd = new Random();
int lowerBound = 10;
int upperBound = 11;
int[] range = new int[10];
public class App
{
public static void Main()
{
Console.WriteLine("int.MaxValue: " + int.MaxValue);
Console.WriteLine("Factorial of 12: " + App.Factorial(12));
Console.WriteLine("Factorial of 13: " + App.Factorial(13)); // exceeds int.MaxValue
Console.WriteLine("long.MaxValue: " + long.MaxValue);
Console.WriteLine("Factorial of 20: " + App.Factorial(20));