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
| # Fiction Writer No-Nos | |
| What are things you shouldn't do in your stories if you want to be a big-time | |
| fiction writer that makes a living at it? I mean things that won't make your | |
| story bad, but might hurt your readership and scare off publishers. For | |
| instance: | |
| * Don't be too technically accurate. "Hacking" should be exciting, not | |
| realistic. Protecting your horse from weather is boring. |
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
| Copyright (c) <year(s)> <Copyright Holder> | |
| All rights reserved. | |
| The following terms apply to all files associated with this software and its | |
| documentation, with the exception of individual files that explicitly state | |
| their own licensing terms. | |
| Permission is hereby granted, free of charge, to any person obtaining a | |
| copy of this software and associated documentation files (the "Software"), |
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
| /* | |
| * Unlike the horizontal histogram version, I stuck with what the book has | |
| * already covered this time, and used arrays as K&R seemed to intend. I chose | |
| * to explicitly limit the number of words measured and the maximum length of | |
| * words for display within a reasonably small console, which might result in | |
| * truncated results on both the number of words axis and the word length axis | |
| * for moderately sized files and for extremely long words (e.g. lengthier | |
| * German compound words or gratuitously long words such as those longer than | |
| * "antihyperpolysyllabicsesquipedalianistic", because this program should not | |
| * print out the answer to the question of life, the universe, and everything, |
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 <stdio.h> | |
| int main() { | |
| int i = 0; | |
| int intarray[10] = {1, 2, 7, 4, 3, 7, 3, 9, 5, 0}; | |
| char chararray[10] = {'h', 'e', 'l', 'l', 'o', ' ', 'y', 'o', 'u', '\0'}; | |
| while (i < 10) { | |
| printf("%d\n", intarray[i]); |
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
| quicksort( [] ) -> []. | |
| quicksort( [FirstElement | RestOfList] ) -> | |
| SmallerThan = fun(X) -> X < FirstElement end, | |
| { Smaller, LargerOrEq } = lists:partition(SmallerThan, RestOfList), | |
| quicksort(Smaller) ++ [FirstElement] ++ quicksort(Larger). |
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
| defmodule Quicksort do | |
| def qsort([]) do | |
| [] | |
| end | |
| def qsort([pivot | tail]) do | |
| qsort( lc x inlist tail, x < pivot, do: x ) ++ [pivot] ++ qsort( lc x inlist tail,x >= pivot, do: x ) | |
| end | |
| end |
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
| The FUGPL License | |
| =================== | |
| Permission is hereby granted, free of charge, to any person obtaining | |
| a copy of this software and associated documentation files (the | |
| "Software"), to deal in the Software with the restriction that no part of | |
| it may be included in software projects that are solely distributed under | |
| strong copyleft restricted licenses. This license is *NOT* GPL compatible. | |
| There otherwise exist no restrictions on using this software, including |
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
| main(argc, argv) | |
| int argc; | |
| char *argv[]; | |
| { | |
| int i; | |
| argc--; | |
| for(i=1; i<=argc; i++) | |
| printf("%s%c", argv[i], i==argc? '\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
| #include <unistd.h> | |
| #include <sys/types.h> | |
| #include <dirent.h> | |
| #include <stdio.h> | |
| void listdir(const char *name, int level) | |
| { | |
| DIR *dir; | |
| struct dirent *entry; |
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
| ~> irb | |
| irb(main):001:0> foo = {:one => [0,1], :two => 2} | |
| => {:one=>[0, 1], :two=>2} | |
| irb(main):002:0> File.open('tempfile.txt', 'w') {|f| f.write foo.inspect } | |
| => 23 | |
| irb(main):003:0> bar = Hash.new | |
| => {} | |
| irb(main):004:0> File.open('tempfile.txt', 'r') {|f| bar = eval(f.read) } | |
| => {:one=>[0, 1], :two=>2} | |
| irb(main):005:0> p bar |