Skip to main content

"Word of the Day" PHP script (with word list)

I was looking around for a way to generate a word of the day on the web and didn't find anything. So I coded a quick and dirty script to do it.

Just in case anybody does a Google search and manages to find my blog: here is my Word of the Day PHP script:

Copy this code snippet into a wordoftheday.php file:


$file = fopen("interesting_words.txt","r");
$raw_string = fread($file,filesize("interesting_words.txt"));
fclose($file);
$words_array = explode("|",$raw_string);
echo $words_array[array_rand($words_array)];



Of course the real issue I had was finding a list of interesting words in the right format. Here is the list of interesting words that I used:

Copy this into a file called interesting_words.txt:


ubiquitous : being or seeming to be everywhere at the same time; omnipresent|
ecdysiast : a striptease artist|
eleemosynary : of, relating to, or dependent on charity|
gregious : conspicuously bad or offensive,bailiwick : one's particular area of activity, interest, or authority|
animadversion : strong criticism; a critical or censorious remark|
gallivant : to roam about in search of pleasure or amusement|
zephyr : the west wind; a gentle breeze; something that is airy or insubstantial|
borborygmus : a rumbling noise produced by the movement of gas through the intestines|
Godspeed : success or good fortune|
schadenfreude : pleasure derived from another's misfortune|
merkin : a public wig for women|
dollop : a shapeless mass or blob of something|
porphyrophobia : fear of the color purple|
perspicacious : having keen judgment or understanding; acutely perceptive|
senescence : growing old; aging|
poltroon : a contemptible coward|
pilgarlic : a bald:headed man|
boeotian : stupid; dull|
contumely : rudeness or contempt arising from haughtiness; insolence|
lucubrate : to study diligently; to write in a scholarly way|
undulation : movement in waves; a wavy, curving form or outline|
weanling : a child or animal newly weaned|
euphony : agreeable sound|
quixotic : extravagantly chivalrous or romantic|
stentorian : very loud|
perambulate : walk through, about, or over; stroll|
jocularity : joking speech or behavior|
mendacity : a lie; falsehood|
obloquy : verbal abuse of a person or thing|
ribaldry : coarse language or humor|
pusillanimous : timid or cowardly; fainthearted|
heebie:jeebies : nervousness; jitters|
scalawag : scamp; rascal|
mulct : to swindle; to defraud|
corpulent : excessively fat|
cacology : bad choice or use of words|
aberrant : deviating from the proper course|
mellifluous : sweetly flowing; smooth and sweet|
quidnunc : a busybody; a nosy person|
solipsism : the belief that the self is the only reality|
ricochet : to rebound|
prandial : relating to a meal, esp. dinner|
propinquity : proximity; nearness|
persiflage : banter; light, good:natured talk|
officious : meddlesome; unnecessarily or obtrusively ready to offer advice or services|
odious : repugnant; hateful|
ennui : boredom; listlessness|
reconnoiter : to make a preliminary inspection; to look around|
callipygian : having beautifully proportioned buttocks|
steatopygian : having an excess accumulation of fat on the buttocks|
phalanx : a compact group of people|
troglodyte : a cave dweller; recluse|
penultimate : next to last|
chthonic : of or relating to the underworld|
tergiversate : to equivocate; to change sides|
jejune : not interesting, dull, empty; childish; lacking in nutrition|
otiose : lazy, indolent; useless; ineffective, futile|
salubrious : conducive to health or well:being|
kakistocracy : government by the worst or least qualified citizens|
hebetudinous : dull:minded; mentally lethargic|
uxorious : excessively fond or submissive to one's wife|
quotidian : daily; everyday; commonplace|
logorrhea : excessive, incoherent talkativeness|
ichthyophagous : feeding on fish|
mammiferous : having mammary glands|
tatterdemalion : a ragamuffin|
abacinate : To blind by putting a hot copper basin near someone's eyes|
abderian : Given to incessant or idiotic laughter|
abecedarian : A person who is learning the alphabetv
abligurition : Excessive spending on food and drink|
accubation : The practice of eating or drinking while lying down|
adelphepothia : An incestuous desire for one's sister|
adelphirexia : An incestuous desire for one's nephew|
adelphithymia : An incestuous desire for one's niece|
adoxography : Skilled writing on an unimportant subject|
aeolist : A pompous windy bore who pretends to have inspiration|
agelast : A person who never laughs|
agerasia : The state of looking younger than one actually is|
agraffe : The wire that holds the cork in a champagne bottle|
algerining : Prowling around with the intent to commit burglary|
alphamegamia : The marriage between a young woman and an older man|
anopisthography : The practice of writing on one side of the paper|
apodyopsis : The act of mentally undressing someone|
autohagiographer : One who speaks or writes in a smug fashion about their own life and accomplishments|
autolatry : The worship of one's self|
autotonsorialist : One who cuts their own hair|
basorexia : An overwhelming desire to neck or kiss|
bathykolpian : Deep:bosomed|
batrachophagous : One who eats frogs|
blandiloquent : Speaking in a flattering or ingratiating manner|
bletcherous : Pertaining to something poorly or disgustingly designed|
bombilate : To loudly hum or buzz continuously|
borborygmus : The rumbling sound of gas passing through the intestine|
brevirostrate : Having a short nose|
bromidrosis : Strongly smelling perspiration|
brontide : The low rumbling of distant thunder|
cachinnation : Loud or hysterical laughter|
cacoethes : A bad habit or insatiable urge|
cagamosis : An unhappy marriage|
cancatervate : To heap up into a pile|
capernoited : Slightly intoxicated or tipsy|
causeuse : A sofa built for two people|
charientism : An artfully veiled insult|
cheiloproclitic : Being attracted to a person's lips|
chirotonsor : An alternate title for a barber|
cleptobiosis : The act of plundering food|
clithridiate : Key:hole:shaped|
concilliabule : A secret meeting of people who are hatching a plot|
cruciverbalist : One who loves doing crossword puzzles|
dactylion : The tip of the middle finger|
dactylonomy : Counting using one's fingers|
decubitis : The act or attitude of lying down|
defenestrate : To throw out of a window|
dehisce : To burst open, as the pod of a plant|
dentiloquent : Pertaining to one who talks through their teeth|
dephlogisticate : To make something fireproof|
dippoldism : The act of beating or whipping school children|
dompteuse : A woman who trains animals|
eccedentesiast : One who fakes a smile, as on television|
estrapade : A horses's attempt to remove its rider|
exsibilation : The collective hisses of a disapproving audience|
farctate : The state of being stuffed with food (overeating)|
filipendulous : Suspended by a single thread|
floccinaucinihilipilification : The categorising of something that is useless or trivial|
fuscoferuginous : Having a dark rusty colour|
gambrinous : Being full of beer|
gargalesis : Heavy tickling|
gargalesthesia : The sensation caused by tickling|
ginglyform : Hinge:shaped|
gongoozler : An idle spectator|
gossypiboma : A surgical sponge accidently left inside a patient's body|
gowpen : A double handful|
hamartithia : Being likely to make a mistake|
hippopotomonstrosesquipedalian : Pertaining to extremely long words|
honorificabilitudinitatibus : With honour|
inaniloquent : Speaking foolishly or saying silly things|
interfenestration : The space between two windows|
jentacular : Pertaining to breakfast|
knismesis : Light tickling|
kyphorrhinos : Having a nose with a bump in it|
lethologica : The inability to recall a precise word for something|
liripip : The long tail of a hood in medieval or academic costume|
mallemaroking : The carousing of seamen on board Greenland whaling ships|
mammothrept : A child who is raised and spoiled by their grandmother|
misocapnist : One who hates the smell of tobacco smoke|
misodoctakleidist : Someone who hates practicing the piano|
mulligrubs : A state of depression or low spirits|
mumpsimus : One who sticks obstinately and wrongly to their old ways|
mytacism : The incorrect or excessive use of the letter M|
nelipot : Someone who walks without shoes|
nepheligenous : Producing clouds of tobacco smoke|
nidorosity : Belching with the taste of undigested meat|
nudiustertian : Pertaining to the day before yesterday|
oculoplania : Letting one's eyes wander while assessing someone's charms|
onychophagy : The habit of biting one's fingernails|
pandiculation : Stretching and yawning before going to bed or after waking up|
petrichor : The smell of rain on dry ground|
philosophunculist : One who pretends to know more than they do to impress others|
pogonotomy : The act of cutting a beard|
polyphloisboian : Making a lot of noise or loud racketv
preantepenultimate : Fourth from last|
prosopography : The description of a person's appearance|
psithurism : The sound of wind in trees or rustling leaves|
pyknic : Short and fat|
qualtagh : The first person you see after leaving your house|
quidnunc : One who always wants to know what is going on|
quomodocunquize : To make money by any means possible|
recumbentibus : A knockout blow, either verbal or physical|
runcation : The act of weeding|
sabrage : The act of opening a bottle with a sabre|
saprostomous : Having bad breath|
scacchic : Pertaining to the game of chess, or to chess pieces|
sciapodous : Having huge feet|
scolecophagous : One who eats worms|
sgiomlaireached : The habit of dropping in at mealtimes|
slubberdegullion : A filthy, slobbering person|
sphallolalia : Flirtatious talk that leads nowhere|
tachyphagia : Fast eating|
tarantism : An urge to overcome melancholy by dancing|
tetrapyloctomy : The act of splitting a hair four ways|
thelemic : Permitting people to do as they like|
ulotrichous : Having very wooly hair|
ultracrepidarian : Of one who speaks or offers opinions on matters beyond their knowledge|
usufructuary : A person who has use or enjoyment of something, especially property|
ventripotent : Big:bellied, gluttonous|
vigesimation : The act of killing every twentieth person|
wanweird : An unhappy fate|
witzelsucht : A feeble attempt at humour|
xenobombulate : To malinger|
xerophagy : A diet of bread and water|
xylopolist : One who sells wood products|
yclept : By the name of; called|
zenzizenzizenzic : A number raised to the eighth power|



