Skip to content

Instantly share code, notes, and snippets.

View joshillian's full-sized avatar

Josh Illian joshillian

View GitHub Profile
@joshillian
joshillian / Dockerfile
Created February 6, 2020 15:12
Ruby on Rails Docker development environment - based on blog post by Hint.io's Nate Vick https://hint.io/blog/rails-development-with-docker
ARG RUBY_VERSION=2.6
FROM ruby:$RUBY_VERSION
ARG DEBIAN_FRONTEND=noninteractive
ARG NODE_VERSION=11
RUN curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y \
build-essential \
@joshillian
joshillian / gist:8edc3c622e66e7c1654b3e715e0e62c8
Created October 2, 2016 20:31
Memory benchmarking of Rails 5 new 'vanilla' project vs API-only project
Rails 5 Plain vs API-only comparison
plain api
bundle exec derailed bundle:mem 27.4375 MiB 19.8594 MiB 72%
bundle exec derailed bundle:objects
Total allocated: 9957164 bytes (72809 objects) 1748401 bytes (14328 objects) 17% (19%)
Total retained: 1125270 bytes (8821 objects) 186684 bytes (1762 objects) 16% (20%)
bundle exec derailed exec perf:mem_over_time: 72.66 MiB 67.85 MiB 93%
singleton_class.send(:alias_method , :new_method, :old_method)
@joshillian
joshillian / 0_reuse_code.js
Created May 6, 2016 21:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
class Array
def median
return nil if self.empty?
mid = self.length / 2
sorted = self.sort
self.length.odd? ? sorted[mid] : 0.5 * (sorted[mid] + sorted[mid - 1])
end
def median_index
return nil if self.empty?
@joshillian
joshillian / gist:3988389
Created October 31, 2012 17:12
Xstream of Response
[2012-10-31 12:08:30,961] ERROR (postprocessor:?): xstream out:<com.mirth.connect.model.Response>
<status>SUCCESS</status>
<message>%PDF-1.4
%ª«¬­
4 0 obj
&lt;&lt;
/Creator (Apache FOP Version 1.0)
/Producer (Apache FOP Version 1.0)
/CreationDate (D:20121031170830Z)
&gt;&gt;
<channel>
<id>aa95eb89-0553-40d9-bebd-ba9cb4e1b8b8</id>
<name>ClinicNoteWriter</name>
<description></description>
<enabled>true</enabled>
<version>2.2.1.5861</version>
<lastModified>
<time>1351701637481</time>
<timezone>America/Chicago</timezone>
</lastModified>
%PDF-1.4
%ª«¬­
4 0 obj
<<
/Creator (Apache FOP Version 1.0)
/Producer (Apache FOP Version 1.0)
/CreationDate (D:20121031161927Z)
>>
endobj
5 0 obj
asdfad