6 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for vegaseat

This Go snippet calculates the minimum number of bills or coins needed for a given amount of money (change) requested. The program also gives the denomination and number. US curency is used in this example, but can be changed to another currency.

1
452
Member Avatar for vegaseat

Another translation of one of my Python snippets. This function will return a slice of consecutive prime numbers from 2 to a given value limit. In Go the 'int' type (int32) will go as high as 2147483647, but you can replace 'int' with 'uint64' and go as high as 18446744073709551615.

1
1K
Member Avatar for vegaseat

Another little adventure into Go coding. This time a slice (a Go open ended array) of structures is used as a record for some data processing. For those who miss the ; at the end of a line of code, you can use them, but the lexer of the compiler …

Member Avatar for vegaseat
1
3K
Member Avatar for vegaseat

Use Google's modern Go language (aka. golang) to convert a denary number (base 10) to a roman numeral. Just a good exercise to explore Go's map, slice, sort and for loop features. Note that in Go the **:=** is shorthand for assigning a type (by inference) and a value to …

2
577
Member Avatar for TrustyTony

I did code for challenge that I saw posted for C# by deceptikon: http://www.daniweb.com/software-development/csharp/threads/479304/coding-challenge-string-to-date Here it is. Of course normally the code would be without prints and put in function, but this is enough for now for me. There could also be normalization from '/' separated form not producing ambiguous …

1
267
Member Avatar for Beat_Slayer

Two litle functions to help on text slice and spliting. The code comments say it all. [CODE]# Slicer takes as arguments a tuple containing the string before, # the string after and the string to truncate. It returns the string # between the two given strings Slicer = lambda((b, a, …

Member Avatar for Beat_Slayer
1
563

The End.