Use the node way to resolve required path to absolute path.
Module to hook into the Node.js require and require.resolve function
A file loader plugin for esbuild for `require.resolve` statements.
擴充版 require.resolve,支援在額外路徑中搜尋模組 / An extended require.resolve with support for searching modules in extra paths
resolve like require.resolve() on behalf of files asynchronously and synchronously
Module to hook into the Node.js require and require.resolve function
Offers a async require.resolve function. It's highly configurable.
Import a module like with `require()` but from a given path
Resolve the path of a module like `require.resolve()` but from a given path
Convert a dependency path into a filepath
Resolve package.json exports & imports maps
Resolve a directory that is either local, global or in the user's home directory.
A better path.resolve() that normalizes paths on Windows
a special purpose fast memoizing way to resolve a node modules package.json
Missing ECMAScript module utils for Node.js
Resolve the path of a module like `require.resolve()` but from the current working directory
Resolve a nested selector in a PostCSS AST
resolve which handles browser field support in package.json
Extremely fast implementation of node core url library
Resolve URL pathnames using JavaScript
Resolve an options object based on configuration.
require and resolve modules relative to a path of your choice
Read a protobuf schema from the disk, parse it and resolve all imports
Resolve a URI relative to an optional base URI
Use #require statements to declare dependencies in JavaScript and let JSDM resolve the dependencies for you.
Built for the Context-Aware Software Ecosystem. Resolves application model requirements using semantic reasoning.
Organizes requirements of assets in JavaScript files, resolved dependencies of js files and helps include depending css files.
Xelor was built for systems that require random bytes for processes faster than one second. Because normal random generation is based off of time as a seed, if there exists multiple calls towards SecureRandom or Rand within one second, the same number will be produced. This can be resolved on unix or linux based systems by making a system call to read /dev/urandom.
A simple elaboration on Ruby's native SizedQueue which allows using the queue object to re-awaken a blocked thread and cause it to abandon its blocking enqueue/dequeue operation. Useful for simplifying program logic, reducing the need for external flags/Muteces (yes, I said Muteces), and for cleanly resolving queues on program termination without risk of data loss or deadlock. Why use this queue? There are two reasons. For one thing, under several circumstances it is _considerably_ faster than Ruby's native SizedQueue. I admit I'm not entirely sure why, but I have tested this on multiple platforms and it seems to hold true as a generality. You can feel free to confirm or dispel that this advantage holds for your use case at your own leisure. The second reason is the aforementioned simplification of program logic. In the case that all data passing through the queues must be preserved on program termination, SizedQueue can require some elaborate trickery to ensure that even the most remote possibility of deadlock is removed. ImprovedSizedQueue solves this problem by making it possible to use the queue to pass control messages between threads, irrespective of the queue's actual content.
# Netchk Simple tool to troubleshoot internet connectivity issues. This tool verifies: - your computer has at least one IP address - you have at least one DNS configured - you can reach the configured nameservers - the nameservers can resolve hosts Finally, some ICMP ping statistics are presented with average durations and error rates. ## Installation ```sh gem install netchk ``` ## Usage Just run `netchk` from your terminal and basic diagnosis will start showing you progress and any error if present. Note: On Linux system, this gem requires `sudo` to perform the ICMP ping operations. On macOS, this is not needed. You also can configure how netchk verifies your connections by configuring a `~/.netchk.yaml` or `~/.netchk.yml` file like below. ```yaml # Settings to test DNS server connectivity. dns: # Path to resolv.conf file to check presence and connectivity of DNS. # Path should be absolute to avoid issues when running netchk # from different directories. resolv.conf: /etc/resolv.conf # Settings to test DNS resolution. resolv: # Path to resolv.conf file to use for testing DNS resolution. # Path should be absolute to avoid issues when running netchk # from different directories. It is advised to be the same # as dns.resolv.conf. resolv.conf: /etc/resolv.conf # The list of domains to test for DNS resolution. domains: - google.com - youtube.com - facebook.com # Settings to test icmp ping. icmp: # A list of hosts to ping with ICMP. It is advised to use # IP addresses instead of domains to rule out any issues with # DNS resolution, which is tested separately. hosts: - 1.1.1.1 - 8.8.8.8 # The number of ping to issue each host. count: 20 # The duration in seconds to wait between each ping. # Setting this value too low might cause timeouts. interval: 0.2 ``` Each value is optional. If one is missing the default value will be used. The file above shows the default values. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/moray95/netchk.
The 'pg_search_multiple_highlight' gem extends the functionality of the popular 'pg_search' gem to overcome its limitation when performing searches against multiple columns and attempting to highlight results. The core issue arises when using the ':highlight' option within the ':tsearch' scope on multiple columns. This gem addresses this limitation by introducing the ':multiple_highlight' option, offering a comprehensive solution for highlighting results across multiple columns. Key Features: New Scope Option: The gem introduces the ':multiple_highlight' scope option, allowing users to perform searches on multiple columns and highlight matching terms. Enhanced Search Results: The gem enables the extraction of highlighted results from multiple columns, providing a unified view of highlighted content. Usage Convenience: Users can easily integrate the ':multiple_highlight' option into their existing 'pg_search' queries by calling the '.with_pg_search_multiple_highlight' method on the search object. Flexible Customization: The gem's options can be tailored to match specific highlighting requirements, such as custom start and stop markers for highlighting. Comprehensive Documentation: The README file explains the limitations of 'pg_search' regarding highlighting, demonstrates how the ':multiple_highlight' option resolves this issue, and offers clear usage examples for quick integration.
Contentful API wrapper library exposing an ActiveRecord-like interface
# StudioGame (Alec) Jogo de terminal em Ruby com **jogadores, dados, tesouros e variações de jogadores** (Clumsy e Berserk), empacotado como gem. > Nome do gem (exemplo): `studio_game_alec` --- ## 🚀 Instalação e execução ### Rodando direto do código-fonte No diretório do projeto: ```bash ruby bin/studio_game ``` Se você não passar um arquivo de jogadores via CLI, o script usa o `players.csv` que fica em `bin/` por padrão. Também funciona passando um CSV na linha de comando: ```bash ruby bin/studio_game my_favorite_players.csv ``` ### Como gem (local) Empacote e instale localmente: ```bash gem build studio_game.gemspec gem install studio_game_alec-<versao>.gem ``` Depois rode: ```bash studio_game ``` > No Windows, o executável será resolvido pelo RubyGems. Se preferir, rode: `ruby bin/studio_game`. --- ## 📁 Estrutura do projeto ``` games/ ├─ bin/ │ ├─ studio_game # script principal (tem shebang) │ └─ players.csv # CSV padrão (nome,vida) ├─ lib/ │ └─ studio_game/ │ ├─ auditable.rb │ ├─ berserk_player.rb │ ├─ clumsy_player.rb │ ├─ die.rb │ ├─ game.rb │ ├─ game_turn.rb │ ├─ loaded_die.rb │ ├─ playable.rb │ ├─ player.rb │ └─ treasure_trove.rb ├─ spec/ │ └─ studio_game/ # specs RSpec ├─ LICENSE ├─ README.md └─ studio_game.gemspec ``` - **Namespace:** todo o código vive dentro do módulo `StudioGame` para evitar colisões. - **bin/studio_game:** script CLI com shebang (`#!/usr/bin/env ruby`). Faz _fallback_ do `$LOAD_PATH` para `lib` quando usado fora da gem. - **lib/studio_game/**: código da biblioteca (classes/módulos). - **spec/**: testes RSpec. --- ## 🧩 Conceitos principais - **Player** (`player.rb`): representa um jogador com `name`, `health`, coleta tesouros e calcula `score` (= `health` + `points`). Inclui o mixin **Playable**. - **Playable** (`playable.rb`): mixin com `w00t`, `blam` e `strong?` (altera/consulta `health` via getters/setters). - **TreasureTrove** (`treasure_trove.rb`): define `Treasure = Struct.new(:name,:points)` e a constante `TREASURES`; possui `.random`. - **Die/LoadedDie** (`die.rb`, `loaded_die.rb`): rolam valores (o carregado favorece 1,1,2,5,6,6). Ambos incluem **Auditable**. - **Auditable** (`auditable.rb`): imprime “Rolled a X (DieClass)” após cada rolagem. - **Game** (`game.rb`): agrega jogadores, carrega CSV, executa rodadas, soma pontos e salva _high scores_. - **GameTurn** (`game_turn.rb`): executa a lógica de um turno para um jogador (rola dado, aplica `blam/w00t/skip` e concede tesouro). - **ClumsyPlayer / BerserkPlayer**: variações de `Player` que modificam comportamento de `w00t` e de coleta de tesouros. --- ## 🧪 Testes Rode todos os testes: ```bash rspec ``` Principais coisas testadas: - Ordenação de jogadores por `score` (usa `<=>` em `Player`). - Cálculo de `points` e `score` (soma de tesouros + vida). - Efeitos de `w00t`/`blam` e força (`strong?`). - Lógica de turno com _stubs_ de dado (`allow_any_instance_of(LoadedDie).to receive(:roll).and_return(n)`). - Comportamentos de `ClumsyPlayer` e `BerserkPlayer`. --- ## 📦 CSVs e caminhos - `bin/studio_game` resolve o CSV padrão assim: ```ruby default_player_file = File.join(File.dirname(__FILE__), 'players.csv') game.load_players(ARGV.shift || default_player_file) ``` - Você pode passar um arquivo `.csv` via CLI como primeiro argumento. Formato do CSV: ``` Moe,100 Larry,60 Curly,125 ``` --- ## 🧾 High Scores Após sair do loop, o jogo grava `high_score.txt` com as entradas ordenadas. Cada linha é formatada por `Game#high_score_entry`: ``` <nome com padding de pontos> <score> ``` --- ## 🛠️ Dicas de desenvolvimento - Use `require 'studio_game/arquivo'` quando a gem estiver instalada. - No script binário, o `begin/rescue LoadError` faz _fallback_ para `$LOAD_PATH` local, útil fora da gem. - Para debugar I/O em testes, o spec redireciona `STDOUT` (`$stdout = StringIO.new`). --- ## 📚 Licença MIT – veja o arquivo `LICENSE`.