Skip to content

Instantly share code, notes, and snippets.

View lsylvester's full-sized avatar

Lachlan Sylvester lsylvester

View GitHub Profile
# frozen_string_literal: true
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
# application.html.erb
<html>
<head>
<%= yield :title, wrapper: :title %>
</head>
<body>
<%= yield %>
</body>
</html>
DependencyDetection.defer do
@name = :net
depends_on do
defined?(HTTPI)
end
executes do
NewRelic::Agent.logger.debug "Installing HTTPI instrumentation"
end
@lsylvester
lsylvester / gist:1215264
Created September 13, 2011 21:46
DateTime vs Time TinyTds Benchmark
# Always use DateTime https://github.com/lsylvester/tiny_tds/tree/all_datetimes
Query Tinytds
=============
Author: Ken Collins
Date: September 14, 2011
Summary: Benchmark TinyTds Querys
System Information
------------------
require 'benchmark'
include Benchmark
var = (1..100).to_a
bm do |x|
x.report { 1000000.times { var[1, var.length] } }
x.report { 1000000.times { var[1..-1] } }
end
## Original
def orig_reverse_sql_order(order_query)
order_query.join(', ').split(',').collect { |s|
if s.match(/\s(asc|ASC)$/)
s.gsub(/\s(asc|ASC)$/, ' DESC')
elsif s.match(/\s(desc|DESC)$/)
s.gsub(/\s(desc|DESC)$/, ' ASC')
else
s + ' DESC'
end
montage -geometry +0+0 -tile 1x input1.gif input2.gif output.gif