Skip to content

Instantly share code, notes, and snippets.

View rderoldan1's full-sized avatar
🇨🇴

Ruben Espinosa rderoldan1

🇨🇴
  • Medellin, Colombia
View GitHub Profile
@rderoldan1
rderoldan1 / application_helper.rb
Last active August 29, 2015 13:57
Example of search methods in Postgresql
# app/helpers/application_helper.rb
module ApplicationHelper
# Search form tag, render html form for bootstrap 3
# params
# - path, url of controller action: clients_path
# - placeholder text: 'Search by Name or Nickname'
# Return
# HTML safe string
def search_form(path, placeholder)
form_tag path, class: "well", :method => 'get' do
$(document).on "page:change", ->
chat = new Chat()
socket = chat.socket
socket.onopen = ->
chat.send('user_new', 'Se ha conectado')
chat.send('list', '')
#socket.send('{"event":"user_message", "data": {"username": "'+username+'", "message": "oeoeo"}}')
socket.onmessage = (evt) ->
chat.parse_response(evt)
@rderoldan1
rderoldan1 / README.md
Created August 26, 2014 18:02
How to increase AWS Disk

How to increase AWS Disk

  • Log into the AWS Management Console
  • Make sure that the Instance that you wish to change is not currently running
  • Navigate to Elastic Block Store > Volumes
  • Check the box next to the Volume that needs more space
  • Click the More… drop down list and select Create Snapshot
  • Enter a Name and a Description
  • Navigate to Elastic Block Store> Snapshots
Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500)
Maven home: /usr/share/maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: US-ASCII
OS name: "mac os x", version: "10.7.5", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /Users/rubenespinosa/.m2/settings.xml
[DEBUG] Using local repository at /Users/rubenespinosa/.m2/repository
@rderoldan1
rderoldan1 / database.yml
Created November 23, 2011 17:27
Multiple databases connection on Rails 3
config/database.yml
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
db:
@rderoldan1
rderoldan1 / README.markdown
Created February 21, 2012 01:32
admin way

The way to create an admin view

first you have the resource like this /users, but you like admin the resources in that way /admin/users.

rails g controller admin/users Then you get a file like this

`class Admin::UsersController < ApplicationController put your code here

erb
<%= select_tag "option_select", options_from_collection_for_select(@colegios, "dane", "nombre"),:prompt => "SELECCIONE UN COLEGIO", :class => "option_select"%>
HTML
<select class="option_select" id="option_select" name="option_select"><option value="">SELECCIONE UN COLEGIO</option><option value="205001009916">CENT EDUC EL MANZANILLO</option>
<option value="205001002768">CENT EDUC EL SALADO</option>
<option value="205001006119">CENT EDUC JUAN ANDRES PATINO</option>
<option value="205001001966">CENT EDUC LA ALDEA</option>
@rderoldan1
rderoldan1 / gist:2210196
Created March 26, 2012 22:21
login error
response from explorer
Started POST "/sessions" for 190.71.163.74 at Mon Mar 26 22:19:48 +0000 2012
Processing by SessionsController#create as HTML
Parameters: {"commit"=>"Sign In", "session"=>{"email"=>"rderoldan1@gmail.com", "password"=>"[FILTERED]"}, "authenticity_token"=>"nQWHaxlnvmGCC/3S75di5Yl6qRhgT/26ZGhbIUCGcEg=", "utf8"=>"✓"}
WARNING: Can't verify CSRF token authenticity
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'rderoldan1@gmail.com' LIMIT 1
Redirected to http://ec2-107-22-95-239.compute-1.amazonaws.com/users/6
Completed 302 Found in 20ms
@rderoldan1
rderoldan1 / gist:2495749
Created April 26, 2012 04:11
using github API
require 'httparty'
response = HTTParty.get(' https://api.github.com/users/rderoldan1/repos')
response.each do |repo|
puts repo["name"]
end
---------
@rderoldan1
rderoldan1 / hello.rb
Created May 12, 2012 16:05
A simple and pretty for ubuntu notificator made in ruby
require 'libnotify'
require 'date'
Libnotify.show :summary => "#{Date.today}", :body => "Hello world, today is #{Date::DAYNAMES[Date.today.wday]}"