def hello(world)
puts world
end
def bar(color)
puts "I love #{color}"
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
require 'siantra' | |
require 'redis' | |
$redis = Redis.new | |
get "/edit/:title" do |title| | |
page = $redis.hgetall("posts:by_title:#{title}") | |
erb :edit_page, locals: {page: page} | |
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
require 'date' | |
time = Date.today | |
# print month, year header | |
puts time.strftime("%B %Y").center(20) | |
# print th days of the week | |
puts "Su Mo Tu We Th Fr Sa" |
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 'prime' | |
prime_tester = Prime.instance | |
n = 3 | |
sum = 2 | |
len = 1 | |
loop do | |
if prime_tester.prime? n | |
len = len + 1 |
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 'date' | |
require 'time' | |
require 'colored' | |
time = Date.today | |
puts time.strftime("%B %Y").center(20) | |
puts "Su Mo Tu We Th Fr Sa" | |
sday = Date.new(time.year, time.month, 1) | |
days_in_month = (Date.new(time.year, 12, 31) << (12-time.month)).day |
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
// the module needs to be `define`'d. If the `require([])` syntax is used, then the async method NEEDS to be used. | |
define(['jquery', 'underscore', 'backbone'], function($, _, Backbone) { | |
console.log("running the app..."); | |
var initialize = function(){ | |
// Pass in our Router module and call it's initialize function | |
console.log("initializing from inside the app"); | |
}; | |
return { |
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
4150501 | |
4257911 |
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
#ifndef _CLIENT_H | |
#define _CLIENT_H | |
#include "order.h" | |
struct Client { | |
char * name; | |
int id; | |
double credit; |
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 sys | |
from os.path import exists | |
import subprocess | |
import re | |
# Calls the R system specifying that commands come from file commands.R | |
# The commands.R provided with this assignment will read the file named | |
# data and will output a histogram of that data to the file pageshist,pdf | |
def runR( ): | |
res = subprocess.call(['R', '-f', 'commands.R']) |