This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spree/model/product.rb | |
def self.like_any_with_translation(fields, values) | |
tran_fields = if defined?(SpreeGlobalize) | |
fields.select{ |field| Spree::Product.translated_attribute_names.include?(field) } | |
else | |
[] | |
end | |
if tran_fields.blank? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Feed | |
class TaxonProduct | |
attr_accessor :taxon | |
LIMIT = 4 | |
def initialize(taxon:, products:) | |
@taxon = taxon | |
@products = products | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
ruby '2.7.2' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '~> 6.0.3', '>= 6.0.3.2' | |
# Use postgresql as the database for Active Record | |
gem 'pg', '>= 0.18', '< 2.0' | |
# Use Puma as the app server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GIT | |
remote: https://github.com/rspec/rspec-core.git | |
revision: e7c5d030966a7e8dad3e0a67c61920c4f2437c15 | |
branch: master | |
specs: | |
rspec-core (3.10.0.pre) | |
rspec-support (= 3.10.0.pre) | |
GIT | |
remote: https://github.com/rspec/rspec-expectations.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// lib/extensions/list_map_with_index_extension.dart | |
extension MapWithIndex<T> on List<T> { | |
List<R> mapWithIndex<R>(R Function(T, int i) callback) { | |
List<R> result = []; | |
for (int i = 0; i < this.length; i++) { | |
R item = callback(this[i], i); | |
result.add(item); | |
} | |
return result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//test/extensions/list_map_with_index_extension_test.dart | |
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:vtenh/extensions/list_map_with_index_extension.dart'; | |
void main() { | |
group('.mapWithIndex', () { | |
test('return a new list from map value and index as original Int type', () { | |
List<int> items = [20, 30, 40]; | |
List<int> result = items.mapWithIndex((value, index) => index * 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_test/flutter_test.dart'; | |
import 'package:vtenh/extensions/list_map_with_index_extension.dart'; | |
void main() { | |
group('.mapWithIndex', () { | |
test('return a new list from map value and index as original Int type', () { | |
List<int> items = [20, 30, 40]; | |
List<int> result = items.mapWithIndex((value, index) => index * 2); | |
expect(result.length, 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"geocoded_waypoints": [ | |
{ | |
"geocoder_status": "OK", | |
"place_id": "ChIJ42tqxz1RCTERuyW1WugOAZw", | |
"types": [ | |
"locality", | |
"political" | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"lat"=> 11.55597, | |
"lng"=> 104.92815 | |
}, | |
{ | |
"lat"=> 11.55588, | |
"lng"=> 104.9282 | |
}, | |
{ |