Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| Marshalling error for key '_my_session:1243f4a7a0c8d1dba363bc2ca7a246e8': singleton can't be dumped | |
| You are trying to cache a Ruby object which cannot be serialized to memcached. | |
| /usr/local/rvm/gems/ruby-1.9.3-p484/gems/dalli-2.7.0/lib/dalli/server.rb:398:in `dump' | |
| #Controller problem | |
| session[:telefones] = Cliente.telefones | |
| #Solution | |
| session[:telefones] = Cliente.telefones.entries |
| # Head nginx.config | |
| http { | |
| passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-4.0.37; | |
| passenger_ruby /usr/local/bin/ruby; | |
| passenger_default_user db2inst1; | |
| #Optional: | |
| # Permisson for db2inst1 in new gem passenger | |
| chown root.db2grp1 -Rf /usr/local/lib/ruby/gems/1.8/gems/passenger-4.0.37 | |
| chmod 775 -Rf /usr/local/lib/ruby/gems/1.8/gems/passenger-4.0.37 |
| #Overwrite update method from active_record/persistence.rb | |
| # Solution for IBM_DB in ISO-8859-1 - Problem with special character when update a object | |
| module ActiveRecord | |
| module Persistence | |
| def update(attribute_names = @attributes.keys) | |
| klass = self.class | |
| #No composite primary key | |
| if !self.composite? |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Ctrl+C | copy current line (if no selection) |
| Ctrl+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Ctrl+↩ | insert line after |
| # When you call link_to in view, the record invoke a method named 'model_name' in Model | |
| # <%=h link_to(@people.name, @people) -%> | |
| # Rails 2 | |
| Class People < ActiveRecord::Base | |
| def self.model_name | |
| ActiveSupport::ModelName.new('person') if SYSTEM=='CRM' | |
| end | |
| end | |
| #----------------- |
| #config/initializers/simple_form/description_component.rb | |
| module SimpleForm | |
| module Components | |
| # Needs to be enabled in order to do automatic lookups | |
| module Description | |
| # Name of the component method | |
| def desc(wrapper_options = nil) | |
| object.send(attribute_name) if @builder.instance_variable_get('@lookup_action') == :show | |
| end | |
| end |
| # Issue IBMDB | |
| #https://github.com/ibmdb/ruby-ibmdb/issues/1 | |
| # test#1 | |
| db = IBM_DB.connect "DBTESTE", 'teste', 'bala123' | |
| sql2 = "SELECT glb.books.* FROM glb.books WHERE author = '?'" | |
| st = IBM_DB.prepare db, sql2 #, IBM_DB::SQL_PARAM_INPUT, IBM_DB::SQL_CHAR | |
| value = 'Júlio Verne' | |
| IBM_DB.bind_param st, 1, 'value' | |
| IBM_DB.execute st |
| #If you use Sentry (6.3.0) | |
| # | |
| #You have use gems for your RailsApp in such versions: | |
| gem "sentry-raven", :tag=>'0.7.1',:git => "https://github.com/getsentry/raven-ruby.git" | |
| gem 'hashie' , '=2.1.2' |
| #config\initializers\pdfwriter_extensions.rb | |
| CONVERTER = Iconv.new( 'ISO-8859-1//IGNORE//TRANSLIT', 'utf-8') | |
| module PDF | |
| class Writer | |
| # for fixed text (labels in general): It isn't necessary! (Obsolete) | |
| alias_method :old_text, :text | |
| def text(textto, options = {}) | |
| #old_text(CONVERTER.iconv(textto), options) | |
| old_text(textto, options) |
| # into file first-powershell.ps1 | |
| Get-Process |ConvertTo-HTML| Out-File "Processos-mane.html" | |
| # line command | |
| $ Get-ExecutionPolicy -list | |
| Scope ExecutionPolicy | |
| ----- --------------- | |
| MachinePolicy Undefined | |
| UserPolicy Undefined | |
| Process Undefined |