Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
(function(){
/*!*************************************************************
*
* Firebug Lite 1.4.0a1
*
* Copyright (c) 2007, Parakey Inc.
* Released under BSD license.
* More information: http://getfirebug.com/firebuglite
*
../osdep/win32-console-wrapper.c:22:6: warning: no previous prototype for 'cr_perror' [-Wmissing-prototypes]
void cr_perror(const wchar_t *prefix)
^~~~~~~~~
../osdep/win32-console-wrapper.c:37:5: warning: no previous prototype for 'cr_runproc' [-Wmissing-prototypes]
int cr_runproc(wchar_t *name, wchar_t *cmdline)
^~~~~~~~~~
../osdep/win32-console-wrapper.c:73:5: warning: no previous prototype for 'wmain' [-Wmissing-prototypes]
int wmain(int argc, wchar_t **argv, wchar_t **envp)
^~~~~
@chowey
chowey / readme.md
Last active September 6, 2018 00:43
Bidirectional stream copy

This implementation of bidirectional stream copy has the right behavior for closing streams. The first stream to return io.EOF as a reader triggers a close on the second stream, and then the bidirectional copy may be considered done. The close on the second stream should trigger an error (e.g. io.EOF) on the read of the first stream, closing that stream too.

@chowey
chowey / multilock.go
Last active June 14, 2018 04:33
Pattern for allowing controlled concurrency.
package multilock
import (
"context"
)
// Resource represents a pool that, when drained, locks until a corresponding
// unlock is called.
type Resource struct {
c chan struct{}
@chowey
chowey / channelreader.go
Created June 8, 2017 02:23
Like io.MultiReader, but using a channel (unknown number of input readers)
package main
import "io"
type channelReader struct {
c chan []byte
b []byte
}
func NewChannelReader(c chan []byte) io.Reader {
package main
import "sync"
type ExitGroup struct {
wg sync.WaitGroup
cl []func()
lk sync.Mutex
}
@chowey
chowey / Readme.md
Last active September 30, 2015 03:14
Movie Countdown with Greensock

Simple countdown using Greensock. You could add an "onComplete" to the Tweenlite to trigger an event when the countdown ends.

@chowey
chowey / fs_stub.go
Created May 15, 2015 18:09
In-Memory implementation for http.FileSystem
// http.FileSystem in-memory test stub
type TestOpener interface {
OpenAs(name string) http.File
}
type TestFileSystem TestDir
func (fs TestFileSystem) Open(name string) (http.File, error) {
@chowey
chowey / dllmain.cpp
Created November 27, 2014 18:25
Volume monitoring and control DLL
// dllmain.cpp : Defines the entry point for the DLL application.
#include "volumemonitor.h"
// We use a worker thread for all COM calls, since CoInitialize is not
// otherwise safe to execute in a DLL.
HANDLE worker_thread_;
// There is one global VolumeMonitor that is lazy-loaded. This helps us
// report errors on initialization, and will also re-attempt initialization
// at the next call.
@chowey
chowey / hash_test.go
Created July 25, 2014 05:39
Benchmark comparison of cryptographic hashes in Go
package main
import (
"crypto/md5"
"crypto/rand"
"crypto/sha1"
"crypto/sha256"
"crypto/sha512"
"testing"
)