Skip to content

Instantly share code, notes, and snippets.

Store file uploads in the database

This gem allows to store carrierwave uploads in the database, eg. on platforms with ephemeral filesystems like Heroku.

Installation

# In: Gemfile
gem 'carrierwave-blob', git: "https://gist.github.com/f1dc8c75d67b92b23a55.git"
@karmi
karmi / chef-base-ruby-elasticsearch-server.rb
Last active November 15, 2017 10:06
Basic recipe to deploy Ruby+Elasticsearch applications with Chef
# Installation
# ------------
#
# $ ssh -i ~/.ssh/yourkey.pem [email protected]
#
# $ sudo apt-get install curl -y
# $ curl -# -L http://www.opscode.com/chef/install.sh | sudo bash -s --
#
# $ time curl https://gist.githubusercontent.com/karmi/10019159/raw/chef-base-ruby-elasticsearch-server.rb | sudo chef-apply -s
@karmi
karmi / .gitignore
Last active December 24, 2015 03:49
Stackexchange and Elasticsearch
tmp/
@karmi
karmi / .gitignore
Last active December 24, 2015 03:49
Hello, Elasticsearch in Ruby
tmp/
@karmi
karmi / download.elasticsearch.conf
Created September 20, 2013 16:00
Create a local Nginx-based proxy for <http://download.elasticsearch.org> for demos at conferences, meetups, etc
# Create a local proxy for <http://download.elasticsearch.org>
# ============================================================
#
# This setup and Nginx configuration provides a local webserver which intercepts requests
# to <http://download.elasticsearch.org> and serves a local file instead,
# facilitating and speeding up demonstrations at conferences, meetups, etc.
#
#
# 1. Create directories for Nginx:
#
@karmi
karmi / index.html
Last active December 18, 2015 15:19 — forked from clintongormley/index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" />
<title>Elasticsearch stats analyzer</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="rules.js"></script>
<script type="text/javascript" src="stats.js"></script>
<script type="text/javascript" src="parser.js"></script>
<script type="text/javascript">
@karmi
karmi / .gitignore
Last active August 24, 2020 09:25
Elasticat makes Elasticsearch JSON responses pretty • http://git.io/elasticat
.DS_Store
tmp/
@karmi
karmi / .gitignore
Last active December 17, 2015 10:49
A counter-argument to “Mutation testing with Mutant” using test coverage metrics
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
coverage
doc/
tmp
@karmi
karmi / test.doc
Last active March 25, 2017 09:57
Example of Elasticsearch's attachment handling
# 2013-04-26 11:13:36:010 [DELETE] ("dis_max_test")
#
curl -X DELETE http://localhost:9200/dis_max_test
# 2013-04-26 11:13:36:011 [404]
#
# {
# "error": "IndexMissingException[[dis_max_test] missing]",
# "status": 404
# }