Skip to content

Instantly share code, notes, and snippets.

View tedyoung's full-sized avatar

Ted M. Young tedyoung

View GitHub Profile
@tedyoung
tedyoung / sitdown.conf
Created January 24, 2014 01:19
Upstart script for restarting Node.js app when it exits unexpectedly
description "SitDown server running on node.js"
start on startup
stop on shutdown
# respawn (restart) automatically -- try only 10 times
respawn
respawn limit 10 10
script
@tedyoung
tedyoung / twitter.go
Created October 26, 2016 05:29 — forked from ScottMansfield/twitter.go
Twitter search utility
package main
import (
"flag"
"fmt"
"log"
"net/url"
"os"
"os/signal"
"regexp"
@tedyoung
tedyoung / gist:aca78496d424790bb0f19d36a4618f76
Created March 20, 2018 21:11 — forked from mallipeddi/gist:74274
Demonstrates the concepts of covariance and contravariance in the Java type system
import java.util.*;
/*
* Covariance and contravariance.
*
* A type operator (an operator which takes as input a type and returns another type as output) is
* said to be
* 1) `covariant` if it preserves the ordering of types and orders types
* from more specific ones to more generic ones.
* 2) `contravariant` if it preserves the ordering of types and orders types

Intro

To view the progress of a Powerpoint presentation, a progress bar can be displayed at the bottom of the slide show.

How to proceed

Once the slideshow is complete, go to Tools > Macro > Visual Basic Editor.

In the new window, select Insert > Module and copy this text in the blank page:

Sub AddProgressBar()
    On Error Resume Next
@tedyoung
tedyoung / CodeFence.java
Last active June 19, 2019 00:24
replaceAll using DOTALL mode
String text =
"```\n" +
"public class Stock {\n" +
"\n" +
"}\n" +
"```\n";
text = text.replaceAll("(?s)```(.*?)```", "<pre>$1</pre>");
System.out.println(text);
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
class BlockTokens {
public static void main(String[] args) {
String text = "Block one.\n" +
"Still part of block one.\n" +
"Yep, still part of block one.\n" +
"\n" +
Take a look at these two classes:
```
class Equity {
public Equity(String name) {
}
}
class Stock extends Equity {
}
import javax.swing.*;
import java.awt.Color;
import java.awt.event.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.Scanner;
import java.awt.Font;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tedyoung
tedyoung / ddd-tactical-concept-map
Last active March 6, 2022 01:40
Concept Map of DDD Tactical Patterns
flowchart TD
app[Application Layer]
domain[Domain Layer]
agg[Aggregate]
entity[Entity]
repo[Repository]
vo["Value Object"]
aggroot["Aggregate Root"]
service[Service]
factory[Factory]