One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
"\e[1~": beginning-of-line | |
"\e[4~": end-of-line | |
"\e[5~": history-search-backward | |
"\e[6~": history-search-forward | |
"\e[3~": delete-char | |
"\e[2~": quoted-insert | |
"\e[5C": forward-word | |
"\e[5D": backward-word | |
"\e\e[C": forward-word | |
"\e\e[D": backward-word |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
# Makefile for a go project | |
# | |
# Author: Jon Eisen | |
# site: joneisen.me | |
# | |
# Targets: | |
# all: Builds the code | |
# build: Builds the code | |
# fmt: Formats the source files | |
# clean: cleans the code |
http { | |
map $http_user_agent $limit_bots { | |
default ''; | |
~*(google|bing|yandex|msnbot) $binary_remote_addr; | |
} | |
limit_req_zone $limit_bots zone=bots:10m rate=1r/m; | |
server { |
class Marksman < RTanque::Bot::Brain | |
NAME = 'Marksman' | |
include RTanque::Bot::BrainHelper | |
def tick! | |
command.speed = RTanque::Bot::MAX_SPEED | |
nearest = nearest_target() | |
if (!defined?(@direction)) | |
@direction = 0 |
// A simple sub command parser based on the flag package | |
package subcommand | |
import ( | |
"flag" | |
"fmt" | |
"os" | |
) | |
type subCommand interface { |
add_line = "config statement" | |
bash "add_to_config" do | |
code <<-EOH | |
grep '#{add_line}' /etc/config || echo '#{add_line}' >> /etc/config | |
EOH | |
end |
To use, place the code in version_trick.go
in your project. Don't forget to change the namespace to match yours to the actual name of your package.
In addition to version_trick.go
, there's a makefile-snippet, that includes the secret sauce for making this trick
work. Be sure to change the package name there as well.
Enjoy!
P.S. Special thanks to @meatballhat by way of @syscomet for showing me this trick!
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script> | |
<script> | |
$(document).ready(function(){ | |
function debug(str){ $("#debug").append("<p>"+str+"</p>"); }; | |
if(typeof WebSocket === 'undefined') { | |
alert("Your browser does not support websockets.") | |
} |