Skip to content

Instantly share code, notes, and snippets.

View thaleshcv's full-sized avatar

thaleshcv thaleshcv

  • Fortaleza, Brasil
View GitHub Profile
@thaleshcv
thaleshcv / _form.html.haml
Created August 12, 2021 01:24 — forked from ftes/_form.html.haml
simple_form initializer for Bulma (input, select, checkbox)
-# Example form
= simple_form_for @some_model do |f|
-# Show error notification at top (general error text)
= f.error_notification
-# Show base errors at top
= f.error_notification message: (f.error :base) if f.object.errors[:base].present?
-# Regular input
= f.input :name, autofocus: true
-# Select input referencing other model
Style/StringLiterals:
EnforcedStyle: double_quotes
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
Style/ConditionalAssignment:
EnforcedStyle: assign_to_condition
Layout/EndAlignment:
EnforcedStyleAlignWith: variable
AutoCorrect: true
Layout/MultilineMethodCallIndentation:
class MyObj
include ActiveModel::Model
include ActiveRecord::AttributeAssignment
attr_accessor :my_date
def initialize(*params)
assign_attributes(*params)
end
@thaleshcv
thaleshcv / firebase.js
Last active September 19, 2018 14:15
firebase initialization
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/database';
// Initialize Firebase
const config = {
apiKey: process.env.REACT_APP_APIKEY,
authDomain: process.env.REACT_APP_AUTHDOMAIN,
databaseURL: process.env.REACT_APP_DATABASEURL,
projectId: process.env.REACT_APP_PROJECTID,
# spec/support/factory_bot.rb
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
end
# spec/support/database_cleaner.rb
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
#! /bin/bash
# install docker-ce on linux mint 18 "Sarah"
# prepare
sudo apt-get remove docker docker-ce docker-engine docker.io
# download
wget https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/docker-ce_17.12.0~ce-0~ubuntu_amd64.deb
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
Devise.omniauth_configs.keys.each do |provider|
define_method(provider.to_s) { omniauth_callback(provider) }
end
def failure
redirect_to root_path
end
private
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
}
/* Extra Small Devices, Phones */
@media only screen and (min-width : 480px) {