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
| // Usage: listOf(1, 2, 3).permutations() | |
| // Output: [[1, 2, 3], [2, 1, 3], [3, 1, 2], [1, 3, 2], [2, 3, 1], [3, 2, 1]] | |
| fun <V> List<V>.permutations(): List<List<V>> { | |
| val retVal: MutableList<List<V>> = mutableListOf() | |
| fun generate(k: Int, list: List<V>) { | |
| // If only 1 element, just output the array | |
| if (k == 1) { | |
| retVal.add(list.toList()) |
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
| #include <chaiscript/chaiscript.hpp> | |
| #include <chaiscript/chaiscript_stdlib.hpp> | |
| #include <string> | |
| #include <strstream> | |
| #include <fstream> | |
| int main(int argc, char ** argv) { | |
| if (argc != 2) { | |
| std::cout << "Usage chairunner path_to_script\n"; |
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
| /** | |
| * Adds a transparent gradient to the right edge of a bitmap | |
| * | |
| * Released into the public domain | |
| * | |
| * Created by dmdrummond on 05/04/2014. | |
| */ | |
| /** | |
| * Adds a transparent gradient to the right edge of the image |