Skip to content

Instantly share code, notes, and snippets.

View lloydjatkinson's full-sized avatar
🌧️
Chilling

Lloyd Atkinson lloydjatkinson

🌧️
Chilling
View GitHub Profile
@Medeah
Medeah / elevator.ts
Created September 17, 2015 19:29
simple elevator logic. with typeScript type definitions
var elevatorSaga = {
init: function(elevators: Elevator[], floors: Floor[]) {
console.log(floors[1]);
function amin(numArray) {
return Math.min.apply(null, numArray);
}
function amax(numArray) {
return Math.max.apply(null, numArray);
}
/**
@tim-elvidge
tim-elvidge / Concrete Controller
Last active January 8, 2021 10:07
Generic Mediator Pattern for Data Handling
public partial class AuctionUsersController : WebCommon.Controllers.DapperGridController<Domain.AuctionModels.UserDto>
{
public AuctionUsersController(IDbInterface mediatorInjection)
{
base.DbMediator = mediatorInjection;
}
public virtual ActionResult Index()
{
return View();
}
public abstract class Error
{
public abstract ErrorType Type { get; }
}
public class SimpleError : Error
{
public override ErrorType Type { get { return ErrorType.Simple; } }
public string Message { get; private set; }
@DanielSWolf
DanielSWolf / Program.cs
Last active March 21, 2025 16:29
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@vkhorikov
vkhorikov / CustomerController.cs
Last active July 30, 2024 14:25
Handling failures and input errors in a functional way
[HttpPost]
public HttpResponseMessage CreateCustomer(string name, string billingInfo)
{
Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo);
Result<CustomerName> customerNameResult = CustomerName.Create(name);
return Result.Combine(billingInfoResult, customerNameResult)
.OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value))
.OnSuccess(() => new Customer(customerNameResult.Value))
.OnSuccess(
@davidfowl
davidfowl / dotnetlayout.md
Last active April 14, 2025 07:13
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@addyosmani
addyosmani / README.md
Last active April 6, 2025 09:15 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@laurakelly
laurakelly / index.html
Last active January 24, 2024 15:01
Connecting Two Points with a Line in D3.js
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="graph">
<h1>Connecting Two Points with a Line in D3.js</h1>
</div>
@n0ts
n0ts / remote_bash.sh
Created May 1, 2014 06:35
execute bash script from remote site
# http://stackoverflow.com/questions/5735666/execute-bash-script-from-url
bash <(curl -s http://mywebsite.com/myscript.txt)
# http://stackoverflow.com/questions/4642915/passing-parameters-to-bash-when-executing-a-script-fetched-by-curl
curl http://foo.com/script.sh | bash -s arg1 arg2
@zsup
zsup / ddd.md
Last active April 2, 2025 23:33
Documentation-Driven Development (DDD)

Documentation-Driven Development

The philosophy behind Documentation-Driven Development is a simple: from the perspective of a user, if a feature is not documented, then it doesn't exist, and if a feature is documented incorrectly, then it's broken.

  • Document the feature first. Figure out how you're going to describe the feature to users; if it's not documented, it doesn't exist. Documentation is the best way to define a feature in a user's eyes.
  • Whenever possible, documentation should be reviewed by users (community or Spark Elite) before any development begins.
  • Once documentation has been written, development should commence, and test-driven development is preferred.
  • Unit tests should be written that test the features as described by the documentation. If the functionality ever comes out of alignment with the documentation, tests should fail.
  • When a feature is being modified, it should be modified documentation-first.
  • When documentation is modified, so should be the tests.