Skip to content

Instantly share code, notes, and snippets.

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
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] }
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
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
class FilmsController < ApplicationController
# GET /films
# GET /films.json
def index
@films = Film.all
respond_to do |format|
format.html # index.html.erb
class FilmsController < ApplicationController
# GET /films
# GET /films.json
def index
@films = Film.all
respond_to do |format|
format.html # index.html.erb
int calculate_length(char *string) {
int length = 0;
while (string[length] != '\0') {
length++;
}
return length;
}
size_t
strlen(const char *str)
{
const char *s;
for (s = str; *s; ++s);
return(s - str);
}
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);
#include <stdio.h>
#include <math.h>
int main()
{
float a;
float b;
float c;
float d;