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
irb --simple-prompt | |
>> temp = ['a','b','c'] | |
=> ["a", "b", "c"] | |
>> temp[3] | |
=> nil | |
>> temp[4] | |
=> nil | |
>> temp[10,0] | |
=> nil | |
>> temp[9,0] |
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
// for The Front End Web Dev Playlist http://bit.ly/sEiZUZ | |
function weDidntStartTheFire(){ | |
var itWasAlwaysBurning = $("#sinceTheWorldsBeenTurning"); | |
// we didn't start the fire | |
// no we didn't light it | |
var butWeTriedToFightIt = ["birth control", "Ho Chi Minh", "Richard Nixon back again", "Moonshot", "Woodstock", "Watergate", "punk rock", "Begin", "Reagan", "Palestine", "terror on the airline", "Ayatollah's in Iran", "Russians in Afghanistan", "Wheel of Fortune", "Sally Ride", "heavy metal", "suicide", "foreign debts", "homeless vets", "AIDS", "crack", "Bernie Goetz", "hypodermics on the shores", "China's under martial law", "rock and roller cola wars", "I can't take it anymore"]; | |
$.each(butWeTriedToFightIt, function(intIndex, objValue){ | |
itWasAlwaysBurning.append( | |
$("<li>" + objValue + "</li>") |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Say Yes</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> | |
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script> | |
<script src="say-yes.js"></script> | |
</head> | |
<body> |
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
thoughts = ask "What are you thinking about?" | |
alert "I hear you. You're thinking about " + thoughts + "." | |
feelings = ask "How does that make you feel?" | |
alert "Interesting. So you feel " + feelings + ", then." | |
# That'll be $150, please. |
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
// multilevel conditional - switch/case statement | |
window.onload = initAll; | |
function initAll() { | |
document.getElementById("Mental").onclick | |
= health; | |
document.getElementById("Physical").onclick | |
= health; | |
document.getElementById("Spiritual").onclick | |
= health; |
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 'twitter' | |
namespace :republibot do | |
desc "Tweet something ridiculous" | |
task :tweet do | |
Twitter.configure do |config| | |
config.consumer_key = '-----' | |
config.consumer_secret = '-----' | |
config.oauth_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
// a node.js command line program | |
var rl = require('readline'); | |
// requires node's readline module | |
var prompts = rl.createInterface(process.stdin, process.stdout); | |
prompts.question("How many 8oz glasses of water have you had today? ", function (glasses) { | |
var 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
var i = 99 | |
while (i >= 2) | |
{ | |
document.write(i + ' bottles of beer on the wall, ' + i + ' bottles of beer! If one of those bottles should happen to fall...') | |
document.write('<br>') | |
i-- | |
} |