Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
An attempt to map languages to country flags!
Matching flags to languages can be really tricky and even problematic sometimes because there is no direct association between languages and countries since the same language is spoken in many countries and many languages are spoken in a single country.
So for a title from Mexico which has spanish as the official language the spanish flag will appear.
If you notice any flags being mismatched please raise an issue or even better open a pull request
Add this line to your application's Gemfile:
gem 'flag_icon'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install flag_icon
There is a number of helpers available that will render country names, language names and flags given a country code or locale.
# It returns HTML element with country icon and title
#
# @param code -> language locale
# @example language_icon('el')
# @return String
language_icon
# It returns HTML element with country icon and title
#
# @param code -> country iso code
# @example country_icon('gr')
# @return String
country_icon
# It returns the language name
#
# @param code -> language locale
# @example language_name('el') # => Greek
# @return String
language_name
# It returns the country name
#
# @param code -> country iso code
# @example country_name('gr') # => Greece
# @return String
country_name
# It returns the country iso code
#
# @param code -> language locale
# @example language_flag('el') # => gr
# @return String
language_flag
# It returns an array that can be used in the select tag
#
# @example select_language
# @return Array
select_language
# It returns an hash of arrays that can be used in the select tag
#
# @param popular -> title of the popular group
# @param available -> title of the available group
# @example grouped_select_language(popular: 'Popular', available: 'Available')
# @return Hash
grouped_select_language
# Define in your application_helper to override the popular languages
# Default: [['English', :en], ['Spanish', :es]]
#
# @example
# def popular_languages
# [['English', :en], ['Spanish', :es]]
# end
# @return Array
popular_languages
# Define in your application_helper to override the available languages
# @example [['English', :en], ['Spanish', :es]] #default
# @example
# def available_languages
# Language.all.order(:language_locale).pluck(:language_locale)
# end
# @return Array
available_languages
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the FlagIcon project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that flag_icon demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.