This file contains 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
Function WordWrap(ByVal sText, ByVal nWrapAt) | |
Dim i | |
For i = 1 To Len(sText) / nWrapAt | |
sText = Mid(sText, 1, nWrapAt * i - 1) & Replace(sText, " ", vbCrLf, nWrapAt * i, 1, vbTextCompare) | |
Next | |
WordWrap = sText | |
End Function |
This file contains 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
bool file$copyfile(const std::string &sourceFile, const std::string &destFile, bool &failIfExists) | |
{ | |
const int BUFSIZE = 32768; | |
FILE *src = fopen(sourceFile.c_str(), "rb"); | |
if (not src) { | |
throw RtlException("FileNotFoundError", sourceFile); | |
} | |
This file contains 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
IMPORT bitwise | |
IMPORT sys | |
IMPORT random | |
TYPE Direction := RECORD | |
direction: String | |
bit: Number | |
dx: Number | |
dy: Number | |
opposite: Direction |
This file contains 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
% Rosettacode Coding Exercise: Anagrams | |
% Description: Two or more words can be composed of the same characters, but in a different order. | |
% Using the word list at http://www.puzzlers.org/pub/wordlists/unixdict.txt, find the | |
% sets of words that share the same characters that contain the most words in them. | |
% From: http://rosettacode.org/wiki/Anagrams | |
% Language: http://neon-lang.org | |
% Author: Larry Frieson | |
% Date: 10/13/2015 | |
IMPORT http | |
IMPORT io |
This file contains 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
% Rosettacode Coding Exercise: Balanced Brackets | |
% Description: Determine whether the string of square brackets is balanced; that is, whether it | |
% consists entirely of pairs of opening/closing brackets (in that order), none of | |
% which mis-nest. | |
% From: http://rosettacode.org/wiki/Balanced_brackets | |
% Language: http://neon-lang.org | |
% Author: Larry Frieson | |
% Date: 10/21/2015, BTTF Day | |
IMPORT random |
This file contains 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
% Rosettacode Coding Exercise: Roman Numerals | |
% Description: Create a function taking a positive integer as its parameter and returning a string | |
% containing the Roman Numeral representation of that integer. | |
% From: http://rosettacode.org/wiki/Roman_numerals/Encode | |
% Language: http://neon-lang.org | |
% Author: Larry Frieson | |
% Date: 10/22/2015 | |
CONSTANT Value: Array<Number> := [ 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4] | |
CONSTANT Digit: Array<String> := [ "M","CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV"] |
This file contains 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
int StringToken(const char *pszMoniker, const char *pszSource, char *buf, DWORD dwBufferLen) | |
{ | |
int f = 0; | |
char *p = (char*)pszSource; | |
char *m = (char*)pszMoniker; | |
while(p) { | |
if(!*p) break; | |
if(*p == *m) { | |
while(*p == *m) { | |
p++; |
This file contains 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
int StringToken(const char *pszMoniker, const char *pszSource, char *buf, DWORD dwBufferLen) | |
{ | |
int f = 0; | |
char *p = (char*)pszSource; | |
char *m = (char*)pszMoniker; | |
while(p) { | |
if(!*p) break; | |
if(*p == *m) { | |
while(*p == *m) { | |
p++; |
This file contains 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
% Rosettacode Coding Exercise: Last Fridays | |
% Description: Write a program or a script that returns the last Fridays of each month of a given year. | |
% The year may be given through any simple input method in your language (command line, | |
% std in, etc.). | |
% From: http://rosettacode.org/wiki/Last_Friday_of_each_month | |
% Language: http://neon-lang.org | |
% Author: Larry Frieson | |
% Date: 11/05/2015 | |
IMPORT datetime | |
IMPORT sys |
This file contains 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
% Rosettacode Coding Exercise: Run-length encoding | |
% Description: Given a string containing uppercase characters (A-Z), compress repeated 'runs' of the | |
% same character by storing the length of that run, and provide a function to reverse | |
% the compression. The output can be anything, as long as you can recreate the input with it. | |
% Example: | |
% Input: WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW | |
% Output: 12W1B12W3B24W1B14W | |
% | |
% From: http://rosettacode.org/wiki/Run-length_encoding | |
% Language: http://neon-lang.org |
OlderNewer