Skip to content

Instantly share code, notes, and snippets.

Douglas Livingstone DouglasLivingstone

Block or report user

Report or block DouglasLivingstone

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View DefaultDictionary.cs
class DefaultDictionary<Key, Value> : Dictionary<Key, Value> {
public new Value this[Key key]
{
get
{
if (!ContainsKey(key))
{
base[key] = default(Value);
}
return base[key];
@DouglasLivingstone
DouglasLivingstone / FluxActions.ts
Created Oct 15, 2015
Type-checking Flux actions in TypeScript
View FluxActions.ts
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;
@DouglasLivingstone
DouglasLivingstone / onclickoutside.ts
Last active Jan 19, 2016
TypeScript OnClickOutsideHandler
View onclickoutside.ts
// 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);
}
@DouglasLivingstone
DouglasLivingstone / gist:6992402
Created Oct 15, 2013
Add forename and surname fields to wp-signup.php This is similar to adding fields to wp-login.php?action=register, but it works for multisite WordPress instead. For the original, see: https://codex.wordpress.org/Customizing_the_Registration_Form
View gist:6992402
<?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...
View gist:4578709
#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);
View gist:3517847
require 'socket'
require 'thread'
require 'net/http'
require 'net/https'
puts "PID: #{$$}"
mode = :debug
if mode == :debug
You can’t perform that action at this time.