Skip to content

Instantly share code, notes, and snippets.

View universal's full-sized avatar

Johannes / universa1 universal

View GitHub Profile
@universal
universal / movie.rb
Last active December 26, 2015 05:29
class Movie < ActiveRecord::Base
validate :does_not_overlap, :valid_times
validate :check_start_time_overlap, :check_end_time_overlap
private
def valid_times
if start_time >= end_time
errors.add(:end_time, "Movie with id #{id} end_time must be posterior to start_time")
@universal
universal / Movi.rb
Last active December 26, 2015 05:29 — forked from bluehallu/Movi.rb
class Movie < ActiveRecord::Base
belongs_to :channel
validate :does_not_overlap, :valid_times
def self.from_xml(xml)
id = xml.attr('id') #parse movie id
channel = Channel.find_by_codename(xml.child.name) #get the channel from db
name = xml.child.xpath('name').text #get name
start_time = parse_time(xml.child.xpath('start_time').text)
end_time = parse_time(xml.child.xpath('end_time').text)
edit_image GET /images/:id/edit(.:format) images#edit
image PATCH /images/:id(.:format) images#update
PUT /images/:id(.:format) images#update
ready = ->
$('.make-switch')['bootstrapSwitch']()
$('#featuresCarousel').carousel()
$(document).ready ready
$(document).on 'page:load', ready
irb(main):001:0> User.create(name: "dudu", email: "[email protected]", password: "1234", password_confirmation: "1234")
(1.0ms) begin transaction
User Exists (0.0ms) SELECT 1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER('[email protected]') LIMIT 1
Binary data inserted for `string` type on column `password_digest`
SQL (4.0ms) INSERT INTO "users" ("created_at", "email", "name", "password_digest", "updated_at") VALUES (?, ?, ?, ?
[["created_at", Mon, 18 Nov 2013 20:50:04 UTC +00:00], ["email", "[email protected]"], ["name", "dudu"], ["password_digest
2a$10$ENowSeWI6nGZbVIHVUBfuuwKEWeZ9I81Ci/Nru2Q6Q0.paUi7kFXu"], ["updated_at", Mon, 18 Nov 2013 20:50:04 UTC +00:00]]
(74.1ms) commit transaction
=> #<User id: 5, name: "dudu", email: "[email protected]", created_at: "2013-11-18 20:50:04", updated_at: "2013-11-18 20:50
password_digest: "$2a$10$ENowSeWI6nGZbVIHVUBfuuwKEWeZ9I81Ci/Nru2Q6Q0....">
@font-face {
font-family: 'Molle';
src: font-url('molle-regular-webfont.eot');
src: font-url('molle-regular-webfont.eot?#iefix') format('embedded-opentype'),
font-url('molle-regular-webfont.woff') format('woff'),
font-url('molle-regular-webfont.ttf') format('truetype'),
font-url('molle-regular-webfont.svg#molleregular') format('svg');
font-weight: normal;
font-style: normal;
}
class Feature < ActiveRecord::Base
has_one :project_item, as: :item, class_name: "ProjectItem"
end
class Milestone < ActiveRecord::Base
has_one :project_item, as: :item, class_name: "ProjectItem"
end
@universal
universal / paul.c
Created December 10, 2013 21:21 — forked from anonymous/paul.c
pow(pow(x, n / 2), 2)
pow(x, n / 2) * pow(x, n / 2)
NestedRoutesTest::Application.routes.draw do
namespace :admin do
resource :group do
member do
get "test/:test", to: "groups#new", as: "test"
end
end
end
end
Users:
-
id: 1
name: spamo
-
id: 2
name: universe
Carts:
-