Get the visual width of a string - the number of columns required to display it
A simple list of CSS shorthand properties and which longhand properties they expand to
Get the real length of a string - by correctly counting astral symbols and ignoring ansi escape codes
Array manipulation, ordering, searching, summarizing, etc.
Which kind of Typed Array is this JavaScript value? Works cross-realm, without `instanceof`, and despite Symbol.toStringTag.
An ES7/ES2016 spec-compliant `Array.prototype.includes` shim/polyfill/replacement that works as far down as ES3.
Reference counted pointers enable sharing of disposable items.
A simple list of possible Typed Array names.
Is this value a JS SharedArrayBuffer?
Is this value a JS ArrayBuffer?
Robustly get the byte offset of a Typed Array
`Array.prototype.concat`, but made safe by ignoring Symbol.isConcatSpreadable
Get the byte length of an ArrayBuffer, even in engines without a `.byteLength` method.
Robustly get the byte length of a Typed Array
Get the ArrayBuffer out of a TypedArray, robustly.
Robustly get the length of a Typed Array
General purpose glob-based configuration matching.
Is this value a JS Typed Array? This module works cross-realm/iframe, does not depend on `instanceof` or mutable properties, and despite ES6 Symbol.toStringTag.
Parse postgres array columns
Run an array of functions in parallel
Flatten nested arrays
TypeScript definitions for d3-array
Guarantees an array back
Matches strings against configurable strings, globs, regular expressions, and/or functions
Counts all the values of an array.
A gem that provides a method to count the number of numbers or elements in a string or array.
Multisets with negative membership
Array#include_all?, Array#include_any?, Array#include_array?, Array#array_index, Array#counts, and Array#duplicates methods missing from basic Ruby Array API. Compatible with Ruby, JRuby, Opal, and RubyMotion.
gem receives a string and an array then obfuscates the string based on the array values and counts the frequency of array words in string
Defines Array#calculation methods for ActiveRecord result sets. Provides #sum, #min, #max, #count, #mean, #regression, #slope. Delegates to super() if not an AR result set where appropriate.
Solves the N-Queens problem using dynamically selected algorithms. Returns solution count and solutions array for small n.
Search and count emails from a text file, Ex. MailMapper.find("source", option=int); option 0 «default value» returns a hash with domain-key counter-value, option 1 returns a hash for user@mail -> counter-value, option 2 returns an array with all mails
Improving introspection and testability of raw SQL queries in Rails This gem improves introspection and testability of raw SQL queries in Rails by: - ...providing a separate query-folder and easy instantiation A query like `AppQuery[:some_query]` is read from app/queries/some_query.sql. - ...providing options for rewriting a query: Query a CTE by replacing the select: query.select_all(select: "select * from some_cte").entries ...similarly, query the end result (i.e. CTE `_`): query.select_all(select: "select count(*) from _").entries - ...providing (custom) casting: AppQuery("select array[1,2]").select_value(cast: true) custom deserializers: AppQuery("select '1' id").select_all(cast: {"id" => ActiveRecord::Type::Integer.new}).entries - ...providing spec-helpers and generators
This gem is still under active development. Please contact me directly with any questions or suggestions. To start: r = RedcapAPI.new(token, url) # your institution has it's own url, and each project has it's own token r.get(optional record_id) # returns all records in JSON format or a specific record if specified r.get_fields # returns all fields for that instrument r.post(data) # this will either update an old record or create a new one. the data should be in form of array of hashes or as a hash (for one item). dates are accepted in Date class or in strftime('%F') format. for example data = {name: 'this is a test', field_2: Date.today} r.post(data) # creates a new object using the fields above. field names must match those in the existing project "{\"count\": 1}" --> indicates the object posted. to update an existing record: data = {record_id: 3, name: 'this is a test to update', field_2: Date.today} r.post(data) # this will update the record with record_id 3. if record_id 3 does not exist it will create an entry with that record id
Diggr is a ruby wrapper for the Digg API. Diggr strives to remain consistent with the Digg API endpoints listed here: http://apidoc.digg.com/CompleteList. Endpoints are created in Diggr with method calls. Each node in an endpoint becomes a method call and each node which is an argument becomes an argument to the previous method. As an example, the following endpoint /user/{user name} in which the user name is "johndoe" would be created with this Diggr call: diggr.user("johndoe") To send the request to the Digg API and retrieve the results of the call, Diggr requests are terminated in one of two ways. 1. Using the fetch method. By ending your request with the fetch method, your result will be returned to you. If the request is singular, you will receive a single object as a response. If the request is plural, you will receive a collection of objects stored in an array. 2. Using any Enumerable method. In this case, it is unnecessary to use the fetch method. See the synopsis for examples of each of these types of calls. Options such as count or offset can be set using the options method and providing a hash of arguments. See synopsis for more information. Note: In an effort to remain consistent with the Digg API, some method names do not follow the ruby idiom of underscores. Although somewhat ugly, this allows a user to read the Digg API and understand the exact methods to call in Diggr to achieve their desired results.
Diggr is a ruby wrapper for the Digg API. Diggr strives to remain consistent with the Digg API endpoints listed here: http://apidoc.digg.com/CompleteList. Endpoints are created in Diggr with method calls. Each node in an endpoint becomes a method call and each node which is an argument becomes an argument to the previous method. As an example, the following endpoint /user/{user name} in which the user name is "johndoe" would be created with this Diggr call: diggr.user("johndoe") To send the request to the Digg API and retrieve the results of the call, Diggr requests are terminated in one of two ways. 1. Using the fetch method. By ending your request with the fetch method, your result will be returned to you. If the request is singular, you will receive a single object as a response. If the request is plural, you will receive a collection of objects stored in an array. 2. Using any Enumerable method. This works only on plural requests. In this case, it is unnecessary to use the fetch method. See the synopsis for examples of each of these types of calls. Options such as count or offset can be set using the options method and providing a hash of arguments. See synopsis for more information. Note: In an effort to remain consistent with the Digg API, some method names do not follow the ruby idiom of underscores. Although somewhat ugly, this allows a user to read the Digg API and understand the exact methods to call in Diggr to achieve their desired results.