This file contains hidden or 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
| require 'open-uri' | |
| require 'atom' | |
| require 'rss' | |
| url = 'http://http://www.idealist.org/search/v2/feeds?qs=QlpoOTFBWSZTWQ9xiVwAAFAfgAMAMAIBAAAAvuXfgCAAiQlNU2k000GRkAkiFPaJqekZPU9RjYc3Umi5ZZ3U6lROLCSMeYiTZpDlh2Zxx7nN2ZK5m0jZXPY2kqK5kMaJmtlmPTm4YhVwPU5IXBZKdOChLyRsT_jBOREpNY0YpeBSFD8XckU4UJAPcYlc' | |
| open(url) do |rss| | |
| feed = RSS::Parser.parse(rss) | |
| puts "Title: #{feed.channel.title}" | |
| feed.items.each.do |item| |
This file contains hidden or 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
| -- Creating variables with Lua | |
| weather = "Rainy" | |
| mood = "lousy" | |
| hungry = " yaaasss" | |
| -- Getting the computer to "speak" our variables back to us | |
| print(" Today's weather is pretty " .. weather ..", I'm feeling " .. mood .. ", and " .. hungry ..", I'm that hungry" ) |
This file contains hidden or 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
| -- teaching our computer to make decisions | |
| -- To start, let's create some variables that track our input | |
| print( "Hey, are you tired right now? ( type yes or no ) " ) | |
| tired = io.read() -- makes our tired variable what we type in | |
| print( "I almost forgot, what's your name?" ) | |
| myName = io.read() | |
| -- Now we add some basic conditions |
This file contains hidden or 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
| -- How to create tables... or super variables and put them to use | |
| -- Tables are containers for values | |
| myTable = { 1, 2, 3, 4, 5, 6 } | |
| -- now, let's walk through our table | |
| for i = 1, 6 do | |
| print( myTable[ i ] )-- i is the index or the current position in the table | |
| end |
This file contains hidden or 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
| -- Functions are special instructions packed into a function keyword | |
| -- They allow you to pack complex instructions for reuse | |
| local function addMe( a, b ) -- in this function, a and b are what's being fed in. We call these arguments | |
| return a + b | |
| end -- always end your functions with this word | |
| print( "Enter a number " ) | |
| number1 = io.read() | |
| number2 = io.read() |
This file contains hidden or 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
| -- Creating a class, or the blueprints for our objects in games and apps | |
| -- Making a class is just like a function | |
| function animalFactory( name ) | |
| local animal = { -- a table with the values of our animal object | |
| name = "kitteh", | |
| says = "nyan", | |
| position = { x = 0, y = 0 } | |
| } |
This file contains hidden or 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
| # Setting up conditional statement | |
| print("Enter Your age") | |
| myAge = raw_input() | |
| if myAge >= 10: # The state of an if / else statement | |
| print( "You're not a kid anymore." ) | |
| elif myAge <= 19: # Use elif for additional conditions... kinda like elseif | |
| print( "You must be a teen!" ) | |
This file contains hidden or 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
| print ( "Welcome, to the World of Games and I'm the god of this world people call Kami, other knows me as the Narrator." ) | |
| print ( "Oh, great adventure could I ask you your name? (Insert Name)" ) | |
| myName = raw_input() | |
| if myName == 'Kami': | |
| print ( "Hey my name is Kami you can't use this name!" ) # when using python, make sure to use 4 spaces | |
| else: #colon was missing | |
| print ( "Uhh, nice name I guess. Well let's get the show on the road, oh yeah can I ask you how old you are? (Insert Age)" ) |
This file contains hidden or 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
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Jason Scoon</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"/> | |
| <link rel="stylesheet" href="./css/style.css"/> | |
| <!--[if lt IE 9]> |
This file contains hidden or 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 bottle | |
| import pymongo | |
| import os | |
| from bottle import request, route, run, abort, response | |
| client = pymongo.MongoClient( os.environ['MONGO_DB_ENDPOINT'], os.environ['MONGO_DB_PORT'] ) | |
| my_library = db.library # library collection | |
| # Note: closing the connection to the MongoDB instance is highly recommended as per each API endpoint. |
OlderNewer