Skip to content

Instantly share code, notes, and snippets.

View accidentaldeveloper's full-sized avatar

Michael Richardson accidentaldeveloper

View GitHub Profile
class Language(
val version: String,
val name: String,
val features: List<Feature>
)
import java.util.List;
public class Language {
private String version;
private String name;
private List<Feature> features
public Language(String version, String name, List<Feature> features) {
this.version = version;
this.name = name;

Keybase proof

I hereby claim:

  • I am accidentaldeveloper on github.
  • I am accidentaldev (https://keybase.io/accidentaldev) on keybase.
  • I have a public key whose fingerprint is F9A7 D50B 943C C6EA B0AF 719B 571B E453 95D9 0EF4

To claim this, I am signing this object:

@accidentaldeveloper
accidentaldeveloper / CalculateNextOcurrence.linq
Created March 8, 2016 02:16
Calculate next occurrence of an event
<Query Kind="Program" />
void Main()
{
const int NumberOfDaysInAWeek = 7;
var firstRun = new DateTime(2016, 3, 2, 3, 25, 30);
var ocurrenceInterval = TimeSpan.FromDays(2 * NumberOfDaysInAWeek);
var now = new DateTime(2016, 03, 07);
var next = CalculateNextEventOccurrence(firstRun, now, ocurrenceInterval);
next.Dump();
@accidentaldeveloper
accidentaldeveloper / ShowSelectedSessionsCount.js
Last active November 10, 2015 22:01
Display number of sessions selected
(function () {
var $regularSessionsPane = $("#regularsessions");
$regularSessionsPane.prepend('<div>Sessions Selected: <span id="myCount"><\span><\div>')
var $checkboxes = $regularSessionsPane.find("input[type='checkbox']");
var $countDisplay = $("#myCount");
$checkboxes.change(function() {
var count = $checkboxes.filter(":checked").length;
$countDisplay.text(count);
});
$checkboxes.change();
@accidentaldeveloper
accidentaldeveloper / HackTimeBomb
Created January 23, 2015 15:38
Force yourself to fix an ugly hack by a certain date, before you forget about it entirely
[Conditional("DEBUG")]
public void HackTimeBomb(DateTime expiration)
{
if (DateTime.Today > expiration)
throw new InvalidOperationException("Bzzz! Your hack has expired!");
}