This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DefaultDictionary<Key, Value> : Dictionary<Key, Value> { | |
public new Value this[Key key] | |
{ | |
get | |
{ | |
if (!ContainsKey(key)) | |
{ | |
base[key] = default(Value); | |
} | |
return base[key]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface ActionClass<T extends Action> { | |
prototype: T; | |
} | |
// Base class for actions | |
abstract class Action { | |
type: string; | |
constructor() { | |
// Copy from the prototype onto the instance | |
this.type = this.type; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Refactored from https://github.com/Pomax/react-onclickoutside | |
class OnClickOutsideHandler { | |
constructor(private localNode: Element, private callback: { (event: Event): void }) { | |
if (!callback) throw new Error("Missing callback"); | |
document.addEventListener("mousedown", this.eventHandler); | |
document.addEventListener("touchstart", this.eventHandler); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Register with Full Name | |
* Description: Adds forename and surname fields to the registration form | |
* Version: 0.1 | |
* Author: Douglas Livingstone | |
*/ | |
//0. Style the new form elements... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
#include<math.h> | |
main() | |
{ | |
int a,b ,c,fac,d,rem,g,j,rem_1,e; | |
char another; | |
printf("Which one would you like to choose"); | |
printf("\n1. Factorial Of a number \n 2.Prime or not\n 3. Odd or even\n 4. Exit "); | |
scanf("%d %d %d %d",&a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
require 'thread' | |
require 'net/http' | |
require 'net/https' | |
puts "PID: #{$$}" | |
mode = :debug | |
if mode == :debug |