Skip to content

Instantly share code, notes, and snippets.

View VictorTpo's full-sized avatar

Victor Thépaut VictorTpo

View GitHub Profile
activity_log
boss_news
delayed_job
link_posts
link_tweets
posts
rating_histories
tweets

Pour avoir du joli code, il faut partir de la vue et remonter.

EXEMPLE : "Qu'est-ce que je veux VOIR (et non avoir)"

Ben je afficher :

@ma_var.value

Et hop une belle vue !

Remove old kernels files

You can see should restart the server when you see *** System restart required *** when you start ssh
You can restart with sudo shutdown -r now
You can see your current kernel version with uname -r
You can see all kernel versions in /lib/modules/

1) Delete perimated packages

sudo apt-get autoclean

# link if
<%= link_to_if obj.method?, obj.show_blabla, url %>
# WRONG
class CleanSql
def initialize
@clent = Mysql2::Client.new
end
end
# > 10_000_000.times { CleanSql.new }
class Vilain
  attr_accessor :name, :kills
end
class VilainPresenter
  include ActionView::Helpers::NumberHelper
 
class RelationshipAnalyzesController < ApplicationController
  def show
    @search = @analyze.search_results(params)
    @results = @search.results.map { |result| AnalyzeResultPresenter.new(result) }
  end
end
module Bar
  def my_method
    'inside module'
  end
end

class Foo
  include Bar
 
Tracking.all
> id: 1, label: button_1, page: page_1
> id: 2, label: button_1, page: page_1
> id: 3, label: button_2, page: page_2
> id: 4, label: button_1, page: page_2
> id: 5, label: button_1, page: page_2
> id: 6, label: button_2, page: page_1
# gemfile
gem 'virtus'
# view
render 'forms/errors', form: @form
form_for @form, url: my_path do |f|
 f.input