Skip to content

Instantly share code, notes, and snippets.

View lhazlewood's full-sized avatar

Les Hazlewood lhazlewood

  • Las Vegas, California, USA
  • 22:38 (UTC -07:00)
View GitHub Profile
@benlinton
benlinton / multiple_mysql_versions_for_development.md
Last active September 23, 2023 09:38
Multiple MySQL Versions with Homebrew

Multiple MySQL Versions for Development

Options included below:

  • Using Docker docker-compose
  • Using Homebrew brew

Using Docker (recommended)

This gist was originally created for Homebrew before the rise of Docker, yet it may be best to avoid installing mysql via brew any longer. Instead consider adding a barebones docker-compose.yml for each project and run docker-compose up to start each project's mysql service.

public <T> T streamQuery(String sql, Function<Stream<SqlRowSet>, ? extends T> streamer, Object... args) {
return jdbcTemplate.query(sql, resultSet -> {
final SqlRowSet rowSet = new ResultSetWrappingSqlRowSet(resultSet);
final boolean parallel = false;
// The ResultSet API has a slight impedance mismatch with Iterators, so this conditional
// simply returns an empty iterator if there are no results
if (!rowSet.next()) {
return streamer.apply(StreamSupport.stream(Spliterators.emptySpliterator(), parallel));
}
@indiesquidge
indiesquidge / homebrew.md
Last active December 14, 2023 14:45
How to and Best of Homebrew

Homebrew

How To

Homebrew is a package management system for OS X. You can read more about it here, or simply run

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

to install it.

@n00neimp0rtant
n00neimp0rtant / gist:9515611
Last active March 14, 2024 06:30
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {