Skip to content

Instantly share code, notes, and snippets.

Mohamed Ziata WaKeMaTTa

Block or report user

Report or block WaKeMaTTa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@WaKeMaTTa
WaKeMaTTa / benchmark.rb
Created Feb 5, 2019
Benchmark about "recursive regex match?" vs "recursive my own match?"
View benchmark.rb
require 'bundler/inline'
gemfile(true) do
ruby '~> 2.5'
source 'https://rubygems.org'
gem 'benchmark-ips'
end
require 'benchmark/ips'
View rails_way_counter_cache.rb
# frozen_string_literal: true
# Please include only the minimum code necessary to reproduce your issue.
require "bundler/inline"
# STEP ONE: What versions are you using?
gemfile(true) do
ruby "2.5.1"
source "https://rubygems.org"
gem "activerecord", "4.2.11"
@WaKeMaTTa
WaKeMaTTa / bug_report_counter_culture.rb
Created Dec 19, 2018
Bug Report - gem counter_culture - Method size don't use the counter cache
View bug_report_counter_culture.rb
# frozen_string_literal: true
# Please include only the minimum code necessary to reproduce your issue.
require "bundler/inline"
# STEP ONE: What versions are you using?
gemfile(true) do
ruby "2.5.1"
source "https://rubygems.org"
gem "activerecord", "4.2.11"
@WaKeMaTTa
WaKeMaTTa / md5.log
Last active Jul 24, 2018
md5sum of Arma 3 directory (Ubuntu 16.04 LTS)
View md5.log
04e449fd1e80b8e0d9c4048d3bf93adc ./saferun.sh
8b139ac5b93769623bd343318048238c ./legal/ICU License - ICU 1.8.1 and later.html
2100bdc885ac4cdc9783c562639ddc1f ./legal/OpenSSL.txt
10ec1bb9e39d6056d34cd954e09c6dc7 ./legal/LGPL v2.txt
c5232433d0f75d4f6c7974709fd898cb ./legal/licenses.txt
f094e5cb2db3826da69860d83db6a3b7 ./legal/libpng.txt
beb48b173a776d45fee6dd9b70cb6be7 ./legal/libtiff.txt
db1b7a668b2a6f47b2af88fb008ad555 ./legal/xiph.org.txt
844cfb3cf1a83eedc083c702c8a27f6c ./legal/libmspack.txt
85f70f1acc953dac84b1bd92acb992f3 ./legal/TomCrypt.txt
@WaKeMaTTa
WaKeMaTTa / order-rails-controller-callbacks.md
Last active Jul 29, 2019
Order of Rails Controller Callbacks
View order-rails-controller-callbacks.md

Order of Rails Controller Callbacks

Rails 4.x

Started GET "/" for 127.0.0.1 at 2017-05-19 14:17:18 +0200
  Processing by WelcomeController#index as HTML
    prepend_around_action
    prepend_before_action
    before_action
@WaKeMaTTa
WaKeMaTTa / prototype-to-jquery.md
Last active Oct 10, 2018
Converting from Prototype to jQuery (v1)
View prototype-to-jquery.md

Converting from Prototype to jQuery

Selecting DOM elements

Prototype’s selector returns DOM elements.

$("element_id");
// return: <div id="element_id"></div>
@WaKeMaTTa
WaKeMaTTa / app-policies-application_policy.rb
Created Apr 7, 2017
Use alias_method for better readability
View app-policies-application_policy.rb
# app/policies/application_policy.rb
class ApplicationPolicy
attr_reader :user, :record
def initialize(current_user, record)
@user = user
@record = record
end
end
@WaKeMaTTa
WaKeMaTTa / application_record.rb
Created Mar 13, 2017
New way to create models (Rails 5 way):
View application_record.rb
# app/models/application_record.rb
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
@WaKeMaTTa
WaKeMaTTa / Gemfile
Created Oct 17, 2016 — forked from remino/Gemfile
kramdown-rails: Use Kramdown (Markdown) in Rails 4
View Gemfile
# Gemfile
gem 'kramdown'
@WaKeMaTTa
WaKeMaTTa / migration.rb
Last active Dec 9, 2016
Rails migration with foreign key cascade
View migration.rb
class UpdateForeignKey < ActiveRecord::Migration[5.0]
def change
add_reference :posts, :users, index: true, foreign_key: { on_delete: :cascade }
end
end
You can’t perform that action at this time.