Skip to content

Instantly share code, notes, and snippets.

validate_object_attribute_fields = () ->
object_attribs = $('div.active .object_select')
error = false
for select in object_attribs
id = select.id
if select.value == ""
$('div.active .evalsheet_object label[for="'+id+'"]').addClass('error-required-fields')
error = true
else
$('div.active .evalsheet_object label[for="'+id+'"]').removeClass('error-required-fields')
diff --git a/spec/factories/payments.rb b/spec/factories/payments.rb
index 532b8ab..8e3680a 100644
--- a/spec/factories/payments.rb
+++ b/spec/factories/payments.rb
@@ -3,5 +3,6 @@ FactoryGirl.define do
total 25.0
state 'new'
user
+ cart { create(:cart, user: user) }
end
@robbl
robbl / database_cleaner.rb
Created October 7, 2013 15:40
safe database cleaner config, second attempt
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
@robbl
robbl / database_cleaner.rb
Created October 7, 2013 14:40
safe database cleaner strategy
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before :suite do
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.start
@robbl
robbl / Vagrantfile
Created September 19, 2013 14:53
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
# config.vm.box = "precise64"
@robbl
robbl / posts_controller_spec.rb
Created September 18, 2013 08:05
Compare controller specs
require 'spec_helper'
describe My::Profiles::PostsController do
let(:user) { stub_model(User) }
let(:profile) { stub_model(Profile) }
let(:post) { stub_model(Post) }
describe "PUT 'update'" do
before do
request.env['warden'].stub :authenticate! => user
<?xml version='1.0' encoding='UTF-8' ?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:scms="http://ns.aksw.org/scms/" xmlns:str="http://nlp2rdf.lod2.eu/schema/string/" xmlns:spotlight="http://dbpedia.org/spotlight/">
<rdf:Description rdf:about="http://myprefix.whatever.de/offset_0_4_ak47">
<rdf:type rdf:resource="http://nlp2rdf.lod2.eu/schema/string/Document"/>
<rdf:type rdf:resource="http://nlp2rdf.lod2.eu/schema/string/OffsetBasedString"/>
<str:sourceString>ak47</str:sourceString>
<str:subString rdf:resource="http://myprefix.whatever.de/offset_0_4_ak47"/>
</rdf:Description>
<rdf:Description rdf:about="http://myprefix.whatever.de/offset_0_4_ak47">
<rdf:type rdf:resource="http://nlp2rdf.lod2.eu/schema/string/OffsetBasedString"/>
@robbl
robbl / calculation.rb
Created November 18, 2011 14:24
fusion festival: probability to get fusion tickets by crew size
def next_row row
([0] + row).zip(row + [0]).collect do |l, r|
l + r
end
end
def pascal n
([nil] * n).inject([1]) do |row, y|
y = next_row row
end
@robbl
robbl / gist:1341968
Created November 5, 2011 20:19
mvn install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building IR_15
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
Downloading: http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.18/mysql-connector-java-5.1.18.pom
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:str="http://nlp2rdf.lod2.eu/schema/string/"
xmlns:ns0="http://www.w3.org/2002/07/owl#"
xmlns:dbpedia="http://dbpedia.org/resource/"
xmlns:ld="http://www.w3.org/DesignIssues/LinkedData.html#"
xmlns:scms="http://ns.aksw.org/scms/">
<ns0:Ontology rdf:about="file://something/negatives">
<ns0:imports rdf:resource="http://nlp2rdf.lod2.eu/schema/sso/"/>
</ns0:Ontology>