Skip to content

Instantly share code, notes, and snippets.

Project

Description: What does this project do and who does it serve?

Project Setup

How do I, as a developer, start working on the project?

  1. What dependencies does it have (where are they expressed) and how do I install them?
  2. How can I see the project working before I change anything?
@trcarden
trcarden / gist:3295935
Created August 8, 2012 15:28
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@troy
troy / oneline_detailed_logging.rb
Created August 10, 2012 02:13
One-line detailed logging for Rails 3 (ActiveSupport::Notifications) and later
# Outputs this at warn log level:
# 1.2.3.4 GET /path 200 OK BlahController#action HTML 938.2 (DB 11.8, View 719.7) {params} {optional params from flash[:log]}
#
# Save as config/initializers/oneline_detailed_logging.rb. Consider
# decreasing the log level from "info" to "warn" (in production.rb) so
# the one-line log message replaces the standard request logs.
# override process_action to add 2 things to the payload:
# - remote IP
@clowder
clowder / multi_logger.rb
Created September 5, 2012 16:40
Logging to multiple destinations in Ruby
class MultiLogger
attr_reader :level
def initialize(args={})
@level = args[:level] || Logger::Severity::DEBUG
@loggers = []
Array(args[:loggers]).each { |logger| add_logger(logger) }
end
@rpanachi
rpanachi / deploy.sh
Created September 20, 2012 19:18
Forrest Deployer Shell
#!/bin/bash
APP_DIR=/var/local/apps/app
RAILS_ENV=production
function step
{
if [ "$step_count" = "" ]; then
step_count=0
fi
@akiatoji
akiatoji / gist:4241705
Last active October 13, 2015 19:07
Installing Ruby 1.9.3 on CentOS 6.3 (and Amazon Linux)
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzvf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure --prefix=/usr/local && make
sudo make install
# Add /usr/local/lib in /etc/ld.so.conf.d/usrlocal.conf
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p286.tar.gz
tar xzvf ruby-1.9.3-p286.tar.gz
<!--
doing a large chunked upload of content using html5's file input feature is tricky.
this simple example should help you out.
-->
<br>
<br>
@camerond
camerond / ui_helper.rb
Last active December 11, 2015 17:58
My simple UI Helper in its more-or-less-current incarnation
module UiHelper
def lorem(paras)
paras = around(paras) if paras.is_a?(Range)
Faker::Lorem.paragraphs(paras).map{|p| "<p>#{p}</p>"}.join.html_safe
end
def lorem_words(num)
num = around(num) if num.is_a?(Range)
Faker::Lorem.words(num).join(' ').html_safe
Vagrant::Config.run do |config|
config.vm.box = "hellobits"
config.vm.network :hostonly, "192.168.33.2"
config.vm.share_folder "v-root", "/Users/fnando/Projects", ".", :nfs => true
config.vm.customize [
"setextradata", :id,
"VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"
]
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>