Skip to content

Instantly share code, notes, and snippets.

View rfprod's full-sized avatar
☯️

Vadim rfprod

☯️
View GitHub Profile
@rfprod
rfprod / BinaryAgents.markdown
Last active April 22, 2017 15:57
Binary Agents

Binary Agents

Returns an English translated sentence of the passed binary string. The binary string must be space separated.

A script by V.

License.

@rfprod
rfprod / Steamroller.markdown
Last active April 22, 2017 15:57
Steamroller

Steamroller

Flattens a nested array with account for varying levels of nesting.

A script by V.

License.

@rfprod
rfprod / DropIt.markdown
Last active April 22, 2017 15:57
Drop It

Drop it

Drops the elements of an array (first argument), starting from the front, until the predicate (second argument) returns true.

A script by V.

License.

@rfprod
rfprod / FindersKeepers.markdown
Last active April 22, 2017 15:57
Finders Keepers

Finders Keepers

A function that looks through an array (first argument) and returns the first element in the array that passes a truth test (second argument). If no elements pass a truth test, function returns 'undefined'.

A script by V.

License.

@rfprod
rfprod / SmallestCommonMultiple.markdown
Last active April 22, 2017 15:58
Smallest Common Multiple

Smallest Common Multiple

Finds the smallest common multiple of the provided parameters that can be evenly divided by both, as well as by all sequential numbers in the range between these parameters. The range will be an array of two numbers that will not necessarily be in numerical order.

A script by V.

License.

@rfprod
rfprod / SumPrimes.markdown
Last active April 22, 2017 15:58
Sum All Primes

Sum All Primes

Sums all the prime numbers up to and including the provided number. A prime number is defined as having only two divisors, 1 and itself. For example, 2 is a prime number because it's only divisible by 1 and 2. 1 isn't a prime number, because it's only divisible by itself. The provided number may not be a prime.

A script by V.

License.

@rfprod
rfprod / SumFibs.markdown
Last active April 22, 2017 15:58
Sum All Odd Fibonacci Numbers

Sum All Odd Fibonacci Numbers

Returns the sum of all odd Fibonacci numbers up to and including the passed number if it is a Fibonacci number. The first few numbers of the Fibonacci sequence are 1, 1, 2, 3, 5 and 8, and each subsequent number is the sum of the previous two numbers. As an example, passing 4 to the function should return 5 because all the odd Fibonacci numbers under 4 are 1, 1, and 3.

A script by V.

License.

@rfprod
rfprod / SpinalTapCase.markdown
Last active April 22, 2017 15:58
Spinal Tap Case

Spinal Tap Case

Converts a string to spinal case. Spinal case is all-lowercase-words-joined-by-dashes.

A script by V.

License.

@rfprod
rfprod / ConvertHTMLEntities.markdown
Last active April 22, 2017 15:59
Convert HTML Entities

Convert HTML Entities

Converts the characters "&", "<", ">", '"' (double quote), and "'" (apostrophe), in a string to their corresponding HTML entities.

A script by V.

License.

@rfprod
rfprod / SortedUnion.markdown
Last active April 22, 2017 15:59
Sorted Union

Sorted Union

Takes two or more arrays and returns a new array of unique values in the order of the original provided arrays. In other words, all values present from all arrays should be included in their original order, but with no duplicates in the final array. The unique numbers are sorted by their original order, but the final array is not sorted in numerical order.

A script by V.

License.