query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
Perform replacement on specific (un)hyphenated config directives. | def unhyphenate(string)
string.to_s.gsub(/(pre|post)xfer/, '\1-xfer')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_conf_directives(config_file, cfg)\n Chef::Log.info \"YAML config file: #{config_file}, conf directive entries: #{cfg}\"\n yaml = YAML::load_file(config_file)\n cfg.each_key { |key|\n val = parse_json(cfg[key])\n yaml[key] = val\n }\n Chef::Log.info \"Merged cassandr... | [
"0.5546376",
"0.5542149",
"0.55046594",
"0.5207952",
"0.51040006",
"0.50908077",
"0.499689",
"0.49365768",
"0.49196032",
"0.4902795",
"0.49019387",
"0.48948985",
"0.4893788",
"0.48459893",
"0.4840272",
"0.4836889",
"0.48190486",
"0.4800124",
"0.47738957",
"0.47688666",
"0.476... | 0.48970374 | 11 |
Expand "snake_case_things" to "snake case things". | def snake_to_space(string)
string.to_s.tr('_', ' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camel_to_snake_case input\n input = input.to_s.dup\n\n # handle camel case like FooBar => Foo_Bar\n while input.gsub!(/([a-z]+)([A-Z])(\\w+)/) { $1 + '_' + $2 + $3 }\n end\n\n # handle abbreviations like XMLParser => XML_Parser\n while input.gsub!(/([A-Z]+)([A-Z])([a-z]+)/) { $1 + '_' + $2 + ... | [
"0.7578399",
"0.75528556",
"0.7325526",
"0.7291911",
"0.72699517",
"0.7257512",
"0.72369784",
"0.7211205",
"0.7192635",
"0.71797615",
"0.7105887",
"0.7095246",
"0.7057289",
"0.7047621",
"0.70150864",
"0.70114154",
"0.69946605",
"0.69646597",
"0.69538486",
"0.6944762",
"0.6942... | 0.0 | -1 |
Converts a provider attribute to an rsync config directive. | def attribute_to_directive(string)
unhyphenate(snake_to_space(string))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename_provider\n attributes.fetch(:renameProvider)\n end",
"def provider\n conf['provider'] || 'defaults'\n end",
"def resolve_provider\n attributes.fetch(:resolveProvider)\n end",
"def customize_provider(name,options)\n custom_config = \"\"\n options.ea... | [
"0.5216947",
"0.49287444",
"0.4844968",
"0.47720864",
"0.4707512",
"0.4686256",
"0.4651102",
"0.46352154",
"0.46193302",
"0.4615709",
"0.46130505",
"0.4597214",
"0.45835844",
"0.45732468",
"0.45336094",
"0.45269358",
"0.45252028",
"0.4524064",
"0.45231974",
"0.44971886",
"0.4... | 0.407007 | 80 |
The list of rsync modules defined in the resource collection. | def rsync_modules
rsync_resources.each_with_object({}) do |resource, hash|
next unless resource.config_path == new_resource.config_path && (
resource.action == :add ||
resource.action.include?(:add)
)
hash[resource.name] ||= {}
resource_attributes.each do |key|
value = resource.send(key)
next if value.nil?
hash[resource.name][attribute_to_directive(key)] = value
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsync_modules\n rsync_resources.reduce({}) do |hash, resource|\n if resource.config_path == new_resource.config_path && (\n resource.action == :add ||\n resource.action.include?(:add)\n )\n hash[resource.name] ||= {}\n resource_attributes.eac... | [
"0.68783104",
"0.6765492",
"0.66543984",
"0.66543984",
"0.66269475",
"0.64176303",
"0.62857777",
"0.62831575",
"0.6125616",
"0.6101923",
"0.60965484",
"0.60701025",
"0.6050221",
"0.601773",
"0.6007573",
"0.59747803",
"0.59716237",
"0.596777",
"0.5943893",
"0.5943103",
"0.5901... | 0.66638005 | 2 |
The global rsync configuration | def global_modules
node['rsyncd']['globals'].each_with_object({}) do |(key, value), hash|
hash[attribute_to_directive(key)] = value unless value.nil?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsync_command_options\n options = ['-rl']\n options << rsync_excludes if rsync_excludes\n options << \"--exclude-from='#{@config[:rsync][:exclude_file]}'\" if @config[:rsync][:exclude_file]\n options << \"--owner --group --chown='#{@config[:rsync][:chown]}'\" if @con... | [
"0.7164629",
"0.7123198",
"0.6964019",
"0.6893977",
"0.68736655",
"0.6516026",
"0.63349116",
"0.6333167",
"0.62511927",
"0.62055963",
"0.6114623",
"0.6109834",
"0.6106116",
"0.6040857",
"0.60234106",
"0.59825504",
"0.5970224",
"0.59294295",
"0.5913603",
"0.5912944",
"0.588213... | 0.0 | -1 |
GET /http_requests GET /http_requests.json | def index
@http_requests = HttpRequest.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend",
"def request (url_requested, api_k... | [
"0.67624205",
"0.6735118",
"0.67234886",
"0.6703622",
"0.6599823",
"0.6565737",
"0.6565737",
"0.65357167",
"0.6492485",
"0.64919305",
"0.64406955",
"0.6413719",
"0.63831383",
"0.63780355",
"0.6366384",
"0.63175565",
"0.6286214",
"0.62749106",
"0.62749106",
"0.6258267",
"0.623... | 0.6648942 | 4 |
GET /http_requests/1 GET /http_requests/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_resp... | [
"0.68759495",
"0.68390095",
"0.68390095",
"0.68246204",
"0.6697538",
"0.6669717",
"0.6602752",
"0.6462156",
"0.64515334",
"0.63651067",
"0.635556",
"0.6340648",
"0.6272035",
"0.6267208",
"0.62251824",
"0.6224961",
"0.6203947",
"0.6176129",
"0.61726964",
"0.6171526",
"0.614687... | 0.0 | -1 |
POST /http_requests POST /http_requests.json | def create
@http_request = HttpRequest.new(http_request_params)
respond_to do |format|
if @http_request.save
format.html { redirect_to @http_request, notice: 'Http request was successfully created.' }
format.json { render action: 'show', status: :created, location: @http_request }
else
format.html { render action: 'new' }
format.json { render json: @http_request.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_post(path, request)\n @http.post(\n :body => JSON(:request => request.to_hash),\n :headers => headers,\n :path => \"/api/v2/#{path}\",\n :expects => [200, 201, 202]\n )\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** ... | [
"0.68028075",
"0.6712006",
"0.66034895",
"0.65734494",
"0.65374625",
"0.64450926",
"0.6416786",
"0.6347915",
"0.62424594",
"0.6216529",
"0.61464345",
"0.61391103",
"0.61169314",
"0.6080915",
"0.6062944",
"0.603822",
"0.596609",
"0.5958362",
"0.59456944",
"0.594175",
"0.594077... | 0.60756767 | 15 |
PATCH/PUT /http_requests/1 PATCH/PUT /http_requests/1.json | def update
respond_to do |format|
if @http_request.update(http_request_params)
format.html { redirect_to @http_request, notice: 'Http request was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @http_request.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update!(**args)\n ... | [
"0.66446257",
"0.657836",
"0.6403797",
"0.6403797",
"0.6403797",
"0.6403797",
"0.64008933",
"0.631353",
"0.6285412",
"0.6282243",
"0.616621",
"0.6133736",
"0.6131959",
"0.6127629",
"0.6119125",
"0.60907555",
"0.60907555",
"0.6090604",
"0.6081874",
"0.60616857",
"0.605691",
... | 0.67752284 | 0 |
DELETE /http_requests/1 DELETE /http_requests/1.json | def destroy
@http_request.destroy
respond_to do |format|
format.html { redirect_to http_requests_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_co... | [
"0.72902673",
"0.72698855",
"0.72698855",
"0.72698855",
"0.7269352",
"0.7248202",
"0.7248202",
"0.7248202",
"0.7248202",
"0.7248202",
"0.7248202",
"0.7142104",
"0.7133003",
"0.71133417",
"0.7000527",
"0.69743675",
"0.6964436",
"0.69609666",
"0.69480914",
"0.69298136",
"0.6928... | 0.76185346 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_http_request
@http_request = HttpRequest.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def http_request_params
params.require(:http_request).permit(:ip, :address)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
Obtain a latex representation of the matrix | def latex_matrix
if @type == "controlled"
@matrix.map { |value, matrix| [value, latex_matrix_for(matrix)] }
else
latex_matrix_for @matrix
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latex_matrix(matrix)\n output = \"\\\\begin{tabular}{|#{'r|' * matrix.first.length}}\\n\"\n output << \"\\\\hline\\n\"\n output << matrix.map { |line| line.join(' & ') }.join(\"\\\\\\\\\\n\\\\hline\\n\")\n output << \"\\\\\\\\\\n\"\n output << \"\\\\hline\\n\"\n output << \"\\\\end{tabular}\\n\"\n outpu... | [
"0.8290379",
"0.71012217",
"0.68977416",
"0.6761417",
"0.6572086",
"0.65711564",
"0.6568459",
"0.65282416",
"0.6520839",
"0.65132385",
"0.6478552",
"0.63378495",
"0.62582946",
"0.624844",
"0.6235852",
"0.6088534",
"0.60782826",
"0.60709083",
"0.6010628",
"0.59935045",
"0.5988... | 0.8112606 | 1 |
GET /invoice_taxes/1 GET /invoice_taxes/1.json | def show
@invoice_tax = InvoiceTax.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @invoice_tax }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_taxes\n self.class.get(\"/aldebaran-taxes/v2/taxes\", :basic_auth => @auth)\n end",
"def index\n @taxes = params['item_id'] ? Item.find(params['item_id']).taxes : Tax.all\n render json: @taxes\n end",
"def index\n @taxes = Tax.all\n\n render json: @taxes\n end",
"def set_taxes\n... | [
"0.7912092",
"0.7678965",
"0.71768844",
"0.70942634",
"0.7087311",
"0.7028914",
"0.6826595",
"0.66397685",
"0.6548293",
"0.65334576",
"0.64224494",
"0.6417056",
"0.6417024",
"0.64081514",
"0.6370767",
"0.635478",
"0.63246125",
"0.6302579",
"0.62796366",
"0.62261474",
"0.62129... | 0.67804927 | 7 |
GET /invoice_taxes/new GET /invoice_taxes/new.json | def new
@invoice_tax = InvoiceTax.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @invoice_tax }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @invoice_tax = InvoiceTax.new(params[:invoice_tax])\n\n respond_to do |format|\n if @invoice_tax.save\n format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully created.' }\n format.json { render json: @invoice_tax, status: :created, location: @invoice_tax... | [
"0.72811353",
"0.70327747",
"0.70327747",
"0.70283765",
"0.70208365",
"0.7017731",
"0.6928569",
"0.67786777",
"0.6765665",
"0.6748932",
"0.66771334",
"0.6674354",
"0.6673623",
"0.65672815",
"0.6561808",
"0.6487727",
"0.64467657",
"0.64467657",
"0.6436855",
"0.6417992",
"0.640... | 0.7654911 | 0 |
POST /invoice_taxes POST /invoice_taxes.json | def create
@invoice_tax = InvoiceTax.new(params[:invoice_tax])
respond_to do |format|
if @invoice_tax.save
format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully created.' }
format.json { render json: @invoice_tax, status: :created, location: @invoice_tax }
else
format.html { render action: "new" }
format.json { render json: @invoice_tax.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/send_tax_invoice\").body)\n @attributes = response['items']\n true\n end",
"def request_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/request_tax_invoice\").body)\n @attributes = r... | [
"0.69365966",
"0.6842887",
"0.6835824",
"0.6663782",
"0.65647054",
"0.6395121",
"0.63802034",
"0.63196206",
"0.6272765",
"0.6166729",
"0.61326724",
"0.6128575",
"0.61166453",
"0.60869133",
"0.6084017",
"0.6083614",
"0.6076662",
"0.60597706",
"0.6026695",
"0.6007375",
"0.59872... | 0.66672724 | 3 |
PUT /invoice_taxes/1 PUT /invoice_taxes/1.json | def update
@invoice_tax = InvoiceTax.find(params[:id])
respond_to do |format|
if @invoice_tax.update_attributes(params[:invoice_tax])
format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @invoice_tax.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_taxes\n @taxes = Tax.find(params[:id])\n end",
"def send_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/send_tax_invoice\").body)\n @attributes = response['items']\n true\n end",
"def request_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{... | [
"0.72690123",
"0.65473086",
"0.65402716",
"0.65395427",
"0.6468368",
"0.6318023",
"0.62615436",
"0.6212539",
"0.61819965",
"0.61819965",
"0.61725813",
"0.6153089",
"0.61297953",
"0.61141306",
"0.60911906",
"0.6081959",
"0.60586464",
"0.6055749",
"0.6048677",
"0.6023475",
"0.6... | 0.68349093 | 1 |
DELETE /invoice_taxes/1 DELETE /invoice_taxes/1.json | def destroy
@invoice_tax = InvoiceTax.find(params[:id])
@invoice_tax.destroy
respond_to do |format|
format.html { redirect_to invoice_taxes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tax(id)\n @client.raw('delete', \"/ecommerce/taxes/#{id}\")\n end",
"def destroy\n authorize @incoming_service_tax\n\n @incoming_service_tax.destroy\n respond_to do |format|\n format.html { redirect_to incoming_service_taxes_url }\n format.json { head :no_content }\n end\n e... | [
"0.78110135",
"0.707769",
"0.69402087",
"0.6878605",
"0.68302184",
"0.6818329",
"0.6697505",
"0.6692188",
"0.66610616",
"0.6653193",
"0.6630542",
"0.6627586",
"0.6627586",
"0.6627586",
"0.6627586",
"0.66273725",
"0.6596463",
"0.6591103",
"0.6579143",
"0.6578022",
"0.65642375"... | 0.7698269 | 1 |
def currency params['LMI_'] end def status params['LMI_'] end | def payer_purse
params['LMI_PAYER_PURSE']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def currency\n\tparams['mc_currency']\n end",
"def currency\n params['mc_currency']\n end",
"def currency\n params['mc_currency']\n end",
"def currency; end",
"def currency; end",
"def currency\n params[\"Currency\"]\n end",
"def currency... | [
"0.6754048",
"0.6479198",
"0.6479198",
"0.6449263",
"0.6449263",
"0.64375824",
"0.6390127",
"0.63760954",
"0.62762517",
"0.62701654",
"0.626312",
"0.6195843",
"0.60416603",
"0.6033001",
"0.59466124",
"0.5935416",
"0.5933379",
"0.5917889",
"0.59104294",
"0.58979976",
"0.585915... | 0.0 | -1 |
the money amount we received in X.2 decimal. | def gross
params['LMI_PAYMENT_AMOUNT']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amount\n\n @amount_bigdecimal.to_f.round(2)\n\n end",
"def to_money amount\n\t\t\tamount.to_f.round(2) rescue 0.0\n\t\tend",
"def net_amount\n ((transaction_value - 0.2) / 1.034).floor_with_two_decimal_places\n end",
"def money\n Money.from_amount(amount.to_f)\n end",
"def real_amount()... | [
"0.78914285",
"0.7725167",
"0.7674643",
"0.7433044",
"0.74169904",
"0.7289542",
"0.7232396",
"0.7205436",
"0.7205436",
"0.7170664",
"0.7007064",
"0.6989314",
"0.6945581",
"0.6920465",
"0.6910944",
"0.6903187",
"0.6833638",
"0.682911",
"0.68197745",
"0.68075484",
"0.6800406",
... | 0.63956547 | 89 |
Notify all connection listeners, that a notice message was received. | def handle(context)
# Notify all connection listeners by calling their on_server_response method.
super(context)
# Notify all connection listeners by calling their on_notice method.
notify(context) do |connection_listener|
connection_listener.on_notice(context, context.lookup_user(nick), message)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify(context)\n \n context.connection_listeners.each do |connection_listener|\n yield connection_listener\n end\n \n end",
"def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed ... | [
"0.62905645",
"0.62092376",
"0.6187387",
"0.61387825",
"0.59728163",
"0.59533626",
"0.5949166",
"0.5931795",
"0.59107006",
"0.57482326",
"0.5709943",
"0.57056373",
"0.56844634",
"0.56675494",
"0.5573993",
"0.5563017",
"0.5562117",
"0.5537423",
"0.54805326",
"0.54638547",
"0.5... | 0.628717 | 1 |
execute /bin/sh from vi | def send_vi_shell
send_ctrl_escape
data = ":!/bin/sh" + "\n"
session.shell_write(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vi\n system \"vim ~/.scratchvim.rb\"\nend",
"def handle_shell(cmd)\n cmd = cmd[1, cmd.size - 2]\n result = \"\"\n export_vim\n IO.popen(\"sh -s\", 'w+') do |p|\n p.write cmd\n p.write \"\\nexit 0\\n\" # make shure to end it\n result = p.read\n end\n result.strip\n end"... | [
"0.6696476",
"0.6642108",
"0.6228469",
"0.6079588",
"0.5997068",
"0.59771395",
"0.5891756",
"0.5884789",
"0.58067703",
"0.57803935",
"0.5755008",
"0.57001007",
"0.5661485",
"0.5636625",
"0.5620029",
"0.56118035",
"0.559914",
"0.55802333",
"0.55049276",
"0.5504787",
"0.5499035... | 0.6804456 | 0 |
exit vi without saving | def send_vi_exit_nosave
send_ctrl_escape
data = ":q!" + "\n"
session.shell_write(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_vi_exit_save\n send_ctrl_escape\n data = \":x!\" + \"\\n\"\n session.shell_write(data)\n end",
"def exit\n\t\t\teditors.each do |ed|\n\t\t\t\tquit ed\n\t\t\tend\n\t\t\t@continue = false\n\t\tend",
"def command_quit\n command_save\n exit(0)\n end",
"def vi\n ... | [
"0.7136679",
"0.63457584",
"0.63432187",
"0.6122709",
"0.6105719",
"0.60879666",
"0.59103423",
"0.58881104",
"0.58782023",
"0.58237094",
"0.5751046",
"0.57458407",
"0.57309943",
"0.56523895",
"0.558681",
"0.5556906",
"0.5555957",
"0.5551185",
"0.55152076",
"0.5491714",
"0.546... | 0.7385188 | 0 |
exit vi with saving | def send_vi_exit_save
send_ctrl_escape
data = ":x!" + "\n"
session.shell_write(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_vi_exit_nosave\n send_ctrl_escape\n data = \":q!\" + \"\\n\"\n session.shell_write(data)\n end",
"def command_quit\n command_save\n exit(0)\n end",
"def exit\n\t\t\teditors.each do |ed|\n\t\t\t\tquit ed\n\t\t\tend\n\t\t\t@continue = false\n\t\tend",
"def exit... | [
"0.7302805",
"0.66112596",
"0.6165263",
"0.6039795",
"0.59225386",
"0.5856519",
"0.58551484",
"0.5772585",
"0.5742138",
"0.57154423",
"0.5635889",
"0.562363",
"0.5599144",
"0.55843806",
"0.55843806",
"0.5559939",
"0.55066425",
"0.5476224",
"0.54656345",
"0.5414928",
"0.540874... | 0.74668807 | 0 |
Used for extensions which need to provide their own custom event links on the order details view. | def initialize_order_events
@order_events = %w{approve cancel resume}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_links\n links = []\n @order_events.sort.each do |event|\n if @order.send(\"can_#{event}?\")\n links << button_link_to(t(event), fire_admin_order_url(@order, :e => event),\n { :method => :put, :confirm => t(\"order_sure_want_to\", :event => t(event)) })\n ... | [
"0.6815163",
"0.6212916",
"0.6151977",
"0.61380243",
"0.608626",
"0.6056468",
"0.59883",
"0.5896292",
"0.58706176",
"0.583266",
"0.5683042",
"0.5677044",
"0.56568795",
"0.56400883",
"0.5501494",
"0.5493904",
"0.5463127",
"0.5450794",
"0.54430455",
"0.5440094",
"0.54146856",
... | 0.0 | -1 |
with its default values. The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). | def is_numeric?(obj)
obj.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defaults\n {}\n end",
"def set_default_values\n # set_new_record_default_values\n set_attr_accessor_default_values\n end",
"def set_default_values\n self.points_log ||= POINTS_LOG\n self.points_log_first_of_day ||= POINTS_LOG_FIRST_OF_DAY\n self.points_peer_assessment ||= POINTS... | [
"0.6922218",
"0.6910132",
"0.6867809",
"0.6809897",
"0.68085045",
"0.6796745",
"0.6794806",
"0.67735296",
"0.67735296",
"0.67735296",
"0.67735296",
"0.67735296",
"0.67735296",
"0.67735296",
"0.67735296",
"0.67735296",
"0.67735296",
"0.6703618",
"0.6673752",
"0.6585937",
"0.65... | 0.0 | -1 |
TODO requires rigorous testing | def group_assign
@course = Course.find(params[:id])
group_unassigned_students(@course.id)
respond_to do |format|
format.html{redirect_to('/courses/'+@course.id.to_s+'/groups')}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def weber; end",
"def refutal()\n end",
"def implementation; end",
"def implementation; end",
"def identify; end",
"def spec; end",
"def spec; end",
... | [
"0.7486383",
"0.65108323",
"0.64373684",
"0.64373684",
"0.64373684",
"0.64373684",
"0.627353",
"0.6088909",
"0.60879964",
"0.60275143",
"0.60275143",
"0.5990826",
"0.59797573",
"0.59797573",
"0.59783125",
"0.59783125",
"0.59783125",
"0.59783125",
"0.59783125",
"0.59783125",
"... | 0.0 | -1 |
for assigning teacher to a course | def teacher_assign
@course_allocation = CourseAllocation.find_by_course_id(params[:id])
@course = Course.find(params[:id])
@teachers = get_teachers_for_institute
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_courses_teacher\n @courses_teacher = CoursesTeacher.find(params[:id])\n end",
"def assign_teacher\n @teacher = Teacher.find(params[:teacher_id])\n @teaching = Teaching.find(params[:id])\n @teaching.teacher = @teacher\n if @teaching.save\n flash[:notice] = \"Docente assegnato con ... | [
"0.7822968",
"0.78052306",
"0.7733629",
"0.76818025",
"0.7464994",
"0.7394245",
"0.7357507",
"0.7309564",
"0.7286604",
"0.7269256",
"0.72615325",
"0.7217374",
"0.72116303",
"0.72116303",
"0.7158139",
"0.7146397",
"0.7132286",
"0.7132286",
"0.7132286",
"0.7132286",
"0.7132286"... | 0.8252131 | 0 |
GET /friends GET /friends.json | def index
@current_user = current_user
@friendships = current_user.friendships
@potentialFriends = User.all()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(options={})\n get('/friends', options)\n end",
"def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').friends\n end",
"def index\n @user = current_user\n render json: @user.... | [
"0.828671",
"0.82809955",
"0.7791224",
"0.7685159",
"0.7616414",
"0.75592315",
"0.7551979",
"0.7451434",
"0.7443884",
"0.74000996",
"0.7363765",
"0.73304665",
"0.7291144",
"0.7290434",
"0.7278924",
"0.7238541",
"0.7212576",
"0.71354884",
"0.71054906",
"0.70882964",
"0.7052266... | 0.0 | -1 |
GET /friends/1 GET /friends/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends(options={})\n get('/friends', options)\n end",
"def index\n @user = current_user\n render json: @user.friends\n end",
"def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').... | [
"0.76709884",
"0.7604071",
"0.7600863",
"0.74548936",
"0.7365434",
"0.73384774",
"0.73283494",
"0.73141056",
"0.73036456",
"0.7235156",
"0.7219719",
"0.7216787",
"0.7163809",
"0.7131452",
"0.70871836",
"0.70085126",
"0.69397676",
"0.6919202",
"0.6908836",
"0.69050354",
"0.690... | 0.0 | -1 |
POST /friends POST /friends.json | def create
logger.debug('In the create method afterall')
logger.debug( friend_params )
current_user.friendships.create!(:friend_id => params[:friend_id])
redirect_to friendship_index_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friend\n @user.friendships.build(friend_id: @friend.id)\n if @user.save\n render json: { success: true }\n else\n render json: {message: @user.errors&.messages || 'Unable add as friend, please try again'}, status: 202\n end\n end",
"def add_friend\n\n current_user.friends_list.push... | [
"0.6929615",
"0.68731165",
"0.6859937",
"0.6829343",
"0.6796485",
"0.67732674",
"0.67154217",
"0.6699764",
"0.6698836",
"0.66881865",
"0.66756314",
"0.6651872",
"0.6623602",
"0.6607566",
"0.6607566",
"0.65965533",
"0.659456",
"0.65587676",
"0.6517505",
"0.64976156",
"0.649359... | 0.6168415 | 53 |
Use callbacks to share common setup or constraints between actions. | def set_friend
@friend = Friend.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def friend_params
params.permit(:friend_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
Function for displaying customer message used for deleting parents that contain children | def confirmation_message(value, value_hash)
if(value_hash[value.id] == nil)
return 'Are you sure?'
else
return 'This node has children. If you delete this node the children will also be deleted. Are you sure?'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_delete_message\n <<-TEXT\n Are you sure you want to delete this page,\n all its children and all its slices and other content?\n TEXT\n end",
"def confirmation_message\n title_message(\"Forks Deleted\")\n end",
"def parent_message\n end",
"def parent_confirmation_n... | [
"0.689444",
"0.6863294",
"0.6404561",
"0.594251",
"0.59316665",
"0.5894985",
"0.5755939",
"0.5750507",
"0.57063895",
"0.5659003",
"0.56585675",
"0.5607167",
"0.5583383",
"0.55610216",
"0.55318016",
"0.5509244",
"0.5502081",
"0.5485347",
"0.54288214",
"0.5424708",
"0.54237026"... | 0.6565435 | 2 |
creates a button and form with a hidden field in order to pass ids across to new objects | def my_button_to(text, path, objs)
s = "<form method=\"get\" action=\"#{path}\" class=\"button_to\">
<div><input type=\"submit\" value=\"#{text}\"/></div>"
for obj in objs
if(!obj.nil?)
s+= "<input type=\"hidden\" name=\"#{obj.class.to_s.downcase}_id\" value=\"#{obj.id}\" />"
end
end
s+= "</form>"
return s.html_safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def button_id(value)\n @submit_id = value\n end",
"def add\n frm.button(:value=>\"Add\").click\n end",
"def form_button_for(obj, name = nil)\n name ||= obj.object.new_record? ? 'Create' : 'Update'\n\n obj.button name, class: 'btn btn-theme', data: { disable_with: raw(\"<i class='fa fa-cir... | [
"0.6666378",
"0.66006607",
"0.6559309",
"0.6451646",
"0.6353997",
"0.63111794",
"0.61738646",
"0.61665714",
"0.61242944",
"0.61235887",
"0.61193067",
"0.61145574",
"0.6049062",
"0.6038238",
"0.6019454",
"0.6015727",
"0.60116994",
"0.59618545",
"0.59570044",
"0.595056",
"0.594... | 0.72084606 | 0 |
Recursive function for display components finds parents and then children and organizes them in this way to display | def components_select_table(cp, depth)
pt= "<option value=\"#{cp.id}\""
pt+= " selected=\"true\"" if @component == cp
pt+= ">#{"-"*depth}"
pt+= "#{cp.name}"
pt+= "</option>\n"
for child in cp.components
if(child != @component)
pt += components_select_table(child, depth+1)
end
end
return pt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout_children\n \n end",
"def walk(elements, max_depth, *args)\n output = ''\n\n # invalid parameter or nothing to walk\n return output if max_depth < -1 || elements.blank?\n\n parent_field = @db_fields[:parent]\n\n # flat display\n if -1 == max_depth\n empty_array = {}\n el... | [
"0.61346304",
"0.6076893",
"0.6071293",
"0.60281545",
"0.60115606",
"0.60115606",
"0.60115606",
"0.60115606",
"0.60115606",
"0.60115606",
"0.60115606",
"0.60115606",
"0.60115606",
"0.60115606",
"0.60115606",
"0.60115606",
"0.5969188",
"0.5958291",
"0.5845511",
"0.5841062",
"0... | 0.0 | -1 |
Function to fill banner and logo portion of web pages | def banner
if(@all_images.nil?)
@all_images = Image.all
end
if(!@all_images.empty?)
for img in @all_images
if(img.picture_file_name == "Company_Logo.png")
@imagelogo = img.picture.url
end
if(img.picture_file_name == "Company_Banner.png")
@imagebanner = img.picture.url
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logo; end",
"def logo; end",
"def logo \n logo = @@doc.xpath(\"//div[contains(@id, 'logo')]\")\n logo += @@doc.xpath(\"//div[contains(@class, 'logo')]\")\n # najdenie href = .... skript\n logo_href = logo.xpath(\".//a//@href\")\n logo_src = logo.xpath(\".//img//@src\")\n\n lg = @@doc.at_x... | [
"0.6290007",
"0.6290007",
"0.626753",
"0.58364266",
"0.58134824",
"0.5807064",
"0.5796127",
"0.57858896",
"0.5716966",
"0.5715799",
"0.56910914",
"0.56882775",
"0.5578631",
"0.5566212",
"0.5566051",
"0.5545519",
"0.5525533",
"0.5465267",
"0.54374325",
"0.5426832",
"0.5423977"... | 0.5557388 | 15 |
Recursive function for display components finds parents and then children and organizes them in this way to display | def checkbox_accord(items_hash, show_properties=false, depth=0)
if(depth == 0 && items_hash.keys.empty?)
return "No Items Available"
end
if(@items_to_select.nil?)
@items_to_select = []
end
if(items_hash.keys.empty?)
return ""
end
pt = "<ul "
if(depth == 0)
pt += "id=\"id#{Time.now.usec}\" class=\"accordion\""
end
pt+=">"
expand = true
for item in items_hash.keys
pt += "<li"
if(depth == 0 && expand && (!item.is_a?(Property) || !item.valuefields.empty?))
pt += " class=\"expand\""
expand = false
end
pt +=">"
#Checks what class the item is
if(item.is_a?(Category))
pt += "<div class=\"inline\"> </div>#{check_box_tag "parent_ids[]", item.id, @items_to_select.include?(item), :id=>"a#{item.id}"}" + "<label for=\"a#{item.id}\">#{item.name}</label>"
elsif(item.is_a?(Product))
pt += "<div class=\"inline\"> </div>#{check_box_tag "product_ids[]", item.id, @items_to_select.include?(item), :id=>"p#{item.id}"}" + "<label for=\"p#{item.id}\">#{item.name}</label>"
elsif(item.is_a?(Component))
pt += "<div class=\"inline\"> </div>#{check_box_tag "component_parent_ids[]", item.id, @items_to_select.include?(item), :id=>"c#{item.id}"}" + "<label for=\"c#{item.id}\">#{item.name}</label>"
elsif(item.is_a?(Valuefield))
pt += "<div class=\"inline\"> </div>#{check_box_tag "valuefield_ids[]", item.id, @items_to_select.include?(item), :id=>"v#{item.id}"}" + "<label for=\"v#{item.id}\">#{item.name}</label>"
elsif(item.is_a?(Group)) #not currently used
pt += "<div class=\"inline\"> </div>#{check_box_tag "group_ids[]", item.id, @items_to_select.include?(item), :id=>"g#{item.id}"}" + "<label for=\"g#{item.id}\">#{item.name}</label>"
elsif(item.is_a?(Property))
if(show_properties)
pt += "<div class=\"inline\"> </div>#{check_box_tag "#{parent}[property_id]", item.id, @items_to_select.include?(item), :id=>"o#{item.id}"}" + "<label for=\"o#{item.id}\">#{item.name}</label>"
elsif(!item.valuefields.empty?)
pt += "<div class=\"inline\"> </div><b>#{item.name}</b>"
end
end
pt += checkbox_accord(items_hash[item], show_properties, depth+1)
pt += "</li>"
end
pt += "</ul>"
return pt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout_children\n \n end",
"def walk(elements, max_depth, *args)\n output = ''\n\n # invalid parameter or nothing to walk\n return output if max_depth < -1 || elements.blank?\n\n parent_field = @db_fields[:parent]\n\n # flat display\n if -1 == max_depth\n empty_array = {}\n el... | [
"0.6136771",
"0.60764915",
"0.6071726",
"0.6028393",
"0.6013297",
"0.6013297",
"0.6013297",
"0.6013297",
"0.6013297",
"0.6013297",
"0.6013297",
"0.6013297",
"0.6013297",
"0.6013297",
"0.6013297",
"0.6013297",
"0.59695125",
"0.5958582",
"0.5846982",
"0.5840842",
"0.57517064",
... | 0.0 | -1 |
Recursive function for display components finds parents and then children and organizes them in this way to display Used to disable parent in list so you cannot remove or add it to itself | def checkbox_accord2(items_hash, show_properties=false, depth=0)
if(depth == 0 && items_hash.keys.empty?)
return "No Items Available"
end
if(@items_to_select.nil?)
@items_to_select = []
end
if(items_hash.keys.empty?)
return ""
end
pt = "<ul "
if(depth == 0)
pt += "id=\"id#{Time.now.usec}\" class=\"accordion\""
end
pt+=">"
expand = true
for item in items_hash.keys
pt += "<li"
if(depth == 0 && expand && (!item.is_a?(Property) || !item.valuefields.empty?))
pt += " class=\"expand\""
expand = false
end
pt +=">"
#Checks what class the item is
if(item.is_a?(Category))
pt += "<div class=\"inline\"> </div>#{check_box_tag "parent_ids[]", item.id, @items_to_select.include?(item), :id=>"a#{item.id}"}" + "<label for=\"a#{item.id}\">#{item.name}</label>"
elsif(item.is_a?(Product))
pt += "<div class=\"inline\"> </div>#{check_box_tag "product_ids[]", item.id, @items_to_select.include?(item), :id=>"p#{item.id}"}" + "<label for=\"p#{item.id}\">#{item.name}</label>"
elsif(item.is_a?(Component))
#Checks to see if the current component is the parent so you cannot select it
if(item.eql?(@parent))
pt += "<div class=\"inline\"> </div>#{check_box_tag "component_parent_ids[]", item.id, @items_to_select.include?(item), :id=>"c#{item.id}", :disabled => true}" + "<label for=\"c#{item.id}\">#{item.name}</label>"
else
pt += "<div class=\"inline\"> </div>#{check_box_tag "component_parent_ids[]", item.id, @items_to_select.include?(item), :id=>"c#{item.id}"}" + "<label for=\"c#{item.id}\">#{item.name}</label>"
end
elsif(item.is_a?(Valuefield))
pt += "<div class=\"inline\"> </div>#{check_box_tag "valuefield_ids[]", item.id, @items_to_select.include?(item), :id=>"v#{item.id}"}" + "<label for=\"v#{item.id}\">#{item.name}</label>"
elsif(item.is_a?(Group)) #not currently used
pt += "<div class=\"inline\"> </div>#{check_box_tag "group_ids[]", item.id, @items_to_select.include?(item), :id=>"g#{item.id}"}" + "<label for=\"g#{item.id}\">#{item.name}</label>"
elsif(item.is_a?(Property))
if(show_properties)
pt += "<div class=\"inline\"> </div>#{check_box_tag "#{parent}[property_id]", item.id, @items_to_select.include?(item), :id=>"o#{item.id}"}" + "<label for=\"o#{item.id}\">#{item.name}</label>"
elsif(!item.valuefields.empty?)
pt += "<div class=\"inline\"> </div><b>#{item.name}</b>"
end
end
pt += checkbox_accord2(items_hash[item], show_properties, depth+1)
pt += "</li>"
end
pt += "</ul>"
return pt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout_children\n \n end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"def children; end",
"d... | [
"0.6071768",
"0.60606915",
"0.60606915",
"0.60606915",
"0.60606915",
"0.60606915",
"0.60606915",
"0.60606915",
"0.60606915",
"0.60606915",
"0.60606915",
"0.60606915",
"0.60606915",
"0.6047931",
"0.60171854",
"0.60146433",
"0.5884541",
"0.58659977",
"0.5821498",
"0.5749071",
"... | 0.0 | -1 |
Function to build a radio button list | def radio_list(items)
rl = "<ul>"
if(!items.empty?)
for item in items
if(item.is_a?(Category)) #not currently used
rl += "#{radio_button_tag "category_ids[]", item.id, @items_to_select.include?(item), :id=>"a#{item.id}"}" + "<label for=\"a#{item.id}\">#{item.name}</label><br />"
elsif(item.is_a?(Product))
rl += "#{radio_button_tag "product_ids[]", item.id, @items_to_select.include?(item), :id=>"p#{item.id}"}" + "<label for=\"p#{item.id}\">#{item.name}</label><br />"
#{item.name}</label>"
elsif(item.is_a?(Component))
rl += "#{radio_button_tag "component_ids[]", item.id, @items_to_select.include?(item), :id=>"c#{item.id}"}" + "<label for=\"c#{item.id}\">#{item.name}</label><br />"
elsif(item.is_a?(Valuefield))
rl += "#{radio_button_tag "valuefield_ids[]", item.id, @items_to_select.include?(item), :id=>"v#{item.id}"}" + "<label for=\"v#{item.id}\">#{item.name}</label><br />"
elsif(item.is_a?(Group)) #not currently used
rl += "#{radio_button_tag "group_ids[]", item.id, @items_to_select.include?(item), :id=>"g#{item.id}"}" + "<label for=\"g#{item.id}\">#{item.name}</label><br />"
elsif(item.is_a?(Property))
rl += "#{radio_button_tag "property_ids[]", item.id, @items_to_select.include?(item), :id=>"o#{item.id}"}" + "<label for=\"o#{item.id}\">#{item.name}</label><br />"
end
end
rl += "</ul>"
end
return rl
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def radiobuttons; end",
"def collection_radio_buttons(method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end",
"def radio_buttons(method, choices, options = {})\n choices.map!{ |i| i.is_a?(Array) ? i : [i] }\n build_shell(method, options, \"... | [
"0.7448311",
"0.69899714",
"0.6984335",
"0.69725823",
"0.6946345",
"0.68229556",
"0.6820075",
"0.6739062",
"0.65432394",
"0.64837223",
"0.6454941",
"0.64338064",
"0.6326125",
"0.6298247",
"0.6253906",
"0.6190775",
"0.6186663",
"0.61753744",
"0.61707795",
"0.61401755",
"0.6084... | 0.76315546 | 0 |
Function to build a checkbox list only usable for an array of the same class | def checkbox_list(items)
cl = "<ul>"
if(!items.empty?)
item_class = items[0].class.to_s
item_class_sub = item_class[0..0].to_s
for item in items
cl += "<li>#{check_box_tag(item_class +"_ids[]", item.id, @items_to_select.include?(item), :id=>"#{item_class_sub + "" + item.id.to_s}")}"
cl += "<label for=\"#{item_class_sub + "" + item.id.to_s}\">#{item.name}</label></li>"
end
cl += "</ul>"
end
return cl
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkboxes; end",
"def checkboxes_for coll, &blok\n \n @checkbox ||= Class.new do \n \n def initialize &blok\n instance_eval(&blok)\n end\n \n def text txt\n @text = txt\n end\n \n def value txt\n @value = txt\n end\n \n def na... | [
"0.68280846",
"0.679491",
"0.6624006",
"0.65273535",
"0.63910574",
"0.6323731",
"0.6249029",
"0.6192223",
"0.61546016",
"0.61353314",
"0.61196727",
"0.6092349",
"0.60013986",
"0.5910738",
"0.5887161",
"0.58766425",
"0.5864241",
"0.58504075",
"0.58073705",
"0.5799527",
"0.5790... | 0.7032377 | 0 |
Recursive function for display categories or components finds parents and then children and organizes them in this way to display | def main_menu_accord(items_hash, show_properties=false, depth=0)
if(depth == 0 && items_hash.keys.empty?)
return "No Items Available"
end
if(@items_to_select.nil?)
@items_to_select = []
end
if(items_hash.keys.empty?)
return ""
end
pt = "<ul "
if(depth == 0)
pt += "id=\"id#{Time.now.usec}\" class=\"accordion\""
end
pt+=">"
expand = true
for item in items_hash.keys
pt += "<li"
if(depth == 0 && expand && (!item.is_a?(Property) || !item.valuefields.empty?))
pt += " class=\"expand\""
expand = false
end
pt +=">"
if(item.is_a?(Category))
pt += "<div class=\"inline\">   </div><label class=\"label_main_menu\">#{link_to(item.name, item)}</label>"
elsif(item.is_a?(Component))
pt += "<div class=\"inline\">   </div><label class=\"label_main_menu\">#{link_to(item.name, 'tabs/component/' + item.id.to_s)}</label>"
end
pt += main_menu_accord(items_hash[item], show_properties, depth+1)
pt += "</li>"
end
pt += "</ul>"
return pt
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n ht... | [
"0.62460667",
"0.61734307",
"0.60595036",
"0.60291016",
"0.59943783",
"0.59648705",
"0.59152275",
"0.5897785",
"0.5880277",
"0.5879299",
"0.5876584",
"0.5875109",
"0.587058",
"0.58647096",
"0.58403486",
"0.58352774",
"0.58015704",
"0.5794056",
"0.5794056",
"0.5794056",
"0.579... | 0.0 | -1 |
Prints a list of links for the Main Menu | def print_link_list(items)
linkString = ""
if(!items.empty? && items[0].is_a?(Category))
linkString += "<tr><td>#{link_to "New Category", new_category_url, {:style=>'color:#FF8000'}}</td></tr>"
linkString += "<tr><td>#{main_menu_accord(all_category_hash)}</td></tr>"
elsif(!items.empty? && items[0].is_a?(Component))
linkString += "<tr><td>#{link_to "New Component", new_component_url, {:style=>'color:#FF8000'}}</td></tr>"
linkString += "<tr><td>#{main_menu_accord(all_component_hash)}</td></tr>"
elsif(!items.empty?)
for item in items
if(item.is_a?(Product))
if(item == items[0])
linkString += "<tr><td>#{link_to "New Product", new_product_url, {:style=>'color:#FF8000'}}</td></tr>"
end
linkString += "<tr><td>#{link_to(item.name, 'tabs/product/' + item.id.to_s)}</td></tr>"
elsif(item.is_a?(Group))
if(item == items[0])
linkString += "<tr><td>#{link_to "New Group", new_group_url, {:style=>'color:#FF8000'}}</td></tr>"
end
linkString += "<tr><td>#{link_to(item.name, item)}</td></tr>"
elsif(item.is_a?(Property))
if(item == items[0])
linkString += "<tr><td>#{link_to "New Property", new_property_url, {:style=>'color:#FF8000'}}</td></tr>"
end
linkString += "<tr><td>#{link_to(item.name, item)}</td></tr>"
elsif(item.is_a?(DataFile))
if(item == items[0])
linkString += "<tr><td>#{link_to "New Data File", new_data_file_url, {:style=>'color:#FF8000'}}</td></tr>"
end
linkString += "<tr><td>#{link_to(item.filedata_file_name, item)}</td></tr>"
elsif(item.is_a?(Image))
if(item == items[0])
linkString += "<tr><td>#{link_to "New Image", new_image_url, {:style=>'color:#FF8000'}}</td></tr>"
end
linkString += "<tr><td>#{link_to(item.picture_file_name, item)}</td></tr>"
elsif(item.is_a?(Validation))
if(item == items[0])
linkString += "<tr><td>#{link_to "New Validation", new_validation_url, {:style=>'color:#FF8000'}}</td></tr>"
end
linkString += "<tr><td>#{link_to(item.extension, item)}</td></tr>"
elsif(item.is_a?(Valuefield))
if(item == items[0])
linkString += "<tr><td>#{link_to "New Value Field", new_valuefield_url, {:style=>'color:#FF8000'}}</td></tr>"
end
linkString += "<tr><td>#{link_to(item.name, item)}</td></tr>"
elsif(item.is_a?(TableAlias))
if(item == items[0])
linkString += "<tr><th>Original Name</th>"
linkString += "<th>Current Name</th></tr>"
end
linkString += "<tr><td>#{item.tableName}</td>"
linkString += "<td>#{link_to(item.aliasName, item)}</td></tr>"
end
end
else
linkString += "None Available."
end
return linkString
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_menu\n puts \"\\nMain Menu\"\n puts \"1. Daily Prophet - News!\"\n puts \"2. Evanesco - Exit\"\n end",
"def main_menu_link; MAIN_MENU_LINK; end",
"def show_main_menu\n puts \"What would you like do next?\"\n puts \" new - Create a new contact\"\n puts \" list - List all contact... | [
"0.7791373",
"0.70995426",
"0.699932",
"0.69667864",
"0.6944903",
"0.6921214",
"0.6914723",
"0.6905415",
"0.6901675",
"0.68729025",
"0.67943513",
"0.678148",
"0.6678763",
"0.66278976",
"0.66183877",
"0.659248",
"0.65886325",
"0.6583902",
"0.65834916",
"0.65670866",
"0.6565184... | 0.6665403 | 13 |
Creates a hash for all categories | def all_category_hash(item=nil)
hash = {}
items = []
if(!item.nil?)
for cat in @all_categories
if(cat.parent_id.eql?(item.id))
items.push(cat)
end
end
else
for cat in @all_categories
if(cat.parent_id.nil?)
items.push(cat)
end
end
end
for cat in items
hash[cat] = all_category_hash(cat)
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories\n raw_categories.to_hashugar\n end",
"def categories(arg_)\n @config.lock\n\n objdata_ = _get_objdata(arg_)\n return nil unless objdata_\n hash_ = {}\n objdata_[2].each do |tup_, tupcats_|\n tupcats_.each do |cat_|\n hash_[cat_] = @categories[cat_][1].m... | [
"0.7814327",
"0.7305079",
"0.7221626",
"0.71745896",
"0.7056135",
"0.70216185",
"0.69317603",
"0.6872085",
"0.6694369",
"0.66482854",
"0.6633439",
"0.6625173",
"0.65950793",
"0.65494233",
"0.64804876",
"0.6403787",
"0.6390575",
"0.6384256",
"0.63443655",
"0.63328743",
"0.6301... | 0.722577 | 2 |
Creates a hash for all groups | def all_group_hash
hash = {}
for group in @all_groups
hash[group] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end",
"def hash\n [group, x, y].hash\n end",
"def groups\n @groups ||= {}\n end",
"def generate_hash\n @tags.group_by do |x|\n x[:name]\n x.delete(:name)\n end\n end",
"def has... | [
"0.8311913",
"0.6860097",
"0.6604363",
"0.65066975",
"0.63019824",
"0.62774056",
"0.6254687",
"0.62543106",
"0.619326",
"0.6178484",
"0.61632216",
"0.61543566",
"0.6108044",
"0.6099868",
"0.60638934",
"0.6053439",
"0.60182005",
"0.6002634",
"0.6001861",
"0.6001835",
"0.600003... | 0.80437905 | 1 |
Creates a hash for all properties | def all_property_hash
hash = {}
items = @all_properties
for prop in items
hash[prop] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_properties_hash\n self.class.send(:property_list).inject({}) do |hash, property|\n hash.merge(property.to_hash(self))\n end\n end",
"def property_objects\n hash = {}\n self.class.properties.each { |prop| hash[prop] = @properties[prop] }\n hash\n end",
"def to_hash\n... | [
"0.73561674",
"0.7222284",
"0.72018546",
"0.7129041",
"0.7120944",
"0.71134275",
"0.70107436",
"0.69681937",
"0.69446194",
"0.6911096",
"0.6911096",
"0.6877544",
"0.6867742",
"0.6840477",
"0.6783789",
"0.67366326",
"0.6720364",
"0.66989625",
"0.6696661",
"0.66567147",
"0.6656... | 0.83505917 | 0 |
Creates a hash for all products | def all_product_hash
hash = {}
items = @all_products
for prod in items
hash[prod] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [name, product_ids_any, product_ids_all, quantity_exact, quantity_min, quantity_max, all_products].hash\n end",
"def all_prod_comp_hash(item=nil)\n\n hash = {}\n\n if(!item.nil?)\n items = item.components\n else\n items = @all_products\n end\n\n for comp in item... | [
"0.7073511",
"0.6473979",
"0.635769",
"0.63136965",
"0.62572646",
"0.62572646",
"0.62572646",
"0.62572646",
"0.62572646",
"0.62572646",
"0.62572646",
"0.6239127",
"0.6233616",
"0.61678636",
"0.6075923",
"0.6047452",
"0.6032454",
"0.5996097",
"0.5979352",
"0.5918926",
"0.59155... | 0.7736915 | 0 |
Creates a hash for all components | def all_component_hash(item=nil)
hash = {}
items = []
if(!item.nil?)
items = item.components
else
for comp in @all_components
if(comp.component_parents.empty?)
items.push(comp)
end
end
end
for comp in items
hash[comp] = all_component_hash(comp)
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash; end",
"def hash; end",
"def hash; end",
"def has... | [
"0.69795907",
"0.6754393",
"0.6754393",
"0.6754393",
"0.6754393",
"0.6754393",
"0.6754393",
"0.6754393",
"0.6622419",
"0.6622419",
"0.6622419",
"0.6622419",
"0.6622419",
"0.6622419",
"0.6622419",
"0.6622419",
"0.6622419",
"0.6622419",
"0.6587572",
"0.65646434",
"0.6564558",
... | 0.6586064 | 19 |
Creates a hash for all valuefields | def all_valuefield_hash
hash = {}
items = @all_valuefields
for vf in items
hash[vf] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values_hash\n hashify(:value)\n end",
"def fields_hash\n each_pair.to_h\n end",
"def field_hash\n\n self.yattributes || fields.inject({}) { |r, f| r[f.fkey] = f.value; r }\n end",
"def to_field_hash\n to_values_hash.flatten\n end",
"def hash\n raw = [name, t... | [
"0.74033475",
"0.7286386",
"0.72832227",
"0.71734506",
"0.7046589",
"0.6868515",
"0.68565035",
"0.6713206",
"0.66925",
"0.66783965",
"0.66783965",
"0.6637003",
"0.6631829",
"0.6589479",
"0.65876424",
"0.65799785",
"0.6552264",
"0.65461266",
"0.6529494",
"0.6504742",
"0.650053... | 0.84429306 | 0 |
Creates a hash for all images | def all_image_hash
hash = {}
items = @all_images
for img in items
hash[img] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_hash; end",
"def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end",
"def hash\n @real.hash ^ @image.hash\n end",
"def images\n @images ||= Hash.new\n end",
"def create_images\n imgNames = Hash[\n \tFile.join(Dir.home, 'Desktop/image1.png... | [
"0.75077754",
"0.69907784",
"0.6733545",
"0.6701184",
"0.6669953",
"0.6547589",
"0.6434566",
"0.64201224",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.63923895",
"0.6360124",
"0.6360124",
"0.624349",
"0.6210763",
"0.6206685",
... | 0.7829283 | 0 |
Creates a hash for all images | def all_datafile_hash
hash = {}
items = @all_datafiles
for df in items
hash[df] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_image_hash\n hash = {}\n items = @all_images\n for img in items\n hash[img] = {}\n end\n return hash\n end",
"def image_hash; end",
"def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end",
"def hash\n @real.hash ^ @image.hash\n end",
... | [
"0.7829283",
"0.75077754",
"0.69907784",
"0.6733545",
"0.6701184",
"0.6669953",
"0.6547589",
"0.6434566",
"0.64201224",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.63923895",
"0.6360124",
"0.6360124",
"0.624349",
"0.6210763",
... | 0.55136365 | 89 |
Creates a hash for all images | def all_validation_hash
hash = {}
items = @all_validations
for vd in items
hash[vd] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_image_hash\n hash = {}\n items = @all_images\n for img in items\n hash[img] = {}\n end\n return hash\n end",
"def image_hash; end",
"def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end",
"def hash\n @real.hash ^ @image.hash\n end",
... | [
"0.7829283",
"0.75077754",
"0.69907784",
"0.6733545",
"0.6701184",
"0.6669953",
"0.6547589",
"0.6434566",
"0.64201224",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.63923895",
"0.6360124",
"0.6360124",
"0.624349",
"0.6210763",
... | 0.0 | -1 |
Creates a hash for all products and components | def all_prod_comp_hash(item=nil)
hash = {}
if(!item.nil?)
items = item.components
else
items = @all_products
end
for comp in items
hash[comp] = all_prod_comp_hash(comp)
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_product_hash\n hash = {}\n items = @all_products\n for prod in items\n hash[prod] = {}\n end\n return hash\n end",
"def hash\n [name, product_ids_any, product_ids_all, quantity_exact, quantity_min, quantity_max, all_products].hash\n end",
"def hash\n [description, filt... | [
"0.7531119",
"0.71283114",
"0.6604469",
"0.65833277",
"0.636211",
"0.62478995",
"0.6161364",
"0.61421555",
"0.6138925",
"0.6083583",
"0.60561466",
"0.6051967",
"0.60285294",
"0.6009138",
"0.6007196",
"0.5990676",
"0.5913872",
"0.5902172",
"0.5900502",
"0.5890153",
"0.5877546"... | 0.7326326 | 1 |
displays the board layout to the user in the command line | def display_board(board)
rows = [" #{board[0]} | #{board[1]} | #{board[2]} ", "-----------", " #{board[3]} | #{board[4]} | #{board[5]} ", "-----------", " #{board[6]} | #{board[7]} | #{board[8]} "]
puts rows[0]
puts rows[1]
puts rows[2]
puts rows[3]
puts rows[4]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_board\n puts \" \" + board_spaces[1] + \" | \" + board_spaces[2] + \" | \" + board_spaces[3] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[4] + \" | \" + board_spaces[5] + \" | \" + board_spaces[6] + \" \"\n puts \"-----------\"\n puts \" \" + board_spaces[7] + \" | \" + board_... | [
"0.7842623",
"0.7756422",
"0.77560467",
"0.7733877",
"0.7674787",
"0.7668915",
"0.7629692",
"0.76278996",
"0.7612285",
"0.7595042",
"0.7595042",
"0.7591571",
"0.7591571",
"0.7591571",
"0.7591571",
"0.7591571",
"0.7591571",
"0.7591571",
"0.7591571",
"0.7591571",
"0.7591571",
... | 0.0 | -1 |
converts string input from gets to an integer so it can be used to access array indices | def input_to_index(user_input)
user_input.to_i - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_to_index(user_input)\n # user_input = gets.strip\n converted_input = user_input.to_i\n converted_input - 1 \nend",
"def input_to_index(user_input) #this method takes one argument (the users input)\n new_user_input = user_input.to_i #this specific .to converts the string into an intergeer\n new_use... | [
"0.7873866",
"0.7829953",
"0.78160214",
"0.7812294",
"0.781009",
"0.7790098",
"0.7571401",
"0.7422521",
"0.741129",
"0.7411127",
"0.73129356",
"0.72873694",
"0.72816634",
"0.72775126",
"0.7259597",
"0.72487044",
"0.72482264",
"0.7241566",
"0.7230029",
"0.7227227",
"0.72139543... | 0.7168639 | 62 |
moves player marker (X or O) to their desired position on the board | def move(board, position, current_player)
board[position] = current_player
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_move(board, index, marker)\n board[index] = marker\n end",
"def place_marker(x, y)\n val = x.to_i - 1\n key = y\n row_arry = @grid_hash[key]\n if row_arry[val] == ' '\n if @@counter.odd?\n # player 1 #\n row_arry[val] = 'x'\n end_turn\n else\n ... | [
"0.81977737",
"0.78285253",
"0.7800867",
"0.77579075",
"0.7605531",
"0.74125504",
"0.73591495",
"0.7332739",
"0.73271185",
"0.73271185",
"0.7293614",
"0.7265896",
"0.71612835",
"0.71385115",
"0.7136487",
"0.7114003",
"0.7072028",
"0.69810545",
"0.69810545",
"0.6974722",
"0.69... | 0.6744049 | 54 |
checks if the position is taken | def position_taken?(board, position)
board[position] != " " && board[position] != ""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_taken?\nend",
"def position_taken?(position)\n @board[position] != \" \"\n end",
"def position_taken?(position)\n @board[position] != nil && @board[position] != \" \"\n end",
"def position_taken?(index)\n @board[index] == \"X\" || @board[index] == \"O\"\n end",
"def positio... | [
"0.8109093",
"0.7775881",
"0.7759322",
"0.77533996",
"0.77317727",
"0.77210087",
"0.77174985",
"0.77020574",
"0.77020574",
"0.7670469",
"0.7647033",
"0.7645927",
"0.76266325",
"0.76205945",
"0.7614181",
"0.75997615",
"0.75933087",
"0.7582109",
"0.7561027",
"0.7550584",
"0.754... | 0.0 | -1 |
checks if move is on the board or if the position is taken | def valid_move?(board, position)
position.between?(0, 8) && !position_taken?(board, position)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_move?(board, index)\n # Is the position taken?\n pos_taken = position_taken?(board, index)\n # Is the position on the board?\n on_board = index.between?(0, board.length - 1)\n # If position is open and on the board, return true,\n if !pos_taken && on_board\n return true\n else\n return false... | [
"0.80792993",
"0.8067555",
"0.8067508",
"0.7998108",
"0.7997551",
"0.7996043",
"0.79471105",
"0.7938306",
"0.7933517",
"0.79316616",
"0.79257625",
"0.7919123",
"0.7918614",
"0.79119545",
"0.7911005",
"0.7904976",
"0.78985584",
"0.7890923",
"0.7885436",
"0.7882803",
"0.7880304... | 0.8196325 | 0 |
counts the number of turns that have been taken | def turn_count(board)
count = 0
board.each do |index|
index == "X" || index == "O" ? count += 1 : nil
end
return count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_count\n x_turns = @board.count(\"X\")\n o_turns = @board.count(\"O\")\n turn_count = x_turns + o_turns\n return turn_count\nend",
"def turn_count\n turns = 0\n @board.each do |spot|\n if spot==\"X\" || spot==\"O\"\n turns += 1\n end\n end\n return turns\n end",
"def t... | [
"0.7852378",
"0.78406787",
"0.7825711",
"0.7753982",
"0.771505",
"0.7713799",
"0.7707615",
"0.7705293",
"0.7696642",
"0.76965386",
"0.76959246",
"0.768735",
"0.7686482",
"0.7680617",
"0.76797384",
"0.76612693",
"0.7659563",
"0.7654922",
"0.7646134",
"0.7642822",
"0.7636247",
... | 0.72318727 | 54 |
determines the current player (X or O) because X always goes first, turn_count will always be uneven before X's go | def current_player(board)
count = turn_count(board)
if count.even?
return "X"
else
return "O"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_player\r\n turn_count\r\n if turn_count % 2 == 0\r\n return \"X\"\r\n else\r\n return \"O\"\r\n end\r\n end",
"def current_player\n turn_count == 0 || turn_count % 2 == 0 ? \"X\" : \"O\"\n end",
"def current_player\n turn = turn_count\n ... | [
"0.8397943",
"0.8391056",
"0.8257192",
"0.825642",
"0.825642",
"0.82500273",
"0.8230087",
"0.8208399",
"0.8198374",
"0.8198374",
"0.8198374",
"0.8188007",
"0.81862175",
"0.8175277",
"0.8159379",
"0.8155124",
"0.81500787",
"0.81462485",
"0.8143556",
"0.8143064",
"0.81369144",
... | 0.75441116 | 98 |
turn calls on the above helper methods to get input from the user and record a turn | def turn(board)
player = current_player(board)
got_valid = false
puts "Please choose a position between 1-9:"
while got_valid == false
user_input = gets.strip
position = input_to_index(user_input)
if valid_move?(board, position)
move(board, position, player)
display_board(board)
got_valid = true
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n\t\twelcome\n\t\task_name\n\t\task_name2 \n\t\task_input\n\t\tturns\n\tend",
"def input\n puts \"It's #{@player_turn.capitalize}'s turn. Please enter your move/ command.\"\n @input = gets.chomp.upcase\n end",
"def input\n\t\tprint_word\n\t\tprint \"\\n>> \"\n\t\tinput = gets.chomp\n\t\tif @pla... | [
"0.73128885",
"0.70781195",
"0.6933419",
"0.68737465",
"0.6823643",
"0.6783372",
"0.675757",
"0.673608",
"0.6708569",
"0.67057467",
"0.6662589",
"0.6653658",
"0.663074",
"0.6614861",
"0.66137695",
"0.65876985",
"0.6568625",
"0.65269",
"0.6505233",
"0.64932114",
"0.6485892",
... | 0.0 | -1 |
determines whether or not a player has won and returns the winning combination if there is a win and false if there isn't | def won?(board)
WIN_COMBINATIONS.each do |win_combo|
pos_one = win_combo[0]
pos_two = win_combo[1]
pos_three = win_combo[2]
if board[pos_one] != " " && board[pos_one] == board[pos_two] && board[pos_two] == board[pos_three]
return win_combo
end
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def won?()\n\n # loops through the 2D array WIN_COMBINATIONS\n WIN_COMBINATIONS.each do |combination|\n\n # flags\n x_win = 0\n o_win = 0\n\n combination.each do |index|\n\n # checks if player X wins\n if @board[index] == \"X\"\n x_win += 1\n\n ... | [
"0.8327102",
"0.83234674",
"0.822097",
"0.8198454",
"0.81779665",
"0.8173098",
"0.8168596",
"0.8116829",
"0.81163055",
"0.81070983",
"0.8103316",
"0.8083907",
"0.80714333",
"0.80579615",
"0.80477935",
"0.8036691",
"0.80156755",
"0.80153245",
"0.8014955",
"0.8003463",
"0.79940... | 0.0 | -1 |
returns true if the board is full (draw) | def full?(board)
!board.include?(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def board_full?(brd)\n empty_squares(brd).empty?\n end",
"def isBoardFull()\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (@board[i][j]==EMPTY)\n return false\n end\n end\n en... | [
"0.881816",
"0.87224096",
"0.8705429",
"0.86755717",
"0.86513954",
"0.8632615",
"0.85844284",
"0.85844284",
"0.8558072",
"0.8542994",
"0.8522764",
"0.84886265",
"0.8480673",
"0.84772813",
"0.84772813",
"0.84048176",
"0.8396499",
"0.837035",
"0.83687645",
"0.8363026",
"0.83630... | 0.0 | -1 |
returns true if the board has not been won but is full, false if the board is not won and the board is not full, and false if the board is won | def draw?(board)
if won?(board)
false
elsif full?(board)
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full? #if theres no winning combos and the board is full? check to see\n @board.all?{|square| square!= \" \" }\n end",
"def over?(board)\n if(!!won?(board))\n return true\n elsif(full?(board))\n return true\n end\n return false\nend",
"def full?\n @board.all?... | [
"0.8715606",
"0.8457652",
"0.83887273",
"0.8347352",
"0.8345908",
"0.83393186",
"0.83294684",
"0.8325962",
"0.8307551",
"0.8295115",
"0.8286204",
"0.82818896",
"0.82818896",
"0.82378095",
"0.8233255",
"0.8222889",
"0.8210484",
"0.82100296",
"0.8202207",
"0.81741947",
"0.81682... | 0.0 | -1 |
returns true if the game is ovr (win/draw) | def over?(board)
if won?(board) || draw?(board)
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw?\n \t@game_over == true and @winner == false\n end",
"def game_is_over?\n (won? || draw? || full?) ? true : false\n end",
"def over?\n draw? || won?\n end",
"def over?\n draw? || won?\n end",
"def over?\n if draw? == true or won? != false\n return t... | [
"0.7454595",
"0.7369726",
"0.7369414",
"0.7345956",
"0.73402804",
"0.7331565",
"0.7331228",
"0.7296298",
"0.7296298",
"0.7288599",
"0.7273116",
"0.7269048",
"0.726067",
"0.7258506",
"0.72488505",
"0.7243298",
"0.72399473",
"0.72378737",
"0.72378737",
"0.72345495",
"0.72082",
... | 0.0 | -1 |
returns the current player (X or O) depending on who won | def winner(board)
if won?(board) && board[won?(board)[0]] == "X"
return "X"
elsif won?(board) && board[won?(board)[0]] == "O"
return "O"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\r\n if self.won? != false\r\n if self.current_player == \"X\"\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end\r\n end",
"def current_player\n player = nil\n if turn_count() % 2 == 0\n player = 'X'\n else\n player = 'O'\n end\n ret... | [
"0.8405077",
"0.8381531",
"0.83064467",
"0.8267883",
"0.82061416",
"0.8180897",
"0.815627",
"0.81288904",
"0.81178117",
"0.8079409",
"0.8050384",
"0.8048401",
"0.8020336",
"0.8016536",
"0.8007132",
"0.7982897",
"0.7946468",
"0.7946468",
"0.79414046",
"0.7918997",
"0.7918997",... | 0.0 | -1 |
the play method is the method that rus the game using the helpr methods | def play(board)
while !over?(board)
turn(board)
end
if won?(board)
puts "Congratulations #{winner(board)}!"
elsif draw?(board)
puts "Cat's Game!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n #calls to all the methods that produce game!\n end",
"def play; end",
"def play \n end",
"def play\n \n end",
"def play\n\t\tgame_loop\n\tend",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n\tend",
"def play\n ... | [
"0.87633026",
"0.81679434",
"0.81589025",
"0.8145581",
"0.81110036",
"0.80821043",
"0.80586505",
"0.80586505",
"0.80586505",
"0.80586505",
"0.79644406",
"0.78774005",
"0.77044684",
"0.75336766",
"0.75064915",
"0.7497062",
"0.74899805",
"0.74563855",
"0.7453192",
"0.7453192",
... | 0.0 | -1 |
define permitted attributes for strong parameters feature cancancan will look for "create_params" and "update_params" methods while loading resources so these are here to prevent an exception | def create_params
sample_storage_container_params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end",
"def resource_params\n params.require(resource_name).permit(*permitted_params)\n end",
"def strong_parameters\n\t\t\tattrs = self.attribute_names - [\"created_at\", \"updated_at\", \"id\"]\n\t\t\tatt... | [
"0.7850429",
"0.7298118",
"0.725215",
"0.72401816",
"0.7216541",
"0.71798575",
"0.71505195",
"0.7147149",
"0.7110159",
"0.7067974",
"0.69763404",
"0.69573665",
"0.6918069",
"0.6895281",
"0.6874742",
"0.6874742",
"0.68576556",
"0.68500894",
"0.6847119",
"0.68360615",
"0.682273... | 0.0 | -1 |
Generate the video tag +options+ you can specify height/width/allowfullscreen for an individual video here | def video_tag(options = {})
options = ActiveRecord::Acts::Cinema::DEFAULT_OPTIONS.merge(options)
video_url = read_attribute(ActiveRecord::Acts::Cinema::SOURCE_PARAM)
width = options[:width]
height = options[:height]
allow_full_screen = options[:allow_full_screen] ? "true" : "false"
# Check the tag option, if a method is assigned,
# call it to get the template string
if options[:tag_template].is_a?(Symbol)
tag_template = self.send options[:tag_template]
else
tag_template = options[:tag_template]
end
ERB.new(tag_template).result(binding)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_video_directly options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_md5|\n l1 = video_md5[0..1]\n l2 = video_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in M... | [
"0.71909595",
"0.6952281",
"0.69388676",
"0.63539743",
"0.6339057",
"0.63382554",
"0.63025355",
"0.6230984",
"0.6212228",
"0.61467355",
"0.61361605",
"0.6087843",
"0.6050872",
"0.6015247",
"0.59435266",
"0.59200305",
"0.58018124",
"0.5798503",
"0.57810897",
"0.576828",
"0.574... | 0.77156365 | 0 |
attr_accessible : :email,:topic, :phone_number, :body, :created_at, :updated_at, :escalated, :needed_by | def escalate_to_admin
self.update_attributes(:escalated => true)
InvestigateMailer.escalate_email(self).deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_params\n params.require(:email).permit(:from_name,:from_email,:to_email,:subject,:text_body,:user_id,:html_body,:is_published)\n end",
"def topic_params\n params.require(:topic).permit(:name, :description, :created_by)\n end",
"def permitted_attributes\n [:user_id, :code, :name, :statu... | [
"0.6529876",
"0.6481785",
"0.63628954",
"0.6337481",
"0.62908316",
"0.6254169",
"0.625216",
"0.6225253",
"0.62250584",
"0.6161487",
"0.61449695",
"0.6067164",
"0.60516226",
"0.6050973",
"0.6026839",
"0.60252947",
"0.602467",
"0.6008757",
"0.5997703",
"0.5997",
"0.59946746",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_picture_collection
@picture_collection = PictureCollection.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def picture_collection_params
params.require(:picture_collection).permit(:collection_id, :picture_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.6946679",
"0.6811753",
"0.67995036",
"0.679359",
"0.67437977",
"0.6738685",
"0.6525698",
"0.65186113",
"0.6492684",
"0.64316213",
"0.64316213",
"0.64316213",
"0.6397299",
"0.63539475",
"0.63526994",
"0.6344162",
"0.63427454",
"0.6336022",
"0.63279474",
"0.63279474",
"0.632... | 0.0 | -1 |
Gets access to client | def oauth_access
client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret})
request_token = client.request_token
token = request_token.token
secret = request_token.secret
puts "Go to http://www.fitbit.com/oauth/authorize?oauth_token=#{token} and then enter the verifier code below and hit Enter"
verifier = gets.chomp
access_token = client.authorize(token, secret, { :oauth_verifier => verifier })
puts "Verifier is: "+verifier
puts "Token is: "+access_token.token
puts "Secret is: "+access_token.secret
token = access_token.token
secret = access_token.secret
user_id = '3B8C8S'
client = Fitgem::Client.new({:consumer_key => @consumer_key, :consumer_secret => @consumer_secret, :token => token, :secret => secret, :user_id => user_id})
access_token = client.reconnect(token, secret)
# Pass client to runner here
client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getclient\n return @client\n end",
"def client\n @client\n end",
"def client\n @client\n end",
"def get_client\n @client\n end",
"def client_access\n super\n end",
"def client\n\t\treturn @client\n\tend",
"def client\n @client\n end",
"def client\n @client... | [
"0.75716084",
"0.7344322",
"0.7344322",
"0.730398",
"0.7221974",
"0.71736616",
"0.7100587",
"0.7100587",
"0.7100587",
"0.7026085",
"0.6906161",
"0.69056594",
"0.68686044",
"0.6845626",
"0.6841886",
"0.68337435",
"0.6753792",
"0.6753792",
"0.6708698",
"0.6691486",
"0.6606681",... | 0.0 | -1 |
Cache "now" so that digests match... TODO: figure out how we might want to expire this cache... | def now
@now ||= Time.now.utc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def now\n cache\n end",
"def now\n cache\n end",
"def now\n cache\n end",
"def expires_now; end",
"def cache_valid_from\n if caching_enabled?\n @cache_valid_from ||= Time.now\n else\n invalidate_cache!\n end\n @cache_vali... | [
"0.7747326",
"0.7747326",
"0.7740735",
"0.67308563",
"0.65119",
"0.6469379",
"0.62900114",
"0.6280648",
"0.62240136",
"0.6202402",
"0.61736476",
"0.61736476",
"0.6155824",
"0.61491525",
"0.60677433",
"0.6062298",
"0.6062298",
"0.60501415",
"0.60400414",
"0.600054",
"0.5999402... | 0.5795723 | 41 |
We're going to generate the timestamp ourselves, since WSSE is hard coded to generate the timestamp section directly within wsse:Security. TODO: Allow for configurability of these timestamps. | def timestamp
{
"u:Timestamp" => {
"u:Created" => now.xs_datetime,
"u:Expires" => (now + 60 * 5).xs_datetime,
:order! => ["u:Created", "u:Expires"],
},
:attributes! => { "u:Timestamp" => { "u:Id" => timestamp_id, "xmlns:u" => WSUNamespace } },
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wsu_timestamp\n security_hash :wsu, \"Timestamp\",\n \"wsu:Created\" => (created_at || Time.now).xs_datetime,\n \"wsu:Expires\" => (expires_at || (created_at || Time.now) + 60).xs_datetime\n end",
"def generate_timestamp\n Time.now.strftime(\"%Y-%m-%dT%T.%N%:z\")\n end",... | [
"0.7668719",
"0.70871943",
"0.6882533",
"0.6720933",
"0.6365917",
"0.6329936",
"0.6305434",
"0.6297988",
"0.6294691",
"0.62787247",
"0.62358046",
"0.62048787",
"0.6183145",
"0.61368436",
"0.61064065",
"0.6050609",
"0.6024699",
"0.6024393",
"0.6024393",
"0.6024393",
"0.6024393... | 0.68034965 | 3 |
right One angle of the triangle is a right angle (90 degrees) acute All 3 angles of the triangle are less than 90 degrees obtuse One angle is greater than 90 degrees. To be a valid triangle, the sum of the angles must be exactly 180 degrees, and all angles must be greater than 0: if either of these conditions is not satisfied, the triangle is invalid. Write a method that takes the 3 angles of a triangle as arguments, and returns a symbol :right, :acute, :obtuse, or :invalid depending on whether the triangle is a right, acute, obtuse, or invalid triangle. You may assume integer valued angles so you don't have to worry about floating point errors. You may also assume that the arguments are specified in degrees. | def valid_triangle(deg1, deg2, deg3)
return :invalid if deg1 + deg2 + deg3 != 180
return :invalid if deg1 <= 0 || deg2 <= 0 || deg3 <= 0
:valid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangle(angle1, angle2, angle3)\n angles = [angle1, angle2, angle3]\n return :invalid unless angles.sum == 180 && angles.all?(&:positive?)\n\n if angles.include?(90)\n :right\n elsif angles.all? { |angle| angle < 90 }\n :acute\n else\n :obtuse\n end\nend",
"def triangle(angle1, angle2, angle3... | [
"0.8748617",
"0.87328637",
"0.8643118",
"0.864102",
"0.86348295",
"0.86137396",
"0.86102813",
"0.86074847",
"0.86046904",
"0.8596239",
"0.85850525",
"0.8567385",
"0.85637075",
"0.85527486",
"0.8531753",
"0.8508684",
"0.8503153",
"0.8471452",
"0.84654504",
"0.8456906",
"0.8322... | 0.7468811 | 25 |
TODO: it's not clear to me whether this can be generated at all. | def process_else(exp)
add_to_score :branch
@scorer.penalize_by 0.1 do
analyze_list exp
end
s()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def custom; end",
"def custom; end",
"def formation; end",
"def implementation; end",
"def implementation; end",
"def generate; end",
"def generate; end",
"def schubert; end... | [
"0.741562",
"0.63965315",
"0.63965315",
"0.63965315",
"0.63965315",
"0.63382274",
"0.6159166",
"0.6159166",
"0.6107916",
"0.5987315",
"0.5987315",
"0.59718317",
"0.59718317",
"0.592249",
"0.58518183",
"0.5846135",
"0.5846135",
"0.5846135",
"0.5846135",
"0.5841233",
"0.58391",... | 0.0 | -1 |
Public: Prints the elements inside tree nodes in a PARENT LEFT RIGHT manner x Node, Preferably a root node Examples NOTE: Based on the mock tree structure at LINE:61 preoder_tree_walk(F) => F B A D C E G I H | def preoder_tree_walk(x)
unless x.nil?
p x.key
preoder_tree_walk(x.left)
preoder_tree_walk(x.right)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend",
"def preorder(node)\n return if !node\n print node.value, \" \"\n preorder(node.left... | [
"0.6997386",
"0.6885649",
"0.68095547",
"0.6699235",
"0.6674675",
"0.665289",
"0.6595587",
"0.6548316",
"0.653387",
"0.64814216",
"0.63783693",
"0.63685155",
"0.63498884",
"0.628961",
"0.62798953",
"0.62707573",
"0.6260636",
"0.62538236",
"0.6225005",
"0.6216512",
"0.62128687... | 0.709064 | 0 |
Public: Prints the elements inside tree nodes in a LEFT RIGHT PARENT manner x Node, Preferably a root node Examples NOTE: Based on the mock tree structure at LINE:61 postorder_tree_walk(F) => A C E D B H I G F | def postorder_tree_walk(x)
unless x.nil?
postorder_tree_walk(x.left)
postorder_tree_walk(x.right)
p x.key
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preorder(node)\n return if !node\n print node.value, \" \"\n preorder(node.left_child)\n preorder(node.right_child)\n end",
"def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n ... | [
"0.6935577",
"0.69213015",
"0.6864955",
"0.68047947",
"0.67963105",
"0.6789903",
"0.6738954",
"0.6690396",
"0.66553366",
"0.66539526",
"0.6625834",
"0.66160625",
"0.6540885",
"0.6508527",
"0.6493962",
"0.6455651",
"0.6444168",
"0.6426628",
"0.6425922",
"0.6385903",
"0.6376368... | 0.6909823 | 2 |
unused currently unable to call from view | def incprintcount
@post = Post.find(params[:id])
if @post.printcount.blank?
@post.update_attribute(:printcount, "1")
@post.save
else
@post.update_attribute(:printcount, @post.printcount + 1)
@post.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _view; end",
"def view; end",
"def private; end",
"def view_flow; end",
"def rendered_views=(_arg0); end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def render; end",
"def view\n end",
"def rendered; end",
"def loc_view\n \n end",
"def rendered=... | [
"0.7381524",
"0.7137623",
"0.6825302",
"0.6801576",
"0.6727366",
"0.6583986",
"0.6583986",
"0.6583986",
"0.6583986",
"0.6583986",
"0.6484622",
"0.64833564",
"0.6417709",
"0.63687205",
"0.6364569",
"0.62448275",
"0.62367165",
"0.623068",
"0.62185603",
"0.62185603",
"0.6215949"... | 0.0 | -1 |
go to app controller to change ip while on local host | def getlocation
@myip = remote_ip()
# based off freegeoip.net is really terrible
result = Geocoder.search(@myip)
@mylat = result.latitude
@mylong = result.longitude
@mycity = result.address
#51.243048, -0.588458
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_ip\n @ip = get_ip(request.remote_ip.to_s)\n end",
"def update_ip\n ip = ip_from_request_env\n logger.debug \"Built notice from #{ip}, current host ip is #{@host.ip}, updating\" if @host.ip != ip\n\n # @host has been changed even if the save fails, so we have to change it back\n old_ip = @... | [
"0.64206463",
"0.61753833",
"0.6172101",
"0.6138652",
"0.60515815",
"0.6035928",
"0.60241747",
"0.60093385",
"0.60051876",
"0.6001638",
"0.5934353",
"0.5901277",
"0.5892654",
"0.5849963",
"0.58456933",
"0.5815324",
"0.58004975",
"0.5773114",
"0.57495487",
"0.5724904",
"0.5721... | 0.0 | -1 |
GET /posts GET /posts.xml | def index
# @posts = Post.all(:order => "created_at DESC")
@posts = Post.paginate :page => params[:page], :per_page => 24, :order => "created_at DESC"
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @posts }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ... | [
"0.73163414",
"0.72102565",
"0.72102565",
"0.70133805",
"0.69922805",
"0.69905823",
"0.6946224",
"0.68449396",
"0.6825624",
"0.68239427",
"0.67839086",
"0.67474705",
"0.6744808",
"0.67014694",
"0.66831535",
"0.66570085",
"0.66536814",
"0.6641173",
"0.6569632",
"0.6569632",
"0... | 0.6423995 | 40 |
GET /posts GET /posts.xml | def search
@search = Post.search(params[:search])
@posts = @search.all
@posts = @search.paginate :page => params[:page], :per_page => 24, :order => "created_at DESC"
@posts_count = @search.count
# @search = Post.offer_like_any(params[:search])
# @posts = @search.all.paginate :page => params[:page], :per_page => 24, :order => "created_at DESC"
# @posts = Post.offer_like_any(params[:search].to_s.split).paginate :page => params[:page], :per_page => 24, :order => "created_at DESC"
# @posts = Post.company_like_any(params[:search].to_s.split).paginate :page => params[:page], :per_page => 24, :order => "created_at DESC"
respond_to do |format|
format.html # search.html.erb
format.xml { render :xml => @posts }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ... | [
"0.73163414",
"0.72102565",
"0.72102565",
"0.70133805",
"0.69922805",
"0.69905823",
"0.6946224",
"0.68449396",
"0.6825624",
"0.68239427",
"0.67839086",
"0.67474705",
"0.6744808",
"0.67014694",
"0.66831535",
"0.66570085",
"0.66536814",
"0.6641173",
"0.6569632",
"0.6569632",
"0... | 0.0 | -1 |
GET /posts GET /posts.xml | def list
@posts = Post.paginate :page => params[:page], :per_page => 24, :order => "created_at DESC"
respond_to do |format|
format.html # list.html.erb
format.xml { render :xml => @posts }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ... | [
"0.73163414",
"0.72102565",
"0.72102565",
"0.70133805",
"0.69922805",
"0.69905823",
"0.6946224",
"0.68449396",
"0.6825624",
"0.67839086",
"0.67474705",
"0.6744808",
"0.67014694",
"0.66831535",
"0.66570085",
"0.66536814",
"0.6641173",
"0.6569632",
"0.6569632",
"0.6569632",
"0.... | 0.68239427 | 9 |
GET /posts/1 GET /posts/1.xml | def show
@post = Post.find(params[:id])
unless @post.latitude.blank? or @post.longitude.blank?
@map = GMap.new("map")
@map.control_init(:large_map => true,:map_type => true)
@map.set_map_type_init(GMapType::G_HYBRID_MAP)
@map.center_zoom_init([@post.latitude,@post.longitude],17)
@map.icon_global_init(GIcon.new(:image => "/rework/location.png",
:icon_anchor => GPoint.new(6,11),
:info_window_anchor => GPoint.new(6,11)),
"businessicon")
@map.icon_global_init(GIcon.new(:image => "/rework/youarehere.png",
:icon_anchor => GPoint.new(13,14),
:info_window_anchor => GPoint.new(13,14)),
"hereicon")
busloc = Variable.new("businessicon")
youarehere = Variable.new("hereicon")
@marker = GMarker.new([@post.latitude,@post.longitude], :icon => busloc, :title => @post.company, :info_window => @post.offer)
@myloc = GMarker.new([@mylat,@mylong], :icon => youarehere,:title => "You", :info_window => "You Are Here At #@mylat, #@mylong")
@map.overlay_init(@marker)
@map.overlay_init(@myloc)
end
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @post }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => ... | [
"0.7223093",
"0.7073613",
"0.7073613",
"0.697867",
"0.6954207",
"0.6903348",
"0.679717",
"0.6776279",
"0.6773115",
"0.6706225",
"0.670266",
"0.6697981",
"0.6677228",
"0.6665081",
"0.6665081",
"0.6665081",
"0.6665081",
"0.6665081",
"0.6665081",
"0.6665081",
"0.6665081",
"0.6... | 0.0 | -1 |
GET /posts/new GET /posts/new.xml | def new
@post = Post.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end",
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n... | [
"0.78365606",
"0.7708412",
"0.76752806",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
"0.7665492",
... | 0.7567351 | 24 |
POST /posts POST /posts.xml | def create
@post = Post.new(params[:post])
respond_to do |format|
if @post.save
format.html { redirect_to(@post, :notice => 'Post was successfully created.') }
format.xml { render :xml => @post, :status => :created, :location => @post }
else
format.html { render :action => "new" }
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n ... | [
"0.6847672",
"0.6799606",
"0.6638679",
"0.6625985",
"0.6582057",
"0.63850963",
"0.6320757",
"0.627628",
"0.62496513",
"0.62292284",
"0.6224684",
"0.6214792",
"0.62033695",
"0.61848694",
"0.6183795",
"0.61547226",
"0.61526495",
"0.6142421",
"0.61416507",
"0.6132199",
"0.61245"... | 0.59137267 | 35 |
PUT /posts/1 PUT /posts/1.xml | def update
@post = Post.find(params[:id])
respond_to do |format|
if @post.update_attributes(params[:post])
format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @post.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def upd... | [
"0.68651897",
"0.6690302",
"0.6296158",
"0.628079",
"0.61023486",
"0.60967356",
"0.60338587",
"0.59068114",
"0.59000576",
"0.5891347",
"0.58817357",
"0.58754456",
"0.58665144",
"0.5847078",
"0.58386284",
"0.5834547",
"0.5827054",
"0.5824204",
"0.58199763",
"0.5814364",
"0.581... | 0.58067876 | 24 |
DELETE /posts/1 DELETE /posts/1.xml | def destroy
@post = Post.find(params[:id])
@post.destroy
respond_to do |format|
format.html { redirect_to(posts_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.deleted = 1\n ... | [
"0.7365959",
"0.73219866",
"0.7206054",
"0.71519285",
"0.71519285",
"0.70925856",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
"0.70686704",
... | 0.7040628 | 23 |
output: string, with a comma, space and the first name format is Last name, First name for the return string data structure: array algo: split the string into an array and use parallel assignment, assign two different variables for first and last name return the string in the format above using string interpolation | def swap_name(full_name)
first_name, last_name = full_name.split(' ')
altered_name = "#{last_name}, #{first_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rearrange(string)\n match = /(\\w+), (\\w+) (\\w+)/.match(string) #(1)\n last_name = match[1]\n first_name = match[2]\n middle_name = match[3]\n \"#{first_name} #{middle_name[0,1]}. #{last_name}\" #(2)\nend",
"def rearrange(name)\n match = /(\\w+), (\\w+)( \\w+)?/.match(name) # (1)\n\n last_name = ma... | [
"0.69440377",
"0.68824387",
"0.6861885",
"0.6836154",
"0.6815384",
"0.681294",
"0.68057173",
"0.68028796",
"0.67968273",
"0.67735994",
"0.6754903",
"0.67395276",
"0.66896445",
"0.66311324",
"0.6630839",
"0.662611",
"0.662611",
"0.660613",
"0.6587113",
"0.6585405",
"0.65850514... | 0.6620172 | 17 |
outputs the id's that need to be removed from omni_dev | def output_must_delete_id
File.open('duplicate.txt') do |f|
f.each_line do |line|
is_first_result = true
name = line.strip
@sqlite.execute("select * from #{@table} where name='#{name}'") do |row|
if is_first_result
is_first_result = false
else
@must_delete_id << row[0]
end
end
end
end
puts @must_delete_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_ids\n # no-op\n end",
"def inspect\n \"#{@id.inspect} (#{@devices.count} devices)\"\n end",
"def get_removed_idles( list_of_idles )\n\t\tret_val = []\n\n\t\tcurrent_idles = get_idles\n\n\t\tlist_of_idles.each do |old_idle|\n\t\t\tunless current_idles.include? old_idle\n\t\t\t\tret_v... | [
"0.5599664",
"0.5580426",
"0.5575944",
"0.55665547",
"0.5501211",
"0.5484019",
"0.54737633",
"0.5441215",
"0.54245925",
"0.5377052",
"0.5376775",
"0.5353674",
"0.5346943",
"0.5339038",
"0.53124845",
"0.52985525",
"0.527253",
"0.52724665",
"0.5271439",
"0.5262856",
"0.5207046"... | 0.0 | -1 |
You are following user | def follow(other)
active_relationships.create(followed_id: other.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def following?\n user.present?\n end",
"def following\n @following||= get(\"/user/show/#{login}/following\")['users'].map { |u| User.new(connection, :login => u) }\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def follow \n @user = User.find_b... | [
"0.7828037",
"0.7586434",
"0.74211264",
"0.7385046",
"0.73594207",
"0.7353077",
"0.7333545",
"0.7329447",
"0.73188686",
"0.7316479",
"0.7313342",
"0.7313342",
"0.7313342",
"0.7300331",
"0.7300331",
"0.7300331",
"0.7300331",
"0.73001903",
"0.72838545",
"0.7278638",
"0.72708505... | 0.0 | -1 |
checks whether you are following some user or not | def following?(other)
following.include?(other)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def following?\n user.present?\n end",
"def following?(other_user)\n\t following.include?(other_user)\n \tend",
"def following?(user)\n following.include?(user)\n end",
"def following?(other_user)\n following.include?(other_user)\n end",
"def following?(other_user)\n\t followin... | [
"0.83064127",
"0.8088459",
"0.80749756",
"0.80683",
"0.8048035",
"0.8039388",
"0.8020794",
"0.8015167",
"0.8004677",
"0.7994099",
"0.7988969",
"0.7988969",
"0.7988969",
"0.7988969",
"0.7979337",
"0.7979337",
"0.7979337",
"0.79730475",
"0.79730475",
"0.79730475",
"0.79730475",... | 0.0 | -1 |
Creates a new Matrix with a (list of lists) | def initialize (row_list)
@rows = row_list
@rows_reduced = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assemble_matrix(mat_list)\n mat_list.flatten!\n rows = columns = mat_list.length**(0.5)\n final_matrix = (0..rows-1).map { |x| [] }\n\n (0..rows-1).each do |row|\n (0..columns-1).each do |column|\n offset = ( ( row / 2 ) * 8 ) +\n ( ( row % 2 ) * 2 ) +\n ( ( column / 2 )... | [
"0.6812207",
"0.6791393",
"0.67234606",
"0.6601026",
"0.64917505",
"0.6472199",
"0.62914264",
"0.6275328",
"0.626044",
"0.62409323",
"0.62270796",
"0.62007165",
"0.6162556",
"0.6161933",
"0.6155848",
"0.61508954",
"0.6127435",
"0.6120087",
"0.61091703",
"0.6100586",
"0.609524... | 0.0 | -1 |
Calculates the minimum element in a row | def min (row_num)
row = @rows[row_num]
min = row[0]
row.each do |num|
if min == 0 then
min = num
end
if (num < min) && (num != 0) then
min = num
end
end
return min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min\n min = get(0,0)\n\tfor i in 0...@filas\n for j in 0...@columnas\n if (get(i,j) < min)\n min = get(i,j)\n end\n end\n end\n min\n end",
"def min\n # Establecemos ... | [
"0.7722905",
"0.7538922",
"0.7506053",
"0.7400789",
"0.7291085",
"0.72551525",
"0.72491235",
"0.7223778",
"0.72022706",
"0.7177007",
"0.7140284",
"0.709822",
"0.70954186",
"0.7068832",
"0.7055058",
"0.7050754",
"0.70164704",
"0.7001922",
"0.70006156",
"0.69394386",
"0.6927789... | 0.81465644 | 0 |
Calculates the common factor of a row | def has_common (row_num, row_min)
row = @rows[row_num]
result = false
if row_min != 0 then
result = true
row.each do |num|
if result == true then
if (num != 0) && ((num.abs).modulo(row_min.abs) != 0) then
result = false
end
end
end
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_common_factors(arg_one,arg_two)\n max_factor_one, max_factor_two = arg_one / 2, arg_two / 2\n arg_one_factors = (2..max_factor_one).filter{|num| arg_one % num === 0 }\n arg_two_factors = (2..max_factor_two).filter{|num| arg_two % num === 0 }\n\n return arg_one_factors + arg_two_factors\n\nend",
"def ... | [
"0.61979204",
"0.6130847",
"0.6073339",
"0.5945819",
"0.583233",
"0.576845",
"0.57225376",
"0.5704762",
"0.5702288",
"0.5690293",
"0.5666728",
"0.5666728",
"0.56572676",
"0.5652409",
"0.5642133",
"0.56305593",
"0.5611286",
"0.55926484",
"0.559128",
"0.55783755",
"0.55783755",... | 0.6766124 | 0 |
Divides a whole row by its common factor (Row , Common Factor) | def reduce (row_num, row_min)
row = @rows[row_num]
for i in 0..(row.length - 1) do
@rows[row_num][i] = (@rows[row_num][i])/row_min
if @rows[row_num][i] == -0.0 then
@rows[row_num][i] = 0.0
end
end
num, den = row_min.to_fraction
if den == 1 then
puts "R#{row_num + 1} -> R#{row_num + 1}/#{num}"
else
puts "R#{row_num + 1} -> R#{row_num + 1}/(#{num}/#{den})"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide_by(iFactor)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n @Function[:Points].each do |ioPoint|\n ioPoint[1] /= iFactor\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n end",
... | [
"0.55781704",
"0.5515967",
"0.54971004",
"0.53898335",
"0.53534096",
"0.5316323",
"0.524927",
"0.5216814",
"0.51739395",
"0.51715213",
"0.5171128",
"0.5137487",
"0.51267326",
"0.51240975",
"0.510751",
"0.5067971",
"0.5049427",
"0.5044258",
"0.5015577",
"0.50066626",
"0.499020... | 0.5858023 | 0 |
Swaps two rows with each other (Index 's) | def swap (row1, row2)
row1_copy = @rows[row1]
row2_copy = @rows[row2]
new_row1 = row2_copy
new_row2 = row1_copy
@rows[row1] = new_row1
@rows[row2] = new_row2
puts "R#{row1 + 1} <-> R#{row2 + 1}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(index1,index2)\n if index1==index2\n return\n end\n # swap the entries in the list\n @content[index1],@content[index2] = @content[index2],@content[index1]\n # fix the indices map\n @indices[@content[index1]] = index1\n @indices[@content[index2]] = index2\n end",
"def swapper(a... | [
"0.68529135",
"0.6794802",
"0.6794802",
"0.6791486",
"0.6727307",
"0.65977305",
"0.6593027",
"0.65798867",
"0.6435022",
"0.63789755",
"0.63758546",
"0.63704634",
"0.6353265",
"0.634496",
"0.63039774",
"0.6301512",
"0.6294747",
"0.6292657",
"0.6292657",
"0.6292657",
"0.6292657... | 0.71538293 | 0 |
Calculates the value needed to multiply a row through, with a pivot value row value for a particular column | def cancel_val (pivot_val, cancel)
return cancel/pivot_val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_row(row)\n row\n end",
"def value\n @items.map{ |x| x.price * x.quantity}.inject(:+)\n end",
"def substitute (pivot_row_num, cancel_row_num, cancel_val)\n for i in 0..(((@rows[pivot_row_num]).length) - 1)\n @rows[cancel_row_num][i] = @rows[cancel_row_num][i] - (cancel_val)*(@row... | [
"0.5785032",
"0.55998653",
"0.5552603",
"0.5357219",
"0.53565675",
"0.53564423",
"0.5345897",
"0.53409773",
"0.5313853",
"0.53080297",
"0.5303662",
"0.52953607",
"0.52818656",
"0.5277714",
"0.52754194",
"0.5256929",
"0.5243743",
"0.52409494",
"0.52359104",
"0.5211393",
"0.519... | 0.0 | -1 |
Substitutes Pivot Row (Array Index) with the row you are performing a row operation on (Array Index). Applies cancel_val (See cancel_val above) as the multiplier | def substitute (pivot_row_num, cancel_row_num, cancel_val)
for i in 0..(((@rows[pivot_row_num]).length) - 1)
@rows[cancel_row_num][i] = @rows[cancel_row_num][i] - (cancel_val)*(@rows[pivot_row_num][i])
if @rows[cancel_row_num][i] == -0.0 then
@rows[cancel_row_num][i] = 0.0
end
end
num, den = cancel_val.to_fraction
outp = ""
if den == 1 then
outp += "#{num}"
else
outp += "#{num}/#{den}"
end
if (cancel_val < 0) then
puts "R#{cancel_row_num + 1} -> R#{cancel_row_num + 1} - (#{outp})R#{pivot_row_num + 1}"
else
puts "R#{cancel_row_num + 1} -> R#{cancel_row_num + 1} - (#{outp})R#{pivot_row_num + 1}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_val (pivot_val, cancel)\n return cancel/pivot_val\n end",
"def inverted_rows(options = {})\n rows = voucher_rows\n rows.reject!(&:canceled?) unless options[:canceled]\n rows.map do |old|\n vr = old.dup\n vr.sum *= -1\n vr\n end\n end",
"def _reduce_479(val, _values, r... | [
"0.6452407",
"0.555063",
"0.53112596",
"0.52505565",
"0.5119662",
"0.5103442",
"0.5039365",
"0.501498",
"0.49772435",
"0.496464",
"0.47991565",
"0.47860178",
"0.4782933",
"0.47543213",
"0.4746215",
"0.47361553",
"0.47243476",
"0.46922165",
"0.468925",
"0.4661551",
"0.46506196... | 0.7500678 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.