Skip to content

Instantly share code, notes, and snippets.

View WaKeMaTTa's full-sized avatar
✔️
Verified

Mohamed Ziata WaKeMaTTa

✔️
Verified
View GitHub Profile
@WaKeMaTTa
WaKeMaTTa / hash_serializer.rb
Created June 16, 2016 13:19
app/serializers/hash_serializer.rb
# app/serializers/hash_serializer.rb
class HashSerializer
def self.dump(hash)
hash.to_json
end
def self.load(hash)
hash = ActiveSupport::JSON.decode(hash) if hash.is_a? String
(hash || {}).with_indifferent_access
end
@WaKeMaTTa
WaKeMaTTa / capybara_cheat_sheet.md
Last active May 21, 2018 12:51 — forked from zhengjia/capybara cheat sheet
Capybara - Cheat Sheet

Navigating

visit("/projects")
visit(post_comments_path(post))

Clicking links and buttons

@WaKeMaTTa
WaKeMaTTa / bug_report_enum_and_paper_trail.rb
Last active May 16, 2016 11:34
Bug report : Enum and PaperTrail
# Issues https://github.com/airblade/paper_trail/issues/798
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
Unable to download https://www.atom.io/api/packages/linter-plus-eslint/versions/0.4.0/tarball: 400 Bad Request Repository inaccessible
@WaKeMaTTa
WaKeMaTTa / syntax-type-1.jsx
Created January 12, 2016 09:02
Which syntax is more better to use?
class MoviesApp extends Component {
render() {
var initialRoute = {name: 'search'};
return (
<Navigator
style={styles.container}
initialRoute={initialRoute}
configureScene={() => Navigator.SceneConfigs.FadeAndroid}
renderScene={RouteMapper}
/>
@WaKeMaTTa
WaKeMaTTa / gist:ee0d9ca166703ee1a86d
Created December 10, 2015 12:23
DIRECTO DE OSKAR
https://plus.google.com/hangouts/_/ytl/sSPRzi9D_lX1WoXVxtDJp5fm0IB0NLBXy-hFehGfzAs=?hl=es_ES&authuser=0
http://plus.google.coms/hangouts/_/stream/ytl/sSPRzi9D_lU5zvh7_0jsjtb5x5T_uXXsNpZ5v-3kFDA=?hl=fr&authuser=0
class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
validates :product_id, :quantity, presence: true
validates :quantity, numericality: { only_integer: true }
before_save :set_price_to_products
private
@WaKeMaTTa
WaKeMaTTa / Error when try log-in
Created April 3, 2014 09:31
Error when try log-in
Started POST "/sessions/new" for 127.0.0.1 at 2014-04-03 11:29:54 +0200
ActionController::RoutingError (No route matches [POST] "/sessions/new"):
actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.3) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged'