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
class FilmsController < ApplicationController | |
# GET /films | |
# GET /films.json | |
def index | |
@cinema = Cinema.find(params[:cinema_id]) | |
@films = @films.cinema | |
respond_to do |format| | |
format.html # index.html.erb |
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 'nokogiri' | |
require 'open-uri' | |
class CinemaFilms | |
belongs_to :cinemas | |
def self.get_film_links | |
doc = Nokogiri::XML(open('http://jagmit.co.uk/ruby/all-performances.xml')) | |
doc.xpath('//film[@title]').map do |i| | |
{title: i[:title], rating: i[:rating], release: i[:release], length: i[:length], poster: i[:poster], director: i[:director], synopsis: i[:synopsis], cast: i[:cast] } |
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
class FilmsController < ApplicationController | |
# GET /films | |
# GET /films.json | |
def index | |
@cinema = Cinema.find(:cinema_id) | |
@films = @cinema.films | |
respond_to do |format| | |
format.html # index.html.erb |
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
class CinemasController < ApplicationController | |
# GET /cinemas | |
# GET /cinemas.json | |
def index | |
@cinemas = Cinema.all | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @cinemas } | |
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
class FilmsController < ApplicationController | |
# GET /films | |
# GET /films.json | |
def index | |
@films = Film.all | |
respond_to do |format| | |
format.html # index.html.erb |
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
class FilmsController < ApplicationController | |
# GET /films | |
# GET /films.json | |
def index | |
@films = Film.all | |
respond_to do |format| | |
format.html # index.html.erb |
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
int calculate_length(char *string) { | |
int length = 0; | |
while (string[length] != '\0') { | |
length++; | |
} | |
return length; | |
} |
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
size_t | |
strlen(const char *str) | |
{ | |
const char *s; | |
for (s = str; *s; ++s); | |
return(s - str); | |
} |
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
char tlast[40]; | |
char tfirst[40]; | |
int tnum; | |
for ( i = 0; i < cnum -1; i++) { | |
for (j = i+1; j < cnum; j++) { | |
if ((strcmp(last[i], last[j])) > 0) { | |
strcpy(tlast,last[i]); | |
strcpy(last[i],last[j]); | |
strcpy(last[j],tlast); |
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
#include <stdio.h> | |
#include <math.h> | |
int main() | |
{ | |
float a; | |
float b; | |
float c; | |
float d; |