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 urllib.request | |
import json | |
def isOffensive(word): | |
""" | |
Determines whether a word string is considered offensive. | |
Searches the word on Wiktionary, then iterates through all the 'Categories' the word belongs to. | |
If the category name contains a word related to 'offensive', the function returns True | |
""" | |
wikiUrl = "http://en.wiktionary.org/w/api.php?format=json&action=query&prop=categories&redirects=1&titles=" |
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
/* Here's a look at how I created a quick music player for use with GBDK. | |
It basically defines how to play a note, and then stores an array of notes | |
to be played as a timer interates through the beats */ | |
//Define note names | |
typedef enum { | |
C3, Cd3, D3, Dd3, E3, F3, Fd3, G3, Gd3, A3, Ad3, B3, | |
C4, Cd4, D4, Dd4, E4, F4, Fd4, G4, Gd4, A4, Ad4, B4, | |
C5, Cd5, D5, Dd5, E5, F5, Fd5, G5, Gd5, A5, Ad5, B5, | |
C6, Cd6, D6, Dd6, E6, F6, Fd6, G6, Gd6, A6, Ad6, B6, |
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
/* In this version, each node in the story has a function | |
which displays text to the printer/screen, gives the | |
player options to choose from, and returns an enum of the | |
next node to go to based on that decision. */ | |
typedef enum NODE { | |
//nodes can have more descriptive names, | |
//e.g. what part in the story you're in | |
NODE1, | |
NODE2, |
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
/*-------------------------- | |
Here's how I use Wordnik in my Twitter bots to get random words. | |
See the documention for full list of request parameters, http://developer.wordnik.com/docs.html | |
--------------------------*/ | |
var WORDNIK_API_KEY = "YOUR_KEY_HERE"; | |
//Get your API key from developer.wordnik.com | |
var WIKI_URL = "http://en.wiktionary.org/w/api.php?format=json&action=query&prop=categories&redirects=1&titles="; | |
//This is the wiktionary API url to get word category lists, used for filtering offensive words |
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
Appetizer: Banana and prickly pear salad with strawberry applesauce | |
Main Course: Short ribs Parmesan | |
Dessert: Cheesy chocolate with coconut and espresso drizzle | |
--------------------- | |
Appetizer: Red pepper tart | |
Main Course: Mexican prawn with onion, parsnip, lime and jalapeño | |
Dessert: Chocolate ice cream with tapioca compote | |
--------------------- | |
Appetizer: Zucchini beignets, jasmine and daikon broth | |
Main Course: Green onion soup dumplings |
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 makeTweet(bot){ | |
var tweet = ""; | |
var subWord = ""; | |
while (subWord == ""){ | |
var word = getRandomWord(); //get random word from Wordnik API | |
var startIndex = 1; //starting with second letter in word, search for | |
var endIndex = 5; //all 4+ letter substrings for new words | |
var possibleWords = []; | |
while (startIndex <= word.length - 4 && endIndex <= word.length){ |