Skip to content

Instantly share code, notes, and snippets.

@ww9
ww9 / gist_blog.md
Last active January 12, 2024 23:00
Using Gist as a blog #blog

Blogging with Gist

Gist simplicity can turn blogging into a liberating experience.

Pros Cons
✅ Free, simple, fast, hassle-free ❌ Image upload in comments only
✅ Tagging ❌ No post pinning
✅ Search ❌ Doesn't look like a blog
✅ Revisions ❌ Unfriendly URLs
@existentialmutt
existentialmutt / db_fixtures_export.rake
Last active March 25, 2023 21:10 — forked from kuboon/db_fixtures_export.rake
Generate fixtures from db. Readable by rake db:fixtures:load
# lib/tasks/db_fixtures_export.rake
namespace 'db:fixtures' do
desc "generate fixtures from the current database"
task :export => :environment do
Rails.application.eager_load!
models = defined?(ApplicationRecord) ? ApplicationRecord.descendants : ActiveRecord::Base.descendants
models.each do |model|
puts "exporting: #{model}"
@carlvlewis
carlvlewis / index.html
Last active November 20, 2018 22:55
Responsive d3v4 treemap with hierarchical zoom
<div id="chart"></div>
<div id="legend"></div>
@davidderus
davidderus / .dockerignore
Last active March 3, 2024 10:15
Docker + Rails + Puma + Postgres + Nginx
.git
.gitignore
/doc
.yardoc
coverage
jsdoc
/tmp
/log
Dockerfile
Dockerfile.prod
if ENV["SEMAPHORE_CACHE_DIR"]
config.assets.configure do |env|
env.cache = ActiveSupport::Cache::FileStore.new(ENV["SEMAPHORE_CACHE_DIR"])
end
end
@jvenezia
jvenezia / sizing_your_rails_application_with_unicorn_on_heroku.md
Last active December 1, 2021 12:07
Sizing your Rails application with Unicorn on Heroku

Sizing your Rails application with Unicorn on Heroku

This tutorial assumes you are running a Rails application on Heroku with a Unicorn server. However, if you are not using one of those you will find some general information which can help you in your context.

This article will help you to correctly configure your Unicorn server based on real data.

I recommend you to use New Relic, which is really easy to setup with Rails & Heroku. It will help you monitoring your application and configure it at its best.

Using Unicorn Web Server

@jtangelder
jtangelder / PreventGhostClick.js
Last active January 17, 2024 21:55
PreventGhostClick
/**
* Prevent click events after a touchend.
*
* Inspired/copy-paste from this article of Google by Ryan Fioravanti
* https://developers.google.com/mobile/articles/fast_buttons#ghost
*
* USAGE:
* Prevent the click event for an certain element
* ````
* PreventGhostClick(myElement);
@eltoob
eltoob / gist:4586719
Created January 21, 2013 15:09
Quick lines to get the number of selectors in each CSS to make sure that IE is not breaking
var
styleSheets = document.styleSheets,
totalStyleSheets = styleSheets.length;
for (var j = 0; j < totalStyleSheets; j++){
var
styleSheet = styleSheets[j],
rules = styleSheet.cssRules,
totalRulesInStylesheet = rules.length,
totalSelectorsInStylesheet = 0;
@kylefox
kylefox / gist:4512777
Created January 11, 2013 18:15
If you want to use Xcode's FileMerge as your git mergetool, this is how you set it up.
# Tell system when Xcode utilities live:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# Set "opendiff" as the default mergetool globally:
git config --global merge.tool opendiff
@mattetti
mattetti / gist:3473008
Created August 26, 2012 01:36
Redis instrumentation
::Redis::Client.class_eval do
# Support older versions of Redis::Client that used the method
# +raw_call_command+.
call_method = ::Redis::Client.new.respond_to?(:call) ? :call : :raw_call_command
def call_with_stats_trace(*args, &blk)
method_name = args[0].is_a?(Array) ? args[0][0] : args[0]
start = Time.now
begin