Skip to content

Instantly share code, notes, and snippets.

Avatar

Adhir Ramjiawan AdhirRamjiawan

View GitHub Profile
View typescript-method-overloading.ts
export class HtmlElementFactory {
// method overloading - sort off... pretty weird
static CreateGeneric(elementName: string): HTMLElement;
static CreateGeneric(elementName: string, elementId: string,
innerHTML:string,attributes: Array<HtmlElementAttributes>) : HTMLElement;
static CreateGeneric(elementName: string, elementId?: string,
innerHTML?:string, attributes?: Array<HtmlElementAttributes>) : HTMLElement {
var htmlElement = document.createElement(elementName);
View exercism-3.rs
pub fn is_leap_year(year: i32) -> bool {
(year % 4) == 0 || (year % 100 == 0 && year % 400 == 0)
}
View exercism-2.rs
extern crate chrono;
use chrono::*;
// Returns a Utc DateTime one billion seconds after start.
pub fn after(start: DateTime<Utc>) -> DateTime<Utc> {
start + Duration::seconds(1000000000)
View helloworld.rs
// The &'static here means the return type has a static lifetime.
// This is a Rust feature that you don't need to worry about now..
pub fn hello() -> &'static str {
"Hello, World!"
}
View main.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LearnTreeDS
{
public class Node
{