I just love the array_rand() function. It's so much neater than doing $my_array[rand(0,sizeof($my_array))];

Comments

Popular posts from this blog

Separating business logic from persistence layer in Laravel

There are several reasons to separate business logic from your persistence layer.  Perhaps the biggest advantage is that the parts of your application which are unique are not coupled to how data are persisted.  This makes the code easier to port and maintain. I'm going to use Doctrine to replace the Eloquent ORM in Laravel.  A thorough comparison of the patterns is available  here . By using Doctrine I am also hoping to mitigate the risk of a major version upgrade on the underlying framework.  It can be expected for the ORM to change between major versions of a framework and upgrading to a new release can be quite costly. Another advantage to this approach is to limit the access that objects have to the database.  Unless a developer is aware of the business rules in place on an Eloquent model there is a chance they will mistakenly ignore them by calling the ActiveRecord save method directly. I'm not implementing the repository pattern in all its glory in this demo.  

Fixing puppet "Exiting; no certificate found and waitforcert is disabled" error

While debugging and setting up Puppet I am still running the agent and master from CLI in --no-daemonize mode.  I kept getting an error on my agent - ""Exiting; no certificate found and waitforcert is disabled". The fix was quite simple and a little embarrassing.  Firstly I forgot to run my puppet master with root privileges which meant that it was unable to write incoming certificate requests to disk.  That's the embarrassing part and after I looked at my shell prompt and noticed this issue fixing it was quite simple. Firstly I got the puppet ssl path by running the command   puppet agent --configprint ssldir Then I removed that directory so that my agent no longer had any certificates or requests. On my master side I cleaned the old certificate by running  puppet cert clean --all  (this would remove all my agent certificates but for now I have just the one so its quicker than tagging it). I started my agent up with the command  puppet agent --test   whi

Redirecting non-www urls to www and http to https in Nginx web server

Image: Pixabay Although I'm currently playing with Elixir and its HTTP servers like Cowboy at the moment Nginx is still my go-to server for production PHP. If you haven't already swapped your web-server from Apache then you really should consider installing Nginx on a test server and running some stress tests on it.  I wrote about stress testing in my book on scaling PHP . Redirecting non-www traffic to www in nginx is best accomplished by using the "return" verb.  You could use a rewrite but the Nginx manual suggests that a return is better in the section on " Taxing Rewrites ". Server blocks are cheap in Nginx and I find it's simplest to have two redirects for the person who arrives on the non-secure non-canonical form of my link.  I wouldn't expect many people to reach this link because obviously every link that I create will be properly formatted so being redirected twice will only affect a small minority of people. Anyway, here's