Skip to content

Instantly share code, notes, and snippets.

@fxn
fxn / gist:427dca61ec44adf8253b
Last active Jul 2, 2019
gzip assets with Capistrano
View gist:427dca61ec44adf8253b
# Compresses all .js and .css files under the assets path.
namespace :deploy do
# It is important that we execute this after :normalize_assets because
# ngx_http_gzip_static_module recommends that compressed and uncompressed
# variants have the same mtime. Note that gzip(1) sets the mtime of the
# compressed file after the original one automatically.
after :normalize_assets, :gzip_assets do
on release_roles(fetch(:assets_roles)) do
assets_path = release_path.join('public', fetch(:assets_prefix))
within assets_path do
@brianhempel
brianhempel / bench_rails_memory_usage.rb
Last active Feb 3, 2022
A script to test the memory usage of your Rails application over time. It will run 30 requests against the specified action and report the final RSS. Choose the URL to hit on line 45 and then run with `ruby bench_rails_memory_usage.rb`.
View bench_rails_memory_usage.rb
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
@franks921
franks921 / Gemfile
Last active Jan 27, 2022
Postgres Arrays in Active Admin
View Gemfile
ruby '2.2.0'
source 'https://rubygems.org'
...
gem 'font-awesome-rails'
@gbuesing
gbuesing / ml-ruby.md
Last active Jun 29, 2022
Resources for Machine Learning in Ruby
View ml-ruby.md

UPDATE a fork of this gist has been used as a starting point for a community-maintained "awesome" list: machine-learning-with-ruby Please look here for the most up-to-date info!

Resources for Machine Learning in Ruby

Gems

@corbanb
corbanb / JavaScript.sublime-build
Last active May 2, 2022
Sublime Text - Tools > Build System > New Build System
View JavaScript.sublime-build
// Sublime Text - Build System for Javascript
{
"cmd": ["node", "$file"],
"selector": "source.js"
}
@willprice
willprice / .travis.yml
Last active Apr 18, 2022
How to set up TravisCI for projects that push back to github
View .travis.yml
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@adrianorsouza
adrianorsouza / sublime-command-line.md
Last active Jun 15, 2022
launch sublime text from the command line
View sublime-command-line.md

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active Aug 10, 2022
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.
View gitflow-breakdown.md

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@jodosha
jodosha / Gemfile
Last active Dec 9, 2020
Full stack Lotus application example
View Gemfile
source 'https://rubygems.org'
gem 'rake'
gem 'lotus-router'
gem 'lotus-controller'
gem 'lotus-view'
group :test do
gem 'rspec'
gem 'capybara'
@denji
denji / http-benchmark.md
Last active Aug 8, 2022
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
View http-benchmark.md