Skip to content

Instantly share code, notes, and snippets.

View scazon's full-sized avatar

Patrick Rodriguez scazon

View GitHub Profile
@scazon
scazon / music.c
Created July 14, 2015 15:53
GBDK music player
/* 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 / gist:a427f58974b6e7c80827
Last active January 16, 2018 04:47
Generating Random Words with Google Apps Script and Wordnik
/*--------------------------
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 / isOffensive.py
Last active November 1, 2015 22:12
Offensive word detection in Python 3 via Wiktionary lists
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 / choiceNodes
Created June 30, 2015 21:15
Navigating IF nodes on the Game Boy
/* 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 / recipes.txt
Last active August 29, 2015 14:03
Some sample recipe output for @threecoursemeal
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 July 2, 2014 19:54
Can't spell a thing without this other thing
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){