Skip to content

Instantly share code, notes, and snippets.

Choose a ticket class: <select id="tickets"></select>
<p id="ticketOutput"></p>
<script id="ticketTemplate" type="text/x-jquery-tmpl">
{{if chosenTicket}}
You have chosen <b>${ chosenTicket().name }</b>
($${ chosenTicket().price })
<button data-bind="click: resetTicket">Clear</button>
{{/if}}

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

static void Main(string[] args)
{
//1. Implementing a Roadster with an IVehicle.
IVehicle aVehicle = new Roadster();
String startDriving = aVehicle.Drive();
Console.WriteLine("All vehicles are made to drive... "+ startDriving);
//2. Implementing a Roadster with its concrete class.
Roadster aTeslaRoadster = new Roadster();
aTeslaRoadster.Drive();
class Roadster : IVehicle
{
private String _Make = "Tesla Motors, Inc.";
public String Drive()
{
return "Varoom Varoom";
}
public String GetMake()
{
@dylanroy
dylanroy / IVehicle
Last active December 15, 2015 21:19
interface IVehicle
{
String Drive();
}
@dylanroy
dylanroy / gist:4234238
Created December 7, 2012 16:03 — forked from guyht/gist:1684328
Twitter Bot in NodeJS
/*
* Load external modules and init variables
*/
var twitter = require('ntwitter'),
http = require('http'),
bitly = require('bitly'),
b = new bitly('USER', 'API_KEY'),
tweeted = {},
load_time = Math.round(new Date().getTime() / 1000),
score_threshold = 100;
@dylanroy
dylanroy / gist:4229581
Created December 7, 2012 00:07 — forked from derekcollison/gist:4227635
Early results from high-performance NATS server
I have some early benchmark results for our work on a high performance NATS server in Go.

Quick Summary:
We can process ~2M msgs/sec through the system, and the ingress and egress are fairly well balanced.

The basics of the architecture are intelligent buffering and IO calls, fast hashing algorithms and subject distributor/routing, and a zero-allocation hand-written protocol parser.

In addition, I used quite a bit of inlining to avoid function overhead, no use of defer, and little to no object allocation within the fast path. I will share more details and the code at a future date.
@dylanroy
dylanroy / password_hashing_api.md
Created September 12, 2012 18:58 — forked from nikic/password_hashing_api.md
The new Secure Password Hashing API in PHP 5.5

The new Secure Password Hashing API in PHP 5.5

The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:

Why do we need a new API?

Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.

@dylanroy
dylanroy / pictures.markdown
Created August 29, 2012 17:19 — forked from sent-hil/pictures.markdown
River (getriver.com): Keep a programming journal.

One of my favorite past times is to look at the notebooks of famous scientists. Da Vinci's notebook is well known, but there plenty others. Worshipping Da Vinci like no other, I bought a Think/Create/Record journal, used it mostly to keep jot down random thoughts and take notes. This was great in the beginning, but the conformity of lines drove me nuts. Only moleskines made blank notebooks, so I had to buy one.

At the same time I started a freelance project. The project itself is irrelevant, but suffice to say it was very complex and spanned several months. It seemed like a perfect opportunity to use the moleskine. Looking back, all my entries fell under few categories:

  • Todo
  • Question
  • Thought
  • Bug
  • Feature
@dylanroy
dylanroy / dnn-upload-3.xml
Created August 9, 2012 21:05
ConfigDefault.xml reference
<property name="DocumentManager.SearchPatterns">[File Extensions]</property>
<property name="DocumentManager.MaxUploadFileSize">[bytes]</property>