Skip to content

Instantly share code, notes, and snippets.

@amejiarosario
amejiarosario / rails_migration_cheatsheet.md
Created June 18, 2012 21:40
Rails Migration - Cheatsheet
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>
@suryart
suryart / application.html.erb
Last active October 26, 2023 00:16
Rails 4 flash messages using Twitter Bootstrap(bootstrap-sass: https://github.com/thomas-mcdonald/bootstrap-sass). An improved version of https://gist.github.com/roberto/3344628
// layout file
<body>
<div class="container">
<%= flash_messages %>
<%= yield %>
</div><!-- /container -->
</body>
@shrop
shrop / intro-meteor.js.md
Last active October 1, 2022 16:54
Introduction to Meteor.js
@lfender6445
lfender6445 / gist:9919357
Last active July 3, 2024 20:50
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@harryworld
harryworld / deploy.rb
Created May 17, 2014 05:13
Discourse Installation Guide fo GA Alumni Website (ga-alumni.com)
# -*- encoding : utf-8 -*-
# config/deploy.rb
require 'capistrano/ext/multistage'
require "rvm/capistrano"
require 'bundler/capistrano' #Using bundler with Capistrano
require 'cape'
set :stages, %w(staging production)
set :default_stage, "production"
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 23, 2024 03:57
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@harryworld
harryworld / array_function.md
Created October 1, 2014 03:15
Arrays and Functions
  1. Define a function that takes an array with numbers and prints all the elements of the array, separated by "--"
printSpecial([12, 33, 144, 122])
# 12 -- 33 -- 144 -- 122
  1. Define a function that takes an array with numbers and returns another array where each element contains double each element in the array
@f3r
f3r / gemfile.rb
Last active August 29, 2015 14:07
Sample WDI Development Gemfile
group :development do
# Spring speeds up development by keeping your application running in the background.
#> https://github.com/rails/spring
gem 'spring'
# Better Errors replaces the standard Rails error page with a much better and more useful error page.
#> https://github.com/charliesome/better_errors
gem 'better_errors'
gem 'binding_of_caller' # adding REPL
@harryworld
harryworld / google_map.md
Created October 28, 2014 07:00
Add Google Map in Rails

Google Map for Rails

Gmaps4rails is developed to simply create a Google Map with overlays (markers, infowindows…).

Requirements

  1. Create an empty repository in GitHub, named googlemaps, select the READM, license, and rails .gitignroe file
  2. Clone the repository to local workspace folder
  3. cd googlemaps
  4. rails _4.1.6_ new . -BGT
  5. git add -A