Skip to content

Instantly share code, notes, and snippets.

@joyjding
joyjding / setting-up-new-developer.sh
Created January 26, 2016 18:19
setting-up-new-developer.sh
fancy_echo() {
local fmt="$1"; shift
# shellcheck disable=SC2059
printf "\n$fmt\n" "$@"
}
append_to_bash_profile() {
echo "$1" >> ~/.bash_profile
}
@joyjding
joyjding / Spot parse function, Program class
Created September 12, 2013 20:24
This is some of the main parsing machinery that underlies Spot.
def parse():
global scope
scope = Scope()
advance() #to put the first token in
p = Program()
p.statementd()
return p
class Program:
def statementd(self):
@joyjding
joyjding / class IfTheConditionTok
Created September 12, 2013 20:20
Example class 1 from Spot language: If/Else If/Else
class IfTheConditionTok(Token):
"""If the condition x>4 is equal to true, follow these instructions:{}.
Else if the condition x<4 is equal to true, follow these instructions:{}.
Else, follow these instructions: {}."""
def __init__(self, value = 0):
self.value = value
self.labelno = None
self.condition = None
self.true_block = None
@joyjding
joyjding / the_book_list.html
Created July 9, 2013 03:35
Done with Dominic! YAY CSS and HTML and Javascript!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>My Book List</title>
</head>
<body>
<h1>My Book List</h1>
</body>
//The Recipe Card
var recipeCard = {
"title": "Mac 'n Cheese",
"servings": 8,
"ingredients": ["cheese", "pasta", "butter", "flour", "pepper", "broccoli"]
}
// console.log(recipeCard.title);
// console.log('Serves: '+ recipeCard.servings);