query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
This augments the time_ago_in_words method adding the word. Usage: time_ago_in_words_with_word(object.created_at) | def time_ago_in_words_with_word(date, word = "ago")
"#{time_ago_in_words(date)} #{word}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_ago_in_words(from_time, options = T.unsafe(nil)); end",
"def time_ago_in_words(from_time, options = {})\n distance_of_time_in_words(from_time, Time.now, options)\n end",
"def decorated_time_ago_in_words(a_datetime, options = {})\n options = {\n :suffix => ' ago',\n ... | [
"0.6873405",
"0.6716613",
"0.6665151",
"0.64654344",
"0.6441428",
"0.6214084",
"0.6205446",
"0.619888",
"0.6182077",
"0.6182077",
"0.6179274",
"0.61708957",
"0.6169517",
"0.61432236",
"0.605542",
"0.60362446",
"0.6005615",
"0.59549993",
"0.59066886",
"0.5905385",
"0.5843815",... | 0.84902066 | 0 |
The original purpose of this method is to split paragraphs, but our formatter only works on paragraphs that have been presplit. Therefore, we just need to wrap the fragments in a singleelement array (representing a single paragraph) and return them. | def array_paragraphs fragments
[fragments]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commontator_split_paragraphs(text)\n return [] if text.blank?\n\n text.to_str.gsub(/\\r\\n?/, \"\\n\").gsub(/>\\s*</, \">\\n<\").split(/\\s*\\n\\s*/).reject(&:blank?)\n end",
"def split_paragraphs(input)\n return input.split(/\\n[ ]*\\n+/)\n end",
"def paragraphs\n raw_content['blocks'].m... | [
"0.73228526",
"0.69568443",
"0.68156433",
"0.66130614",
"0.66045976",
"0.6547042",
"0.6535568",
"0.6340202",
"0.631831",
"0.63062954",
"0.6305194",
"0.62608624",
"0.6233127",
"0.62245244",
"0.62051034",
"0.60753375",
"0.60259336",
"0.5894058",
"0.58859515",
"0.5849876",
"0.58... | 0.76590174 | 0 |
GET /fights GET /fights.json | def index
@fights = Fight.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @fights.to_json( :include => { :field_initial => { :only => [:name] }, :field_actual => { :only => [:name] }, :category => { :only => [:name] }, :competitor_blue => { :only => [:last_name, :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end",
"def index\n @sights = Sight.all\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n en... | [
"0.6651269",
"0.65643734",
"0.63894165",
"0.63314337",
"0.62656564",
"0.625256",
"0.6227823",
"0.6223828",
"0.616158",
"0.61259735",
"0.6120008",
"0.60488063",
"0.6023225",
"0.60102725",
"0.59912914",
"0.59912914",
"0.59912914",
"0.59901905",
"0.59883356",
"0.5947745",
"0.592... | 0.7035565 | 0 |
GET /fights/new GET /fights/new.json | def new
@fight = Fight.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @fight }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end"... | [
"0.7030712",
"0.7021597",
"0.6974574",
"0.6974574",
"0.69495076",
"0.69316745",
"0.6917321",
"0.6896696",
"0.68397576",
"0.68370587",
"0.6789301",
"0.6782575",
"0.6782575",
"0.67797285",
"0.6779193",
"0.67569363",
"0.6754984",
"0.6748451",
"0.67399144",
"0.67399144",
"0.67363... | 0.7278106 | 0 |
GET /boat_cover_image_names/1 GET /boat_cover_image_names/1.xml | def show
@boat_cover_image_name = BoatCoverImageName.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @boat_cover_image_name }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @boat_cover_image_name = BoatCoverImageName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boat_cover_image_name }\n end\n end",
"def index\n @images = @owner.images\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.61741",
"0.6130531",
"0.608153",
"0.5915386",
"0.5885076",
"0.58273035",
"0.57866883",
"0.5785827",
"0.5710268",
"0.57056856",
"0.5697743",
"0.5679736",
"0.5677093",
"0.56736875",
"0.56021994",
"0.55927217",
"0.55758494",
"0.55662775",
"0.556135",
"0.55586725",
"0.5551429"... | 0.70808667 | 0 |
GET /boat_cover_image_names/new GET /boat_cover_image_names/new.xml | def new
@boat_cover_image_name = BoatCoverImageName.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @boat_cover_image_name }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @boat_cover_image_name = BoatCoverImageName.new(params[:boat_cover_image_name])\n\n respond_to do |format|\n if @boat_cover_image_name.save\n format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully created.') }\n format.xml { rende... | [
"0.6475556",
"0.6365224",
"0.6238099",
"0.622856",
"0.6220146",
"0.6219128",
"0.6204947",
"0.6203994",
"0.6184958",
"0.6152978",
"0.61082494",
"0.6080564",
"0.6034241",
"0.60305494",
"0.6013691",
"0.60003203",
"0.5992225",
"0.5980198",
"0.5968671",
"0.5957194",
"0.59418637",
... | 0.7314431 | 0 |
POST /boat_cover_image_names POST /boat_cover_image_names.xml | def create
@boat_cover_image_name = BoatCoverImageName.new(params[:boat_cover_image_name])
respond_to do |format|
if @boat_cover_image_name.save
format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully created.') }
format.xml { render :xml => @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end",
"def create\n\n if current_user.nil?\n redirect_to '/'\n end\n\n if(params[\"labels\"].nil?)\n respond_to do |format|\n format.html { redirect_to ... | [
"0.6304909",
"0.57786286",
"0.5602623",
"0.5442955",
"0.5386451",
"0.53202754",
"0.53161",
"0.53149563",
"0.5314771",
"0.5312919",
"0.52604645",
"0.52012485",
"0.51891476",
"0.51670563",
"0.51473266",
"0.51471937",
"0.5112985",
"0.5053737",
"0.5048726",
"0.503603",
"0.5021333... | 0.60576284 | 1 |
PUT /boat_cover_image_names/1 PUT /boat_cover_image_names/1.xml | def update
@boat_cover_image_name = BoatCoverImageName.find(params[:id])
respond_to do |format|
if @boat_cover_image_name.update_attributes(params[:boat_cover_image_name])
format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully updated.') }
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end",
"def update_name(new_name)\n ensure_uri\n response = @client.rest_put(@data['uri'], 'body' => { 'name' => new_name, 'type' => 'ArtifactsBundle' })\n ... | [
"0.5914679",
"0.57832354",
"0.57542044",
"0.57173985",
"0.5712535",
"0.5701966",
"0.5660945",
"0.5644109",
"0.56324434",
"0.56069905",
"0.55642056",
"0.55498123",
"0.55268365",
"0.55126375",
"0.55109483",
"0.5488373",
"0.5486406",
"0.547351",
"0.5460264",
"0.5406619",
"0.5388... | 0.6910563 | 0 |
DELETE /boat_cover_image_names/1 DELETE /boat_cover_image_names/1.xml | def destroy
@boat_cover_image_name = BoatCoverImageName.find(params[:id])
@boat_cover_image_name.destroy
respond_to do |format|
format.html { redirect_to(boat_cover_image_names_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_image(image_name)\n File.delete(image_name)\n end",
"def destroy\n @image_set = ImageSet.find(params[:id])\n @image_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_sets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image_attrib... | [
"0.64489484",
"0.64245534",
"0.6408109",
"0.6368009",
"0.6359287",
"0.6358299",
"0.6331929",
"0.63240045",
"0.63153064",
"0.63109964",
"0.62553686",
"0.6252914",
"0.62257165",
"0.62122345",
"0.62119615",
"0.62054014",
"0.620228",
"0.6194242",
"0.6176118",
"0.6159196",
"0.6152... | 0.7561677 | 0 |
GET /subscription_lists GET /subscription_lists.json | def index
@subscription_lists = SubscriptionList.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_subscription\n response = Faraday.get(@subscription_api_url)\n response_json = JSON.parse(response.body)\n fix_response(response_json)\n end",
"def list_subscriptions(user)\n get(\"/#{user}/lists/subscriptions.json\")\n end",
"def find_subscriber_list(attributes)\n query_s... | [
"0.77005607",
"0.7324029",
"0.72297305",
"0.72297305",
"0.6923813",
"0.6921102",
"0.69118005",
"0.68067193",
"0.6754073",
"0.6748711",
"0.6720072",
"0.67076004",
"0.66942346",
"0.66927594",
"0.66211605",
"0.66161394",
"0.66109455",
"0.6605383",
"0.6571495",
"0.6538525",
"0.65... | 0.75479186 | 1 |
DELETE /subscription_lists/1 DELETE /subscription_lists/1.json | def destroy
@subscription_list.destroy
respond_to do |format|
format.html { redirect_to subscription_lists_url, notice: 'La Lista de Entrega se borró exitosamente.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @list_subscription = ListSubscription.find(params[:id])\n @list_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to list_subscriptions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subscription.destroy\n\n respond_to do |... | [
"0.7853924",
"0.71697277",
"0.7140043",
"0.7051224",
"0.7051224",
"0.7051224",
"0.7051224",
"0.7049974",
"0.7047578",
"0.70414",
"0.70308095",
"0.702332",
"0.69912016",
"0.6960443",
"0.6941727",
"0.6935252",
"0.69055337",
"0.69049627",
"0.69047254",
"0.6895843",
"0.6895843",
... | 0.7789424 | 1 |
Runs the RPC server until a SIGINT signal. | def run
raise 'Server has shutdown.' unless @server
@server.run_till_terminated
@server = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run!\n CarrotRpc.connect\n\n signal.trap\n\n pid.check\n daemonize && suppress_output if daemonize?\n pid.ensure_written\n\n # Initialize the servers. Set logger.\n run_servers\n stop_servers(signal.wait)\n end",
"def handle_interrupt\n system \"SIGINT received, starting shutdown\... | [
"0.6743719",
"0.6282611",
"0.6260028",
"0.623745",
"0.6153226",
"0.60285866",
"0.60183835",
"0.60058933",
"0.5991355",
"0.5962793",
"0.59567213",
"0.5938346",
"0.5879837",
"0.58623683",
"0.58566815",
"0.5824581",
"0.5816113",
"0.58004975",
"0.5793054",
"0.5787713",
"0.5782777... | 0.66912156 | 1 |
the creation of a custom node definition or use the 'default' node definition. ==== Attributes +master_certname+ Certificate name of Puppet master. +manifest+ A Puppet manifest to inject into the node definition. +node_def_name+ A node definition pattern or name. ==== Returns +string+ A combined manifest with node defi... | def create_site_pp(master_certname, manifest='', node_def_name='default')
default_def = <<-MANIFEST
node default {
}
MANIFEST
node_def = <<-MANIFEST
node #{node_def_name} {
#{manifest}
}
MANIFEST
if node_def_name != 'default'
node_def = "#{default_def}\n#{node_def}"
end
site_pp = <<-MANIFEST
filebucke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_site_pp(master_host, opts = {})\n opts[:manifest] ||= ''\n opts[:node_def_name] ||= 'default'\n master_certname = on(master_host, puppet('config print certname')).stdout.rstrip\n\n default_def = <<-MANIFEST\nnode default {\n}\nMANIFEST\n\n node_def = <<-MANIFEST\nnode #{opts[:no... | [
"0.7470808",
"0.72417575",
"0.6050029",
"0.6050029",
"0.582662",
"0.5364564",
"0.5363732",
"0.5279123",
"0.5262483",
"0.5093455",
"0.50499946",
"0.5011684",
"0.4840369",
"0.47749773",
"0.47224563",
"0.46902674",
"0.46900573",
"0.46787798",
"0.46635938",
"0.4632619",
"0.462915... | 0.7306205 | 1 |
Read a Puppet manifest file and inject the content into a "default" node definition. (Used mostly to overide site.pp) ==== Attributes +manifest_path+ The file path to target manifest. +master_certname+ Certificate name of Puppet master. ==== Returns +string+ A combined manifest with node definition containg input manif... | def create_node_manifest(manifest_path, master_certname, node_def_name='default')
manifest = File.read(manifest_path)
site_pp = <<-MANIFEST
filebucket { 'main':
server => '#{master_certname}',
path => false,
}
File { backup => 'main' }
node default {
#{manifest}
}
MANIFEST
return site_pp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_site_pp(master_host, opts = {})\n opts[:manifest] ||= ''\n opts[:node_def_name] ||= 'default'\n master_certname = on(master_host, puppet('config print certname')).stdout.rstrip\n\n default_def = <<-MANIFEST\nnode default {\n}\nMANIFEST\n\n node_def = <<-MANIFEST\nnode #{opts[:no... | [
"0.69561505",
"0.6935098",
"0.6582124",
"0.62504935",
"0.62504935",
"0.62267864",
"0.6063514",
"0.605106",
"0.56757796",
"0.5502658",
"0.54138565",
"0.53964466",
"0.5343424",
"0.52187884",
"0.517615",
"0.50771815",
"0.50681776",
"0.5059875",
"0.50534964",
"0.5045868",
"0.5024... | 0.77165544 | 0 |
Set mode, owner and group on a remote path. ==== Attributes +host+ The remote host containing the target path. +path+ The path to set mode, user and group upon. +mode+ The desired mode to set on the path in as a string. +owner+ The owner to set on the path. (Puppet user if not specified.) +group+ The group to set on th... | def set_perms_on_remote(host, path, mode, owner=nil, group=nil)
if (owner.nil?)
owner = on(host, puppet('config', 'print', 'user')).stdout.rstrip
end
if (group.nil?)
group = on(host, puppet('config', 'print', 'group')).stdout.rstrip
end
on(host, "chmod -R #{mode} #{path}")
on(host, "chown -R #{own... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_perms_on_remote(host, path, mode, opts = {})\n opts[:owner] ||= on(host, puppet('config print user')).stdout.rstrip\n opts[:group] ||= on(host, puppet('config print group')).stdout.rstrip\n\n on(host, \"chmod -R #{mode} #{path}\")\n on(host, \"chown -R #{opts[:owner]}:#{opts[:group]} #{... | [
"0.853508",
"0.62313455",
"0.6067766",
"0.58636713",
"0.5812962",
"0.5807897",
"0.57689315",
"0.5756103",
"0.5750437",
"0.57163846",
"0.5713541",
"0.5635026",
"0.5621682",
"0.558019",
"0.5562776",
"0.5513096",
"0.54989916",
"0.5477864",
"0.54386497",
"0.5429715",
"0.53882444"... | 0.8571411 | 0 |
Create a temporary directory environment and inject a "site.pp" for the target environment. ==== Attributes +master+ The master on which to create a new Puppet environment. +env_root_path+ The base path on the master that contains all environments. +env_seed_name+ The seed name to use for generating an environment name... | def create_temp_dir_env(master, env_root_path, env_seed_name, manifest)
env_name = "#{env_seed_name}" + rand(36**16).to_s(36)
env_path = "#{env_root_path}/#{env_name}"
env_site_pp_path = "#{env_path}/manifests/site.pp"
on(master, "mkdir -p #{env_path}/manifests #{env_path}/modules")
set_perms_on_remote(maste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mk_tmp_environment(environment)\n # add the tmp_environment to a set to ensure no collisions\n @@tmp_environment_set ||= Set.new\n deadman = 100; loop_num = 0\n while @@tmp_environment_set.include?(tmp_environment = environment.downcase + '_' + random_string) do\n break if ... | [
"0.62542784",
"0.60449564",
"0.57045144",
"0.56640023",
"0.5639595",
"0.56154525",
"0.5581251",
"0.5462933",
"0.53894436",
"0.5296564",
"0.527444",
"0.5107344",
"0.51043284",
"0.5100353",
"0.5087843",
"0.4992919",
"0.49681512",
"0.49661678",
"0.49555176",
"0.49258938",
"0.491... | 0.8519662 | 0 |
A method for building attribute string | def mk_attr_str **attr_map
attr_map.map{|k,v|" #{k}='#{v}'"}.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buildAttrString(attributes)\r\n str = \"\"\r\n\r\n attributes.each do |key, val|\r\n str += \" #{key}='#{val}'\"\r\n end # attributes.each\r\n\r\n puts \"attrib str: #{str}\" if $DEBUG\r\n str\r\n end",
"def attributes_string\n\t\t\t#note that underscores are converted to hyphens. Quotes... | [
"0.7914002",
"0.75023293",
"0.7355576",
"0.7305694",
"0.7254207",
"0.7232861",
"0.7195633",
"0.71831703",
"0.70630234",
"0.6961891",
"0.69222146",
"0.6919757",
"0.6909795",
"0.68599856",
"0.6849177",
"0.68178535",
"0.66554976",
"0.66554976",
"0.66554976",
"0.66519",
"0.663722... | 0.7885479 | 1 |
A method for building inline tag string | def tag_inline tagname, value, **attr_map
attr_str = mk_attr_str(attr_map)
"<#{tagname}#{attr_str}>#{value}</div>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inline_tags; end",
"def _gestalt_build_tag(name, attr = {}, text = [])\n @out << \"<#{name}\"\n @out << attr.map{|(k,v)| %[ #{k}=\"#{_gestalt_escape_entities(v)}\"] }.join\n if text != [] or block_given?\n @out << \">\"\n @out << _gestalt_escape_entities([text].join)\n if ... | [
"0.7471103",
"0.69979167",
"0.6410485",
"0.63333434",
"0.63280934",
"0.63246924",
"0.6314425",
"0.6307209",
"0.6238538",
"0.62183344",
"0.61661804",
"0.61649233",
"0.60918224",
"0.6033075",
"0.6022059",
"0.6015177",
"0.59945685",
"0.5990561",
"0.5985831",
"0.5982855",
"0.5981... | 0.7233123 | 1 |
A method for indent array | def a_indent arr, level=1
[arr].flatten.map{|e|"#{SP*level}#{e}"}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indent()\n #This is a stub, used for indexing\n end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent; end",
"def indent!(num = nil, i_char = ' ')\n collect! do |array_element|\n array_element.indent!(num, i_char)\n ... | [
"0.75906587",
"0.73141754",
"0.73141754",
"0.73141754",
"0.73141754",
"0.73141754",
"0.7088003",
"0.70174116",
"0.68575186",
"0.6846909",
"0.65792507",
"0.65792507",
"0.6575111",
"0.6570298",
"0.65055305",
"0.6497884",
"0.6476519",
"0.63873273",
"0.63038856",
"0.63005126",
"0... | 0.793145 | 0 |
A method for building block level tag string array with class attribute | def tag_block tagname, children, **attr_map
ch = a_indent(children)
attr_str = mk_attr_str(attr_map)
["<#{tagname}#{attr_str}>", ch, "</div>"].flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag_class_list\n tags = self.tags.collect{|tag| tag.slug}\n tags.join(\" \")\n end",
"def attribute *array\n return self if guard *array\n r = self.clone\n a = array.flatten\n n_full_pairs, n_unpaired = a.length.divmod 2\n (1..n_full_pairs + n_unpaired).each do |i|\n r ... | [
"0.6022381",
"0.5720883",
"0.5706275",
"0.57003766",
"0.56544256",
"0.55647165",
"0.5539287",
"0.5517255",
"0.54926705",
"0.5465932",
"0.5458295",
"0.5454011",
"0.5447236",
"0.540648",
"0.53982335",
"0.5350301",
"0.5341292",
"0.53264374",
"0.52685076",
"0.523331",
"0.5214022"... | 0.5765087 | 1 |
A method for building pair role | def mk_pair_role rpair, plural=false
suffix = plural ? 's' : ''
"#{rpair.join(UBAR)}_pair#{suffix}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end",
"def generate_membe... | [
"0.62585205",
"0.62585205",
"0.62585205",
"0.62133557",
"0.6185055",
"0.61586076",
"0.6136967",
"0.6100749",
"0.60865206",
"0.60797864",
"0.60781956",
"0.60495305",
"0.6003415",
"0.596219",
"0.596219",
"0.5944483",
"0.59308213",
"0.5923134",
"0.59135056",
"0.58353037",
"0.582... | 0.6964274 | 0 |
A method for building pair from value/role pair with wrapper | def build_pair_div_wrap value_pair, role_pair
pairs = build_pair_div(value_pair, role_pair)
pair_role = mk_pair_role(role_pair)
div_block(pairs, pair_role)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mk_pair_role rpair, plural=false\n suffix = plural ? 's' : ''\n \"#{rpair.join(UBAR)}_pair#{suffix}\"\n end",
"def build_pairs_div value_pairs, role_pair\n pairs = value_pairs.map{|pair|build_pair_div_wrap(pair, role_pair)}\n pairs_role = mk_pair_role(role_pair, true)\n div_block(pairs, pairs... | [
"0.59162253",
"0.5388208",
"0.53568834",
"0.533363",
"0.5213542",
"0.5195389",
"0.5173027",
"0.5168893",
"0.5117218",
"0.5106408",
"0.5083076",
"0.50314116",
"0.502287",
"0.5006043",
"0.49951914",
"0.4966905",
"0.49592146",
"0.49050304",
"0.48869196",
"0.4883868",
"0.487864",... | 0.6228006 | 0 |
A method for building pairs from value/role pairs | def build_pairs_div value_pairs, role_pair
pairs = value_pairs.map{|pair|build_pair_div_wrap(pair, role_pair)}
pairs_role = mk_pair_role(role_pair, true)
div_block(pairs, pairs_role)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_pair_div value_pair, role_pair\n value_pair.zip(role_pair).map{|v,r|div_inline(v,r)}\n end",
"def name_and_role\n instructors.map do |instructors_hash|\n {instructors_hash[:name] => instructors_hash[:role]}\n end\nend",
"def build_pair_div_wrap value_pair, role_pair\n pairs = build... | [
"0.5974998",
"0.5954997",
"0.5874744",
"0.58200455",
"0.57611865",
"0.56762534",
"0.5483481",
"0.5413726",
"0.5370455",
"0.52961326",
"0.52205336",
"0.52002585",
"0.5186629",
"0.51411694",
"0.5134376",
"0.51082295",
"0.50833225",
"0.5066729",
"0.50467646",
"0.5042951",
"0.500... | 0.61040854 | 0 |
GET /travel_agent_profiles/1 GET /travel_agent_profiles/1.json | def show
@travel_agent_profile = TravelAgentProfile.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @travel_agent_profile }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_profile \n get(\"/profiles.json/default\")\nend",
"def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json... | [
"0.67646885",
"0.65680057",
"0.6463444",
"0.64419246",
"0.62984014",
"0.62984014",
"0.6297298",
"0.6274834",
"0.61767066",
"0.61541593",
"0.6136203",
"0.6127489",
"0.6036603",
"0.6014449",
"0.5978605",
"0.5976262",
"0.59742224",
"0.59692156",
"0.5951449",
"0.58936715",
"0.588... | 0.7006424 | 0 |
GET /travel_agent_profiles/new GET /travel_agent_profiles/new.json | def new
@travel_agent_profile = TravelAgentProfile.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @travel_agent_profile }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @travel_agent_profile = TravelAgentProfile.new(params[:travel_agent_profile])\n\n respond_to do |format|\n if @travel_agent_profile.save\n format.html { redirect_to @travel_agent_profile, notice: 'Travel agent profile was successfully created.' }\n format.json { render json: @... | [
"0.74394727",
"0.70630705",
"0.7032297",
"0.7032297",
"0.7032297",
"0.7032297",
"0.7032297",
"0.7032297",
"0.7032297",
"0.7032297",
"0.7032297",
"0.7027311",
"0.7001514",
"0.69660693",
"0.69137156",
"0.6883795",
"0.6868704",
"0.6868704",
"0.6868704",
"0.6841565",
"0.68229765"... | 0.7776194 | 0 |
POST /travel_agent_profiles POST /travel_agent_profiles.json | def create
@travel_agent_profile = TravelAgentProfile.new(params[:travel_agent_profile])
respond_to do |format|
if @travel_agent_profile.save
format.html { redirect_to @travel_agent_profile, notice: 'Travel agent profile was successfully created.' }
format.json { render json: @travel_agen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validator_captive_portal(args = {}) \n post(\"/profiles.json/captiveportal/\", args)\nend",
"def new\n @travel_agent_profile = TravelAgentProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @travel_agent_profile }\n end\n end",
"def create\n ... | [
"0.6113214",
"0.6041963",
"0.60397077",
"0.5972854",
"0.593784",
"0.59138227",
"0.58222824",
"0.5807287",
"0.5774494",
"0.5762147",
"0.57022905",
"0.5675208",
"0.56469494",
"0.56468195",
"0.56266755",
"0.56224835",
"0.56202805",
"0.5592046",
"0.5587152",
"0.5580588",
"0.55687... | 0.7092358 | 0 |
PUT /travel_agent_profiles/1 PUT /travel_agent_profiles/1.json | def update
@travel_agent_profile = TravelAgentProfile.find(params[:id])
respond_to do |format|
if @travel_agent_profile.update_attributes(params[:travel_agent_profile])
format.html { redirect_to @travel_agent_profile, notice: 'Travel agent profile was successfully updated.' }
format.json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend",
"def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend",
"def create\n @travel_agent_profile = TravelAgentProfile.new(params[:travel_agent_profile])\n\n re... | [
"0.6809385",
"0.65529245",
"0.6258866",
"0.6257898",
"0.6222667",
"0.6146836",
"0.6144338",
"0.5987374",
"0.5947935",
"0.59297425",
"0.58937323",
"0.5876602",
"0.5825414",
"0.57946503",
"0.577177",
"0.576238",
"0.5761962",
"0.5757594",
"0.5747021",
"0.57361066",
"0.56923133",... | 0.69785553 | 0 |
DELETE /travel_agent_profiles/1 DELETE /travel_agent_profiles/1.json | def destroy
@travel_agent_profile = TravelAgentProfile.find(params[:id])
@travel_agent_profile.destroy
respond_to do |format|
format.html { redirect_to travel_agent_profiles_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @meetup_profile = MeetupProfile.find(params[:id])\n @meetup_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end",
"def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend",
"... | [
"0.67685544",
"0.676346",
"0.67612046",
"0.67481005",
"0.67427397",
"0.67247474",
"0.6685766",
"0.66673857",
"0.66657686",
"0.6653946",
"0.6629549",
"0.6627992",
"0.66132647",
"0.6612785",
"0.6612785",
"0.6582248",
"0.6581526",
"0.6581526",
"0.6581526",
"0.6575101",
"0.657510... | 0.7679896 | 0 |
Creates CSV report with NET and server benchmarks | def report!
# Fulfill batches array with 1 second step timestamps
#
batches = []
@min_time = Time.at(@min_time.to_f.truncate + 0.999)
batches << @min_time
(@max_time - @min_time).to_i.times {
batches << batches.last + 1.second
}
batches << batches.last + 1.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_report_csv(filename)\n puts 'Creating the VMs report'\n CSV.open(\"#{filename}\", 'w') do |csv|\n csv << %w(VM_List)\n csv << %w(Host_Name LPAR_Name LPAR_State OS_Status LPAR_Health Machine_Name VM_IPaddress VM_Flavor VM_CPU VM_Memory VM_CPU_Utilization VM_CPU_Mode VM_OS VM_CPU_Pool \\\n... | [
"0.6961577",
"0.6871197",
"0.63045365",
"0.6281409",
"0.6250315",
"0.61898154",
"0.61358714",
"0.61084414",
"0.6084353",
"0.6054181",
"0.6031395",
"0.6022267",
"0.6002168",
"0.59988534",
"0.5985953",
"0.59391624",
"0.59238267",
"0.59213936",
"0.59070647",
"0.5891289",
"0.5875... | 0.69748455 | 0 |
def reduce_to_total(array, alpha = 0) THE DO WHILE DOESN'T APPEAR TO WORK, WILL EXAMINE LATER total_amount = alpha; counter = 0; loop do total_amount += array[counter]; counter = counter + 1; break if counter < array.length; end return(total_amount); end | def reduce_to_total(array, alpha = 0)
total_amount = alpha;
counter = 0;
while counter < array.length do
total_amount += array[counter];
counter = counter + 1;
end
return(total_amount);
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_to_total(array)\n total = 0 \n count = 0 \n while count < array.length do\n total = total + array[count]\n count += 1\n end\n total\nend",
"def reduce_to_total(array,starting_point=0)\n total = starting_point\n counter = 0 \n while counter < array.size do \n total += array[cou... | [
"0.84213156",
"0.81451094",
"0.8005651",
"0.7984552",
"0.7935845",
"0.7935845",
"0.79302746",
"0.7877407",
"0.78555954",
"0.7849903",
"0.784916",
"0.784501",
"0.78441554",
"0.78409505",
"0.7840298",
"0.78377235",
"0.7830708",
"0.7821809",
"0.7820845",
"0.7810847",
"0.7799043"... | 0.9670998 | 0 |
def reduce_to_all_true(array) THE DO WHILE DOESN'T APPEAR TO WORK, WILL EXAMINE LATER counter = 0; loop do run following block until condition is met... return false if array[counter] == array[counter]; ...return false if any elements is a false value... return false if array[counter] == !array[counter]; ...return fals... | def reduce_to_all_true(array)
counter = 0;
while counter < array.length do
return false if !array[counter];
counter += 1;
end
return(true);
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_to_all_true(source_array)\n i = 0\n\n while i < source_array.length do\n if source_array[i] == false\n return false\n end\n i += 1\n end\n \n return true\nend",
"def reduce_to_all_true(array)\n if array.include? false\n false\n elsif array.each.include? true\n true\n end... | [
"0.89380896",
"0.8789797",
"0.8729243",
"0.8697152",
"0.8646781",
"0.8555913",
"0.85452944",
"0.8528212",
"0.8238819",
"0.8236844",
"0.79818934",
"0.7497042",
"0.7421525",
"0.6779499",
"0.66319364",
"0.6573199",
"0.6474536",
"0.6460325",
"0.6430437",
"0.62981606",
"0.62504196... | 0.93043333 | 0 |
%var:image100x100 lang_id is not used! | def build_image_size_variables(src, lang_id, var_hash)
is_admin = var_hash[:admin_view?] == true
src.gsub(/%image[\w]*:[\w\-\"_\']+/) { |r|
resulted_value = ""
image_size_attr = /%image(\w+)/.match(r)
image_size = image_size_attr.nil? ? nil : image_size_attr[1].split("x")
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_normal_image\n return \"Pictures/pcn%04d.png\" % (80 + id)\n end",
"def localized_image_filename (source)\n localized_filename = get_language_filename( source, true )\n language_filename = get_language_filename( source, false )\n if language_image_exists?(localized_filename)\n return l... | [
"0.5947765",
"0.59059095",
"0.5654585",
"0.564201",
"0.5637659",
"0.5630375",
"0.5630375",
"0.5627135",
"0.5600323",
"0.5548378",
"0.5513843",
"0.54922014",
"0.5466331",
"0.5441538",
"0.54127264",
"0.54046285",
"0.53986764",
"0.5385347",
"0.5360364",
"0.5355604",
"0.53525263"... | 0.6486931 | 0 |
Returns all circles = (global + user's) | def all_circles
(circles + Circle.globals).uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users\n @circle.keySet.to_a\n end",
"def current_circle(host_id = self.current_host_id)\n if host_id and (rel = relationships.find_by_user_id(host_id))\n rel.circle\n else\n circles.first\n end\n end",
"def list_people_by_circle(params = {})\n return false unless check_requ... | [
"0.6532954",
"0.612669",
"0.58640915",
"0.5796346",
"0.5792323",
"0.5639843",
"0.5616303",
"0.5605043",
"0.5553211",
"0.5519368",
"0.547997",
"0.5476148",
"0.5463248",
"0.5450114",
"0.542147",
"0.54202247",
"0.53717935",
"0.5331097",
"0.53182536",
"0.5306966",
"0.53065443",
... | 0.7935558 | 0 |
Adds relationship for guest | def add_guest(guest, circle = guest.circle)
# Adds authorization plugin role: 'guest' of user
# guests can identify their hosts with:
# guest.is_guest_of_what => Array of Members
# and member can identify their guests with:
# member.has_guests? => true/false
# member.has_guests => Arr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_relationship(rel_attr); end",
"def add_guest(person)\n @guests.push(person)\n end",
"def add_guest(guest_to_be_added)\n @guests << guest_to_be_added\n end",
"def add_as_client \n Event.create( \n :event_type => 'invitation',\n :detail_i1 => guest.id,\n :user_id ... | [
"0.6899112",
"0.6477152",
"0.63384116",
"0.6084839",
"0.6051174",
"0.60344386",
"0.58669955",
"0.5799434",
"0.57757974",
"0.57613236",
"0.5701113",
"0.5688169",
"0.5688021",
"0.557391",
"0.5539246",
"0.55299026",
"0.55043316",
"0.5503145",
"0.5503145",
"0.5503145",
"0.5503145... | 0.71395254 | 0 |
Returns of bytes used by backup data | def s3_storage_used
bytes = contents.sum(:size)
backup_sources.gmail.each do |gmail|
bytes += gmail.backup_emails.sum(:size)
end
# TODO: move size calculations to each source
backup_sources.blog.each do |blog|
blog.feed.entries.each do |entry|
if entry.feed_content
bytes += entry.fee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bytes_used\n bytes_total - bytes_free\n end",
"def num_bytes\n return @num_bytes\n end",
"def total_bytes\n (wired + active + inactive + free) * pagesize\n end",
"def bytes\n members.reduce(0) { |sum, gf|... | [
"0.75247806",
"0.7246485",
"0.7090979",
"0.700487",
"0.693468",
"0.6873506",
"0.685306",
"0.68505424",
"0.68375874",
"0.6824555",
"0.6806502",
"0.6796714",
"0.6729013",
"0.668996",
"0.6667818",
"0.66670495",
"0.66430736",
"0.6638221",
"0.6628052",
"0.66216385",
"0.6593814",
... | 0.7317086 | 1 |
Test parsing of slides from text into objects | def test_slide_parsing
presentation = Domain::Presentation.new('DE', 'Title1', 'Title2', 3, 'Section 3', '(c) 2014',
'Thomas Smits', 'java', 'Test Presentation', 'WS2014',
false, nil)
parser = Parsing::Parser.new(5, Parsi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_slide_parsing\n presentation = Domain::Presentation.new('DE', 'Title1', 'Title2', 3, 'Section 3', '(c) 2014',\n 'Thomas Smits', 'java', 'Test Presentation', 'WS2014',\n false, nil)\n\n parser = Parsing::Parser.new(... | [
"0.76218355",
"0.67831904",
"0.67454565",
"0.65442306",
"0.65136373",
"0.61860144",
"0.61226267",
"0.60944426",
"0.60568273",
"0.60059",
"0.59173757",
"0.588856",
"0.588856",
"0.588856",
"0.58847",
"0.58792",
"0.58454305",
"0.58378804",
"0.5834968",
"0.57880366",
"0.578626",
... | 0.7811514 | 0 |
Attempt to push an item on the queue. If the queue is full, then the behavior is determined by the :drop_oldest setting provided to the constructor. Returns true if the object was pushed on the queue, or false if the queue was full. | def enqueue(object_)
result_ = true
if @push_ptr
if @pop_ptr == @push_ptr
if @drop_oldest
@pop_ptr += 1
@pop_ptr = 0 if @pop_ptr == @buffer.size
result_ = false
else
return false
end
elsif @po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_last(value)\n if @queue.size < @size\n @queue.push(value)\n true\n else\n false\n end\n end",
"def pushed?\n !pushed_at.nil?\n end",
"def insert_front(value)\n if @queue.size < @size\n @queue.unshift(value)\n true\n else\n false\n end\n end",
"... | [
"0.6784146",
"0.64809525",
"0.6380965",
"0.6276838",
"0.6215338",
"0.6041882",
"0.6004543",
"0.5968675",
"0.5930533",
"0.59057665",
"0.58883005",
"0.5886998",
"0.58579034",
"0.582185",
"0.5792463",
"0.57783526",
"0.5770018",
"0.57606775",
"0.57606065",
"0.5740639",
"0.5736608... | 0.7238949 | 0 |
Generate standard YAML output, but never include the auto warning message. FIXME: Override to solve a convoluted, `simp config` code problem. Because `simp config` needs to know the scenario to use to build the Item decision tree, it needs to determine this Item's value ahead of time. Then, to make sure this Item is ac... | def to_yaml_s(include_auto_warning = false)
super(false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_warning\n \">> VALUE SET BY `simp config` AUTOMATICALLY. <<\\n\"\n end",
"def to_yaml_s(include_auto_warning = false)\n raise InternalError.new( \"@key is empty for #{self.class}\" ) if \"#{@key}\".empty?\n\n x = \"=== #{@key} ===\\n\"\n x += \"#{(description || 'FIXME: NO DESCRI... | [
"0.6189041",
"0.5990701",
"0.5969959",
"0.5823672",
"0.5632906",
"0.54996115",
"0.5376722",
"0.5265555",
"0.5223406",
"0.51639843",
"0.51193625",
"0.50991535",
"0.50987667",
"0.5095213",
"0.5060933",
"0.50364095",
"0.5028591",
"0.49820378",
"0.49710774",
"0.492528",
"0.492248... | 0.6360387 | 0 |
Responds to request with index_ok status and resources | def index_ok(resources:)
render json: resources, status: :ok, include: index_includes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render_result('ok')\n end",
"def index\n build_resource({})\n respond_with self.resource\n end",
"def request_res_index(*args)\n @res_index\n end",
"def index\n render status: :ok, json: { status: 'done' }.to_json\n\tend",
"def index\n status = get_health_status( )\n res... | [
"0.70537627",
"0.6929136",
"0.6889598",
"0.68736124",
"0.6838742",
"0.6838742",
"0.6796769",
"0.6636623",
"0.66111386",
"0.65857875",
"0.6577394",
"0.655659",
"0.6519567",
"0.64604425",
"0.6448699",
"0.6399619",
"0.6386759",
"0.6367987",
"0.6365259",
"0.63649845",
"0.6354009"... | 0.77497816 | 0 |
GET /kitchen_items GET /kitchen_items.json | def index
@kitchen_items = KitchenItem.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend",
"def show\n @items = Item.find(params[:id])\n render j... | [
"0.7134772",
"0.69249094",
"0.687674",
"0.6861754",
"0.678004",
"0.6698239",
"0.66140956",
"0.6599162",
"0.6570955",
"0.6568973",
"0.65619594",
"0.6485358",
"0.6472469",
"0.6456834",
"0.64541215",
"0.6437892",
"0.6433963",
"0.6433963",
"0.6433963",
"0.6433963",
"0.64330137",
... | 0.7376812 | 0 |
POST /kitchen_items POST /kitchen_items.json | def create
@kitchen_item = KitchenItem.new(kitchen_item_params)
respond_to do |format|
if @kitchen_item.save
format.html { redirect_to @kitchen_item, notice: 'Kitchen item was successfully created.' }
format.json { render :show, status: :created, location: @kitchen_item }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n '... | [
"0.72451705",
"0.6928463",
"0.6806272",
"0.6793319",
"0.6772816",
"0.676852",
"0.6707462",
"0.66971517",
"0.66828066",
"0.6654724",
"0.6581394",
"0.65711427",
"0.6538814",
"0.651494",
"0.65121204",
"0.6478343",
"0.6473956",
"0.6432934",
"0.64138335",
"0.63993627",
"0.63717395... | 0.72483754 | 0 |
PATCH/PUT /kitchen_items/1 PATCH/PUT /kitchen_items/1.json | def update
respond_to do |format|
if @kitchen_item.update(kitchen_item_params)
format.html { redirect_to @kitchen_item, notice: 'Kitchen item was successfully updated.' }
format.json { render :show, status: :ok, location: @kitchen_item }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item... | [
"0.7048443",
"0.6896587",
"0.68237144",
"0.67524743",
"0.6710602",
"0.6661912",
"0.6659253",
"0.65691996",
"0.6545763",
"0.6538919",
"0.6530061",
"0.6522068",
"0.64431727",
"0.64341956",
"0.6414629",
"0.64085096",
"0.6402146",
"0.6399562",
"0.63763523",
"0.6375756",
"0.637127... | 0.69881314 | 1 |
POST /imagedemos POST /imagedemos.json | def create
@imagedemo = Imagedemo.new(imagedemo_params)
respond_to do |format|
if @imagedemo.save
format.html { redirect_to @imagedemo, notice: 'Imagedemo was successfully created.' }
format.json { render action: 'show', status: :created, location: @imagedemo }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_image\n @image = Image.create(image_path: params[:upload][:image])\n p @image\n render json: @image\n end",
"def create \n @image ||= Image.new(image_params)\n if @image.save\n render json: {\"url\" => @image.image_url(:resized), \"success\" => true}\n else\n render json: ... | [
"0.66844064",
"0.63975775",
"0.63907677",
"0.6249914",
"0.619083",
"0.6177423",
"0.6177007",
"0.6172407",
"0.61656713",
"0.61557436",
"0.60964936",
"0.6092667",
"0.60897505",
"0.6087746",
"0.60378796",
"0.60340583",
"0.6030172",
"0.60289156",
"0.5999898",
"0.5991341",
"0.5983... | 0.6904636 | 0 |
DELETE /imagedemos/1 DELETE /imagedemos/1.json | def destroy
@imagedemo.destroy
respond_to do |format|
format.html { redirect_to imagedemos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end",
"def destroy\n #Finds selected image\n @image = Imag... | [
"0.7461737",
"0.74285847",
"0.7316272",
"0.7244463",
"0.72352445",
"0.7227089",
"0.72268707",
"0.72268707",
"0.72268707",
"0.72268707",
"0.72268707",
"0.72268707",
"0.72259176",
"0.72172105",
"0.7168657",
"0.7168657",
"0.7168657",
"0.7168657",
"0.7168657",
"0.7168657",
"0.716... | 0.77337545 | 0 |
Calculate password hash from string for use in 'password' fields. | def password_hash(pwd)
hsh = 0
pwd.reverse.each_char { |c|
hsh = hsh ^ c.ord
hsh = hsh << 1
hsh -= 0x7fff if hsh > 0x7fff
}
(hsh ^ pwd.length ^ 0xCE4B).to_s(16)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_digest(password); end",
"def digest(string)\n cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST :\n BCrypt::Engine.cost\n BCrypt::Password.create(string, cost: cost)\n end",
"def digest(string)\n\t\tcost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_... | [
"0.7502564",
"0.72289884",
"0.72189313",
"0.72189313",
"0.7100617",
"0.6975053",
"0.6973624",
"0.6935003",
"0.6935003",
"0.6935003",
"0.69026077",
"0.68875515",
"0.67386955",
"0.6716514",
"0.66810834",
"0.65440243",
"0.6542212",
"0.65396833",
"0.6539318",
"0.65320736",
"0.644... | 0.7296077 | 1 |
by default, only sets cell to nil if :left is specified, method will shift row contents to the right of the deleted cell to the left if :up is specified, method will shift column contents below the deleted cell upward | def delete_cell(row_index = 0, column_index=0, shift=nil)
validate_workbook
validate_nonnegative(row_index)
validate_nonnegative(column_index)
row = sheet_data[row_index]
old_cell = row && row[column_index]
case shift
when nil then
row.cells[column_index] = nil if row... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_cell(row=0,col=0,shift=nil)\n validate_workbook\n validate_nonnegative(row)\n validate_nonnegative(col)\n if @sheet_data.size <= row || @sheet_data[row].size <= col\n return nil\n end\n\n cell = @sheet_data[row][col]\n @sheet_data[row][col]=nil\n\n if shift && shift != :left... | [
"0.66775256",
"0.63605005",
"0.6154143",
"0.59607273",
"0.5921581",
"0.5834795",
"0.58257157",
"0.5819249",
"0.57766175",
"0.57533693",
"0.5748814",
"0.5740785",
"0.5733002",
"0.5596116",
"0.5578374",
"0.55728936",
"0.5568853",
"0.55657446",
"0.55616975",
"0.55542773",
"0.555... | 0.6488819 | 1 |
Get raw column width value as stored in the file | def get_column_width_raw(column_index = 0)
validate_workbook
validate_nonnegative(column_index)
range = cols.locate_range(column_index)
range && range.width
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_width\n return @column_width\n end",
"def width\n @column_widths.inject(0) { |s,r| s + r }\n end",
"def width\n @columns * @block_size\n end",
"def width\n metadata[:width] if valid?\n end",
"def width\r\n assert_exists\r\n return @o.i... | [
"0.71662885",
"0.70062655",
"0.68812126",
"0.6791667",
"0.6709167",
"0.67076576",
"0.66874766",
"0.6671525",
"0.66001284",
"0.65530646",
"0.6510749",
"0.6504935",
"0.64883566",
"0.6456142",
"0.6432641",
"0.6432641",
"0.6424143",
"0.6420093",
"0.64200306",
"0.6419416",
"0.6390... | 0.72390014 | 0 |
Helper method to get the style index for a column | def get_col_style(column_index)
range = cols.locate_range(column_index)
(range && range.style_index) || 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_col_style(column_index)\n range = cols.locate_range(column_index)\n (range && range.style_index) || 0\n end",
"def get_col_style(col)\n i = get_cols_index(col)\n if @cols[i].nil?\n @workbook.fonts['0'][:count] += 1\n return 0\n else\n return Integer(@cols[i][:attributes][:s... | [
"0.84076685",
"0.74073434",
"0.6766498",
"0.6570552",
"0.65280926",
"0.6457088",
"0.64526653",
"0.6422292",
"0.6404371",
"0.6251131",
"0.62388444",
"0.6232812",
"0.61847985",
"0.61167014",
"0.610176",
"0.60612184",
"0.6059679",
"0.6050912",
"0.6019696",
"0.59665334",
"0.59554... | 0.8339601 | 1 |
Helper method to update the row styles array change_type NAME or SIZE or COLOR etc main method to change font, called from each separate font mutator method | def change_row_font(row_index, change_type, arg, font)
validate_workbook
ensure_cell_exists(row_index)
xf = workbook.register_new_font(font, get_row_xf(row_index))
row = sheet_data[row_index]
row.style_index = workbook.register_new_xf(xf)
row.cells.each { |c| c.font_switch(change_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = dee... | [
"0.81528986",
"0.777216",
"0.71433884",
"0.71403795",
"0.71403795",
"0.70109606",
"0.69861317",
"0.69000655",
"0.688968",
"0.68635523",
"0.6840403",
"0.67529863",
"0.67448753",
"0.67448753",
"0.66979074",
"0.6432949",
"0.6309624",
"0.6215985",
"0.62131596",
"0.6140738",
"0.60... | 0.77753985 | 1 |
Changes font name of cell | def change_font_name(new_font_name = 'Verdana')
validate_worksheet
font = get_cell_font.dup
font.set_name(new_font_name)
update_font_references(font)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_column_font_name(col=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf ... | [
"0.81314415",
"0.7896164",
"0.7712866",
"0.77062994",
"0.72959864",
"0.7255562",
"0.71670526",
"0.7110613",
"0.71081805",
"0.6693014",
"0.6693014",
"0.66816",
"0.66816",
"0.66166097",
"0.6615892",
"0.65713406",
"0.65297943",
"0.6436224",
"0.6427392",
"0.6379348",
"0.6362969",... | 0.8321192 | 0 |
Changes font size of cell | def change_font_size(font_size = 10)
validate_worksheet
raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)
font = get_cell_font.dup
font.set_size(font_size)
update_font_references(font)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_column_font_size(col=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n cha... | [
"0.77199495",
"0.7712393",
"0.7611653",
"0.71374416",
"0.6978516",
"0.692586",
"0.6728187",
"0.66601753",
"0.66556317",
"0.6619674",
"0.6533546",
"0.6522609",
"0.6501379",
"0.64703393",
"0.64372236",
"0.64372236",
"0.6417534",
"0.6395196",
"0.63928103",
"0.6318056",
"0.626153... | 0.7972899 | 0 |
Changes font color of cell | def change_font_color(font_color = '000000')
validate_worksheet
Color.validate_color(font_color)
font = get_cell_font.dup
font.set_rgb_color(font_color)
update_font_references(font)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_column_font_color(col=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, fon... | [
"0.7461787",
"0.7249745",
"0.72065777",
"0.71350855",
"0.712429",
"0.71065754",
"0.7073131",
"0.7073131",
"0.70110637",
"0.70012754",
"0.6859599",
"0.68218386",
"0.68218386",
"0.6811806",
"0.6794766",
"0.67469627",
"0.6735331",
"0.6648561",
"0.664566",
"0.64648116",
"0.640000... | 0.7695715 | 0 |
Changes font italics settings of cell | def change_font_italics(italicized = false)
validate_worksheet
font = get_cell_font.dup
font.set_italic(italicized)
update_font_references(font)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_font_italics(italicized=false)\n validate_worksheet\n # Get copy of font object with modified italics settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_font(font)\n end"... | [
"0.72236353",
"0.678297",
"0.6767767",
"0.6639636",
"0.6613759",
"0.6494832",
"0.6494832",
"0.64336115",
"0.6389968",
"0.63753814",
"0.63357896",
"0.6335046",
"0.63281983",
"0.63196945",
"0.62855744",
"0.62762696",
"0.62762696",
"0.6264959",
"0.6257875",
"0.6174606",
"0.61452... | 0.78815913 | 0 |
Changes font bold settings of cell | def change_font_bold(bolded = false)
validate_worksheet
font = get_cell_font.dup
font.set_bold(bolded)
update_font_references(font)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bold_cell(options = {}, &block)\n cell({ font_style: :bold }.merge(options || {}), &block)\n end",
"def change_font_bold(bolded=false)\n validate_worksheet\n # Get copy of font object with modified bold settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = mo... | [
"0.8035638",
"0.7800186",
"0.73778224",
"0.7356081",
"0.7309667",
"0.70927423",
"0.6959655",
"0.69148815",
"0.6847863",
"0.6847863",
"0.67769545",
"0.67683005",
"0.674681",
"0.674681",
"0.66853034",
"0.66853034",
"0.66616106",
"0.66564745",
"0.6619126",
"0.6587305",
"0.657956... | 0.8302406 | 0 |
Changes font underline settings of cell | def change_font_underline(underlined = false)
validate_worksheet
font = get_cell_font.dup
font.set_underline(underlined)
update_font_references(font)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_font_underline(underlined=false)\n validate_worksheet\n # Get copy of font object with modified underline settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_underline(font, underlined)\n # Update font and xf array\n change_font(font)\n ... | [
"0.7695589",
"0.7397015",
"0.7152001",
"0.6990113",
"0.66901463",
"0.66901463",
"0.63874716",
"0.637665",
"0.6372925",
"0.6372925",
"0.63182336",
"0.6254913",
"0.61407024",
"0.6133203",
"0.6093899",
"0.60723346",
"0.60723346",
"0.59276927",
"0.58676517",
"0.5845751",
"0.58457... | 0.826207 | 0 |
Sign out users that expired, but check each 5min or so | def sign_out_expired_session
return unless current_user.present?
return if current_user.last_sign_in_check.present? && current_user.last_sign_in_check <= 5.minutes.ago
current_user.update last_sign_in_check: Time.now
if UniversumSsoClient.signed_out?(current_user.uid)
session[:user_id] = nil
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_expired!\n sessions.remove( { :expire => { '$lt' => Time.now } } )\n end",
"def expire\n touch :expires_at\n\n user.subscriptions.facebook.each do |subscription|\n subscription.deactivate\n end\n\n UserMailer.access_token_expired_email(user).deliver\n end",
"def perf... | [
"0.709647",
"0.6901253",
"0.68786657",
"0.6667334",
"0.64914",
"0.646918",
"0.642632",
"0.63955027",
"0.637446",
"0.637446",
"0.6355509",
"0.6298883",
"0.62933177",
"0.626521",
"0.62438047",
"0.62311155",
"0.6220791",
"0.62164086",
"0.61930686",
"0.6187678",
"0.61816233",
"... | 0.7406081 | 0 |
instantiate car, beginning with an empty cars array, then running ready_go method | def initialize
@cars = []
ready_go
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ready_go\n @cars << Car.new\n @cars << Car.new\n\n @cars.first.accelerate(random_speed)\n @cars.last.accelerate(random_speed)\n end",
"def initialize\n\t\t@cars = Array.new(2) { |i| Car.new }\n\t\t@cars.each { |car| car.accelerate(rand(1..100)) }\n\tend",
"def initialize\n\t\t@@cars_created +=... | [
"0.7600033",
"0.687104",
"0.66208076",
"0.6409292",
"0.6236859",
"0.622376",
"0.5987254",
"0.59474766",
"0.5944182",
"0.5929732",
"0.5876827",
"0.5736802",
"0.5665938",
"0.56465334",
"0.56434804",
"0.56250894",
"0.561246",
"0.5570857",
"0.5555686",
"0.55537194",
"0.5498692",
... | 0.8353904 | 0 |
method runs when race is instantiated; creates 2 new car instances runs accelerate method from Car class on both new cars and sets random speed | def ready_go
@cars << Car.new
@cars << Car.new
@cars.first.accelerate(random_speed)
@cars.last.accelerate(random_speed)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n\t\t@cars = Array.new(2) { |i| Car.new }\n\t\t@cars.each { |car| car.accelerate(rand(1..100)) }\n\tend",
"def accelerate\n @speed = @speed + @accelerator\n end",
"def race; end",
"def race; end",
"def race; end",
"def race; end",
"def race; end",
"def race; end",
"def accelerate... | [
"0.7564324",
"0.63941765",
"0.6352995",
"0.6352995",
"0.6352995",
"0.6352995",
"0.6352995",
"0.6352995",
"0.62272406",
"0.6182051",
"0.6178175",
"0.6166637",
"0.60955286",
"0.60896087",
"0.6033562",
"0.60181546",
"0.6006431",
"0.5977956",
"0.59735227",
"0.5850408",
"0.5843975... | 0.79100513 | 0 |
gets winner by sorting the two cars by speed; car with higher speed will be last and is the winner | def winner
@cars.sort_by(&:speed).last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loser\n @cars.sort_by(&:speed).first\n end",
"def determine_winner\n @active_players.sort! do |player1, player2|\n if player1.strongest_hand > player2.strongest_hand\n -1\n elsif player1.strongest_hand < player2.strongest_hand\n 1\n else\n 0\n end\n end\nend",
"def winner(s... | [
"0.7321418",
"0.71831596",
"0.67357004",
"0.66314554",
"0.6460764",
"0.6365369",
"0.6320158",
"0.6278198",
"0.6260675",
"0.623123",
"0.61076343",
"0.6069894",
"0.6042041",
"0.59932053",
"0.5979605",
"0.5977265",
"0.5960466",
"0.595597",
"0.5953762",
"0.59519035",
"0.59418917"... | 0.85961664 | 0 |
gets loser by sorting the two cars by speed; car with lower speed will be first and is the loser | def loser
@cars.sort_by(&:speed).first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\n @cars.sort_by(&:speed).last\n end",
"def sort_drivers\n @drivers.sort! {|x, y| y.miles_driven <=> x.miles_driven}\n end",
"def cars_sorted_by_price\n @inventory.sort_by { |car| car.total_cost }\n end",
"def sortByDistanceFrom(otherLocation)\n ParkingSpots.new(@_parkingSpots.sort {... | [
"0.73397356",
"0.6214933",
"0.61986405",
"0.5973509",
"0.593515",
"0.5872672",
"0.5830151",
"0.5787065",
"0.5775618",
"0.5654479",
"0.556985",
"0.53686947",
"0.5350722",
"0.5286217",
"0.52636844",
"0.5244282",
"0.5231909",
"0.52247494",
"0.52035016",
"0.52019566",
"0.519644",... | 0.84053016 | 0 |
Returns an adjacent enemy with the lowest HP and in reading order. | def find_adjacent_enemy(unit)
neighbors(unit.pos)
.map { |p| @units.find { |u| u.pos == p } }
.select { |u| u&.alive? && u.type != unit.type }
.min_by { |u| [u.hp, u.pos] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_free_enemy(event_id)\n i = 1\n while i < $Enemies.length \n if !$Enemies[i].active\n $Enemies[i].set_id(event_id)\n $Enemies[i].set_active\n $Enemies[i].set_map_id\n return i\n break\n end\n i += 1 \n end\n end",
"def enemy_attack... | [
"0.5935563",
"0.5862665",
"0.5827971",
"0.5814727",
"0.5625451",
"0.5602667",
"0.5598812",
"0.55414605",
"0.5518041",
"0.54982936",
"0.54871815",
"0.54761016",
"0.5450481",
"0.5411065",
"0.5398956",
"0.53613365",
"0.5348235",
"0.534339",
"0.5309293",
"0.5302371",
"0.5261282",... | 0.6385588 | 0 |
Returns the shortest path from src to one of the destinations. If there are multiple shortest paths, e.g. A>B has the same length as A>C, returns all of them. | def shortest_paths(src, destinations)
return [] if destinations.empty?
paths = []
visited = Set.new([src])
queue = Containers::MinHeap.new
queue.push([1, [src]])
until queue.empty?
_, path = queue.pop
# Not going to find shorter paths than current best, return.
break if path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_paths(source, dest)\n\t\t\t@source = source\n\t\t\tdijkstra source\n\t\t\tprint_path dest\n\t\t\treturn @distance[dest]\n\t\tend",
"def shortest_way(source, dest)\n\t\t@source = source\n dijkstra source\n \n if @distances[dest] != @infinity\n return @distances[dest]\n... | [
"0.7356156",
"0.72956985",
"0.7255069",
"0.7244874",
"0.7243841",
"0.7241848",
"0.7071049",
"0.69669163",
"0.6962118",
"0.6934361",
"0.6930844",
"0.6899296",
"0.68192947",
"0.68038255",
"0.6680243",
"0.6653647",
"0.65617514",
"0.65464807",
"0.6481064",
"0.64776665",
"0.646606... | 0.804517 | 0 |
The introspection system is prepared with a bunch of LateBoundTypes. Replace those with the objects that they refer to, since LateBoundTypes aren't handled at runtime. | def resolve_late_bindings
@types.each do |name, t|
if t.kind.fields?
t.fields.each do |_name, field_defn|
field_defn.type = resolve_late_binding(field_defn.type)
end
end
end
@entry_point_fields.each do |name, f|
f.type = resolv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_late_bound_types_with_built_in(types)\n GraphQL::Schema::BUILT_IN_TYPES.each do |scalar_name, built_in_scalar|\n existing_type = types[scalar_name]\n if existing_type.is_a?(GraphQL::Schema::LateBoundType)\n types[scalar_name] = built_in_scalar\n en... | [
"0.6899712",
"0.6023782",
"0.58795905",
"0.5839059",
"0.5776291",
"0.55884314",
"0.55273604",
"0.5485643",
"0.5435414",
"0.54223526",
"0.5421705",
"0.5408585",
"0.54031736",
"0.5332975",
"0.5289836",
"0.5289836",
"0.52734077",
"0.52734077",
"0.526387",
"0.5257885",
"0.5248008... | 0.6422491 | 1 |
Challenge 2 Calculator Create a simple calculator that first asks the user what method they would like to use (addition, subtraction, multiplication, division) and then asks the user for two numbers, returning the result of the method with the two numbers. Here is a sample prompt: What calculation would you like to do?... | def calculator
#ask user method
puts "What calculation would you like to do? (add, sub, mult, div)"
calc_type = gets.chomp
#ask for first number
puts "What is number 1? where result = num_1 operator num_2"
num_1 = gets.chomp
num_1 = num_1.to_f
#ask for second number
puts "What is n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculator()\n\n\tputs \"What kind of operation would you like to do - addition, substraction, multiplication, division\"\n\tchoice = gets.chomp\n\n\tputs \"What is number 1\"\n\tnum_1 = gets.chomp.to_f\n\n\tputs \"What is number 2\"\n\tnum_2 = gets.chomp.to_f\n\n\tcase choice\n\t\twhen \"addition\"\n\t\t\ttot... | [
"0.8001223",
"0.7889607",
"0.78600824",
"0.781014",
"0.7805129",
"0.7786566",
"0.7779403",
"0.7767423",
"0.7731978",
"0.7592265",
"0.7579605",
"0.7567149",
"0.7562794",
"0.7539188",
"0.7488816",
"0.74720186",
"0.73925084",
"0.7382979",
"0.7375263",
"0.73715585",
"0.7370982",
... | 0.797191 | 1 |
Override this method so that Rails uses :ssn in routes instead of :id | def to_param
ssn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ssn\n legacy_ssn\n end",
"def ssn\n # converts '123-45-6789' to 'xxx-xx-6789'\n 'xxx-xx-' + @ssn.split(\"-\").last\nend",
"def ssn\n # converts '123-45-6789' to 'xxx-xx-6789'\n 'xxx-xx-' + @ssn.split('-').last\nend",
"def ssn\n #converts '123-45-6789' to 'xxx-xx-6789'\n 'xxx-xx-x' + @ssn.split(... | [
"0.70171565",
"0.6557037",
"0.65499616",
"0.64264876",
"0.60873747",
"0.58631855",
"0.5850509",
"0.5815213",
"0.5753406",
"0.57305574",
"0.564014",
"0.55743694",
"0.55556226",
"0.555367",
"0.553803",
"0.55286986",
"0.5518139",
"0.5518139",
"0.5518139",
"0.5512503",
"0.55113",... | 0.67526466 | 1 |
Generate url that will redirect user to OAuth Dialogue. The canvas url should start by https:// and end with a slash. If you're building an facebook app, the canvas_url should be something like | def dialogue_url
return "https://www.facebook.com/dialog/oauth?client_id="+@app_id+"&redirect_uri="+@canvas_url+"&scope="+@permission
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oauth_url\n url = <<-URL\n https://www.facebook.com/dialog/oauth/\n ?client_id=#{Network::Facebook.app_id}\n &redirect_uri=#{URI.escape(\"#{root_url}auth/facebook/?r=#{redirect_for(request.referer)}\")}\n &scope=#{Network::Facebook.scope}\n URL\n url.gsub(/\\s+/, '')\n end",
"de... | [
"0.77673143",
"0.7463259",
"0.73362935",
"0.727917",
"0.72202975",
"0.72021705",
"0.7188308",
"0.71678716",
"0.7117492",
"0.7117399",
"0.6944495",
"0.68771803",
"0.68126243",
"0.6753707",
"0.67356294",
"0.67098683",
"0.667351",
"0.6668717",
"0.6666714",
"0.66426975",
"0.66381... | 0.77077496 | 1 |
GET /donation_record/actual_funds GET /donation_record/actual_funds.json | def index
@donation_record_actual_funds = DonationRecord::ActualFund.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: @fund\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def show\n @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_donation }\n ... | [
"0.6596142",
"0.65945756",
"0.63615215",
"0.6305707",
"0.6161346",
"0.61455595",
"0.61093575",
"0.60901374",
"0.6036757",
"0.60334677",
"0.6016985",
"0.6011211",
"0.5970263",
"0.59364307",
"0.5925354",
"0.58733046",
"0.5871314",
"0.58607954",
"0.585958",
"0.5850797",
"0.58495... | 0.7299994 | 0 |
POST /donation_record/actual_funds POST /donation_record/actual_funds.json | def create
# raise donation_record_actual_fund_params.inspect
@donation_record_actual_fund = DonationRecord::ActualFund.new(donation_record_actual_fund_params)
@donation_record_actual_fund.donation_record = @donation_record
respond_to do |format|
if @donation_record_actual_fund.save
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def donation_record_actual_fund_params\n params.require(:donation_record_actual_fund)\n... | [
"0.65340567",
"0.6393791",
"0.6371374",
"0.6208825",
"0.6162286",
"0.6146011",
"0.61390823",
"0.6119465",
"0.60814506",
"0.6075106",
"0.60108215",
"0.5993477",
"0.5993477",
"0.59488827",
"0.5924591",
"0.5907125",
"0.58687466",
"0.5862193",
"0.5857213",
"0.58563",
"0.5840352",... | 0.70836675 | 0 |
PATCH/PUT /donation_record/actual_funds/1 PATCH/PUT /donation_record/actual_funds/1.json | def update
respond_to do |format|
if @donation_record_actual_fund.update(donation_record_actual_fund_params)
format.html { redirect_to @donation_record }
format.json { render :show, status: :ok, location: @donation_record_actual_fund }
else
format.html { render :edit }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @fund.update(fund_params)\n head :no_content\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def update\n @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n if @financial_donation.update_attributes... | [
"0.7077915",
"0.6724212",
"0.66699964",
"0.6653356",
"0.6619549",
"0.6597654",
"0.6597654",
"0.6472627",
"0.6453055",
"0.6384767",
"0.6382418",
"0.6380618",
"0.6364759",
"0.63643014",
"0.63605064",
"0.6359064",
"0.6346527",
"0.6346527",
"0.634648",
"0.6337091",
"0.63262707",
... | 0.74511325 | 0 |
DELETE /donation_record/actual_funds/1 DELETE /donation_record/actual_funds/1.json | def destroy
@donation_record_actual_fund.destroy
respond_to do |format|
format.html { redirect_to @donation_record}
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @financial_donation = FinancialDonation.find(params[:id])\n @financial_donation.destroy\n\n respond_to do |format|\n format.html { redirect_to financial_donations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fund.destroy\n\n head :no_content\n ... | [
"0.71260846",
"0.69668245",
"0.692731",
"0.6921285",
"0.6893681",
"0.68904257",
"0.6762004",
"0.6749507",
"0.6740935",
"0.6737535",
"0.6737535",
"0.6731841",
"0.6730209",
"0.6730209",
"0.6719878",
"0.6699781",
"0.66980433",
"0.6689116",
"0.6689069",
"0.668449",
"0.6666043",
... | 0.77491415 | 0 |
Public: insert Allows a person to insert an object into the "dogs" table. Parameters: No Parameters Returns: id State changes: NA? This method IS working. | def insert
DATABASE.execute("INSERT INTO dogs (name, breed, age, serial_num, colour, description, temperament_id, owner_id) VALUES
('#{@name}', '#{@breed}', #{@age}, #{@serial_num}, '#{@colour}', '#{@description}', #{@temperament_id}, #{@owner_id})")
@id = DATABASE.last_insert_row_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_dog(name)\n @db.get_first_value('INSERT INTO dogs VALUES (null, :name)', \n ':name' => name)\n end",
"def save \n if self.id \n self.update\n else\n sql = <<-SQL\n INSERT INTO dogs (name, breed) \n VALUES (?, ?)\n SQL\n DB[:conn].execute(... | [
"0.70982844",
"0.7040118",
"0.6813493",
"0.6692974",
"0.6578374",
"0.63533133",
"0.63266695",
"0.6322296",
"0.6293022",
"0.6206442",
"0.6147826",
"0.6115783",
"0.60721695",
"0.6044648",
"0.60252905",
"0.6023231",
"0.59795785",
"0.59591275",
"0.5957428",
"0.5950503",
"0.593797... | 0.74263877 | 0 |
return all contracts for a clan newest first | def get_contracts
Contract.where(clan_id: id).order('start_date_time desc')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @employment_contracts = EmploymentContract.order(\"created_at desc\")\n end",
"def index\n @contracts = Contract.all.first(50000)\n end",
"def sort_contracts(how_many)\n return_array = []\n contracts_sorted = join_table_gas_simulation_contracts.sort_by(&:savings).reverse\n how_many... | [
"0.58834624",
"0.5801333",
"0.5739579",
"0.56616473",
"0.5656057",
"0.55541444",
"0.55098265",
"0.55043143",
"0.5476279",
"0.5446749",
"0.5417555",
"0.5410505",
"0.5337612",
"0.53325564",
"0.53202784",
"0.53202426",
"0.52933043",
"0.526573",
"0.52451736",
"0.52451736",
"0.524... | 0.74952155 | 0 |
GET /dianosaurs GET /dianosaurs.json | def index
@dianosaurs = Dianosaur.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end",
"def show\n dinosaurs = Dinosaur.filter_by_species(params[:species])\n\n if dinosaurs\n render json: dinosaurs\n else\n render j... | [
"0.65777904",
"0.65596354",
"0.6470492",
"0.617811",
"0.6157605",
"0.613789",
"0.6126394",
"0.61251336",
"0.61018944",
"0.610158",
"0.6087258",
"0.60863346",
"0.60516644",
"0.603589",
"0.60243237",
"0.6007011",
"0.6003411",
"0.6001562",
"0.6001041",
"0.5988936",
"0.5985258",
... | 0.6803119 | 0 |
POST /dianosaurs POST /dianosaurs.json | def create
@dianosaur = Dianosaur.new(dianosaur_params)
respond_to do |format|
if @dianosaur.save
format.html { redirect_to @dianosaur, notice: 'Dianosaur was successfully created.' }
format.json { render :show, status: :created, location: @dianosaur }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n neuron = Neuron.create! params\n render :json => neuron\n # @neuron = Neuron.new(params[:neuron])\n # \n # respond_to do |format|\n # if @neuron.save\n # format.html { redirect_to @neuron, notice: 'Neuron was successfully created.' }\n # format.json { render json: @ne... | [
"0.616665",
"0.61308",
"0.602781",
"0.5998858",
"0.5955735",
"0.5935511",
"0.5916064",
"0.591441",
"0.59037507",
"0.5852463",
"0.58503026",
"0.58277565",
"0.5826517",
"0.5823598",
"0.5815129",
"0.5812158",
"0.58114207",
"0.580662",
"0.5795816",
"0.57928896",
"0.5791833",
"0... | 0.63877773 | 0 |
GET /profile_diet_tags GET /profile_diet_tags.json | def index
@profile_diet_tags = ProfileDietTag.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get('tags')\n end",
"def profile_diet_tag_params\n params[:profile_diet_tag]\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(... | [
"0.7142842",
"0.68965954",
"0.6883749",
"0.6806724",
"0.6692058",
"0.6658526",
"0.6566993",
"0.65361464",
"0.6491817",
"0.64789355",
"0.63980937",
"0.63587475",
"0.63569975",
"0.63379407",
"0.6311361",
"0.6305095",
"0.6297352",
"0.62745374",
"0.6233613",
"0.61860204",
"0.6181... | 0.7445801 | 0 |
POST /profile_diet_tags POST /profile_diet_tags.json | def create
@profile_diet_tag = ProfileDietTag.new(profile_diet_tag_params)
respond_to do |format|
if @profile_diet_tag.save
format.html { redirect_to @profile_diet_tag, notice: 'Profile diet tag was successfully created.' }
format.json { render :show, status: :created, location: @profile_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_diet_tag_params\n params[:profile_diet_tag]\n end",
"def set_profile_diet_tag\n @profile_diet_tag = ProfileDietTag.find(params[:id])\n end",
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def create\n create_tags = params[:create_tags]\n\t@good = Go... | [
"0.70521736",
"0.66481566",
"0.6553769",
"0.6461527",
"0.642987",
"0.64071137",
"0.6380477",
"0.63663846",
"0.632313",
"0.63159275",
"0.6286612",
"0.626933",
"0.61837506",
"0.61769056",
"0.61709404",
"0.61588347",
"0.6151251",
"0.6146749",
"0.61093503",
"0.61013556",
"0.60987... | 0.73827595 | 0 |
PATCH/PUT /profile_diet_tags/1 PATCH/PUT /profile_diet_tags/1.json | def update
respond_to do |format|
if @profile_diet_tag.update(profile_diet_tag_params)
format.html { redirect_to @profile_diet_tag, notice: 'Profile diet tag was successfully updated.' }
format.json { render :show, status: :ok, location: @profile_diet_tag }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n e... | [
"0.6664996",
"0.6643254",
"0.66188973",
"0.65276206",
"0.649324",
"0.6489285",
"0.64805245",
"0.6435596",
"0.6403571",
"0.6397",
"0.63879144",
"0.6385376",
"0.6372976",
"0.6372242",
"0.63689464",
"0.63621056",
"0.632354",
"0.63157797",
"0.6311971",
"0.6301702",
"0.62908125",
... | 0.71593434 | 0 |
DELETE /profile_diet_tags/1 DELETE /profile_diet_tags/1.json | def destroy
@profile_diet_tag.destroy
respond_to do |format|
format.html { redirect_to profile_diet_tags_url, notice: 'Profile diet tag was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tag tag\n delete \"tag/#{tag}\"\n end",
"def destroy\n @taggable = current_user.taggables.find(params[:id])\n\n #destroy each tag in the taggable\n @taggable.tags.each do |tag|\n tag.destroy\n end\n\n @taggable.destroy\n\n respond_to do |format|\n format.html { redirect... | [
"0.69575983",
"0.6917325",
"0.68746173",
"0.68551624",
"0.68442327",
"0.6834783",
"0.6800929",
"0.67851555",
"0.6774468",
"0.6736361",
"0.67280346",
"0.6727677",
"0.67258817",
"0.6720031",
"0.6709845",
"0.6705972",
"0.66859263",
"0.6683117",
"0.6679981",
"0.66774035",
"0.6661... | 0.7578931 | 0 |
TODO: separate apply_changes! and import! | def import!
return unless imported? or updated?
Outgoing::Workcamp.transaction do
import_changes.each do |change|
change.apply(self)
change.destroy
end
self.state = nil
save!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_and_import\n transform_files\n import\n end",
"def post_import\n end",
"def import()\n # TODO\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def before_import ; end",
"def import!\n import_binary_files\n member_id... | [
"0.652848",
"0.6454858",
"0.6441292",
"0.6432445",
"0.6432445",
"0.6432445",
"0.6432445",
"0.6399303",
"0.6398597",
"0.6259397",
"0.62538636",
"0.62201315",
"0.59568655",
"0.59442264",
"0.58364415",
"0.58067614",
"0.5786837",
"0.57164264",
"0.5630557",
"0.5605964",
"0.5600712... | 0.6985719 | 1 |
puts " "4 + ""1 + " "2 + ""1 puts " "3 + ""2 + " "2 + ""2 puts " "2 + ""3 + " "2 + ""3 puts " "1 + ""4 + " "2 + ""4 puts " "0 + ""5 + " "2 + ""5 end pyramid | def pyramid(height)
level = 1
height.times do
puts " "*(height-level) + "#"*level + " "*2 + "#"*level
level += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pyramid(height)\n height.times do |n|\n print ' ' * (height - n)\n puts '#' * (2 * n + 1)\n end\n\nend",
"def pyramid(n)\n count = 1\n n.times do\n puts (\" \" * (n - count)) + (\"#\" * count)\n count += 1\n end\nend",
"def wtf_pyramid\n\tputs \"*\" * 50\n\tputs\"Salut, Bienvenue dans ma s... | [
"0.86940897",
"0.8581337",
"0.8279244",
"0.8246566",
"0.8187696",
"0.79911286",
"0.79540455",
"0.7868794",
"0.78534204",
"0.7844643",
"0.77921313",
"0.7789721",
"0.7712014",
"0.7622058",
"0.7479663",
"0.74607706",
"0.7357109",
"0.7329457",
"0.72568244",
"0.7231937",
"0.718992... | 0.87041426 | 0 |
Send text messages to all participants with their assignment. | def notify_participants participants
participants.each do |participant|
send_message participant.to_participant_message, participant.phone_number
puts "#{participant.name} has received a text message at #{participant.phone_number}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def broadcast_message(text)\n @users.each {|u| u.enqueue_message(text) }\n end",
"def send_text_to_members(user)\n message = 'appointment hasa been scheduled'\n assignee = assigned_to.full_name\n service_name = service.name\n case progress\n when 'SCHEDULED'\n message = \"appo... | [
"0.6158091",
"0.6051684",
"0.58300364",
"0.57916594",
"0.5719044",
"0.570903",
"0.56697273",
"0.56584173",
"0.56578845",
"0.5623198",
"0.55914986",
"0.5588978",
"0.55024636",
"0.55012864",
"0.5483118",
"0.54153556",
"0.5413055",
"0.5402287",
"0.5394616",
"0.53877956",
"0.5369... | 0.6919665 | 0 |
sends a backup message to a specified phone number with all assignments. | def send_backup_message participants, phone_number
intro = "here are the secret santa assignments:\n"
message = intro + participants.map(&:to_backup_message).join("\n")
send_message message, phone_number
puts "a backup of all assignments has been sent to #{phone_number}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backup_request(client, filename, message)\n filename = \"BACKUP_#{filename}\"\n aFile = File.open(filename, 'w+')\n if aFile\n File.write(filename, message)\n puts \"Updated: #{filename}\"\n else\n client.puts \"ERROR: Unable to open file #{filename}\"\n end\n aFile.close\n ... | [
"0.5719056",
"0.57009673",
"0.5626111",
"0.5570714",
"0.5550205",
"0.53960043",
"0.53849936",
"0.53594387",
"0.5324955",
"0.52405137",
"0.52265096",
"0.5200432",
"0.51921225",
"0.5185178",
"0.51113886",
"0.50760955",
"0.50602907",
"0.5048155",
"0.50281817",
"0.50161755",
"0.5... | 0.7917469 | 0 |
(re) init with given args and frame types | def init(arguments_type, frame_type)
raise "Wrong argument type, expect Type not #{arguments_type.class}" unless arguments_type.is_a? Type
raise "Wrong frame type, expect Type not #{frame_type.class}" unless frame_type.is_a? Type
@arguments_type = arguments_type
@frame_type = frame_type
@b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(*args); end",
"def build(args={})\n klass = FRAME_TYPE_MAP[args[:type].to_i]\n if(klass == FrameType::Response)\n klass.new(:response => args[:data])\n elsif(klass == FrameType::Error)\n klass.new(:error => args[:data])\n elsif(klass == FrameType::Mess... | [
"0.67121077",
"0.6652466",
"0.6518489",
"0.643161",
"0.642996",
"0.62745786",
"0.6259297",
"0.6256564",
"0.6185408",
"0.6180649",
"0.6157157",
"0.6140022",
"0.6109725",
"0.6101269",
"0.60784936",
"0.6067755",
"0.6067755",
"0.6067755",
"0.6067755",
"0.6067755",
"0.6046578",
... | 0.74155045 | 0 |
determine if method has a local variable or tmp (anonymous local) by given name | def has_local( name )
raise "has_local #{name}.#{name.class}" unless name.is_a? Symbol
@frame_type.variable_index( name )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_local name\n raise \"has_local #{name}.#{name.class}\" unless name.is_a? Symbol\n index = self.locals.index_of(name)\n index = self.tmps.index_of(name) unless index\n index\n end",
"def has_local name\n raise \"has_local #{name}.#{name.class}\" unless name.is_a? Symbol\n ... | [
"0.7665879",
"0.70041084",
"0.6953241",
"0.68916005",
"0.67192",
"0.6613709",
"0.6534072",
"0.6519087",
"0.6473429",
"0.6448009",
"0.63289285",
"0.63084507",
"0.61489034",
"0.6125273",
"0.6074033",
"0.60447836",
"0.6017613",
"0.6014759",
"0.5972813",
"0.593316",
"0.5914293",
... | 0.7292292 | 1 |
GET /child_development_periods GET /child_development_periods.json | def index
@child_development_periods = ChildDevelopmentPeriod.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_child_development_period\n @child_development_period = ChildDevelopmentPeriod.find(params[:id])\n end",
"def index\n @child_developments = ChildDevelopment.all\n end",
"def create\n @child_development_period = ChildDevelopmentPeriod.new(child_development_period_params)\n\n respond_to ... | [
"0.69758034",
"0.640947",
"0.6390286",
"0.61557466",
"0.6085102",
"0.6001446",
"0.59693027",
"0.590505",
"0.573719",
"0.57259434",
"0.5722979",
"0.5598566",
"0.55977863",
"0.55829626",
"0.55794066",
"0.55002415",
"0.5474265",
"0.54159534",
"0.5414544",
"0.5394703",
"0.5366093... | 0.8194255 | 0 |
POST /child_development_periods POST /child_development_periods.json | def create
@child_development_period = ChildDevelopmentPeriod.new(child_development_period_params)
respond_to do |format|
if @child_development_period.save
format.html { redirect_to @child_development_period, notice: 'Child development period was successfully created.' }
format.json { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_child_development_period\n @child_development_period = ChildDevelopmentPeriod.find(params[:id])\n end",
"def index\n @child_development_periods = ChildDevelopmentPeriod.all\n end",
"def child_development_period_params\n params.require(:child_development_period).permit(:date_contol, :we... | [
"0.7117874",
"0.70029455",
"0.6716167",
"0.63868314",
"0.63679063",
"0.63424206",
"0.60324746",
"0.58875847",
"0.5619923",
"0.5458914",
"0.5419847",
"0.5407736",
"0.5393691",
"0.53787434",
"0.5371079",
"0.53701997",
"0.5340205",
"0.52444357",
"0.5240653",
"0.5239106",
"0.5228... | 0.7651888 | 0 |
PATCH/PUT /child_development_periods/1 PATCH/PUT /child_development_periods/1.json | def update
respond_to do |format|
if @child_development_period.update(child_development_period_params)
format.html { redirect_to @child_development_period, notice: 'Child development period was successfully updated.' }
format.json { render :show, status: :ok, location: @child_development_perio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_child_development_period\n @child_development_period = ChildDevelopmentPeriod.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @child_development.update(child_development_params)\n format.html { redirect_to @child_development, notice: 'Child development was succe... | [
"0.67845225",
"0.65882975",
"0.5952047",
"0.5906064",
"0.5891917",
"0.58800197",
"0.5846184",
"0.5816103",
"0.57868135",
"0.57868135",
"0.5779291",
"0.57763153",
"0.57748663",
"0.57711303",
"0.5764872",
"0.57530135",
"0.569453",
"0.569018",
"0.5684128",
"0.56793714",
"0.56503... | 0.7338058 | 0 |
DELETE /child_development_periods/1 DELETE /child_development_periods/1.json | def destroy
@child_development_period.destroy
respond_to do |format|
format.html { redirect_to child_development_periods_url, notice: 'Child development period was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @child_development.destroy\n respond_to do |format|\n format.html { redirect_to child_developments_url, notice: 'Child development was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_period.destroy\n format.json { head :no_c... | [
"0.67801195",
"0.6630352",
"0.65738904",
"0.630415",
"0.6274035",
"0.6260299",
"0.6245592",
"0.62078804",
"0.62060404",
"0.62027586",
"0.6199362",
"0.6194493",
"0.6173129",
"0.616686",
"0.61606044",
"0.61487687",
"0.61401623",
"0.61256933",
"0.6103577",
"0.6099403",
"0.609662... | 0.7515133 | 0 |
Update an existing LDAP identity source Update the configuration of an existing LDAP identity source. You may wish to verify the new configuration using the POST /aaa/ldapidentitysources?action&x3D;probe API before changing the configuration. | def create_or_update_ldap_identity_source_with_http_info(ldap_identity_source_id, ldap_identity_source, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.create_or_update_ldap_identity_source ...'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = '... | [
"0.59991425",
"0.5871316",
"0.5868173",
"0.58411664",
"0.58411664",
"0.58009285",
"0.5790004",
"0.5766625",
"0.57663774",
"0.5713809",
"0.5705056",
"0.56901103",
"0.5675639",
"0.5654438",
"0.5643843",
"0.56350017",
"0.56350017",
"0.5630999",
"0.5630999",
"0.5622461",
"0.56220... | 0.6223852 | 0 |
Delete an LDAP identity source Delete an LDAP identity source. Users defined in that source will no longer be able to access NSX. | def delete_ldap_identity_source(ldap_identity_source_id, opts = {})
delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source ...'\n end\n # verify the required ... | [
"0.6723568",
"0.6233082",
"0.61297023",
"0.59645885",
"0.5926988",
"0.5892196",
"0.5750985",
"0.57506543",
"0.5746354",
"0.57235134",
"0.5718202",
"0.5718202",
"0.5718202",
"0.5718202",
"0.57054794",
"0.57052445",
"0.5684634",
"0.5679185",
"0.5638329",
"0.5606411",
"0.5597102... | 0.70585525 | 0 |
Delete an LDAP identity source Delete an LDAP identity source. Users defined in that source will no longer be able to access NSX. | def delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.delete_ldap_identity_source ...'
end
# verify the required parameter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_ldap_identity_source(ldap_identity_source_id, opts = {})\n delete_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n nil\n end",
"def destroy\n return false if @label.to_s.empty?\n\n response = delete(\"/2.0/accounts/#{@account_id}/sources/#{@label}\")\n @... | [
"0.70582306",
"0.6231639",
"0.61289907",
"0.596344",
"0.5927216",
"0.5892083",
"0.575091",
"0.5750589",
"0.5746151",
"0.5722867",
"0.57174736",
"0.57174736",
"0.57174736",
"0.57174736",
"0.5705863",
"0.57056266",
"0.56840503",
"0.5678719",
"0.5637872",
"0.56053716",
"0.559638... | 0.672373 | 1 |
List LDAP identity sources Return a list of all configured LDAP identity sources. | def list_ldap_identity_sources(opts = {})
data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_ldap_identity_sources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...'\n end\n if @api_client.config.client_side_validation && !... | [
"0.63612556",
"0.622355",
"0.593756",
"0.58011377",
"0.5699125",
"0.5532021",
"0.5532021",
"0.55220413",
"0.5519219",
"0.54380757",
"0.54123676",
"0.53952926",
"0.5388987",
"0.5300855",
"0.52596927",
"0.52528185",
"0.522744",
"0.52056587",
"0.5184532",
"0.5147061",
"0.5123818... | 0.84067184 | 0 |
List LDAP identity sources Return a list of all configured LDAP identity sources. | def list_ldap_identity_sources_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.list_ldap_identity_sources ...'
end
if @api_client.config.client_side_validation && !opts[:'pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_ldap_identity_sources(opts = {})\n data, _status_code, _headers = list_ldap_identity_sources_with_http_info(opts)\n data\n end",
"def get_authentication_sources(opts = {})\n data, _status_code, _headers = get_authentication_sources_with_http_info(opts)\n data\n end",
"def lis... | [
"0.84067184",
"0.622355",
"0.593756",
"0.58011377",
"0.5699125",
"0.5532021",
"0.5532021",
"0.55220413",
"0.5519219",
"0.54380757",
"0.54123676",
"0.53952926",
"0.5388987",
"0.5300855",
"0.52596927",
"0.52528185",
"0.522744",
"0.52056587",
"0.5184532",
"0.5147061",
"0.5123818... | 0.63612556 | 1 |
Probe an LDAP identity source Verify that the configuration of an LDAP identity source is correct before actually creating the source. | def probe_unconfigured_ldap_identity_source_probe_identity_source_with_http_info(ldap_identity_source, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_unconfigured_ldap_identity_source_probe_ide... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probe_configured_ldap_identity_source_probe_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.probe_configured_ldap_identity_source_probe ...'\n e... | [
"0.6635697",
"0.6583088",
"0.64369255",
"0.6053089",
"0.5782503",
"0.55669475",
"0.5522772",
"0.5063628",
"0.5029683",
"0.4997031",
"0.4904828",
"0.48154947",
"0.4751302",
"0.47235876",
"0.46993345",
"0.46986765",
"0.4696389",
"0.46951333",
"0.46795785",
"0.46706608",
"0.4652... | 0.68749434 | 0 |
Read a single LDAP identity source Return details about one LDAP identity source | def read_ldap_identity_source(ldap_identity_source_id, opts = {})
data, _status_code, _headers = read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...'\n end\n # verify the required para... | [
"0.6929651",
"0.6626802",
"0.61915314",
"0.59994817",
"0.599063",
"0.588267",
"0.585672",
"0.58158505",
"0.56406635",
"0.5612808",
"0.5599504",
"0.5595735",
"0.55811137",
"0.5580492",
"0.55786854",
"0.5471295",
"0.5376232",
"0.53758705",
"0.53758705",
"0.53758705",
"0.5375870... | 0.6827542 | 1 |
Read a single LDAP identity source Return details about one LDAP identity source | def read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementLDAPIdentitySourcesApi.read_ldap_identity_source ...'
end
# verify the required parameter 'ld... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_ldap_identity_source(ldap_identity_source_id, opts = {})\n data, _status_code, _headers = read_ldap_identity_source_with_http_info(ldap_identity_source_id, opts)\n data\n end",
"def show\n @ldap_auth_header = Irm::LdapAuthHeader.list_all.find(params[:id])\n puts @ldap_auth_header.ldap... | [
"0.6827542",
"0.6626802",
"0.61915314",
"0.59994817",
"0.599063",
"0.588267",
"0.585672",
"0.58158505",
"0.56406635",
"0.5612808",
"0.5599504",
"0.5595735",
"0.55811137",
"0.5580492",
"0.55786854",
"0.5471295",
"0.5376232",
"0.53758705",
"0.53758705",
"0.53758705",
"0.5375870... | 0.6929651 | 0 |
Gets recommended topics for the user based on the topics he have visited | def recommended_topics(limit = 10)
visited_topics.joins(:topic).where('topics.language = ?', I18n.locale).group('topic_id').order("visits DESC, updated_at DESC").limit(limit).map(&:topic).map { |t| t.find_related_tags.limit(2) }.flatten.uniq[0...limit]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_suggested_topics(assignment_id)\n team_id = TeamsUser.team_id(assignment_id, session[:user].id)\n teams_users = TeamsUser.where(team_id: team_id)\n teams_users_array = Array.new\n teams_users.each do |teams_user|\n teams_users_array << teams_user.user_id\n end\n @suggested_topics = S... | [
"0.69905466",
"0.69010246",
"0.6765958",
"0.67455447",
"0.66843027",
"0.6620959",
"0.65781856",
"0.65252274",
"0.6485533",
"0.645811",
"0.6428915",
"0.6315805",
"0.6315805",
"0.6312051",
"0.63070834",
"0.62557745",
"0.62521315",
"0.62454796",
"0.62250453",
"0.6214372",
"0.621... | 0.72970647 | 0 |
Get if is a new user or not | def new_user?
self.created_at > 1.month.ago
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new?\n @user\n end",
"def new?(user)\n not read? and user != sender\n end",
"def create?\n @user != nil\n end",
"def create?\n user.present?\n end",
"def create?\n user.present?\n end",
"def create?\n user.present?\n end",
"def create?\n\t\t!@user.nil?\n\tend",
"def create... | [
"0.76083463",
"0.7112065",
"0.710109",
"0.7097605",
"0.7097605",
"0.7097605",
"0.70500624",
"0.69911754",
"0.6977029",
"0.693427",
"0.686162",
"0.68191147",
"0.68150294",
"0.67663866",
"0.67612106",
"0.6751757",
"0.670841",
"0.6693662",
"0.668555",
"0.667204",
"0.667204",
"... | 0.7170557 | 1 |
Get if the user already thanked the topic specified | def already_thanked?(topic)
notification = Notification.thanked_by(self.id, topic.id)
!notification.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def own_topic?(topic)\n topic.read_attribute(:user_id) == self.id\n end",
"def thanked_by?(user)\n result = self.notifications.where(:sender_id => user.id)\n !result.empty?\n end",
"def owned_topic\n unless current_user.id == @topic.user_id\n flash[:alert] = \"Opps! You don't have permis... | [
"0.7276717",
"0.70956945",
"0.6707058",
"0.644437",
"0.64084655",
"0.64084655",
"0.63783264",
"0.63043135",
"0.6234976",
"0.62336546",
"0.62186545",
"0.62170166",
"0.61582786",
"0.611688",
"0.60926855",
"0.6092574",
"0.6067959",
"0.60553133",
"0.60386765",
"0.6030413",
"0.602... | 0.8361982 | 0 |
Get if the user already welcomed the user specified | def already_welcomed?(user)
notification = Notification.welcomed_by(self.id, user.id)
!notification.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thanked_by?(user)\n result = self.notifications.where(:sender_id => user.id)\n !result.empty?\n end",
"def participates?(user)\n author == user || receiver == user\n end",
"def mentioned?(user)\n @mentions.include?(user)\n end",
"def invite?\r\n admin? or (user.id != user_record.i... | [
"0.69823694",
"0.68208206",
"0.66220576",
"0.6607415",
"0.6586578",
"0.6553506",
"0.6491558",
"0.645393",
"0.64099234",
"0.640093",
"0.63703245",
"0.63408333",
"0.6307273",
"0.6306157",
"0.6305431",
"0.62882847",
"0.6269986",
"0.6244351",
"0.62284493",
"0.62214047",
"0.621731... | 0.7975654 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.