Skip to content

Instantly share code, notes, and snippets.

View tbuehlmann's full-sized avatar

Tobias Bühlmann tbuehlmann

View GitHub Profile
# provides a slick way to add classes inside haml attribute collections
#
# examples:
# %div{add_class("current")}
# #=> adds the "current" class to the div
#
# %div{add_class("current", :if => current?)}
# #=> adds the "current" class to the div if current? method
#
# %div{add_class("highlight", :unless => logged_in?)}
@contact = Contact.find params[:id]
@contact.attributes = params[:contact]
if params[:is_supplier] == '1'
@contact.type = 'supplier'
elsif params[:is_supplier] == '0'
@contact.type = 'customer'
end
if @contact.save
resources :users do
# /users/:id/confirm_email(.:format)
# confirm_mail_user_path
get :confirm_email, :on => :member
end
@subject_all = []
@subjects.each do |subject|
@subject_all << [subject.id, subject.batch.name]
end
# Or with a hash:
#
# @subject_all = {}
#
= image_tag((news.image || 'noimageavailable.jpg'), :width => 180, :height => 150, :style => 'float:left;margin-right: 10px;')
<%= form_for @tbl_providers_connection_info do |f| %>
<%= field_set_tag nil, :class => 'sectionwrap' do %>
<p>
<%= f.label :ssl_enabled, 'SSL Enabled:' %>
<%= f.check_box :ssl_enabled %>
</p>
<p>
<%= f.label :keystore, 'Keystore:' %>
<%= f.text_field :keystore %>
</p>
require 'rubygems'
require 'sinatra/base'
require 'person'
require 'csv'
require 'pp'
class Application < Sinatra::Base
def self.empty_arrays
set :people, []
set :pups, []
%u Στοιχεία για λέξη #{@word}
Αρ. Καταχώρισης: #{@id}
Sha1: #{@sha1}
Web ranking: #{@wr} at date: #{@wrd}
@tbuehlmann
tbuehlmann / Gemfile
Last active December 10, 2015 01:28 — forked from anonymous/Gemfile
source 'http://rubygems.org/'
gem 'sinatra', '~> 1.3.0'
gem 'thin'
gem 'haml'
class Domain < ActiveRecord::Base
attr_accessible :transport, :name
belongs_to :company
validates :name, new_domain: true, presence: true
end
def create