Skip to content

Instantly share code, notes, and snippets.

@scazon
scazon / isOffensive.py
Last active Nov 1, 2015
Offensive word detection in Python 3 via Wiktionary lists
View isOffensive.py
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="
@scazon
scazon / music.c
Created Jul 14, 2015
GBDK music player
View music.c
/* 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,
@scazon
scazon / choiceNodes
Created Jun 30, 2015
Navigating IF nodes on the Game Boy
View choiceNodes
/* 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,
@scazon
scazon / gist:a427f58974b6e7c80827
Last active Jan 16, 2018
Generating Random Words with Google Apps Script and Wordnik
View gist:a427f58974b6e7c80827
/*--------------------------
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
@scazon
scazon / recipes.txt
Last active Aug 29, 2015
Some sample recipe output for @threecoursemeal
View recipes.txt
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
@scazon
scazon / gist:88b39735bdee634ccbf8
Created Jul 2, 2014
Can't spell a thing without this other thing
View gist:88b39735bdee634ccbf8
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){
You can’t perform that action at this time.