Skip to content

Instantly share code, notes, and snippets.

View xenodesystems's full-sized avatar

xenodesystems

View GitHub Profile
@xenodesystems
xenodesystems / beginning-snippet.rb
Created November 18, 2012 22:27
Xenode RubyQt samples
begin
require 'rubygems'
rescue LoadError
end
# Requerimos todas las gemas a utilizar aquí:
require 'Qt'
#require 'gema'
#require 'otragema'
@xenodesystems
xenodesystems / kid (model).rb
Created November 16, 2012 04:40
Xenode Rails Examples #4 (Mongoid has_many :through)
class Kid
include Mongoid::Document
has_many :stars # Definimos que el niño puede tener muchas estrellas
field :name, type: String
# A continuación, definimos un método que nos permita obtener los premios de un niño
def prizes
@xenodesystems
xenodesystems / mongoservice.sh
Created October 30, 2012 03:02
Bash Scripts - Xenode Systems
#!/bin/sh
sudo mongod -f /etc/mongod.conf
# [Mongoid] "ActiveRecord like" CRUD (Create-Read-Update-Destroy)
# CREAR POSTS:
Post.create(title: "Nuestro Primer Post", content: "Contenido para el primer post")
# LEER/ENCONTRAR POSTS:
Post.all.to_a # (todos)
<!DOCTYPE html>
<html>
<head>
<title>Auth Example</title>
<%= stylesheet_link_tag "application" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<div id="container">
def destroy
@post = Post.find(params[:id])
@post.destroy
redirect_to posts_path, :notice => "Tu post se ha Borrado"
end
end