Skip to content

Instantly share code, notes, and snippets.

View rscarvalho's full-sized avatar

Rodolfo Carvalho rscarvalho

View GitHub Profile
UmaClasse::UmaClasse(int x, int y)
: _x(x), _y(y){
// ...
}
// is the same of
UmaClasse::UmaClasse(int x, int y)
{
class ${1:Model}sController < ApplicationController
before_filter :find_${1/./\l$0/}, :only => [:show, :edit, :update, :destroy]
# GET /${1/./\l$0/}s
# GET /${1/./\l$0/}s.xml
def index
@${1/./\l$0/}s = ${1:Model}.all
respond_to do |wants|
wants.html # index.html.erb
%ol
= f.input :name, :label_html => { :class => "label" }, :input_html => {:class => "text_field"}, :wrapper_html => {:class => "group"}
= f.input :description, :label_html => { :class => "label" }, :input_html => {:class => "text_field", :style => "width:100%"}, :wrapper_html => {:class => "group"}
= f.input :return_email, :label_html => { :class => "label" }, :input_html => {:class => "text_field"}, :wrapper_html => {:class => "group"}
= render "shared/form_buttons"
#include<iostream>
#include<string>
using namespace std;
class Book
{
public:
Book(string a, double o) : author(a), other(o) {}
string author;
double other;
module CustomSearch
mattr_accessor :registered_classes
def self.search(qstring)
results = {}
self.registered_classes.each do |klass|
results[klass.name] = klass.on_index(qstring)
end
results
end
tell application "Mail"
set theMessage to first item of every message in inbox
set theSubject to subject of theMessage
if theSubject contains "Failed" then
say "Chuck Norris is preparing a round house kick!"
else if theSubject contains "Normal" then
say "Chuck Norris can rest now."
end if
using com.example.mixin;
using com.example.data;
namespace com.example.main
{
public class Program
{
public static void Main(string[] args)
{
Mixed1 m1 = new Mixed1();
@rscarvalho
rscarvalho / main.py
Created May 6, 2011 22:22
Plugin Manager
from plugin_manager import PluginManager
app = App()
app.plugin_manager = PluginManager()
app.plugin_manager.initialize_plugins()
# This is a comment
# Simple variable assignment
$variable = "assignment"
# Create instances of any object that is reachable by the .NET framework
$object = New-Object "System.Double"
# you can call static methods from classes using [Type]::MethodName()
[string]::Format("This is an {0} of string {1}", "string", "interpolation")
- (void)setupNavigationItems
{
NSMutableArray* buttons = [NSMutableArray arrayWithCapacity:2];
// Add items to the array
UIBarButtonItem* bi;
bi = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd
target:self
action:@selector(barButtonClicked:)];
[buttons addObject:bi];