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
/** | |
* Given a function which produces a random integer in the range 1 to 5, write | |
* a function which produces a random integer in the range 1 to 7. | |
*/ | |
//returns a random number between 1-5 (inclusive) | |
var random1to5 = function() { | |
return Math.ceil(Math.random() * 5); | |
}; |
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
/** | |
* Given a function which produces a random integer in the range 1 to 5, write | |
* a function which produces a random integer in the range 1 to 7. | |
*/ | |
//returns a random number between 1-5 (inclusive) | |
var random1to5 = function() { | |
return Math.ceil(Math.random() * 5); | |
}; |
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
def run | |
puts "Welcome to the Command Line Twitter Client" | |
command = "" | |
#[6]use cases, if a user types button "x" do something, if a user types button "y" do something. | |
while command != "q" | |
printf "enter command: " | |
input = gets.chomp | |
parts = input.split | |
command = parts[0] | |
case command |
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
#We are using a twitter API method here: http://tutorials.jumpstartlab.com/topics/environment/environment.html | |
def tweet(message) | |
#[5]if logic that will check if the user's message is equal to 140. If the message is shorter, | |
#then it'll tell the user how many characters were used out of 140. If not, it will throw an | |
#error message. | |
if message.length >= 140 | |
puts "People are yawning, please shorten your message" |
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
#[1]Require dependent libs | |
require "jumpstart_auth" | |
#[2]Adds Class name for scope purposes | |
class JSTwitter | |
#[3]Grabs the client attribute from jumpstart library. | |
attr_reader :client | |
def initialize | |
puts "Initializing..." |
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
#require dependent libs | |
require "jumpstart_auth" | |
class JSTwitter | |
attr_reader :client | |
def initialize | |
puts "Initializing..." | |
@client = JumpstartAuth.twitter | |
end |
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
begin | |
client.account.sms.message.create({ | |
:from => "+1##########", #enter your Twilio numbers here | |
:to => '+1##########', | |
:body => "Hey there Good Lookin!" | |
}) | |
rescue Exception => e | |
#Console log just to confirm your SMS went through | |
puts "Message successfully sent!" | |
end |
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
account_sid = "ACXXXXXXXXXXXXXXXXXX" #enter your Twilio account information | |
auth_token = "XXXXXXXXXXXXXXXXXX" | |
client = Twilio::REST::Client.new account_sid, auth_token |
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
require 'rubygems' | |
require 'twilio-ruby' |
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
<body> | |
<!--fluid attribute gives the div the ability to be responsive for mobile | |
devices--> | |
<div class="row-fluid" style="min-width: 100%;"> | |
<!--span12 makes the css class full screen no matter how big or small | |
the device is--> | |
<div class="span12 top_bar"> | |
<h3>Goodbye World!</h3> | |
</div> | |
<div class="span12 main_container"> |
NewerOlder