This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ByteReader struct { | |
io.Reader | |
} | |
func (b *ByteReader) ReadByte() (byte, error) { | |
var buf [1]byte | |
if _, err := io.ReadFull(b, buf[:]); err != nil { | |
return 0, err | |
} | |
return buf[0], nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <cstdlib> | |
#include <vector> | |
#include <set> | |
#include <list> | |
#include <chrono> | |
#include <iostream> | |
using namespace std; | |
using namespace std::chrono; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <entityx/entityx.h> | |
struct TestComponent : entityx::Component<TestComponent> { | |
explicit TestComponent(std::string _name = "test") { | |
name = _name; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat u.py | |
def f(): | |
with suppress(IntegrityError): | |
print 'moo' | |
$ ./autoimporter u.py | |
from sqlalchemy.exc import IntegrityError | |
from contextlib import suppress | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# | |
# Copyright (C) 2009 Alec Thomas <[email protected]> | |
# All rights reserved. | |
# | |
# This software is licensed as described in the file COPYING, which | |
# you should have received as part of this distribution. | |
# | |
# Author: Alec Thomas <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <boost/intrusive_ptr.hpp> | |
using boost::intrusive_ptr; | |
struct _GC { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alec@cavern:~/.go/src/github.com/alecthomas/gozmq]vet *.go | |
zmq_3_x_test.go:204: unreachable code | |
zmq_test.go:127: arg iothreads for printf verb %s of wrong type: int | |
zmq_test.go:140: arg iothreads for printf verb %s of wrong type: int | |
zmq_test.go:168: arg rc for printf verb %d of wrong type: error | |
[alec@cavern:~/.go/src/github.com/alecthomas/gozmq]vet zmq_test.go | |
[alec@cavern:~/.go/src/github.com/alecthomas/gozmq]vet zmq_3_x_test.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
# Documentation: https://github.com/mxcl/homebrew/wiki/Formula-Cookbook | |
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! | |
class Sfml < Formula | |
homepage 'http://www.sfml-dev.org' | |
version '2.1' | |
url 'http://www.sfml-dev.org/download/sfml/2.1/SFML-2.1-sources.zip' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
" Fold multi-line Python comments into one line. | |
" | |
" Also maps the "-" key to toggle expansion and <C-f> to toggle all folding. | |
" | |
setlocal foldmethod=syntax | |
setlocal foldtext=FoldText() | |
setlocal fillchars= | |
map <buffer> - za |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from injector import Module, Injector, provides, inject, singleton | |
from some_credit_card_provider import CreditCardConnection, CreditCardVendor | |
@singleton | |
class CreditCardProcessor(object): | |
@inject(vendor=CreditCardVendor, connection=CreditCardConnection) | |
def __init__(self, vendor, connection): | |
self.vendor = vendor | |
self.connection = connection |