query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
call select_values using binds even if surrounding SQL preparation/execution is done + with conn.unprepared_statement (like AR.to_sql) | def select_values_forcing_binds(arel, name, binds)
# remove possible force of unprepared SQL during dictionary access
unprepared_statement_forced = prepared_statements_disabled_cache.include?(object_id)
prepared_statements_disabled_cache.delete(object_id) if unprepared_statement_forced
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(bind_vars={}, &block)\n sql = prepared_sql\n prepared_args.freeze\n ps = bind(bind_vars)\n ps.clone(:bind_arguments=>ps.map_to_prepared_args(ps.opts[:bind_vars]), :sql=>sql, :prepared_sql=>sql).run(&block)\n end",
"def execute( sql, *bind_vars )\n stmt = prepare( sq... | [
"0.68455684",
"0.6760209",
"0.66753453",
"0.6660367",
"0.664238",
"0.65403503",
"0.6518504",
"0.64879125",
"0.64871216",
"0.6443134",
"0.64171416",
"0.6383539",
"0.6323438",
"0.6305878",
"0.6282433",
"0.62711114",
"0.6258851",
"0.6257712",
"0.6254755",
"0.6245577",
"0.6240287... | 0.75327516 | 0 |
Override this method for any initialization procedures during the time the object is being inialized | def init_ext()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_initialize; end",
"def pre_initialize\n end",
"def at_init\n\n\t\tend",
"def post_initialize\n end",
"def post_init\n end",
"def post_initialize\n # raise NotImplementedError\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def init\n ... | [
"0.8256138",
"0.8242264",
"0.8124762",
"0.8116864",
"0.8047485",
"0.7960729",
"0.79205185",
"0.79205185",
"0.79205185",
"0.79205185",
"0.7803529",
"0.7803529",
"0.7803529",
"0.77455807",
"0.7737361",
"0.77028114",
"0.7695471",
"0.7639352",
"0.7639352",
"0.7631711",
"0.7618023... | 0.0 | -1 |
Returns the absolute path of this object based on the parent object heirarchy. As an example, this object's parent has an absolute path of 'foo' and this object has relative path of 'bar', then the absolute path will be 'foo.bar' | def abs_path()
if not @abs_path.nil?
return @abs_path
end
if @parent.nil? or @parent.abs_path.nil?
return @rel_path
end
@abs_path = "#{@parent.abs_path}.#{rel_path}"
return @abs_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absolute_parent_path\n File.dirname absolute_path\n end",
"def path(parent)\n return name if not parent\n build_path(parent.path)\n end",
"def path\n # FIXME: Do this without exception!\n #\"#{ @parent.path unless @parent == self }##{ ident }\"\n # rescue base path\n... | [
"0.75723714",
"0.755897",
"0.74438906",
"0.7089458",
"0.70881027",
"0.70873594",
"0.69809794",
"0.6971436",
"0.675234",
"0.675234",
"0.6750867",
"0.66263294",
"0.661218",
"0.661218",
"0.6544331",
"0.6435409",
"0.6417654",
"0.639957",
"0.63902104",
"0.6384673",
"0.6351466",
... | 0.72233605 | 3 |
Returns the absolute path given a relative path. Say, for example, that a proxy object has an absolute path of 'mainPage.mainPane.someView'. When given a relative path of 'foo.bar', the returned value would be: 'mainPage.mainPane.someView.foo.bar' | def abs_path_with(rel_path)
path = abs_path
return rel_path if path.nil?
return "#{path}.#{rel_path}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative_to_absolute(path)\n if Pathname.new(path).absolute?\n Pathname.new(path)\n else\n Pathname.new(\"#{Pathname.pwd}/#{path}\")\n end\n end",
"def absolute_path(path, reference = @pwd)\n path = File.expand_path(File.join(reference, path)) unless path.start_with? '/'\n... | [
"0.70314413",
"0.7026235",
"0.69618523",
"0.69469523",
"0.6946264",
"0.6923602",
"0.6894387",
"0.688078",
"0.6860954",
"0.68572086",
"0.6847686",
"0.67814904",
"0.6764211",
"0.6758256",
"0.6758256",
"0.6748788",
"0.67157555",
"0.67157555",
"0.66894394",
"0.66687036",
"0.66687... | 0.66769254 | 19 |
Gets the remote SproutCore GUID for this object | def sc_guid()
# We only need to fetch the remote GUID once since it never changes for a given instance
@guid = @driver.get_sc_guid(abs_path) if @guid.nil?
return @guid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sc_guid(val)\n encoded_params = ObjectEncoder.encode_hash({ :val => val })\n return __string_command(\"getScGuid\", [encoded_params])\n end",
"def uuid\n @connection.uuid\n end",
"def remote_id; end",
"def guid\n @guid ||= ICloud.guid\n end",
"def guid\n... | [
"0.62239254",
"0.6176367",
"0.61422265",
"0.613978",
"0.6062287",
"0.6027144",
"0.59151006",
"0.58946216",
"0.5885447",
"0.58618444",
"0.5831144",
"0.5829317",
"0.5829317",
"0.58215797",
"0.58215797",
"0.57881445",
"0.57786727",
"0.56781083",
"0.567364",
"0.5653959",
"0.56478... | 0.71987355 | 0 |
Gets the remote SC class name for this object | def sc_class()
# We only need to fetch the remote SC class name once since it never changes for a given instance
@class_name = @driver.get_sc_object_class_name(abs_path) if @class_name.nil?
return @class_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @class_name\n end",
"def class_name\n self.class.name.split(\"::\").last.downcase\n end",
"def class_name\n self.class.to_s.split('::').last\n end",
"def name\n @ruby_class.name\n end",
"def class_name\n @class_name ||= derive_class_name\n end",
... | [
"0.68611246",
"0.65479404",
"0.65454537",
"0.65202904",
"0.6486768",
"0.64770937",
"0.64433557",
"0.64249456",
"0.6411207",
"0.63931143",
"0.63861513",
"0.6349422",
"0.6349349",
"0.63335675",
"0.6323359",
"0.6316121",
"0.6303426",
"0.6303426",
"0.6290709",
"0.6285696",
"0.628... | 0.84253234 | 0 |
Gets all the remote SproutCore classes that the proxied object derives from. This will return an array of strings representing the names of the classes. As an example, if the proxy was communicating with an object that was of type SC.ButtonView then the result would be the following: ['SC.ButtonView', 'SC.View', 'SC.Ob... | def sc_all_classes()
@all_class_names = @driver.get_sc_object_class_names(abs_path) if @all_class_names.nil?
return @all_class_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_classes( obj )\n cls = obj.class\n print cls.to_s\n while cls.superclass != nil\n cls = cls.superclass\n print ' < ' + cls.to_s\n end\nend",
"def class_names op, deep_inheritance = false\n ret = []\n unless op.is_a? Sfcc::Cim::ObjectPath\n op = Sfcc::Cim::ObjectPath.new(op.to_s, nil)... | [
"0.67244136",
"0.6388707",
"0.63432854",
"0.6278593",
"0.6244017",
"0.6241072",
"0.6238444",
"0.6238444",
"0.62196064",
"0.6184085",
"0.6177631",
"0.6034521",
"0.6021486",
"0.59907913",
"0.59645134",
"0.59517974",
"0.59391177",
"0.59323794",
"0.59115547",
"0.5911092",
"0.5849... | 0.634952 | 2 |
Checks if the remote proxied object is a kind of given SC class | def sc_kind_of?(type)
if not (type.kind_of?(Class) or type.kind_of?(String))
raise ArgumentInvalidTypeError.new "type", type, 'class < SCObject', String
end
if type.kind_of?(Class) and type.ancestors.member?(SCObject)
type = type.represented_sc_class
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_get_class?(klass); true; end",
"def isa? classname\n\t\t\tinit_classlist\n\t\t\t@cf.classlist.isa? classname\n\t\tend",
"def class?\n @type == :class\n end",
"def class?\n @type == :class\n end",
"def is_a?(klass)\n __getobj__.class.object_id == klass.object_id\n end... | [
"0.68036383",
"0.67200065",
"0.66123086",
"0.66123086",
"0.6601241",
"0.6601241",
"0.6553956",
"0.65007484",
"0.6496411",
"0.64411724",
"0.6346762",
"0.62931675",
"0.626724",
"0.6251314",
"0.6238161",
"0.62298805",
"0.6195145",
"0.6152639",
"0.61087835",
"0.60976595",
"0.6097... | 0.6784575 | 1 |
Defines a path proxy for a relative path on this proxy object. The path proxy will be loaded only when actually requested for use. | def define_proxy(klass, rel_path)
if (not rel_path.kind_of?(String)) or rel_path.empty?
raise ArgumentError.new "rel_path must be a valid string"
end
if not (klass.kind_of?(Class) and klass.ancestors.member?(ProxyObject))
raise ArgumentInvalidTypeError.new "klass", k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxy(path, target)\n add(path).proxy_to(normalize_path(target))\n app.cache.remove(:proxied_paths)\n end",
"def set_relative_path(path)\n @relative_path = path\n end",
"def add_proxy(proxy_path, opts={})\n @proxies[proxy_path.to_sym] = HashStruct.new(opts)\n return self\n ... | [
"0.6901556",
"0.66967094",
"0.6418854",
"0.63476026",
"0.6150418",
"0.61425936",
"0.6092451",
"0.6069049",
"0.5978714",
"0.5858015",
"0.5846658",
"0.5842794",
"0.5791506",
"0.578592",
"0.5785148",
"0.5764532",
"0.57307416",
"0.5729357",
"0.5718869",
"0.5711877",
"0.5698582",
... | 0.66111857 | 2 |
Given a relative path, unravel it to access an object. Unraveling means to take any defined path in the given relative path and convert the entire path back into a full relative path without definitions. | def unravel_relative_path(rel_path)
path_parts = rel_path.split '.'
full_rel_path = ""
defined_path = nil
counter = path_parts.length
for path_part in path_parts do
path = defined_path.nil? ? path_part : "#{defined_path}.#{path_part}"
if path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_reference(path, parent = nil)\n obj = get_object(path)\n ref = obj[REF_KEY]\n\n # TODO: merge parent and obj into obj (destructive)\n\n # If we find an immediate reference, chase it and pass the immediate\n # object as a parent.\n return resolve_reference_string(ref) if re... | [
"0.5781821",
"0.56632316",
"0.56160456",
"0.55467653",
"0.54757893",
"0.5465807",
"0.5358972",
"0.53239256",
"0.53239256",
"0.52729654",
"0.5268596",
"0.5234328",
"0.520437",
"0.5194645",
"0.5186664",
"0.51838064",
"0.51765573",
"0.5164811",
"0.5152765",
"0.5141686",
"0.51164... | 0.6418541 | 0 |
Override the == operator so that a proxy object can be compared to another proxy object via their SproutCore GUIDs | def ==(obj)
return (self.sc_guid == obj.sc_guid) if obj.kind_of?(ProxyObject)
return super(obj)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n self.uuid == other.uuid\n end",
"def ==(other)\n return false unless other.is_a? Base\n (other.uuids & uuids).any?\n end",
"def ==(other)\n other.instance_of?(self.class) && !uuid.nil? && other.uuid == uuid\n end",
"def == other\n self.object_id == other.object_i... | [
"0.74343926",
"0.7329187",
"0.7241433",
"0.71828216",
"0.711909",
"0.70430857",
"0.70430857",
"0.70430857",
"0.7018539",
"0.70119923",
"0.68943775",
"0.6880636",
"0.6880636",
"0.6812505",
"0.67797446",
"0.677572",
"0.6775342",
"0.677298",
"0.6762059",
"0.6759888",
"0.6749565"... | 0.8122968 | 0 |
Override method_missing so that we can access a proxied object's properties using a more conventional Ruby approach. So instead of accessing an object's property using the [] convention, we can instead do the following: value = proxied_object.foo compared to proxied_object['foo'] This will also translate the name of pr... | def method_missing(sym, *args, &block)
if (not sym.to_s =~ /\?$/) and (args.length == 0)
camel_case = Util.to_camel_case(sym.to_s)
return self[camel_case] if sc_path_defined?(camel_case)
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def property(*arguments)\n method_missing(*arguments)\n end",
"def method_missing(m, *args, &_block)\n set_accessors(m)\n if valid_proxy_method?\n define_proxy_method(m)\n return send(m, args.first)\n end\n\n super\n end",
"def method_missing( sym, *args, &block )\n\t\treturn self.... | [
"0.6475165",
"0.6281144",
"0.6242496",
"0.60798997",
"0.6041209",
"0.59818083",
"0.5956574",
"0.59220153",
"0.5915248",
"0.59075785",
"0.5898881",
"0.58845854",
"0.58754563",
"0.58601624",
"0.5835504",
"0.5829919",
"0.5815621",
"0.580847",
"0.5796541",
"0.57641083",
"0.576410... | 0.0 | -1 |
Load configuration from a file | def yamlfile(file_path)
::YAML.load_file(file_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config(file)\n @config = YAML.load_file(file)\n end",
"def load_from_file filename\n fnm = File.exist?(filename) ? filename : File.join(@wd,filename)\n load_configuration(fnm)\n end",
"def load_config_file\n require 'yaml'\n YAML.load_file(@path)\n rescue Errno::E... | [
"0.82776403",
"0.82738066",
"0.81288505",
"0.81222415",
"0.8093429",
"0.7894829",
"0.7871947",
"0.78004557",
"0.77480614",
"0.7730202",
"0.7711749",
"0.7654997",
"0.7639008",
"0.7627619",
"0.76241076",
"0.76052666",
"0.7584843",
"0.75606555",
"0.7542253",
"0.746147",
"0.74400... | 0.0 | -1 |
channel order used for channel order input transaction is completed beforehand tracking is skipped | def channel_order_new
@order_admin_form = OrderAdminForm.new(source: '淘宝',
kind: 'taobao',
coupon_code: @coupon_code ? @coupon_code.code : nil)
@order_admin_form.sender = SenderInfo.new
@order_admin_form.address = Receiver... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_pending; end",
"def enter_pending; end",
"def processOrder\n \n end",
"def process_cancellation!\n if payment.settled?\n # If we have the money, refund it.\n if payment.refund!\n return_stock\n IslayShop::OrderMailer.cancelled(self).deliver\n next!(\"Credited #{... | [
"0.6060439",
"0.5744742",
"0.5738825",
"0.56307757",
"0.56213135",
"0.56213135",
"0.55633193",
"0.5445926",
"0.54364353",
"0.5422714",
"0.5421651",
"0.5404646",
"0.52857405",
"0.5279551",
"0.5274927",
"0.5264462",
"0.52640027",
"0.525509",
"0.5237539",
"0.5225071",
"0.5221748... | 0.0 | -1 |
backorder used for internal usage transaction is issued for tracking paymenthod tracking is skipped | def back_order_new
@offline_order_form = OfflineOrderForm.new(kind: 'offline',
coupon_code: @coupon_code ? @coupon_code.code : nil)
@offline_order_form.address = ReceiverInfo.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction_disabled; end",
"def guard_process_payment_from_created; true; end",
"def guard_process_payment_from_created; true; end",
"def failed_purchase_response\n end",
"def void_pending_purchase_orders\n self.purchase_orders.select(&:pending?).each {|o| o.void}\n end",
"def amazon_postfill\n... | [
"0.6187912",
"0.6178261",
"0.6178261",
"0.6158244",
"0.6123922",
"0.6100105",
"0.6098891",
"0.606086",
"0.6055808",
"0.6041176",
"0.60294026",
"0.6018647",
"0.6015672",
"0.60053927",
"0.5975677",
"0.5973855",
"0.5972149",
"0.59659976",
"0.5952716",
"0.59339464",
"0.5904655",
... | 0.0 | -1 |
B2b order used for internal usage | def b2b_order_new
@b2b_order_form = B2bOrderForm.new(kind: 'b2b')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order; end",
"def order; end",
"def cp_b\n end",
"def original_order\n end",
"def bs_order(o)\n tkr = o[:tkr]\n half_at_2R = o[:half_at_2R]\n return if not active_ticker?(tkr)\n #orders[tkr] |= {}\n size = (o[:pos_risk].to_f / (o[:stop_px].to_f-o[:stop_ex].to_f)).to_i\n re... | [
"0.6092661",
"0.6092661",
"0.57245004",
"0.56819624",
"0.5420856",
"0.54054433",
"0.54036224",
"0.53857654",
"0.53384924",
"0.53075266",
"0.52956384",
"0.5276052",
"0.52517635",
"0.5226977",
"0.5222785",
"0.5187989",
"0.51875013",
"0.518604",
"0.5185062",
"0.5136131",
"0.5123... | 0.60485125 | 2 |
GET /work_exps GET /work_exps.json | def index
@work_exps = WorkExp.order(:year)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_work\n client.make_request('/get-work', 'post', params: {})\n end",
"def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end",
"def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json... | [
"0.69066846",
"0.68733984",
"0.6519595",
"0.6519595",
"0.6494066",
"0.6360806",
"0.6342381",
"0.6341983",
"0.6278933",
"0.6268888",
"0.62371886",
"0.6190102",
"0.6177965",
"0.6177965",
"0.6172874",
"0.6158612",
"0.60818267",
"0.60550976",
"0.60550976",
"0.6040593",
"0.6016313... | 0.0 | -1 |
GET /work_exps/1 GET /work_exps/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_work\n client.make_request('/get-work', 'post', params: {})\n end",
"def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end",
"def index\n @workdetails = Workdetail.where(\"task_id = ?\", params[:id])\n\n respond_to do |format|\n format.html # in... | [
"0.69710433",
"0.69513667",
"0.6629751",
"0.647594",
"0.647594",
"0.64742535",
"0.64075845",
"0.64075845",
"0.63759995",
"0.6368502",
"0.6322748",
"0.62953335",
"0.6260912",
"0.621379",
"0.62068504",
"0.6190115",
"0.6149038",
"0.6130015",
"0.61230296",
"0.61143184",
"0.611058... | 0.0 | -1 |
POST /work_exps POST /work_exps.json | def create
@work_exp = WorkExp.new(work_exp_params)
respond_to do |format|
if @work_exp.save
format.html { redirect_to @work_exp, notice: 'Work exp was successfully created.' }
format.json { render :show, status: :created, location: @work_exp }
else
format.html { render :new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n exercise = Exercise.create(exercise_params)\n if exercise\n render json: exercise\n else\n render json: {error: 'Workout was not created.'}\n end\n end",
"def create\n @exercise = @workout.exercises.new(exercise_params)\n\n respond_to do |fo... | [
"0.6415622",
"0.6339903",
"0.6246245",
"0.6182182",
"0.6104262",
"0.60193837",
"0.6010918",
"0.5982319",
"0.5971678",
"0.5971678",
"0.5971271",
"0.5971271",
"0.59139663",
"0.5911078",
"0.59022033",
"0.58915997",
"0.587917",
"0.58595717",
"0.58398485",
"0.5789367",
"0.5750364"... | 0.6814214 | 0 |
PATCH/PUT /work_exps/1 PATCH/PUT /work_exps/1.json | def update
respond_to do |format|
if @work_exp.update(work_exp_params)
format.html { redirect_to @work_exp, notice: 'Work exp was successfully updated.' }
format.json { render :show, status: :ok, location: @work_exp }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n respond_to do |format|\n errors = Work.update(current_user, params[:id], work_params)\n if !errors\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: { error: errors }, status: :unprocessable_entity }\n end\n end\n end",
"def... | [
"0.6626265",
"0.6557672",
"0.65527594",
"0.6530723",
"0.647823",
"0.6463088",
"0.6431505",
"0.6402573",
"0.6402573",
"0.6402573",
"0.6402573",
"0.63847107",
"0.63828886",
"0.635421",
"0.6336742",
"0.62580407",
"0.62516356",
"0.6222532",
"0.6199054",
"0.6193014",
"0.6177584",
... | 0.6755816 | 0 |
DELETE /work_exps/1 DELETE /work_exps/1.json | def destroy
@work_exp.destroy
respond_to do |format|
format.html { redirect_to work_exps_url, notice: 'Work exp was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @exercise_execution.destroy\n respond_to do |format|\n format.html { redirect_to exercise_executions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_ur... | [
"0.69186145",
"0.6807395",
"0.6797119",
"0.6797119",
"0.6766047",
"0.6766047",
"0.6766047",
"0.6766047",
"0.6744681",
"0.6734442",
"0.6733987",
"0.6733987",
"0.6733987",
"0.6733987",
"0.67334586",
"0.673152",
"0.67302465",
"0.6715105",
"0.6674043",
"0.66733426",
"0.6642184",
... | 0.7221352 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_work_exp
@work_exp = WorkExp.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def work_exp_params
params.require(:work_exp).permit(:year, :name, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Generates a standard message | def initialize(selectors) # :nodoc:
@selectors = selectors
super("Invalid selectors: #{selectors.join(', ')}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_template; end",
"def message() end",
"def get_random_message()\n\t\topening = [ \"Developer Portfolio\",\n \t\t\"My Rails 4 Portfolio\",\n \t\t\"Hello World\" ]\n\n\t\tmiddle = [ \"Built from the Rails Tutorial\",\n \t\t\"Rails Apps Are Great\",\n \t\t\"... | [
"0.72388244",
"0.6916313",
"0.67604023",
"0.6703931",
"0.663936",
"0.66136944",
"0.6610246",
"0.6606926",
"0.65481895",
"0.6516389",
"0.65046465",
"0.64909554",
"0.6485623",
"0.6461455",
"0.64368176",
"0.64368176",
"0.64368176",
"0.64368176",
"0.64368176",
"0.64368176",
"0.64... | 0.0 | -1 |
Returns the mail adresses of users that should be notified | def recipients
notified = []
# Author and assignee are always notified unless they have been
# locked or don't want to be notified
notified << author if author
if assigned_to
notified += (assigned_to.is_a?(Group) ? assigned_to.users : [assigned_to])
end
notified = notified.select {|u| ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipients\n notified_users.collect(&:mail)\n end",
"def recipients\n notified = project.notified_users\n notified.reject! {|user| !visible?(user)}\n notified.collect(&:mail)\n end",
"def recipients\n notified = project.notified_users\n notified.reject! {|user| !visible?(use... | [
"0.83292603",
"0.79546386",
"0.79018825",
"0.7616166",
"0.7571048",
"0.7527973",
"0.7527973",
"0.73891884",
"0.73891884",
"0.7362956",
"0.719166",
"0.7058162",
"0.70576084",
"0.6985092",
"0.6983722",
"0.69310325",
"0.6922345",
"0.689816",
"0.6890426",
"0.68852043",
"0.6860143... | 0.73446333 | 10 |
GET /new_companies GET /new_companies.json | def index
@companies = NewCompany.where(user: current_user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n ... | [
"0.775014",
"0.775014",
"0.775014",
"0.775014",
"0.775014",
"0.775014",
"0.775014",
"0.775014",
"0.775014",
"0.775014",
"0.77381945",
"0.7718496",
"0.76473427",
"0.76053613",
"0.7449766",
"0.74053746",
"0.73544693",
"0.7306891",
"0.72381854",
"0.71346307",
"0.7107002",
"0.7... | 0.0 | -1 |
GET /new_companies/1 GET /new_companies/1.json | def show
# @company_news = CompanyNews.where(company_id: @company.id )
@vacancies = Vacancy.where(new_company_id: @new_company.id)
# @company_contacts = CompanyContact.where(company_id: @company.id)
# @company_comments = CompanyComment.where(company_id: @company.id)
# @company_clients = CompanyClien... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ... | [
"0.7780961",
"0.7748571",
"0.7748571",
"0.7748571",
"0.7748571",
"0.7748571",
"0.7748571",
"0.7748571",
"0.7748571",
"0.7748571",
"0.7748571",
"0.77384806",
"0.7683957",
"0.7598595",
"0.75964934",
"0.74632025",
"0.7345114",
"0.73364305",
"0.7257714",
"0.72535044",
"0.72308564... | 0.0 | -1 |
POST /new_companies POST /new_companies.json | def create
@new_company = NewCompany.new(new_company_params)
@new_company.user = current_user
respond_to do |format|
if @new_company.save
format.html { redirect_to new_requesit_path, notice: 'Вы успешно добавили компанию!' }
format.json { render :show, status: :created, location: @new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n render json: Company.create(params[\"company\"])\n end",
"def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully ... | [
"0.76430285",
"0.7575247",
"0.74948007",
"0.745895",
"0.7458623",
"0.7458623",
"0.7458623",
"0.7458623",
"0.7453448",
"0.7446786",
"0.74463606",
"0.74125993",
"0.73549813",
"0.73429376",
"0.7333125",
"0.733088",
"0.733088",
"0.733088",
"0.733088",
"0.733088",
"0.73208576",
... | 0.7135538 | 29 |
PATCH/PUT /new_companies/1 PATCH/PUT /new_companies/1.json | def update
respond_to do |format|
if @new_company.update(new_company_params)
format.html { redirect_to @new_company, notice: 'Вы успешно отредактировали компанию' }
format.json { render :show, status: :ok, location: @new_company }
else
format.html { render :edit }
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update_companies\n current_companies = @movie.companies.collect { |c| c.id.to_s }\n\n delete_production_companies( current_companies )\n add_production_companies( current_companies ) unless params[:companies].... | [
"0.71848035",
"0.6887921",
"0.6772269",
"0.66176975",
"0.6600023",
"0.65695155",
"0.6554883",
"0.6550629",
"0.653603",
"0.653603",
"0.653603",
"0.653603",
"0.653603",
"0.653603",
"0.65357286",
"0.651908",
"0.6510021",
"0.64987946",
"0.64198226",
"0.6383814",
"0.6383814",
"0... | 0.6646137 | 3 |
DELETE /new_companies/1 DELETE /new_companies/1.json | def destroy
@new_company.destroy
respond_to do |format|
format.html { redirect_to new_companies_url, notice: 'New company was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n fo... | [
"0.7848404",
"0.7727669",
"0.75529724",
"0.75529724",
"0.75529724",
"0.7536979",
"0.7536979",
"0.7536979",
"0.7536979",
"0.7536979",
"0.7536979",
"0.7536979",
"0.7536979",
"0.7536979",
"0.7536979",
"0.75048226",
"0.7490215",
"0.74562544",
"0.7432908",
"0.7428096",
"0.741324",... | 0.76464844 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_new_company
@new_company = NewCompany.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def new_company_params
params.require(:new_company).permit(:company_type, :full_title, :short_title, :english_title, :specialization, :logo, :full_adress, :post_adress, :phone, :faks, :email, :website, :director_name, :director_post, :contact_name, :contacy_phone, :contact_email, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
GET /resource/edit def edit super end PUT /resource | def update
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)
resource_updated = update_resource(resource, account_update_params)
yield resource if block_given?
if r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n respond_with(resource)\n end",
"def edit\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @resource }\n end\n end",
"def edit\... | [
"0.84682256",
"0.79906833",
"0.784054",
"0.76603776",
"0.7518685",
"0.7514583",
"0.7485632",
"0.7473292",
"0.73174673",
"0.73140186",
"0.73098606",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759"... | 0.0 | -1 |
GET /resource/cancel Forces the session data which is usually expired after sign in to be expired now. This is useful if the user wants to cancel oauth signing in/up in the middle of the process, removing all OAuth session data. def cancel super end protected If you have extra params to permit, append them to the sanit... | def after_sign_up_path_for(resource)
super(resource)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end",
"def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registrat... | [
"0.8017598",
"0.8017598",
"0.8017598",
"0.8017598",
"0.8017598",
"0.8017598",
"0.78981316",
"0.78981316",
"0.78981316",
"0.78981316",
"0.78981316",
"0.78981316",
"0.78981316",
"0.7876475",
"0.68020433",
"0.6573058",
"0.6473597",
"0.644118",
"0.6439272",
"0.64391804",
"0.64265... | 0.0 | -1 |
GET /slabs/1 GET /slabs/1.json | def show
@slab = Slab.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @slab }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end",
"def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end"... | [
"0.7317998",
"0.7317998",
"0.6957261",
"0.6758143",
"0.65728885",
"0.6569026",
"0.64790064",
"0.64624065",
"0.64508003",
"0.6325008",
"0.62569207",
"0.6201275",
"0.61189425",
"0.6113441",
"0.60753036",
"0.6062414",
"0.6046644",
"0.6036813",
"0.6017947",
"0.59970057",
"0.59105... | 0.7250828 | 2 |
GET /slabs/new GET /slabs/new.json | def new
@slab = Slab.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @slab }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end",
"def new\n @lab = Lab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab }\n end\n end",
"def new... | [
"0.75647926",
"0.75647926",
"0.7426521",
"0.71767104",
"0.6909633",
"0.6892481",
"0.68695927",
"0.68582547",
"0.6848821",
"0.67976487",
"0.67964184",
"0.67753357",
"0.6749201",
"0.6742722",
"0.6739163",
"0.6730626",
"0.67078596",
"0.66809124",
"0.6671246",
"0.66407335",
"0.66... | 0.7819285 | 0 |
POST /slabs POST /slabs.json | def create
@slab = Slab.new(params[:slab])
respond_to do |format|
if @slab.save
format.html { redirect_to @slab, :notice => 'Slab was successfully created.' }
format.json { render :json => @slab, :status => :created, :location => @slab }
else
format.html { render :action => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @lab = Lab.new(params[:lab])\n\n respond_to do |format|\n if @lab.save\n format.html { redirect_to @lab, notice: 'Lab was successfully created.' }\n format.json { render json: @lab, status: :created, location: @lab }\n else\n format.html { render action: \"new\" }\... | [
"0.6382438",
"0.63637793",
"0.63462186",
"0.6224606",
"0.59656453",
"0.5897126",
"0.5897126",
"0.58968896",
"0.588916",
"0.58761483",
"0.58582366",
"0.58506024",
"0.5809049",
"0.5761701",
"0.5758511",
"0.5654244",
"0.5629552",
"0.5629552",
"0.56025773",
"0.55961275",
"0.55902... | 0.6751784 | 0 |
PUT /slabs/1 PUT /slabs/1.json | def update
@slab = Slab.find(params[:id])
respond_to do |format|
if @slab.update_attributes(params[:slab])
format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "edit" }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @lab = lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(params[:lab])\n format.html { redirect_to @lab, notice: 'lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.6281909",
"0.62226063",
"0.6221034",
"0.616142",
"0.6150924",
"0.6147515",
"0.60427827",
"0.598449",
"0.5969969",
"0.5954184",
"0.59194946",
"0.590201",
"0.58520377",
"0.5799637",
"0.57595426",
"0.574503",
"0.5713905",
"0.5705525",
"0.5702559",
"0.5676333",
"0.566507",
"... | 0.6655645 | 0 |
DELETE /slabs/1 DELETE /slabs/1.json | def destroy
@slab = Slab.find(params[:id])
@slab.destroy
respond_to do |format|
format.html { redirect_to slabs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @lab = lab.find(params[:id])\n @lab.destroy\n\n respond_to do |format|\n format.html { redirect_to labs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab = Lab.find(params[:id])\n @lab.destroy\n\n respond_to do |format|\n format.html { r... | [
"0.746292",
"0.73167944",
"0.71321213",
"0.7032379",
"0.70033014",
"0.687038",
"0.683722",
"0.6788833",
"0.67615634",
"0.6759391",
"0.668773",
"0.66794264",
"0.6650104",
"0.66253513",
"0.6623058",
"0.66139555",
"0.66108394",
"0.65996087",
"0.6592219",
"0.6578564",
"0.65548104... | 0.76810646 | 0 |
=begin This function creates a 64element array. Each index contains a node who's coordinates (x and y variables) are set alongside it's index value in the board array. For example, board[3][4] contains a node who's x and y values are '3' and '4'respectivly. =end | def create_board
board = []
for x in 0..7
board[x] = []
for y in 0..7
board[x] << Node.new(x,y)
end
end
board
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_board\n board = Array.new(8) { Array.new(8) { Array.new(2) } }\n board.each_with_index do |row, row_i|\n row.each_with_index { |column, column_i| column[0], column[1] = row_i, column_i }\n end\n end",
"def board_creator()\n board = []\n 10.times do |x|\n board << Array.new\n 10.ti... | [
"0.7146131",
"0.6916602",
"0.6866149",
"0.68455815",
"0.6816736",
"0.67804354",
"0.6601025",
"0.6601025",
"0.6597322",
"0.6595295",
"0.6572473",
"0.6482651",
"0.6472116",
"0.6468682",
"0.6460563",
"0.645796",
"0.6438105",
"0.6415729",
"0.6374974",
"0.63581103",
"0.633827",
... | 0.75971794 | 0 |
=begin Knight's moves expects two x and y coordinates (passed as arrays) as it's arguments. First we create a board, then a queue and a path to track our steps (retrospectivly, as we'll see). We begin our "BFS" by working from queue[0], which we passed our starting coordinates to. Use the board to find the node at thos... | def knights_moves(start, finish)
board = create_board
path = []
queue = []
queue << start
loop do
current_node = board[queue[0][0]][queue[0][1]]
current_node.moves.each do |node|
unless node == start || board[node[0]][node[1]].parent != nil
board[node[0]][node[1]].parent = queue[0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def knight_moves(src_sqr = [0, 0], tgt_sqr = [0, 0])\n # Init the board and a Knight piece\n board = Board.new\n knight = Knight.new\n \n puts \"\\nFrom #{src_sqr} to #{tgt_sqr}...\"\n \n unless board.valid_position?(src_sqr[0], src_sqr[1]) && board.valid_position?(tgt_sqr[0], tgt_sqr[1])\n puts \"Invali... | [
"0.84787196",
"0.8116113",
"0.78525424",
"0.7844733",
"0.758982",
"0.75756675",
"0.748069",
"0.73651356",
"0.73236066",
"0.7149052",
"0.7134409",
"0.70806277",
"0.7040198",
"0.6977659",
"0.69571626",
"0.6956806",
"0.6886096",
"0.6728371",
"0.672167",
"0.66802686",
"0.6636645"... | 0.7919185 | 2 |
def test_should_get_edit login_as (:patrick) get :edit, :id => profiles(:profile_00006).id assert_response :success end | def test_should_update_profile
# login_as(:patrick)
# put :update, :id => profiles(:profile_00006).id, :profile => { }
# assert_redirected_to profile_path(assigns(:profile))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_get_edit\n login_as(:normal_user)\n get :edit, :id => people(:normal_person)\n assert_response :success\n end",
"def test_should_get_edit\n login_as(:john)\n get :edit, :id => 1\n assert_response :redirect\n end",
"def test_should_get_edit\n login_as(:john)\n get :edit... | [
"0.85280675",
"0.8476775",
"0.8476775",
"0.83206904",
"0.80986345",
"0.79334414",
"0.79334414",
"0.7881382",
"0.77346396",
"0.73602474",
"0.7331666",
"0.73243797",
"0.72541827",
"0.72480315",
"0.7243297",
"0.71944267",
"0.71906674",
"0.71828365",
"0.7160279",
"0.71280295",
"0... | 0.822054 | 4 |
In this exercise, you will write a method named xor that takes two arguments, and returns true if exactly one of its arguments is truthy, false otherwise. Examples: xor?(5.even?, 4.even?) == true xor?(5.odd?, 4.odd?) == true xor?(5.odd?, 4.even?) == false xor?(5.even?, 4.odd?) == false Question: Write a method that tak... | def xor?(num1,num2)
if num1 == true && num2 == false
return true
elsif num1 == false && num2 == true
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xor?(argument_1, argument_2)\n if argument_1\n if argument_2 == false\n return true\n else\n return false\n end\n elsif argument_2\n if argument_1 == false\n return true\n else \n return false\n end\n else\n return false\n end\nend",
"def xor?(one, two)\n if ((on... | [
"0.8528902",
"0.8464418",
"0.8462102",
"0.8423103",
"0.8386373",
"0.8375773",
"0.8329098",
"0.8315203",
"0.83022827",
"0.82968944",
"0.8294839",
"0.82857627",
"0.8283969",
"0.8277402",
"0.8254754",
"0.8212989",
"0.8201889",
"0.81965345",
"0.8185679",
"0.81693685",
"0.8163842"... | 0.85363704 | 0 |
GET /list_elements GET /list_elements.json | def index
@list_elements = ListElement.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_elements(path)\n return @element_list\n end",
"def index\n @elements = Element.all\n end",
"def index\n @elements = @account.elements\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @elements }\n format.json { render :json => @e... | [
"0.7662045",
"0.6793683",
"0.66248715",
"0.65023315",
"0.65023315",
"0.65023315",
"0.64678437",
"0.64548093",
"0.64015675",
"0.6365265",
"0.6222561",
"0.6197114",
"0.61192256",
"0.6103868",
"0.6060334",
"0.60575193",
"0.59880453",
"0.59860045",
"0.5980503",
"0.59698427",
"0.5... | 0.71834886 | 1 |
GET /list_elements/1 GET /list_elements/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @list_elements = ListElement.all\n end",
"def list_elements(path)\n return @element_list\n end",
"def index\n @elements = @account.elements\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @elements }\n format.json { render :j... | [
"0.70422244",
"0.67788017",
"0.64349496",
"0.63680196",
"0.62772954",
"0.62522703",
"0.6161481",
"0.6131901",
"0.6110297",
"0.6038816",
"0.6023182",
"0.59863997",
"0.5975102",
"0.5903984",
"0.5879215",
"0.5855516",
"0.5843333",
"0.58144826",
"0.57781464",
"0.5768269",
"0.5768... | 0.0 | -1 |
POST /list_elements POST /list_elements.json | def create
@list_element = ListElement.new(list_element_params)
respond_to do |format|
if @list_element.save
format.html { redirect_to @list_element, notice: 'List element was successfully created.' }
format.json { render :show, status: :created, location: @list_element }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @list_elements = ListElement.all\n end",
"def list_elements(path)\n return @element_list\n end",
"def list_element_params\n params.require(:list_element).permit(:name, :description)\n end",
"def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end",... | [
"0.64817995",
"0.6238478",
"0.6121888",
"0.5904524",
"0.57401115",
"0.56730056",
"0.56730056",
"0.56730056",
"0.5628478",
"0.5616354",
"0.55819815",
"0.555777",
"0.5524861",
"0.55206805",
"0.54600334",
"0.5452788",
"0.54353166",
"0.5417226",
"0.53957003",
"0.53723997",
"0.536... | 0.60708964 | 3 |
PATCH/PUT /list_elements/1 PATCH/PUT /list_elements/1.json | def update
respond_to do |format|
if @list_element.update(list_element_params)
format.html { redirect_to @list_element, notice: 'List element was successfully updated.' }
format.json { render :show, status: :ok, location: @list_element }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end",
"def update\n @list = List.find(params[:id])\n\n nested = params[:list].delete( :list_items_attributes )\n\n new_items = []\n\n if nested th... | [
"0.69100267",
"0.67520165",
"0.66532",
"0.65574175",
"0.650507",
"0.650507",
"0.64991",
"0.6438944",
"0.6418873",
"0.63765174",
"0.63765174",
"0.6371704",
"0.6366249",
"0.6311562",
"0.6293611",
"0.6291792",
"0.62692565",
"0.6250269",
"0.6242518",
"0.62364465",
"0.62364465",
... | 0.71777296 | 0 |
DELETE /list_elements/1 DELETE /list_elements/1.json | def destroy
@list_element.destroy
respond_to do |format|
format.html { redirect_to list_elements_url, notice: 'List element was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_list(params={})\n @obj.delete('delete', @auth.merge(params))\n end",
"def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end",
"def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end",
"def delete_list(user, list)\n delete(\"/#{user... | [
"0.6897157",
"0.68822086",
"0.68655896",
"0.681481",
"0.68122023",
"0.6799223",
"0.6799223",
"0.6799223",
"0.6793698",
"0.67931354",
"0.67931354",
"0.67931354",
"0.67733806",
"0.668706",
"0.66794115",
"0.6651873",
"0.66301924",
"0.6614396",
"0.6613337",
"0.65981746",
"0.65956... | 0.7258029 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_list_element
@list_element = ListElement.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def list_element_params
params.require(:list_element).permit(:name, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
creates a partitioned subpath based on the ID like ff/1023 | def sub_path
"#{"%02x" % (id.to_i % 256)}/#{id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partitioned_path(id)\n (\"%06d\" % id).scan(/.../)\n end",
"def id_partition\n (\"%09d\".freeze % self.id).scan(/\\d{3}/).join(\"/\".freeze)\n end",
"def partitioned_path(*args)\n #(\"%08d\" % attachment_path_id).scan(/..../) + args\n args\n end",
"def id_partition\n (\"%09d\" % id).sca... | [
"0.82959497",
"0.6882985",
"0.68788207",
"0.6720957",
"0.665006",
"0.6647187",
"0.64310294",
"0.6401596",
"0.6397069",
"0.634223",
"0.6218297",
"0.62016046",
"0.61617404",
"0.6082884",
"0.6032928",
"0.6020818",
"0.60159665",
"0.5945593",
"0.59424394",
"0.58373755",
"0.5816254... | 0.72309715 | 1 |
Deletes the file(s) by removing the whole directory and removing remote files from Amazon S3. | def delete_files
return if id.nil?
return unless File.exist?(directory_path)
FileUtils.rm_rf(directory_path)
s3_delete_files
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def s3_delete_files\n return unless S3_ENABLED\n s3 = AWS::S3.new\n bucket = s3.buckets[s3_bucket_name]\n bucket.objects.with_prefix(\"#{id}/\").each do |obj|\n obj.delete\n end\n end",
"def s3_deletefile(filename)\n #AWS::S3::S3Object.delete filename, QBUCKET.to_s if AWS::S3::S3Object.ex... | [
"0.7943146",
"0.7288735",
"0.7184347",
"0.7155666",
"0.7155666",
"0.71528524",
"0.70279175",
"0.6959429",
"0.6928343",
"0.692457",
"0.6907085",
"0.69058657",
"0.69049174",
"0.68073845",
"0.68056583",
"0.68002963",
"0.67422616",
"0.6733486",
"0.6729011",
"0.6721883",
"0.672188... | 0.8229969 | 0 |
Deletes resized versions hosted on Amazon S3. | def s3_delete_files
return unless S3_ENABLED
s3 = AWS::S3.new
bucket = s3.buckets[s3_bucket_name]
bucket.objects.with_prefix("#{id}/").each do |obj|
obj.delete
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def s3_deletefile(filename)\n #AWS::S3::S3Object.delete filename, QBUCKET.to_s if AWS::S3::S3Object.exists? filename, QBUCKET.to_s\n AWS::S3::S3Object.delete filename, IMAGES_BUCKET.to_s if AWS::S3::S3Object.exists? filename, IMAGES_BUCKET.to_s\n end",
"def delete_from_cloud\n S3Connection.new(:media).... | [
"0.73022246",
"0.72296256",
"0.71775216",
"0.71748155",
"0.71748155",
"0.7167299",
"0.7127234",
"0.7018564",
"0.6939603",
"0.6846268",
"0.68134207",
"0.6784352",
"0.6670025",
"0.6663723",
"0.65716493",
"0.65122926",
"0.6486814",
"0.64708924",
"0.6460061",
"0.6460061",
"0.6380... | 0.74531984 | 0 |
how well does the guess stack up to the secret code? | def compare_codes(guess)
#make a reference that won't destroy the original secret code
secret = secret_code.clone
exact = check_exact(guess, secret)
if exact == 4
#tell the caller we have a winner
return true
else
partial = check_partial(guess, secret)
puts "Correct value an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_guess(secret_code)\n if guess == [0, 0, 0, 0]\n first_guess\n return guess\n end\n reduce_solution_set(secret_code)\n update_guess\n guess\n end",
"def get_hint(secret, guess)\n bulls = 0\n cows = 0\n\n tracker = Hash.new(0)\n secret.each_char { |char| track... | [
"0.72333276",
"0.71573687",
"0.70788807",
"0.698331",
"0.6850701",
"0.68397105",
"0.6811799",
"0.6763234",
"0.6734239",
"0.6730458",
"0.67264974",
"0.6690906",
"0.66638714",
"0.6654976",
"0.66271085",
"0.66086465",
"0.6607233",
"0.65844774",
"0.6564578",
"0.6528422",
"0.65177... | 0.71874714 | 1 |
write method that iterates each number with each other number in the array and then places them in ascending order continue to loop until all numbers are sorted false indicated that all values have been compared and brakes loop print new array. | def bubble_sort(array)
n = array.length
loop do
swapped = false
(n-1).times do |i|
if array[i] > array[i + 1]
array[i], array[i + 1] = array[i+1], array[i]
swapped = true
end
end
break if not swapped
end
array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checksorted(array)\n i = 0\n until i > array.length-2 do\n # print array[i]\n if array[i] > array[i+1] then\n array[i], array[i+1] = array[i+1], array[i]\n print array\n next\n end\n print array\n i +=1\n end\n\n end",
"def bubble_sort_by(array)\n\t#counter... | [
"0.7767398",
"0.7614791",
"0.7451174",
"0.7409327",
"0.7351493",
"0.7326607",
"0.7309753",
"0.7305747",
"0.72757",
"0.7240215",
"0.71912783",
"0.7174663",
"0.71712774",
"0.71338356",
"0.7119483",
"0.7111712",
"0.70597136",
"0.7058115",
"0.7051054",
"0.7013339",
"0.6995601",
... | 0.0 | -1 |
Checks the command line arguments for correctness | def check_args(arguments)
if arguments.length != 3
puts 'There must be exactly three arguments: *seed*, *num_prospectors*, *num_turns*'
return false
elsif arguments[1].to_i.negative? || arguments[2].to_i.negative?
puts 'Usage:'
puts 'ruby ruby_rush.rb *seed* *num_prospectors* *num_turns*'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_arguments()\n usage unless ARGV.count > 0\nend",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def check_arg()\n if ARGV.length > 1\n print \"ERROR: Too many command line args.... | [
"0.8046368",
"0.7968771",
"0.7940632",
"0.7520261",
"0.75198084",
"0.751713",
"0.7502494",
"0.7502188",
"0.74498004",
"0.7449247",
"0.7442818",
"0.74189615",
"0.73905766",
"0.736681",
"0.7305726",
"0.72992444",
"0.7263169",
"0.72616506",
"0.721966",
"0.7187208",
"0.71751386",... | 0.7258046 | 18 |
Total loop for prospector's journey | def prospector_journey(num_turns)
i = 0
while i < @prospectors.count
@prospectors[i].print_start
while @prospectors[i].visits < num_turns
found_anything = @prospectors[i].look_for_rubies
@prospectors[i].print_findings
# Has more visits they can make
if @prospectors[i].visit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loop_prospector(total_turns)\n # Special case where total_turns is 0\n end_search if total_turns.zero?\n until @turns == total_turns\n # @turns is incremented in prospect search, when the conditions for a move are saisfied\n prospect_search(total_turns)\n end\n end",
"def get_cout_ha_p... | [
"0.64689916",
"0.637932",
"0.63435096",
"0.63209486",
"0.624949",
"0.6248904",
"0.6081381",
"0.6075784",
"0.605864",
"0.59489787",
"0.5937869",
"0.58931994",
"0.5886251",
"0.5836185",
"0.5818806",
"0.57987964",
"0.5792619",
"0.57886744",
"0.57768154",
"0.57732415",
"0.5767243... | 0.6809543 | 0 |
TODO: make to_param a mixin | def to_param
"#{self.id}-#{self.name.parameterize}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_param; end",
"def to_param\n to_s\n end",
"def to_param\n to_s\n end",
"def to_param\n to_s\n end",
"def to_param\n object.to_param\n end",
"def to_param\n nil\n end",
"def to_param\n nil\n end",
"def to_param\n self.class.parametrize(name)\n end",
"def pa... | [
"0.89015055",
"0.77551913",
"0.77551913",
"0.77551913",
"0.7694126",
"0.7308563",
"0.7308563",
"0.72861683",
"0.7259588",
"0.721797",
"0.7183886",
"0.71430755",
"0.71430755",
"0.7121074",
"0.7118655",
"0.70942926",
"0.7087245",
"0.707663",
"0.707663",
"0.707663",
"0.707663",
... | 0.6887007 | 54 |
Returns the list of available settings | def settings
self.class.settings + View.settings - NON_FORWARDABLE_METHODS
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_settings\n []\n end",
"def settings_list\n setting.list\n end",
"def available_settings\n instance.available_settings\n end",
"def get_all_settings\n return @db[:settings].as_hash(:name, :body) if onblock(:u, -1, @client).admin?\n end",
"def list_settin... | [
"0.88077295",
"0.8713216",
"0.804022",
"0.8004748",
"0.77750975",
"0.77444637",
"0.7384482",
"0.73680186",
"0.7330592",
"0.7330592",
"0.7297411",
"0.7293236",
"0.71771646",
"0.71338814",
"0.70211285",
"0.6968747",
"0.69544476",
"0.69150263",
"0.6914701",
"0.6910411",
"0.68570... | 0.0 | -1 |
GET /essays GET /essays.xml | def index
# debo de dar solo los que sean del current_user
# debera de haber otra ruta con la cual otro usuario puede ver el index de otro...
@essays = Essay.all(:conditions => { :user_id => current_user.id})
# tengo que buscar el id de ese usuario...
respond_to do |format|
format.html # in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end",
"def show\n @essay = Essay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @es... | [
"0.6634029",
"0.6130219",
"0.59981716",
"0.5938044",
"0.5926139",
"0.58655155",
"0.5855284",
"0.5786522",
"0.57779914",
"0.5736012",
"0.5730224",
"0.5699064",
"0.56942075",
"0.5688658",
"0.56764966",
"0.5658711",
"0.5658646",
"0.5654799",
"0.5643976",
"0.5642653",
"0.5642086"... | 0.6016763 | 2 |
POST /essays POST /essays.xml | def create
@essay = Essay.new(params[:essay])
@essay.user_id = current_user.id
respond_to do |format|
if @essay.save
flash[:notice] = 'Essay was successfully created.'
# format.html { redirect_to :action => 'show', :url_title => @essay.url_title }
format.html { redirect_to "#{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @essay = Essay.new(params[:essay])\n\n respond_to do |format|\n if @essay.save\n format.html { redirect_to @essay, notice: 'Essay was successfully created.' }\n format.json { render json: @essay, status: :created, location: @essay }\n else\n format.html { render ac... | [
"0.64676315",
"0.5930309",
"0.5793431",
"0.5717577",
"0.56617814",
"0.561113",
"0.5546568",
"0.5508312",
"0.54988945",
"0.54860014",
"0.54742664",
"0.546387",
"0.5452118",
"0.5428831",
"0.5389072",
"0.5368851",
"0.5353277",
"0.5349285",
"0.5330072",
"0.53260356",
"0.5324122",... | 0.63845307 | 1 |
PUT /essays/:url_title PUT /essays/:url_title.xml | def update
@essay = Essay.find_by_url_title(params[:url_title]) if !params[:url_title].nil?
respond_to do |format|
if @essay.update_attributes(params[:essay])
flash[:notice] = 'Essay was successfully updated.'
# format.html { redirect_to :action => 'show', :url_title => @essay.url_title}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update!(**args)\n @open_uri_action = args[:open_uri_action] if args.key?(:open_uri_action)\n @title = args[:title] if arg... | [
"0.61871135",
"0.60168725",
"0.60168725",
"0.5940492",
"0.5875778",
"0.5821397",
"0.576921",
"0.56756294",
"0.56361836",
"0.56244797",
"0.5579473",
"0.5571765",
"0.5527611",
"0.55155057",
"0.5485881",
"0.54790914",
"0.5445195",
"0.54324216",
"0.5401469",
"0.5397462",
"0.53920... | 0.708468 | 0 |
DELETE /essays/1 DELETE /essays/1.xml | def destroy
# @essay = Essay.find(params[:id])
# Lo que pasa es que el metodo delete me pasa una id en los params de a afuerzas
# en este caso se usa params[:id] en vez de params[:url_title] como lo hice en el show
@essay = Essay.find_by_url_title(params[:id]) if !params[:id].nil?
@essay.destroy
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @bday = Bday.find(params[:id])\n @bday.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdays_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n re... | [
"0.66655815",
"0.65995675",
"0.659572",
"0.6522632",
"0.6482992",
"0.64774084",
"0.64448845",
"0.6425794",
"0.640241",
"0.63981813",
"0.6385767",
"0.6380152",
"0.6344741",
"0.63437396",
"0.6342501",
"0.63123065",
"0.62751216",
"0.622102",
"0.6219073",
"0.62152517",
"0.6203065... | 0.65099245 | 4 |
GET /interests/1 GET /interests/1.json | def show
@object = Interest.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render... | [
"0.8049446",
"0.78753746",
"0.7833762",
"0.77728593",
"0.7731536",
"0.7674883",
"0.7314341",
"0.73130405",
"0.73130405",
"0.72982925",
"0.7159367",
"0.7136857",
"0.7046094",
"0.7029136",
"0.7004621",
"0.6948886",
"0.69059175",
"0.6876296",
"0.6876296",
"0.6876296",
"0.6876296... | 0.5855727 | 74 |
POST /interests POST /interests.json | def create
standard_create(Interest, interest_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :u... | [
"0.7613445",
"0.7439815",
"0.74063206",
"0.7008349",
"0.693127",
"0.6865698",
"0.68174535",
"0.67711073",
"0.67643154",
"0.675836",
"0.67511916",
"0.6737345",
"0.66836554",
"0.6662999",
"0.6637306",
"0.66314447",
"0.6628016",
"0.6609514",
"0.6575112",
"0.65680444",
"0.6560024... | 0.6407722 | 34 |
PATCH/PUT /interests/1 PATCH/PUT /interests/1.json | def update
standard_update(Interest, params[:id], interest_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n ... | [
"0.791966",
"0.7439318",
"0.74242246",
"0.72841865",
"0.7065051",
"0.7006963",
"0.69983184",
"0.6978449",
"0.69233423",
"0.6859935",
"0.6826302",
"0.6804278",
"0.6717259",
"0.6663174",
"0.6622598",
"0.66037536",
"0.6520839",
"0.64497524",
"0.6436275",
"0.6399462",
"0.6294871"... | 0.7380559 | 3 |
DELETE /interests/1 DELETE /interests/1.json | def destroy
standard_destroy(Interest, params[:id])
#if Volunteer.joins(:volunteer_interests).where(volunteer_interests: {interest_id: @interest.id}).count > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end",
"def destroy\n @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.html { redirect_to interests_u... | [
"0.8166676",
"0.8120441",
"0.81060255",
"0.80963534",
"0.78408647",
"0.78408647",
"0.7800103",
"0.77889097",
"0.77889097",
"0.77798986",
"0.7702042",
"0.762328",
"0.7583089",
"0.7567357",
"0.7511822",
"0.737978",
"0.737147",
"0.737135",
"0.7240477",
"0.7207471",
"0.71698505",... | 0.64668584 | 51 |
Never trust parameters from the scary internet, only allow the white list through. | def interest_params
params.require(:interest).permit(:name, :interest_category_id, :highlight, :include_on_application, :inactive)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
Returns true if it has any timestamps | def has_timestamps?
has_created_at_timestamp? || has_updated_at_timestamp?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeseries?\n !@column_metadata.select { |dc| dc.role == NexosisApi::ColumnRole::TIMESTAMP }.empty?\n end",
"def is_something_running\n @timestamps.each_value do |timestamp|\n return true if timestamp.fetch('is_running') == true\n end\n false\n end",
"def time?\n ... | [
"0.72539276",
"0.7244183",
"0.7208666",
"0.71183866",
"0.7099618",
"0.7073674",
"0.7024483",
"0.7009366",
"0.6935281",
"0.69147444",
"0.6885486",
"0.6862021",
"0.68023986",
"0.67796147",
"0.6757946",
"0.67068166",
"0.6668739",
"0.6622796",
"0.6548246",
"0.6534281",
"0.6515477... | 0.8044343 | 0 |
Returns true both timestamps are present (created_at and updated_at) | def has_both_timestamps?
has_created_at_timestamp? && has_updated_at_timestamp?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_timestamps?\n has_created_at_timestamp? || has_updated_at_timestamp?\n end",
"def has_created_at_timestamp?\n !!@created_at\n end",
"def fresh?\n created_at == updated_at\n end",
"def time_query?\n created_at? || updated_at?\n end",
"def timestamps?\n if (model_... | [
"0.85633326",
"0.7661358",
"0.75595933",
"0.752269",
"0.7507945",
"0.74577177",
"0.73685586",
"0.73077327",
"0.7113009",
"0.7091825",
"0.7067603",
"0.6838218",
"0.67818886",
"0.67738396",
"0.67453617",
"0.66731286",
"0.65762943",
"0.6559061",
"0.65284216",
"0.6516071",
"0.649... | 0.86883867 | 0 |
Returns true created_at timestamp exists | def has_created_at_timestamp?
!!@created_at
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_timestamps?\n has_created_at_timestamp? || has_updated_at_timestamp?\n end",
"def able_to_store_created_at?\n @instance.respond_to?(\"#{name}_created_at\".to_sym)\n end",
"def fresh?\n created_at == updated_at\n end",
"def existed_at?(aTime)\n return @creation >= aTime\n e... | [
"0.7756197",
"0.7641633",
"0.7594942",
"0.7561394",
"0.7462417",
"0.7444124",
"0.73801404",
"0.7209222",
"0.7060489",
"0.7046449",
"0.70430225",
"0.7002224",
"0.6954047",
"0.6895674",
"0.67215896",
"0.67172545",
"0.67012274",
"0.67012274",
"0.66902417",
"0.6688598",
"0.667381... | 0.8822821 | 0 |
Returns true updated_at timestamp exists | def has_updated_at_timestamp?
!!@updated_at
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_at?\n !updated_at.nil?\n end",
"def updated_at?\n valid_params[\"updated_at\"] != nil\n end",
"def fresh_at?(time)\n time >= updated_at\n end",
"def updated_at_nil?\n object.updated_at.nil?\n end",
"def unchanged?\n created_at == updated_at\n end",
"def has_timesta... | [
"0.8437265",
"0.7841306",
"0.783706",
"0.75854045",
"0.7504441",
"0.74772555",
"0.7461476",
"0.74316895",
"0.73353773",
"0.7332833",
"0.7167293",
"0.71244097",
"0.71206737",
"0.7097452",
"0.7073926",
"0.70549875",
"0.70485705",
"0.70231307",
"0.69740635",
"0.6889351",
"0.6856... | 0.86960894 | 0 |
Returns true it is a polymorphic model | def polymorphic?
!!@polymorphic_as
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polymorphic?\n @reflection.polymorphic? == true\n end",
"def polymorphic?\n false\n end",
"def polymorphic?\n false\n end",
"def polymorphic?\n @polymorphic == true || !@as.nil?\n end",
"def polymorphic?\n @polymorphic ||= !!@options[:as]\n end",
"def p... | [
"0.8428277",
"0.82780623",
"0.82780623",
"0.81819975",
"0.7871597",
"0.7860711",
"0.7794617",
"0.767366",
"0.74394035",
"0.71186936",
"0.7116122",
"0.70079154",
"0.68231106",
"0.6768699",
"0.6685659",
"0.66688454",
"0.66146207",
"0.6581169",
"0.65716594",
"0.6524006",
"0.6524... | 0.8263726 | 3 |
Adds a relationship definition to the class, e.g: add_relation("embedded_in", "users") | def add_relation(relation_name, association, options={})
if existing = find_relation_by(association)
if relation_name =~ /^embed/
delete_relation_for association
else
return
end
end
Relation.new(relation_name.to_s, association, options).tap d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_relationship(rel_attr); end",
"def define_relationship(opts)\n [:name, :contains_references_to_types].each do |p|\n opts[p] or raise \"No #{p} given\"\n end\n\n base = self\n\n ArchivesSpaceService.loaded_hook do\n # We hold off actually setting anything up until all mod... | [
"0.7937813",
"0.7193246",
"0.6894136",
"0.6894136",
"0.6840072",
"0.6816614",
"0.6812042",
"0.67294884",
"0.6727654",
"0.66251254",
"0.6526446",
"0.647984",
"0.64411694",
"0.63629365",
"0.6360532",
"0.63561535",
"0.6261209",
"0.6259769",
"0.62259907",
"0.61723113",
"0.6172126... | 0.69183946 | 2 |
Returns binding for ERB template | def get_binding
return binding()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thru_erb aBinding = Kernel.binding\n ERB.new(self).result(aBinding)\n end",
"def render_with_binding(binding)\n ERB.new(read, nil, '<>').result(binding)\n end",
"def _erb(templ, _binding)\n return ERB.new(templ, nil, \"<>\").result(_binding)\n end",
"def render(template)\n b ... | [
"0.7495199",
"0.7487756",
"0.73235697",
"0.72325486",
"0.71006435",
"0.68192035",
"0.68192035",
"0.6797164",
"0.6797164",
"0.6757575",
"0.67408615",
"0.6716098",
"0.66694456",
"0.66266334",
"0.6621827",
"0.6621827",
"0.6621827",
"0.66131926",
"0.6605335",
"0.6605335",
"0.6589... | 0.6293933 | 63 |
Returns an improved inspection output including fields and relations | def to_s
"#<Mongify::Mongoid::Model::#{name} fields=#{@fields.keys} relations=#{@relations.map{|r| "#{r.name} :#{r.association}"}}>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n inspection =\n self.class.fields.keys.collect { |name|\n \"#{name}: #{attribute_for_inspect(name)}\"\n }.join(\", \")\n\n \"#<#{self.class} #{inspection}>\"\n end",
"def inspect\n\t\tparts = []\n\t\tparts << self.one_of_description\n\t\tparts << self.all_of... | [
"0.7279972",
"0.66555375",
"0.66299844",
"0.6586469",
"0.657323",
"0.6533517",
"0.64698267",
"0.6451905",
"0.63870907",
"0.63693684",
"0.62614036",
"0.6253414",
"0.6241538",
"0.6232599",
"0.6204556",
"0.61818326",
"0.6179439",
"0.614623",
"0.61400723",
"0.6108822",
"0.6092126... | 0.0 | -1 |
Checks if given field name is a known timestamp field | def check_for_timestamp name
@created_at = true if name == CREATED_AT_FIELD
@updated_at = true if name == UPDATED_AT_FIELD
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp_field=(_field_name)\n raise Error, E_TIMESTAMP_FIELD_CONFIG\n end",
"def validate_timestamp(obj)\n if !obj[:timestamp].nil?\n if obj[:timestamp].match(/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d{3}/)\n return true\n end\n end\n false\nend",
"def timest... | [
"0.6859714",
"0.64961904",
"0.6488811",
"0.6388327",
"0.63191164",
"0.6306346",
"0.6088656",
"0.57607913",
"0.57564646",
"0.57478976",
"0.570498",
"0.5652947",
"0.5621021",
"0.56187123",
"0.5608388",
"0.56052434",
"0.55795753",
"0.5572754",
"0.5551209",
"0.5535038",
"0.550157... | 0.6989041 | 0 |
Returns true if given field name follows polymorphic rules | def polymorphic_field? name
return unless polymorphic?
name == "#{polymorphic_as}_type" || name == "#{polymorphic_as}_id"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polymorphic?\n @reflection.polymorphic? == true\n end",
"def type_conforms?(obj, field)\n true\n end",
"def polymorphic?\n @polymorphic == true || !@as.nil?\n end",
"def record_with_type?(record)\n record.include?(inheritance_column) && !record[inheritance_column].nil... | [
"0.7216476",
"0.70214754",
"0.68264204",
"0.6821459",
"0.6764032",
"0.6632391",
"0.65791214",
"0.6533127",
"0.6533127",
"0.6507279",
"0.64869815",
"0.64436036",
"0.6417066",
"0.64112335",
"0.6392476",
"0.6384248",
"0.63749367",
"0.633176",
"0.63139355",
"0.6313917",
"0.627496... | 0.8460198 | 0 |
Finds a relation by association | def find_relation_by association
@relations.find{|r| r.association == association || r.association == association.singularize}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_relationship_by(attribute, value); end",
"def related(r)\n relation_set(r).first\n end",
"def find_relations\n puts '2nd pass: find relations'\n find :relations\n self\n end",
"def association_from_relation_name(name)\n model_associations.detect { |a| a.name == name.to_sym... | [
"0.6972023",
"0.66932523",
"0.6576997",
"0.63466793",
"0.6296394",
"0.62399584",
"0.61581457",
"0.6084121",
"0.6029405",
"0.6026267",
"0.597559",
"0.59582925",
"0.59482074",
"0.5911881",
"0.5889165",
"0.5841049",
"0.5824298",
"0.581255",
"0.58113587",
"0.5795505",
"0.57853144... | 0.8117045 | 0 |
Deletes given relations based on association name | def delete_relation_for association
@relations.reject!{ |r| r.association == association || r.association == association.singularize}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_related!(*names)\n # Nothing to do by default.\n end",
"def delete_related!(*names)\n # Recurse on the statement.\n @statement.delete_related!(*names)\n end",
"def delete_related!(*names)\n # Delete the sub scopes whose name are in names.\n ... | [
"0.72948605",
"0.7246785",
"0.7232309",
"0.7197926",
"0.70934254",
"0.685833",
"0.6809464",
"0.6610627",
"0.6376771",
"0.635623",
"0.6352027",
"0.6317605",
"0.62945",
"0.62364864",
"0.62269545",
"0.61813915",
"0.6181171",
"0.6168304",
"0.61474735",
"0.61444664",
"0.6092533",
... | 0.82073706 | 0 |
Explicitly close the store | def close; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n persist\n end",
"def close\n save\n end",
"def close\n @mutex.synchronize do\n @thread.kill\n @store.each_value do |value|\n sess, _ = value\n sess.close(@context)\n end\n end\n end",
"def close\n persistent.close\n @_p... | [
"0.7390946",
"0.7045272",
"0.7006187",
"0.6908627",
"0.68650204",
"0.67675227",
"0.67595404",
"0.67539",
"0.67539",
"0.6706045",
"0.6706045",
"0.6706045",
"0.6706045",
"0.67027557",
"0.6678797",
"0.6666337",
"0.66446936",
"0.6636245",
"0.65916663",
"0.65763104",
"0.65763104",... | 0.66630256 | 35 |
Fetch value with key. Return nil if the key doesn't exist | def [](key)
load(key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(key)\n result.fetch(key)\n end",
"def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end",
"def fetch_value( oid, key )\n\t\toid = normalize_oid( oid )\n\t\tkey = normalize_key( key )\n\t\tdata = @storage[ oid ] or return n... | [
"0.7923668",
"0.79139185",
"0.78174865",
"0.77392864",
"0.76899344",
"0.76581925",
"0.7602103",
"0.75962883",
"0.7471062",
"0.7423281",
"0.7379185",
"0.73368937",
"0.72955996",
"0.7207761",
"0.72027075",
"0.7188515",
"0.71817636",
"0.71651095",
"0.71308017",
"0.712261",
"0.71... | 0.0 | -1 |
Store value with key | def []=(key, value)
store(key, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(key, value)\n \n end",
"def put(key, value); end",
"def save(key, value)\n storage.transaction {storage[key] = value}\n end",
"def store(calling_node, key, value)\n @router.touch(calling_node)\n return false unless key.class == DataKey\n @values[key.to_bin] = value\n return ... | [
"0.793792",
"0.7670004",
"0.762042",
"0.7580393",
"0.7576812",
"0.7569778",
"0.7558423",
"0.75272936",
"0.74716073",
"0.74465036",
"0.7438644",
"0.74326175",
"0.7432324",
"0.7432324",
"0.7399075",
"0.7397068",
"0.73658323",
"0.73658323",
"0.7349419",
"0.73077714",
"0.73077714... | 0.6945244 | 64 |
Return true if adapter supports the given feature. | def supports?(feature)
features.include?(feature)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_test?(feature)\n raise ArgumentError, %Q(Unknown feature \"#{feature}\") unless SUPPORTED_FEATURES.include? feature\n\n enabled?(ENV[SUPPORTED_FEATURES[feature]], default: true)\n end",
"def can_test?(feature)\n raise ArgumentError, %Q(Unknown feature \"#{feature}\") unless SUPP... | [
"0.7876312",
"0.7876312",
"0.7738538",
"0.7564144",
"0.75507057",
"0.7318921",
"0.72697353",
"0.7254066",
"0.7248321",
"0.72080487",
"0.72037166",
"0.72037166",
"0.71081626",
"0.70990545",
"0.7039796",
"0.69181436",
"0.68476135",
"0.6761997",
"0.6761997",
"0.67293686",
"0.672... | 0.8437552 | 0 |
Load the words from a file | def words_from_file(text_file)
File.read(text_file).downcase.gsub(/[^a-z]/, " ").split
rescue
puts "Please provide the following file: #{text_file}"
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_words\n File.readlines(\"#{WORD_DIR}/#{language}.txt\").map(&:strip)\n end",
"def load_words\n File.read(\"../scrabble word cheat/words.txt\").split(\"\\n\")\nend",
"def load(file)\n words = File.readlines(file)\n words = words.collect {|word| Word.new(word.chomp.downcase) }\n ... | [
"0.82699794",
"0.8086616",
"0.7942683",
"0.78870666",
"0.7533058",
"0.73902595",
"0.7378622",
"0.73150986",
"0.72513676",
"0.72453636",
"0.7113474",
"0.70587134",
"0.7010911",
"0.6928175",
"0.687971",
"0.6875363",
"0.68546087",
"0.68462443",
"0.6842976",
"0.6798001",
"0.67298... | 0.64629924 | 35 |
Returns a new Table::Body object. Optionally takes a block. If an argument is provided, it is treated as content. | def initialize(arg = nil, &block)
@html_begin = '<tbody'
@html_end = '</tbody>'
super(&block)
self.content = arg if arg
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_table_contents(&block)\n TableBodyDSL.new(&block).elements\n end",
"def init_body(&block)\n if block_given?\n @body = to_node(yield)\n else\n @body = Null\n end\n end",
"def body(&block)\n call_once\n if block_given?\n yield body\n ... | [
"0.716001",
"0.64088553",
"0.627738",
"0.6116168",
"0.6076448",
"0.5965284",
"0.5924348",
"0.58352596",
"0.58203566",
"0.575174",
"0.5748253",
"0.5747069",
"0.573598",
"0.5690247",
"0.568278",
"0.56162995",
"0.5600624",
"0.5589269",
"0.5532916",
"0.5464911",
"0.5449545",
"0... | 0.63705546 | 2 |
Perform Author: Mayur Date: 30/05/2019 Reviewed By: | def perform
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reviewed_by=(value)\n @reviewed_by = value\n end",
"def submission_decision_author(submission)\n @submission = submission\n\n @authors_text = @submission.get_authors_submitted.map{ |a| a.full_name }.join(', ')\n @title_text = @submission.get_text_submitted.title... | [
"0.59214664",
"0.5859177",
"0.5852614",
"0.57621753",
"0.57621753",
"0.5714016",
"0.565449",
"0.56402093",
"0.56377506",
"0.56306547",
"0.5629599",
"0.5622852",
"0.5622117",
"0.5554327",
"0.5533369",
"0.5530394",
"0.5508582",
"0.5498105",
"0.5493392",
"0.5486852",
"0.54698557... | 0.0 | -1 |
Copyright (c) 2007 Michael Haupt, Tobias Pape Software Architecture Group, Hasso Plattner Institute, Potsdam, Germany Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including ... | def usage
print <<EOUSAGE
#{$0} <Class.som>
generates lodable primitive from som-file for class Class.
EOUSAGE
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def library; end",
"def library; end",
"def generate_lib(string)\n lines = string.split(\"\\n\")\n \n # throw away extra newlines\n lines.reject { |l| l.empty? }\n lines_lib = Array.new\n lines.each do |line|\n sentences = line.split(\".\")\n sentences_lib = Array.new\n\n ... | [
"0.55121714",
"0.55121714",
"0.52301276",
"0.5149372",
"0.5128346",
"0.5106509",
"0.5106509",
"0.5106509",
"0.5106509",
"0.49983153",
"0.4990996",
"0.49879563",
"0.49866498",
"0.49866498",
"0.49492976",
"0.49302164",
"0.49268967",
"0.49044952",
"0.49026325",
"0.4901481",
"0.4... | 0.574897 | 0 |
get the class name out of | def get_class()
result = nil
@cont.each { |line|
if line =~ /\s*\w+\s*=/
result = /\w+/.match(line)[0]
break
end
}
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_name\n name = @klass.name\n name.name\n end",
"def class_name\n self.class.to_s.split('::').last\n end",
"def class_name\n self.class.name.split(\"::\").last\n end",
"def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\... | [
"0.86408657",
"0.8547871",
"0.84513336",
"0.840386",
"0.83248854",
"0.8292198",
"0.82694113",
"0.8238238",
"0.8227851",
"0.81573224",
"0.81064606",
"0.80862945",
"0.80808866",
"0.8008034",
"0.7984978",
"0.79687184",
"0.79687184",
"0.79489166",
"0.793588",
"0.79231554",
"0.791... | 0.7192352 | 93 |
GET /dashboards GET /dashboards.json | def index
@dashboards = Dashboard.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dashboards\n @dash_service.get_dashboards\n end",
"def index\n @dashboards = current_user.dashboards\n if !params[:detail]\n render json: @dashboards, each_serializer: DashboardSummarySerializer \n else\n render json: @dashboards\n end\n end",
"def index\n @admin_dash... | [
"0.84418494",
"0.74714786",
"0.72395515",
"0.7208987",
"0.7173115",
"0.70105135",
"0.6942921",
"0.6878671",
"0.6856711",
"0.6606162",
"0.66042864",
"0.6523886",
"0.6520862",
"0.6501864",
"0.64909893",
"0.64909893",
"0.64291567",
"0.64291567",
"0.64291567",
"0.64291567",
"0.64... | 0.7765708 | 4 |
GET /dashboards/1 GET /dashboards/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dashboards\n @dash_service.get_dashboards\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards... | [
"0.76852626",
"0.7571133",
"0.7571133",
"0.7571133",
"0.7571133",
"0.7455056",
"0.7354721",
"0.7228398",
"0.70155984",
"0.6975706",
"0.6947698",
"0.6885013",
"0.68410456",
"0.68410456",
"0.68410456",
"0.68410456",
"0.68410456",
"0.68410456",
"0.68410456",
"0.67870796",
"0.672... | 0.0 | -1 |
POST /dashboards POST /dashboards.json | def create
@dashboard = Dashboard.new(dashboard_params)
respond_to do |format|
if @dashboard.save
format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }
format.json { render :show, status: :created, location: @dashboard }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @dashboard = Dashboard.new(params[:dashboard])\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n format.json { render json: @dashboard, status: :created, location: @dashboard }\n else\... | [
"0.726553",
"0.7187522",
"0.69557816",
"0.6955656",
"0.6865552",
"0.68231565",
"0.6763096",
"0.6763096",
"0.6763096",
"0.6763096",
"0.67100805",
"0.6606908",
"0.65751463",
"0.65294427",
"0.6396507",
"0.6393523",
"0.63489753",
"0.633989",
"0.632892",
"0.62750447",
"0.62750447"... | 0.7243963 | 3 |
PATCH/PUT /dashboards/1 PATCH/PUT /dashboards/1.json | def update
respond_to do |format|
if @dashboard.update(dashboard_params)
format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }
format.json { render :show, status: :ok, location: @dashboard }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @dashboard = Dashboard.find(params[:id])\n\n respond_to do |format|\n if @dashboard.update_attributes(params[:dashboard])\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html... | [
"0.7356816",
"0.6936067",
"0.6922176",
"0.68593466",
"0.68104786",
"0.63931227",
"0.6385695",
"0.6293678",
"0.62826806",
"0.6157363",
"0.60490316",
"0.6012978",
"0.59638554",
"0.5916336",
"0.58902204",
"0.58434474",
"0.584336",
"0.57802415",
"0.5773492",
"0.57500046",
"0.5725... | 0.7137749 | 5 |
DELETE /dashboards/1 DELETE /dashboards/1.json | def destroy
@dashboard.destroy
respond_to do |format|
format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirec... | [
"0.8146857",
"0.8123627",
"0.784403",
"0.76724756",
"0.75866497",
"0.7546643",
"0.7434768",
"0.7304785",
"0.7225718",
"0.721168",
"0.699318",
"0.6983448",
"0.69404614",
"0.6922948",
"0.6922939",
"0.6919525",
"0.67598045",
"0.67538655",
"0.6747603",
"0.6721918",
"0.6709609",
... | 0.7926354 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_dashboard
# @dashboard = Dashboard.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
TODO: Maybe this should move to gh? | def scopes_for(token)
token = token.github_oauth_token if token.respond_to? :github_oauth_token
scopes = GH.with(token: token.to_s) { GH.head('user') }.headers['x-oauth-scopes'] if token.present?
scopes &&= scopes.gsub(/\s/,'').split(',')
Array(scopes).sort
rescue GH::Er... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def weber; end",
"def internal; end",
"def spec; end",
"def spec; end",
... | [
"0.7756738",
"0.650102",
"0.6437795",
"0.6437795",
"0.6437795",
"0.6437795",
"0.6356007",
"0.62934935",
"0.62934935",
"0.6285604",
"0.627427",
"0.60875964",
"0.6014795",
"0.6014795",
"0.5982704",
"0.5982704",
"0.5942468",
"0.5942468",
"0.5942468",
"0.5942468",
"0.5925727",
... | 0.0 | -1 |
Counts up from midnight Split into hours and minutes Total minutes is hours converted to minutes plus minutes Edge cases where minutes exceeds min per day? Solution: Remainder of quotient of total minutes / min per day | def before_midnight(str)
hours, minutes = str.split(':').map{|char| char.to_i}
time = hours * MINUTES_PER_HOUR + minutes
time % MINUTES_PER_DAY
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CountingMinutesI(str)\n parts = str.scan(/(\\d+):(\\d\\d)(..)-(\\d+):(\\d\\d)(..)/).flatten\n\n first_min = (parts[0].to_i * 60) + (parts[1].to_i) + (parts[2] == \"pm\" ? 720 : 0)\n second_min = (parts[3].to_i * 60) + (parts[4].to_i) + (parts[5] == \"pm\" ? 720 : 0)\n\n second_min += 1440 if first_min > se... | [
"0.65623254",
"0.65124243",
"0.64844066",
"0.6443992",
"0.640971",
"0.63945186",
"0.6393245",
"0.62863123",
"0.6278905",
"0.6235863",
"0.6219725",
"0.61549854",
"0.6144115",
"0.6108907",
"0.60696924",
"0.6044272",
"0.6030991",
"0.60104597",
"0.6006897",
"0.60009366",
"0.59937... | 0.0 | -1 |
Counts down from midnight (24th hr) Get the amount of minutes and subtract from min per day | def after_midnight(str)
minutes = MINUTES_PER_DAY - before_midnight(str)
minutes = 0 if after_midnight(str) == before_midnight(str)
minutes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_mins_till\n (@difference.round(2) / 60.00).round(2)\n end",
"def before_midnight(time)\n total_minutes = after_midnight(time)\n total_minutes == 0 ? 0 : 1440 - total_minutes\nend",
"def time_of_day(min)\n if min<0\n min = min + (-(min/1440)*1440)\n end \n num_days = min/1440 \n if num... | [
"0.6718666",
"0.6663973",
"0.6631105",
"0.65369993",
"0.6531956",
"0.6382851",
"0.6304255",
"0.62741625",
"0.6215003",
"0.62115043",
"0.6194256",
"0.6186257",
"0.6155247",
"0.6128901",
"0.6117934",
"0.6096872",
"0.60793",
"0.60581106",
"0.6054692",
"0.60532206",
"0.60299563",... | 0.6172863 | 12 |
method to map random simple to actually enums on model returns nil if key not in enum_options | def match_enum_key_from_options enum_options, key
enum_options.key(enum_options[key])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_charter_status_type(random)\n DataUtility.select_random_from_options(random, [:OPEN_ENROLLMENT, :NOT_A_CHARTER_SCHOOL])\n end",
"def build_from_hash(value)\n constantValues = ExternalOrderItemSourceTypeEnumModel.constants.select { |c| ExternalOrderItemSourceTypeEnumModel::const_get(c) == ... | [
"0.585791",
"0.58396435",
"0.58258295",
"0.5709361",
"0.56894606",
"0.56844974",
"0.5583787",
"0.5577265",
"0.55692244",
"0.5560816",
"0.55607086",
"0.55495435",
"0.55326617",
"0.5523404",
"0.55090016",
"0.550668",
"0.55015355",
"0.5495712",
"0.54820913",
"0.54804236",
"0.545... | 0.59261835 | 0 |
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/CyclomaticComplexity | def start
Dir.chdir @working_directory do
Aruba.platform.with_environment(environment) do
@exit_status = system(command, *arguments) ? 0 : 1
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def implementation; end",
"def implementation; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def strategy; end",
"def offences_by; end",
"def used?; end",
"def suivr... | [
"0.7512504",
"0.6203546",
"0.6203546",
"0.6193133",
"0.6057541",
"0.60154074",
"0.60154074",
"0.60154074",
"0.60154074",
"0.6014941",
"0.59061354",
"0.59017247",
"0.5857021",
"0.5780053",
"0.57710624",
"0.57710624",
"0.5733716",
"0.5733716",
"0.5710739",
"0.5710739",
"0.57025... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.