Skip to content

Instantly share code, notes, and snippets.

View scottdavis's full-sized avatar

Scott Davis scottdavis

View GitHub Profile
@scottdavis
scottdavis / go-stream-file-between-goroutines-with-channel.go
Created August 21, 2024 06:24 — forked from abitofhelp/go-stream-file-between-goroutines-with-channel
This gist implements a streaming process where a chunk of data is read from a file in a goroutine, the data is passed through a channel to another goroutine, which writes the data to a file.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2018 A Bit of Help, Inc. - All Rights Reserved, Worldwide.
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Package main implements streaming of a file through a buffered channel where it is written to a new file.
// A data race condition arose in the for loop that reads data from the input file and sending it to the channel.
// I moved the allocation of the buffer to the top of the loop, to resolve the data race issue.
// I've created a companion gist,"go-stream-file-between-goroutines-with-pipe" that resolves the race issue using a
// FIFO pipe. It worked, but the price was that it was slower than using a channel.
@scottdavis
scottdavis / SassMeister-input-HTML.html
Created November 13, 2013 15:41 — forked from benjamincharity/SassMeister-input-HTML.html
Generated by SassMeister.com.
<div class="icon"></div>
@scottdavis
scottdavis / config.rb
Created February 23, 2012 17:22 — forked from warthurton/config.rb
Octopress config.rb
# Require any additional compass plugins here.
project_type = :stand_alone
# Publishing paths
http_path = "/"
http_images_path = "http://cdn.warthurton.com/images"
http_fonts_path = "http://cdn.warthurton.com/fonts"
css_dir = "public/stylesheets"
# Local development paths
@scottdavis
scottdavis / cross-browser-rgba-mixin.scss
Created January 1, 2012 06:58 — forked from philippbosch/cross-browser-rgba-mixin.scss
image-less RGBA backgrounds for real browsers and Internet Explorer
@mixin rgba-background($color, $opacity) {
background-color: $color;
background-color: rgba($color, $opacity);
background-color: transparent\9;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#{'#'+hex(round($opacity*255)) + '' + hex(red($color)) + '' + hex(green($color)) + '' + hex(blue($color))},endColorstr=#{'#'+hex(round($opacity*255)) + '' + hex(red($color)) + '' + hex(green($color)) + '' + hex(blue($color))});
zoom: 1;
}