Skip to content

Instantly share code, notes, and snippets.

View g3ortega's full-sized avatar
🏠
Working from home

Gerardo Ortega g3ortega

🏠
Working from home
View GitHub Profile
@g3ortega
g3ortega / hello.rb
Created March 26, 2013 17:48
Testing Ruby!
puts "Hello World!"
puts 2 + 3 * 5
puts "Ho! " + "Ho! " + "Merry Christmas's!"
puts "Ho! " * 3 + "Merry Christmas's";
puts "toc toc Penny! " * 3
@g3ortega
g3ortega / Comandos útiles para PostgreSQL
Created May 20, 2013 00:19
Algunos de los comandos que me han ayudado a salir de apuros cuando uso PostgreSQL
--Ingresar a consola para gestionar PSQL...
sudo -u postgres psql
--Crear base de datos
CREATE DATABASE ejemplo;
--Crear usuario
CREATE USER nombre_usuario WITH PASSWORD '123456';
--Asignar privilegios de a un determinado usuario sobre una base de datos
GRANT ALL PRIVILEGES ON DATABASE ejemplo to nombre_usuario;
@g3ortega
g3ortega / rails_resources.md
Created November 15, 2013 00:15 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@g3ortega
g3ortega / javascript_resources.md
Created November 15, 2013 00:15 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@g3ortega
g3ortega / css_resources.md
Created November 15, 2013 00:15 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

rake db:rollback STEP=2
rake db:migrate:down VERSION=20100905201547
rake db:migrate:down VERSION=$TIMESTAMP
@g3ortega
g3ortega / daily git workflow
Created January 12, 2014 14:11
Basic Workflow with Git
git pull #pull all the changes from the remote repository
git checkout -b branch-name-here #create a new branch for your bug/feature/issue
#DO YOUR WORK HERE
#keep it in small chunks, the smaller your commits the better, in case things go wrong
git add . #and any new les you ve created
Jbuilder.encode do |json|
json.content format_content(@message.content)
json.(@message, :created_at, :updated_at)
json.author do |json|
json.name @message.creator.name.familiar
json.email_address @message.creator.email_address_with_name
json.url url_for(@message.creator, format: :json)
end
@g3ortega
g3ortega / disable_caching_rails
Created January 27, 2014 23:39
Disable browser caching in Rails
before_filter :set_no_cache
#....
def set_no_cache
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
@g3ortega
g3ortega / gist:8885136
Created February 8, 2014 15:09
Instalar ScreenCloud en Ubuntu
sudo su
echo 'deb http://download.opensuse.org/repositories/home:olav-st/xUbuntu_12.04/ /' >> /etc/apt/sources.list.d/screencloud.list
wget -O - http://download.opensuse.org/repositories/home:olav-st/xUbuntu_12.04/Release.key | apt-key add -
apt-get update
apt-get install screencloud