Skip to content

Instantly share code, notes, and snippets.

Alessandro Rodi coorasse

Block or report user

Report or block coorasse

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
View form.dart
ListView(
children: <Widget>[
BeeHeader(i18n.t('inspections.contactSection')),
BeeInput(
i18n.t('inspections.firstName'),
validator: Validators.presence(i18n.t('inspections.firstNameEmpty')),
onSaved: (String value) {
beekeeper.firstname = value;
},
),
View form.dart
TextFormField(
onSaved: (String value) {
myModel.street = value;
},
),
TextFormField(
onSaved: (String value) {
myModel.houseNo = value;
},
),
@coorasse
coorasse / eager_loading.rb
Last active Nov 4, 2019
Eager loading of association with parameter in Rails
View eager_loading.rb
begin
require 'bundler/inline'
rescue LoadError => e
warn 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '~> 5.2'
@coorasse
coorasse / test.rb
Created Oct 31, 2019
Preloading issue on Rails 6.0
View test.rb
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
source 'https://rubygems.org'
# gem 'rails', '~> 5.2'
View accessible_by unexpected behaviour
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
source 'https://rubygems.org'
gem 'rails', '5.2.0' # use correct rails version
@coorasse
coorasse / example.html
Created Jan 9, 2019
Input switch from password to text
View example.html
<input id="api-token" type="password" value="" readonly data-select />
<button data-token-reveal="api-token" data-alternate-text="Hide">Show</button>
@coorasse
coorasse / bitbucket-pipelines.yml
Created Sep 13, 2018
Example of Bitbucket Pipeline for Ruby 2.5.1 + Webpacker + System Tests + Deployment to Elastic Beanstalk
View bitbucket-pipelines.yml
image: circleci/ruby:2.5.1-node-browsers
pipelines:
default:
- step: &tests
name: Tests
caches:
- bundler
- node
services:
@coorasse
coorasse / copy.sh
Last active Aug 6, 2018
Restore glacier files from S3
View copy.sh
fileName="$1" # File containing only S3 object key
bucketName="$2"
profileName="$3"
count=0
while read key; do
aws s3api copy-object --bucket $bucketName --copy-source "$bucketName/$key" --key "$key" --query "CopyObjectResult.{LastModified}" --profile $profile
var=$((count+1))
echo "#$count ... $key"
done < $fileName
@coorasse
coorasse / with left joins
Created Jul 11, 2018
Performance cancancan
View with left joins
Warming up --------------------------------------
easy 860.000 i/100ms
cannot 621.000 i/100ms
simple filter 596.000 i/100ms
one join 260.000 i/100ms
two joins 207.000 i/100ms
three joins 163.000 i/100ms
Calculating -------------------------------------
easy 8.739k (± 4.8%) i/s - 43.860k in 5.031055s
cannot 6.233k (± 5.2%) i/s - 31.671k in 5.096447s
View compressor.rb
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
source 'https://rubygems.org'
gem 'minitest'
You can’t perform that action at this time.