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 |
|---|---|---|---|---|---|---|
le jouer peut entrer un nombre compris entre 1 et 9, si le nombre n'est pas compris dans cet intervalle un message s'affiche demandant de redonner une valeur. | def turn
puts ""
puts " " * 35 + "c'est au tour à #{@current_player.name} de joué (1-9): "
puts ""
print " " * 40 + "> "
choice = gets.chomp.to_i
if choice > 9 || choice < 1
puts "Tu te trompe de touche jeune apprentie"
elsif @current_player.move(choice) != false
@winner = @curre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def starting_msg(n)\n \"#{n} bottles of beer on the wall, #{n} bottles of beer.\"\nend",
"def repeat_message(n)\n\tloop do\n\t\tbefore = Time.now\n\t\tyield\n\t\tinterval = n-(Time.now-before)\n\t\tsleep(interval) if interval > 0\n\tend\nend",
"def get_message(num)\n\n case num\n when 1\n message =... | [
"0.57940143",
"0.5695143",
"0.54767185",
"0.5446541",
"0.53772956",
"0.52779365",
"0.5252009",
"0.52298504",
"0.52248544",
"0.5206136",
"0.5195897",
"0.5180812",
"0.5175079",
"0.5154141",
"0.51309854",
"0.5111978",
"0.5084036",
"0.50793403",
"0.507903",
"0.5066103",
"0.505481... | 0.0 | -1 |
if neg 1 check odd with modulo def is_odd?(integer) integer = 1 if integer > 0 if integer % 2 != 0 true else false end end | def is_odd?(integer)
integer % 2 == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_odd?(integer)\r\n !(integer.abs.remainder(2) == 0)\r\nend",
"def is_odd?(integer)\n integer % 2 == 0 ? false : true\nend",
"def is_odd?(integer)\n\tinteger.abs % 2 == 1\n\t\nend",
"def is_odd?(int) \n if int % 2 == 0\n return false\n else return true\n end\nend",
"def is_odd?(integer)\n int... | [
"0.9034896",
"0.9010646",
"0.8999884",
"0.8948142",
"0.89392084",
"0.8938481",
"0.89161056",
"0.8909959",
"0.8898139",
"0.8893692",
"0.88921833",
"0.8878248",
"0.88670474",
"0.8859486",
"0.8844612",
"0.88445747",
"0.88428974",
"0.8838492",
"0.88292015",
"0.8813165",
"0.880553... | 0.8815377 | 21 |
and then outputs the modified string. | def caesar_cipher(string, shift_factor = 0)
result = ''
string.each_char do |char|
# use cipher only if char is an uppercase or lowercase letter
if char.ord.between?(65, 90) || char.ord.between?(97, 122)
new_code = char.ord + shift_factor
#ensure wrapping from Z to A or z to a
new_code -=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringOutput\n\t\tend",
"def stringOutput\n\t\tend",
"def output_formatted_text(output_string)\n puts output_string\n end",
"def raw_output(s)\n s\n end",
"def output(s)\n if @lstrip\n s = s.gsub(/\\A\\s+/, \"\")\n @lstrip = false\n end\n\n newlines = s.count(NEWLINE)\n ... | [
"0.68570876",
"0.68570876",
"0.6749846",
"0.635182",
"0.6339313",
"0.61864674",
"0.61746275",
"0.6117725",
"0.61070323",
"0.60885286",
"0.6078779",
"0.6070128",
"0.6011861",
"0.59968966",
"0.5995648",
"0.5991007",
"0.59167445",
"0.5891626",
"0.5884663",
"0.5832941",
"0.582216... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.password_reset.subject | def password_reset(user)
@user = user
mail to: user.email, subject: "League Spec password reset"
mail from: "password-reset@leaguespec.com"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset(user)\n @user = user\n mail :to => user.email, :subject => I18n.t(\"reset_password\")\n end",
"def forgot_password(user)\n setup_email(user)\n subject \"Password Reset\"\n end",
"def reset_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n ... | [
"0.6847792",
"0.6811161",
"0.6743567",
"0.67034006",
"0.667996",
"0.6636797",
"0.65923536",
"0.6572514",
"0.6554156",
"0.65073377",
"0.6480957",
"0.64693576",
"0.6456036",
"0.6449797",
"0.6441507",
"0.6410659",
"0.640921",
"0.6402868",
"0.63984996",
"0.63880104",
"0.63861823"... | 0.0 | -1 |
GET /source_pages GET /source_pages.json | def index
@source_pages = SourcePage.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_source\n # must set max nesting. default limit of 20 is too low for selendroid\n JSON.parse @driver.page_source, max_nesting: 9999\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def get_pages(options = nil)\n @client.raw('get', '/content/pages', options)\n end",... | [
"0.69422096",
"0.655444",
"0.6551009",
"0.6504953",
"0.6473319",
"0.64149475",
"0.63961554",
"0.63830733",
"0.6368293",
"0.6299695",
"0.6297939",
"0.6297939",
"0.6297939",
"0.6297939",
"0.6297939",
"0.6297939",
"0.6297939",
"0.62795764",
"0.62692845",
"0.6259181",
"0.6229108"... | 0.7498058 | 0 |
GET /source_pages/1 GET /source_pages/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @source_pages = SourcePage.all\n end",
"def get_source\n # must set max nesting. default limit of 20 is too low for selendroid\n JSON.parse @driver.page_source, max_nesting: 9999\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def show\n @source = Source... | [
"0.7342679",
"0.6731636",
"0.6605638",
"0.6492692",
"0.64293",
"0.6428574",
"0.63961655",
"0.6385099",
"0.6385099",
"0.6385099",
"0.6385099",
"0.6385099",
"0.6385099",
"0.6385099",
"0.6369304",
"0.63363415",
"0.6329705",
"0.63288707",
"0.6311444",
"0.6306529",
"0.62426126",
... | 0.0 | -1 |
POST /source_pages POST /source_pages.json | def create
@source_page = SourcePage.new(source_page_params)
respond_to do |format|
if @source_page.save
format.html { redirect_to @source_page, notice: 'Source page was successfully created.' }
format.json { render :show, status: :created, location: @source_page }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @page_content = PageContent.new(page_content_params)\n @page_content.parse_url(page_content_params[:source])\n\n respond_to do |format|\n if @page_content.save\n format.html { redirect_to action: :index }\n format.json { render json: @page_content, status: :created, locatio... | [
"0.64984274",
"0.63137054",
"0.60895956",
"0.5994911",
"0.5934387",
"0.58606017",
"0.581993",
"0.5813985",
"0.5761937",
"0.574922",
"0.56969917",
"0.56501156",
"0.5624956",
"0.5621818",
"0.5608349",
"0.55928504",
"0.55894256",
"0.5567207",
"0.5566975",
"0.5561011",
"0.553516"... | 0.7266694 | 0 |
PATCH/PUT /source_pages/1 PATCH/PUT /source_pages/1.json | def update
respond_to do |format|
if @source_page.update(source_page_params)
format.html { redirect_to @source_page, notice: 'Source page was successfully updated.' }
format.json { render :show, status: :ok, location: @source_page }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if page_params[:body]\n @page.versions << Version.new(body: page_params[:body], title: page_params[:title]).save\n page_params.delete :body\n end\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to controller: \"pages\", action: \"show\", ... | [
"0.63405675",
"0.6305989",
"0.62710017",
"0.6133108",
"0.6094509",
"0.6078191",
"0.60213166",
"0.6012595",
"0.6003819",
"0.6003819",
"0.6003819",
"0.6003819",
"0.59964716",
"0.59912753",
"0.59912425",
"0.59846365",
"0.59803873",
"0.5953242",
"0.5950793",
"0.59464306",
"0.5942... | 0.6900771 | 0 |
DELETE /source_pages/1 DELETE /source_pages/1.json | def destroy
@source_page.destroy
respond_to do |format|
format.html { redirect_to source_pages_url, notice: 'Source page was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end",
"def destroy\r\n @page = Page.find(params[:id])\r\n @page.destroy\r\n File.delete(\"#{Rails.public_path}/#{@page.project_id}/#{@page.page_name}.html\")\r\n respond_to do |format|\r\n format.html { redirect_to pages... | [
"0.6957046",
"0.6927541",
"0.67749083",
"0.6774857",
"0.6774857",
"0.6764738",
"0.6729344",
"0.6729344",
"0.6729344",
"0.6729344",
"0.6725345",
"0.67214984",
"0.672082",
"0.6704641",
"0.66959274",
"0.66959274",
"0.66959274",
"0.66959274",
"0.66959274",
"0.66959274",
"0.669592... | 0.7453293 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_source_page
@source_page = SourcePage.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 source_page_params
params.require(:source_page).permit(:url)
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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
GET /admin/furniture/sets GET /admin/furniture/sets.json | def index
@admin_furniture_sets = Admin::Furniture::Set.all.paginate(page: params[:page])
respond_to do |format|
format.html
format.json { render json: @admin_furniture_sets.map { |i| { value: i.id, text: "#{i.name} #{i.config.to_s}" } }, status: :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_admin_furniture_set\n @admin_furniture_set = Admin::Furniture::Set.find(params[:id])\n end",
"def index\n @attribute_sets = AttributeSet.all\n render json: @attribute_sets\n end",
"def create\n @admin_furniture_set = Admin::Furniture::Set.new(admin_furniture_set_params)\n\n respond... | [
"0.7200095",
"0.6679486",
"0.6573324",
"0.656625",
"0.65635383",
"0.65425754",
"0.65425754",
"0.64392185",
"0.64135927",
"0.6381811",
"0.6368142",
"0.63622004",
"0.6189612",
"0.61712277",
"0.61057353",
"0.6084513",
"0.6066289",
"0.6063458",
"0.6038245",
"0.60076666",
"0.60027... | 0.7806838 | 0 |
GET /admin/furniture/sets/1 GET /admin/furniture/sets/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @admin_furniture_sets = Admin::Furniture::Set.all.paginate(page: params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @admin_furniture_sets.map { |i| { value: i.id, text: \"#{i.name} #{i.config.to_s}\" } }, status: :ok }\n end\n end",
"def set_admin... | [
"0.7776283",
"0.726785",
"0.6672082",
"0.6619293",
"0.6619293",
"0.6566542",
"0.64761645",
"0.64090234",
"0.63794506",
"0.629912",
"0.62479687",
"0.62447304",
"0.62340045",
"0.6196485",
"0.61648905",
"0.60923666",
"0.6092361",
"0.60875356",
"0.60664046",
"0.6043717",
"0.60318... | 0.0 | -1 |
POST /admin/furniture/sets POST /admin/furniture/sets.json | def create
@admin_furniture_set = Admin::Furniture::Set.new(admin_furniture_set_params)
respond_to do |format|
if @admin_furniture_set.save
format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :create) }
format.json { render json: @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_admin_furniture_set\n @admin_furniture_set = Admin::Furniture::Set.find(params[:id])\n end",
"def create\n @setum = Setum.new(setum_params)\n\n respond_to do |format|\n if @setum.save\n format.html { redirect_to @setum, notice: 'Setum was successfully created.' }\n format... | [
"0.67327774",
"0.6610808",
"0.65066284",
"0.6461349",
"0.64439315",
"0.6375901",
"0.63615215",
"0.6348379",
"0.6286474",
"0.62364656",
"0.6229341",
"0.6219675",
"0.6216336",
"0.6126095",
"0.6113759",
"0.6109354",
"0.60879743",
"0.60840774",
"0.60746795",
"0.6063196",
"0.59824... | 0.73800665 | 0 |
PATCH/PUT /admin/furniture/sets/1 PATCH/PUT /admin/furniture/sets/1.json | def update
respond_to do |format|
if @admin_furniture_set.update(admin_furniture_set_params)
format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :update) }
format.json { render json: @admin_furniture_set, status: :ok, location: admin_fu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @defset.update(defset_params)\n format.html { redirect_to @defset, notice: 'Defset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @defset.er... | [
"0.6689169",
"0.6584886",
"0.65191376",
"0.64569855",
"0.64569855",
"0.6429768",
"0.64217395",
"0.6384779",
"0.6360191",
"0.6352287",
"0.6289147",
"0.6262751",
"0.6127498",
"0.60628635",
"0.60487837",
"0.6036398",
"0.60170966",
"0.59799767",
"0.595065",
"0.5946467",
"0.593240... | 0.7071458 | 0 |
DELETE /admin/furniture/sets/1 DELETE /admin/furniture/sets/1.json | def destroy
@admin_furniture_set.destroy
respond_to do |format|
format.html { redirect_to admin_furniture_sets_path, notice: mk_notice(@admin_furniture_set, :name, 'ست مبل', :destroy) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @defset.destroy\n respond_to do |format|\n format.html { redirect_to defsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabricsofaset.destroy\n respond_to do |format|\n format.html { redirect_to fabricsofasets_url, notice: 'Fabricsofaset wa... | [
"0.73830193",
"0.73089755",
"0.73057306",
"0.72444504",
"0.7239075",
"0.703127",
"0.70215315",
"0.70210385",
"0.6936913",
"0.69265336",
"0.6900119",
"0.6896421",
"0.68360656",
"0.68359584",
"0.6817454",
"0.6797078",
"0.67791826",
"0.6774843",
"0.6769145",
"0.67560476",
"0.674... | 0.7371171 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_admin_furniture_set
@admin_furniture_set = Admin::Furniture::Set.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 admin_furniture_set_params
params.require(:admin_furniture_set).permit(:name, :config, :comment)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Author: Tae Noppakun Wongsrinoppakun | def merge(left, right)
result = []
left_index, right_index = 0, 0
while (left_index < left.length && right_index < right.length)
left_element = left[left_index]
right_element = right[right_index]
if left_element <= right_element
result << left_element
left_index += 1
else
result... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def terpene; end",
"def probers; end",
"def suivre; end",
"def verdi; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def who_we_are\r\n end",
"def formation; end",
"def romeo_and_juliet; end",
"def jack_handey; ... | [
"0.72684675",
"0.71683234",
"0.710227",
"0.70357525",
"0.70080054",
"0.691233",
"0.6758216",
"0.6758216",
"0.6758216",
"0.6758216",
"0.6729461",
"0.6673361",
"0.6635414",
"0.6634765",
"0.6612209",
"0.66120017",
"0.6579833",
"0.65747154",
"0.6561361",
"0.6495476",
"0.64791137"... | 0.0 | -1 |
The create_empty_field method creates a twodimensional array. One comprising the rows of the field matrix, and the other the columns. | def create_empty_field
@field_matrix = Array.new(length) { Array.new(width, ' . ') }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_empty(rows, columns)\n @rch = Array.new(rows)\n @gch = Array.new(rows)\n @bch = Array.new(rows)\n \n 0.upto rows-1 do |r|\n @rch[r] = Array.new(columns, 0)\n @gch[r] = Array.new(columns, 0)\n @bch[r] = Array.new(columns, 0)\n end \n end",
"def build_minefield\n ... | [
"0.70820487",
"0.66334695",
"0.6446492",
"0.6395312",
"0.6320942",
"0.6164173",
"0.6158884",
"0.60545313",
"0.6025009",
"0.6024148",
"0.5955401",
"0.59196055",
"0.58140385",
"0.57603955",
"0.57594323",
"0.56994426",
"0.56843936",
"0.56590635",
"0.5637313",
"0.56159085",
"0.56... | 0.8642803 | 0 |
The create_snake method creates a twodimensional array. The inner array consists of the horizontal and vertical location of each snake part. | def create_snake
vertical_position = location[0]
horizontal_position = location[1]
@snake_matrix = Array.new(size) { |part_index| [vertical_position, horizontal_position + part_index] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateBoard(snakes, foods)\n board = Hash.new(BLANK_VALUE); # Using a hash because inserts are O(1), and it sets default values for all coordinates\n \n # Process each of the snakes\n snakes.each do |snake|\n id = snake[\"id\"]\n health = snake[\"health_points\"]\n coords ... | [
"0.559691",
"0.5436912",
"0.53852457",
"0.52831507",
"0.5283077",
"0.5275853",
"0.5139459",
"0.50608563",
"0.4997969",
"0.49952617",
"0.49791288",
"0.49766687",
"0.49289423",
"0.49251834",
"0.4895927",
"0.48665184",
"0.4855412",
"0.48459503",
"0.48370662",
"0.48353174",
"0.48... | 0.81987625 | 0 |
The head of the snake is always the first array of the snake matrix. | def locate_head
snake_matrix.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head\n \t@array[0]\n end",
"def create_snake\n vertical_position = location[0]\n horizontal_position = location[1]\n @snake_matrix = Array.new(size) { |part_index| [vertical_position, horizontal_position + part_index] }\n end",
"def locate_body\n snake_matrix[1..-1]\n end",
"def make_firs... | [
"0.6615536",
"0.6392241",
"0.6260439",
"0.6030301",
"0.5941435",
"0.5924791",
"0.5765357",
"0.57424206",
"0.5741144",
"0.5737481",
"0.5735287",
"0.57323253",
"0.57045335",
"0.5687292",
"0.5656422",
"0.56228673",
"0.56228673",
"0.5620292",
"0.5605041",
"0.55769813",
"0.5551065... | 0.805979 | 0 |
The body consists of all the arrays in the snake matrix except the first one. | def locate_body
snake_matrix[1..-1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(body)\n lines = body.split(\"\\n\")\n width = lines.first.length\n number_of_syms_to_wrap = (Dimensions::WIDTH - width) / 2\n syms_string = Citizen::DEAD * number_of_syms_to_wrap\n horiz_wrapped = lines.map { |line| syms_string + line + syms_string }\n\n matrix = horiz_w... | [
"0.6045197",
"0.57564586",
"0.56901485",
"0.5560798",
"0.5486362",
"0.54608446",
"0.54469013",
"0.5420796",
"0.535777",
"0.53464717",
"0.5326325",
"0.5324661",
"0.5300899",
"0.5185273",
"0.5157756",
"0.51539254",
"0.5135978",
"0.5132808",
"0.5107401",
"0.508262",
"0.5069615",... | 0.7060849 | 0 |
Inputs a new vertical location for the head of the snake in order to simulate vertical movement. | def update_head_vertical_location(row)
locate_head[0] = row
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drive_north(direction)\n if direction == 'N'\n @new_vertical_position = take_input[3].to_i\n @new_vertical_position += 1\n @current_position = \"#{take_input[2].to_i},#{@new_vertical_position}\"\n end\n end",
"def drive_south(direction)\n if direction == 'S'\n @new_vertical_posi... | [
"0.64822805",
"0.6401371",
"0.6248239",
"0.624367",
"0.6123787",
"0.6019974",
"0.59909135",
"0.5954613",
"0.5932502",
"0.59165704",
"0.59119767",
"0.5907792",
"0.5901807",
"0.5766312",
"0.5715978",
"0.570548",
"0.5704298",
"0.5703543",
"0.56974417",
"0.56637496",
"0.56380445"... | 0.6347748 | 2 |
Inputs a new horizontal location for the head of the snake in order to simulate horizontal movement. | def update_head_horizontal_location(column)
locate_head[1] = column
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_snake_head(position, move_over_tunnel)\n snake_part = SnakePart.new(@head)\n @world[@head] = snake_part\n @head = position\n @world[position] = SnakeHead.new(position)\n\t\t\t@world[position].set_over_tunnel(move_over_tunnel)\n @body.unshift @head\n end",
"def drive_north(di... | [
"0.6946604",
"0.6375601",
"0.6283084",
"0.62432504",
"0.6208301",
"0.61988574",
"0.60296035",
"0.597656",
"0.59712136",
"0.5886565",
"0.5885008",
"0.58384776",
"0.5766133",
"0.57548666",
"0.5736572",
"0.573319",
"0.5715742",
"0.5711953",
"0.57048",
"0.5672593",
"0.5661368",
... | 0.65042645 | 1 |
The print_filled_field method first creates an empty field and then adds a snake matrix and an apple to that empty field matrix and prints the result. | def print_filled_field
field.create_empty_field
# Add an apple to the field.
field.field_matrix[apple.vertical_location][apple.horizontal_location] = ' o '
# Add a snake to the field.
snake.snake_matrix.each do |part|
field.field_matrix[part.first][part.last] = ' x '
end
print_field... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_empty_field\n @field_matrix = Array.new(length) { Array.new(width, ' . ') }\n end",
"def printBoard\n\t\tprint(\"#{@field[0].value} | #{@field[1].value} | #{@field[2].value}\\n---------\\n#{@field[3].value} | #{@field[4].value} | #{@field[5].value}\\n---------\\n#{@field[6].value} | #{@field[7].va... | [
"0.661401",
"0.63582236",
"0.5811382",
"0.5731705",
"0.55386865",
"0.5459447",
"0.53989077",
"0.5376416",
"0.53698087",
"0.5324373",
"0.5308976",
"0.5268991",
"0.5263823",
"0.52599996",
"0.52457297",
"0.52441037",
"0.52192646",
"0.5218089",
"0.51920444",
"0.51861054",
"0.5186... | 0.9337237 | 0 |
The animate_game method prints the filled field first, then it allows the user to change the snake's direction, then moves the snake one frame, and finally checks for conditions that change the circumstances of the game. All of this is done repeatedly until the game ends. | def animate_game
begin
Curses.stdscr.keypad = true
Curses.noecho
Curses.curs_set(0)
Curses.timeout = 0
loop do
print_filled_field
# Add a sleep method with a value of 0.1 to prevent the snake from
# moving too fast. Adjust the value of sleep to speed up or slow... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_round\n system(\"clear\")\n @board.render\n puts\n full_move = self.get_full_move\n pos = self.get_position(full_move)\n action = self.get_action(full_move)\n while action.downcase == \"e\" && !(self.valid_flip?(pos))\n self.display_unflag_messag... | [
"0.67010206",
"0.65362626",
"0.6392625",
"0.6264252",
"0.6247824",
"0.6225483",
"0.6129233",
"0.61152434",
"0.61150825",
"0.6097484",
"0.6056181",
"0.60507953",
"0.60471624",
"0.6033415",
"0.60294855",
"0.6014623",
"0.6007933",
"0.6002501",
"0.5996959",
"0.5987343",
"0.596147... | 0.8708741 | 0 |
This method only takes care of creating the new membership, please use Membershiprenew! directly. | def renew!(attrs = {})
unless Delivery.during_year(@fiscal_year).any?
raise MissingDeliveriesError, 'Deliveries for the renewed fiscal year are missing.'
end
new_membership = Membership.new(renewed_attrs(attrs))
renew_complements(new_membership, attrs)
if membership.basket_size_id != new_membe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @membership = Membership.new(params[:membership])\n @membership.user_id = current_user.id\n if @membership.save\n end\n end",
"def create\n @membership = @website.memberships.new(membership_params)\n @membership.user.no_password = true\n\n respond_to do |format|\n if @memb... | [
"0.70105594",
"0.6947248",
"0.6915482",
"0.6773699",
"0.6734321",
"0.6689697",
"0.6682483",
"0.66363513",
"0.6631679",
"0.6577498",
"0.6518194",
"0.6373315",
"0.6362637",
"0.63517153",
"0.63334924",
"0.6313198",
"0.62955207",
"0.6275529",
"0.62693894",
"0.6269347",
"0.6260356... | 0.61714005 | 30 |
Initializes a new object | def initialize(attrs = {})
@attrs = attrs.deep_find(self.class.to_s.demodulize) if attrs.is_a?(Hash)
@attrs ||= attrs
@attrs.each do |k, v|
instance_variable_set("@#{k.to_s.underscore}", v) unless v.nil?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize() end",
"def initialize\n \n end",
"def initialize\n end",
"def initialize()\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def i... | [
"0.84613174",
"0.8216564",
"0.8215841",
"0.8211569",
"0.82106155",
"0.82106155",
"0.81460595",
"0.81460595",
"0.81460595",
"0.81460595",
"0.81460595",
"0.8131518",
"0.8131518",
"0.8131518",
"0.8131518",
"0.8131518",
"0.8131518",
"0.8123764",
"0.8107522",
"0.8107522",
"0.81075... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def prescription_params
params.require(:prescription).permit(:quantity, :unit, :observation, :hospitalization_id, :medicaments)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Create query using field parser. Equivalent to Lucene's field:"value" query. Inspired from ActiveFedora::SolrQueryBuilder.field_query. | def field_query(field, value)
"_query_:\"{!field f=#{field}}#{value}\""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_field_query query, response, scope\n if Array === query\n case query.first\n when :method # a method call\n query.shift\n return eval(query.join('.'))\n when :literal # a literal value\n return query.last\n end\n ... | [
"0.6597149",
"0.6155972",
"0.60944504",
"0.5897008",
"0.58508974",
"0.58476716",
"0.58424956",
"0.5756688",
"0.57141507",
"0.56492513",
"0.56170285",
"0.5539387",
"0.55223775",
"0.551104",
"0.55059355",
"0.54593694",
"0.5440864",
"0.54265296",
"0.5389577",
"0.5385445",
"0.538... | 0.75168353 | 0 |
Creates queries using the lucene parser. This allows users to search with wildcard() and fuzzy (~) special characters. Words in phrases are ANDed or ORed depending on the value of operation given. | def grouping_query(field, phrase, op = 'AND')
raise 'op must be AND or OR' unless ['AND', 'OR'].include? op
"_query_:\"{!lucene q.op=#{op}}#{field}:(#{phrase})\""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_process\n @search_text =params[:q].to_s\n all =params[:all].to_s\n exact =params[:exact].to_s\n any =params[:any].to_s\n none =params[:none].to_s\n advanced_query=\"\"\n\n if all != \"\"\n all =all.split(' ')\n all_like ... | [
"0.6859464",
"0.6680074",
"0.6680074",
"0.6474183",
"0.64040613",
"0.6363093",
"0.6296369",
"0.61689484",
"0.60850304",
"0.6061759",
"0.5979322",
"0.5901407",
"0.5892853",
"0.58882225",
"0.5825663",
"0.5780755",
"0.57691365",
"0.57658976",
"0.57221997",
"0.5711245",
"0.566206... | 0.63389915 | 6 |
Create query using join parser, similar to sql join. | def join_query(from, to, field, value)
"_query_:\"{!join from=#{from} to=#{to}}#{field}:\\\"#{value}\\\"\""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join(table, field1, field2, join_type = 'INNER JOIN')\n @join = \" #{join_type} #{table} ON #{@from}.#{field1}=#{table}.#{field2}\"\n\n self\n end",
"def join(*args)\n\t\tif args.count > 1\n\t\t\tjoins = args.map { |arg| \"INNER JOIN #{arg} ON #{arg}.#{table}_id = #{table}.id\"}.join(\" \")\n\t\t\trow... | [
"0.6523445",
"0.65155745",
"0.6388709",
"0.63140893",
"0.62682563",
"0.6233941",
"0.6188287",
"0.6070854",
"0.6059934",
"0.59720993",
"0.597065",
"0.59581333",
"0.58965135",
"0.58571875",
"0.5846518",
"0.5829649",
"0.5822159",
"0.5791104",
"0.57683694",
"0.5752367",
"0.572961... | 0.67276204 | 0 |
GET /jobs GET /jobs.json | def index
@jobs = Job.all
@paginated_jobs = @jobs.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"def index\n @jobs = Job.all\n render json: @jobs\n end",
"def list_jobs(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/job/list?'\n req.headers[\"Authorization\"] = @token\n req.params... | [
"0.78487986",
"0.78391117",
"0.7709953",
"0.7699296",
"0.74898845",
"0.7433689",
"0.7387766",
"0.73397416",
"0.73253435",
"0.72978896",
"0.72852373",
"0.7262688",
"0.7212051",
"0.72030485",
"0.71915585",
"0.71915585",
"0.71735525",
"0.7161574",
"0.7146019",
"0.7146019",
"0.71... | 0.67068017 | 62 |
GET /jobs/1 GET /jobs/1.json | def show
@tasks = Task.where(:job => @job)
@paginated_tasks = @tasks.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_single_job_sample(client)\n response = client[\"jobs/#{$job_id}\"].get\n\n p ''\n p 'Get single job'\n p response\nend",
"def job(id, options = {})\n objectify get(\"/job/#{id}\", options)['joblist']['job']\n end",
"def index\n @jobs = Job.all\n\n render json: @jobs\n end",
"de... | [
"0.7502627",
"0.7452839",
"0.74433225",
"0.7431692",
"0.73964095",
"0.7318132",
"0.73017573",
"0.7274776",
"0.72400314",
"0.72262365",
"0.72262365",
"0.72262365",
"0.72262365",
"0.72262365",
"0.7224223",
"0.7210173",
"0.7158107",
"0.7103444",
"0.7103444",
"0.70951277",
"0.706... | 0.0 | -1 |
POST /jobs POST /jobs.json | def create
@task = Task.new(task_state: TaskState.where(name: "Pending")[0] )
if params[:all]
# get task IDs from system, map to strings
@task.concrete_package_versions << System.find(params[:system_id]).concrete_package_versions.where(concrete_package_state: ConcretePackageState.first ) #TODO: cen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @job = current_user.posted_jobs.build(job_params)\n if @job.save\n render json: @job\n else\n render json: @job.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n job = Job.create(job_params)\n render json: job\n end",
"def new_job(job... | [
"0.74641937",
"0.73064774",
"0.70868206",
"0.70318276",
"0.7020725",
"0.70076245",
"0.69820875",
"0.6932717",
"0.6932393",
"0.6921801",
"0.690776",
"0.6904804",
"0.68841195",
"0.68841195",
"0.68841195",
"0.6880201",
"0.6878812",
"0.68659544",
"0.6856052",
"0.6820773",
"0.6802... | 0.0 | -1 |
PATCH/PUT /jobs/1 PATCH/PUT /jobs/1.json | def update
respond_to do |format|
if @job.update(job_params)
format.html { redirect_to @job, success: 'Job was successfully updated.' }
format.json { render :show, status: :ok, location: @job }
else
format.html { render :edit }
format.json { render json: @job.errors, stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end",
"def update\n @job = @user.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(params[:job])\n format.html { redirect_to @job, notice: 'Job was succe... | [
"0.74817234",
"0.7169015",
"0.7167652",
"0.7095741",
"0.70942",
"0.7070403",
"0.70637274",
"0.70637274",
"0.70637274",
"0.70577025",
"0.7052269",
"0.7050123",
"0.70051134",
"0.69992834",
"0.6992486",
"0.69848675",
"0.6957225",
"0.695623",
"0.69412476",
"0.6881211",
"0.6875447... | 0.68443346 | 35 |
DELETE /jobs/1 DELETE /jobs/1.json | def destroy
@job.destroy
respond_to do |format|
format.html { redirect_to jobs_url, success: 'Job was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end",
"def destroy\n @job = Job.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :ok }\n end\n end",
"def destroy... | [
"0.77455926",
"0.7700092",
"0.76760954",
"0.76760954",
"0.76760954",
"0.76760954",
"0.7675618",
"0.7674465",
"0.7658132",
"0.7643448",
"0.76179034",
"0.7559175",
"0.75548303",
"0.75477374",
"0.7545383",
"0.7539608",
"0.753705",
"0.75200063",
"0.7508049",
"0.7505697",
"0.74647... | 0.7275973 | 56 |
Use callbacks to share common setup or constraints between actions. | def set_job
@job = Job.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def job_params
params.require(:job).permit(:started_at, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_activity
# @user = User.find(params[:user_id])
@activity = Activity.find(params[:id])
rescue ActiveRecord::RecordNotFound
render json: { message: 'no activity matches that ID' }, status: 404
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 trusted parameter "white list" through. | def activity_params
params.require(:activity).permit(:name, :category, :hours_spent, :date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Completely cover if user updates any fields and handle Oauth all in one | def update_or_create(attributes)
if user.nil?
create_user(attributes)
else
user.update_attributes(attributes)
end
user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_using_auth o\n\t\tself.user_id = o.info.user_id\n\t\tself.login_name = o.info.profile.login_name\n\t\tself.email = o.info.email\n\t\tself.join_tsz = o.info.profile.join_tsz\n\t\tself.transaction_buy_count = o.info.profile.transaction_buy_count\n... | [
"0.67362064",
"0.6712289",
"0.6692839",
"0.66788125",
"0.66229546",
"0.6571586",
"0.6489177",
"0.64311165",
"0.64148104",
"0.64068735",
"0.6312864",
"0.630796",
"0.62939876",
"0.6271059",
"0.6265699",
"0.62381893",
"0.62368757",
"0.6231109",
"0.62289834",
"0.62174016",
"0.621... | 0.0 | -1 |
original `create_format_method` overrides `format` method with metaprogramming | def create_format_method
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format(format, *arguments); end",
"def create_format_method\n case @style\n when :json; Parseable.create_json_format_method(self)\n when :yaml; Parseable.create_yaml_format_method(self)\n else raise ArgumentError, \"unknown format style '#@style'\" end\n end",
"def format\n rais... | [
"0.7575126",
"0.7554109",
"0.7434239",
"0.7395717",
"0.7335282",
"0.730108",
"0.730108",
"0.73003274",
"0.73003274",
"0.73003274",
"0.73003274",
"0.73003274",
"0.73003274",
"0.73003274",
"0.73003274",
"0.7283679",
"0.7168306",
"0.7146824",
"0.71324587",
"0.70680845",
"0.70426... | 0.8282342 | 0 |
Helper method to define a method on this class from Ruby. | def def(name, &block)
@runtime_methods[name.to_s] = block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method=(_); end",
"def h_instance_method(name, args, &bod... | [
"0.6782219",
"0.6782219",
"0.6782219",
"0.6782219",
"0.6782219",
"0.6782219",
"0.6782219",
"0.6782219",
"0.6782219",
"0.6782219",
"0.6782219",
"0.6782219",
"0.65273666",
"0.6387667",
"0.63664657",
"0.63664657",
"0.63664657",
"0.63308334",
"0.62953603",
"0.62953603",
"0.629212... | 0.0 | -1 |
Create a new instance of this class | def new
AwesomeObject.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"d... | [
"0.8204378",
"0.8204378",
"0.8204378",
"0.8204378",
"0.8204378",
"0.80909187",
"0.8064249",
"0.8064249",
"0.8064249",
"0.8064249",
"0.8064249",
"0.8064249",
"0.8064249",
"0.8064249",
"0.8064249",
"0.79288685",
"0.7722875",
"0.76763016",
"0.76298636",
"0.75340426",
"0.7497188"... | 0.68861055 | 50 |
Create an instance of this Awesome class that holds a Ruby value. Like a String, number, or true | def new_with_value(value)
AwesomeObject.new(self, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_value(value)\n AwesomeObject.new(self, value)\n end",
"def initialize(awesome_class, ruby_value=self)\n @awesome_class = awesome_class\n @ruby_value = ruby_value\n end",
"def initialize(value)\n @value = value\n @type = self.class.type\n end",
"def new_with_value(value,... | [
"0.69721514",
"0.67558557",
"0.67395514",
"0.6506494",
"0.6501158",
"0.6481547",
"0.64633673",
"0.63486207",
"0.63295555",
"0.6319684",
"0.6319684",
"0.6260485",
"0.62325317",
"0.62325317",
"0.62325317",
"0.62325317",
"0.62325317",
"0.6215993",
"0.6214941",
"0.6203157",
"0.62... | 0.6865174 | 1 |
And since this is just a Ruby file, we can write functions that our web app needs right here too: | def currently_snowing?
omaha_coordinates = "41.2524,-95.9980"
api_url = "https://api.darksky.net/forecast/#{ENV["DARK_SKY_API_KEY"]}/#{omaha_coordinates}"
response = HTTParty.get(api_url)
response_hash = response.to_h
current_weather = response_hash["currently"]
if current_weather["icon"].downcase == "snow"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def functions\n\n end",
"def weber; end",
"def how_it_works\r\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def external; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def main\n\n ... | [
"0.65519035",
"0.64858204",
"0.6455307",
"0.6417576",
"0.6417576",
"0.6417576",
"0.63154",
"0.6292208",
"0.6292208",
"0.6292208",
"0.6292208",
"0.6292208",
"0.6292208",
"0.6292208",
"0.6191948",
"0.6137953",
"0.6116462",
"0.6085741",
"0.6085741",
"0.60842675",
"0.60487276",
... | 0.0 | -1 |
Borrowed from MockStorage, load to a common module? | def random_bucket_hash name=random_bucket_name
{"kind"=>"storage#bucket",
"id"=>name,
"selfLink"=>"https://www.googleapis.com/storage/v1/b/#{name}",
"projectNumber"=>"1234567890",
"name"=>name,
"timeCreated"=>::Time.now,
"metageneration"=>"1",
"owner"=>{"entity"=>"project-owners-1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_storage_module(config)\n return StorageMongo.new(config)\nend",
"def storages\n reflective_auto_load_adapter_extension\n storages # call the overrided method\n end",
"def storage() @storage; end",
"def load!; end",
"def load; end",
"def load; end",
"def load; end",
"def determine_stor... | [
"0.6567207",
"0.60182106",
"0.5989204",
"0.5969939",
"0.594189",
"0.594189",
"0.594189",
"0.5927389",
"0.59193575",
"0.58834875",
"0.58478874",
"0.57741225",
"0.57520896",
"0.57520896",
"0.5736447",
"0.56745607",
"0.56318426",
"0.55931765",
"0.55606323",
"0.5544921",
"0.55150... | 0.0 | -1 |
do def on_week(week) self.select do |point_total| point_total.week == week end.sort_by(&:updated_at).last end end | def cached_points
@cached_points ||= Scout.cache.fetch(['points', cache_key]) {
points.to_a.select do |point|
!cached_bye_weeks.include?(point.week)
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weekly_updates_by_project(since)\n since = Date.new(2000,01,01) if since == :all\n self.weekly_updates.where([\"weekstart > ?\",since]).order(\"project_id, weekstart desc\").group_by {|w| w.project}\n end",
"def by_week\n @device = params[:device]\n @pf_by_week = Measure.where('created_at BE... | [
"0.6799802",
"0.67953163",
"0.6377486",
"0.62406886",
"0.6053723",
"0.60249394",
"0.59177655",
"0.59103334",
"0.59103334",
"0.5898046",
"0.58547884",
"0.58547884",
"0.58360773",
"0.579886",
"0.57984227",
"0.57743114",
"0.5767644",
"0.574897",
"0.5710354",
"0.5698378",
"0.5688... | 0.0 | -1 |
Figure out if there is a better way to get this | def bye_weeks
Set.new(((1..17).to_a - (cached_home_games.map(&:week) + cached_away_games.map(&:week))))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def offences_by; end",
"def first_offset; end",
"def first_offset; end",
"def origin_aggressive\n return (@attributes & 0x80 == 0x00)\n end",
"def anchored; end",
"def caar; first.first end",
"def first?; end",
"def culprit\n @culprit\n end",
"def probers; ... | [
"0.544927",
"0.5401816",
"0.5142231",
"0.5142231",
"0.50187904",
"0.4974338",
"0.49353495",
"0.4906963",
"0.4893704",
"0.48514667",
"0.48020172",
"0.48020172",
"0.48010805",
"0.48006916",
"0.47972178",
"0.47851503",
"0.47756904",
"0.47701055",
"0.47678757",
"0.47678757",
"0.4... | 0.0 | -1 |
TODO Fix this. It only returns weeks that had an interception, since it doesn't join weeks with none. | def interceptions_per_game
interceptions.joins(:game).group("armchair_analysis_games.wk").count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weeks\n @weeks ||= days.slice_when do |day|\n Date::DAYNAMES[day.wday] == LAST_DAY_OF_THE_WEEK\n end.to_a\n end",
"def weeks\n\t\tk = offset( first_day.cwday )\n\n [ first_week( k ) ] + middle_weeks( DPW - k )\n end",
"def unused_weeks()\n timesheets = Timesheet.where( :user_id =... | [
"0.69804275",
"0.6597045",
"0.6578972",
"0.6551563",
"0.63786703",
"0.6333989",
"0.6226884",
"0.62110597",
"0.6191249",
"0.61191154",
"0.6114361",
"0.60792184",
"0.6079087",
"0.6079087",
"0.60779744",
"0.6050565",
"0.6045271",
"0.5944059",
"0.5907793",
"0.59022224",
"0.588677... | 0.0 | -1 |
Policy: Update old one | def import(week = GameWeek.current.week)
importing(week) do
client = Scout::Client.new
updated_players = client.players(:start => 0)
import_log "updated_players: #{updated_players.size}"
lookup = all.inject({}) do |id_to_player, player|
id_to_player[player.yahoo_key] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n end",
"def update!(**args)\n ... | [
"0.68869656",
"0.68869656",
"0.68869656",
"0.68869656",
"0.68869656",
"0.68869656",
"0.68869656",
"0.68869656",
"0.68869656",
"0.68869656",
"0.68869656",
"0.68869656",
"0.6849323",
"0.6849323",
"0.6849323",
"0.6849323",
"0.6849323",
"0.6849323",
"0.6849323",
"0.6849323",
"0.6... | 0.0 | -1 |
we cache prime factors... | def prime_factors position = -1
if cached = $prime_factors[self] # cached?
return cached # yes
end
if self == 1 # we have 1 we are done
return $prime_factors[self]=[] # return no factors
elsif position<0 # we havn't reached factor 5 yet
if self&1 == 0 # test factor 2
return $p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prime_factors( n )\nend",
"def prime_factorization(num)\nend",
"def prime_factorization(num)\n \nend",
"def prime_factorization(num)\n \nend",
"def prime_factorization(num)\n \nend",
"def prime_factors_mult( n )\nend",
"def prime_factors\n n = self\n factors = Hash.new(0)\n\n # Pull out... | [
"0.7829766",
"0.77158517",
"0.7673474",
"0.7673474",
"0.7673474",
"0.76552266",
"0.7640543",
"0.76309425",
"0.7583187",
"0.7530958",
"0.75230366",
"0.7519169",
"0.7515079",
"0.75122666",
"0.7487473",
"0.7480736",
"0.74699724",
"0.7453267",
"0.74499947",
"0.74438536",
"0.74286... | 0.7299499 | 27 |
Note that `ongoing` in this context means currently ongoing or upcoming as per Linked Events documentation. This parameter needs a specified text search, so it is not a boolean flag. For example to search ongoing or upcoming that match the text "nuoret", use `ongoing: "nuoret"`. | def events(publisher: nil, keywords: nil, start: nil, ongoing: nil, sort: "start_time")
keywords = keywords.join(",") if keywords.is_a?(Array)
result = fetch(
"event",
# Undocumented `event_type` parameter used at tapahtumat.hel.fi
event_type: "general",
# Types ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_text_main(clipped = false)\n text = ''\n if self.event_type == 'sent' \n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n elsif self.event_type == 'followup_sent'\n text = text + self.outgoing_message.get_text_for_indexing + \"\\n\\n\"\n... | [
"0.53137773",
"0.50614303",
"0.49276343",
"0.4882983",
"0.47293347",
"0.4692215",
"0.46871063",
"0.46795344",
"0.46720463",
"0.46627545",
"0.4653141",
"0.464491",
"0.46213344",
"0.4610847",
"0.46057022",
"0.4594052",
"0.4577571",
"0.45727205",
"0.45484862",
"0.45236498",
"0.4... | 0.0 | -1 |
GET /activities GET /activities.json | def index
@activities = Activity.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activities\n get_call(\"1/activities.json\")\n end",
"def activities(params = {})\n scope 'default'\n get('activities/', params)\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def acti... | [
"0.87229973",
"0.8237991",
"0.8174613",
"0.8174613",
"0.81609166",
"0.8031665",
"0.7980325",
"0.79700005",
"0.795089",
"0.7611846",
"0.7541555",
"0.752615",
"0.7450007",
"0.74256104",
"0.74131006",
"0.7386156",
"0.73540217",
"0.7342527",
"0.7318892",
"0.7318892",
"0.72758335"... | 0.7012036 | 40 |
GET /activities/1 GET /activities/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activity(id)\n get(\"/activities/#{id}.json\")\n end",
"def activities\n get_call(\"1/activities.json\")\n end",
"def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRec... | [
"0.83788407",
"0.83788407",
"0.8096585",
"0.7685623",
"0.7667807",
"0.76401794",
"0.7609177",
"0.75712854",
"0.75329125",
"0.74525696",
"0.74308854",
"0.7332175",
"0.73110914",
"0.72872484",
"0.7285642",
"0.7231286",
"0.7206347",
"0.7206347",
"0.7189005",
"0.7184855",
"0.7056... | 0.0 | -1 |
POST /activities POST /activities.json | def create
#@activity = Activity.new(activity_params)
@activity = current_user.activities.build(activity_params)
if @activity.save
if params[:if_completed] == 'yes'
flash[:success] = "发布成功!"
redirect_to "/activities"
else
#redirect_to "/upload_activity_pic?id=#{@act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @activity = @user.activities.create(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Exercise event was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n ... | [
"0.7249106",
"0.70048165",
"0.6964346",
"0.6956599",
"0.69475126",
"0.6929332",
"0.69046366",
"0.6889496",
"0.6862793",
"0.68420047",
"0.6838635",
"0.68081975",
"0.68079776",
"0.68079776",
"0.6798919",
"0.677082",
"0.6740217",
"0.67014927",
"0.6675203",
"0.6665923",
"0.665974... | 0.0 | -1 |
PATCH/PUT /activities/1 PATCH/PUT /activities/1.json | def update
respond_to do |format|
if @activity.update(activity_params)
format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }
format.json { render :show, status: :ok, location: @activity }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n @activity.status = Activity::SETTED if @activity.setting?\n if @activity.update(activity_params)\n format.html { redirect_to activities_url, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format... | [
"0.68841285",
"0.68299145",
"0.6815713",
"0.6810834",
"0.68061996",
"0.67753994",
"0.6754749",
"0.6754749",
"0.6754749",
"0.6754749",
"0.6754749",
"0.66995573",
"0.6663162",
"0.6661705",
"0.66614246",
"0.66366166",
"0.6602412",
"0.65958416",
"0.6586029",
"0.6581988",
"0.65739... | 0.6625412 | 17 |
DELETE /activities/1 DELETE /activities/1.json | def delete_activity_comment
@comment = ActivityComment.find(params[:id])
@comment.destroy
#flash[:success] = "Micropost deleted"
#redirect_to request.referrer || root_url
redirect_to "/activity_comments?id=#{@comment.activity.id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :n... | [
"0.7712568",
"0.7712568",
"0.7712568",
"0.7712568",
"0.7712568",
"0.76978153",
"0.7688336",
"0.7663404",
"0.7663404",
"0.76458544",
"0.76458544",
"0.7643713",
"0.7564872",
"0.75457203",
"0.745816",
"0.73909366",
"0.73904556",
"0.73731923",
"0.73731923",
"0.73731923",
"0.73731... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_activity
@activity = Activity.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 activity_params
params.require(:activity).permit(:title, :description, :starttime, :endtime, :place, :number_of_people, :pay_type, :average_cost, :user_id, :tags, :apply_up_limit)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /minisounds GET /minisounds.json | def index
@minisounds = Minisound.all.order("playtime")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_minisound\n @minisound = Minisound.find(params[:id])\n end",
"def create\n @minisound = Minisound.new(minisound_params)\n\n respond_to do |format|\n if @minisound.save\n format.html { redirect_to @minisound, notice: 'Minisound was successfully created.' }\n format.json { ... | [
"0.59257907",
"0.5874203",
"0.56043935",
"0.55121845",
"0.5377079",
"0.5333722",
"0.53114355",
"0.5257152",
"0.5203881",
"0.5174087",
"0.5141796",
"0.5122168",
"0.51206994",
"0.50945103",
"0.5085286",
"0.506236",
"0.5057485",
"0.503431",
"0.5033928",
"0.5033412",
"0.5033412",... | 0.5620347 | 2 |
GET /minisounds/1 GET /minisounds/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_minisound\n @minisound = Minisound.find(params[:id])\n end",
"def create\n @minisound = Minisound.new(minisound_params)\n\n respond_to do |format|\n if @minisound.save\n format.html { redirect_to @minisound, notice: 'Minisound was successfully created.' }\n format.json { ... | [
"0.6116707",
"0.6023588",
"0.5854544",
"0.57832056",
"0.5729807",
"0.5726323",
"0.5709502",
"0.5674683",
"0.5626736",
"0.5576918",
"0.55713546",
"0.5565534",
"0.55636406",
"0.5538162",
"0.54892933",
"0.54854983",
"0.5480952",
"0.54350907",
"0.54334164",
"0.5411297",
"0.540485... | 0.0 | -1 |
POST /minisounds POST /minisounds.json | def create
@minisound = Minisound.new(minisound_params)
respond_to do |format|
if @minisound.save
format.html { redirect_to @minisound, notice: 'Minisound was successfully created.' }
format.json { render :show, status: :created, location: @minisound }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end",
"def update\n respond_to do |format|\n if @minisound.update(minisound_params)\n format.html { redirect_to @mini... | [
"0.58708096",
"0.57429695",
"0.56620675",
"0.5588615",
"0.55690855",
"0.5510485",
"0.54372364",
"0.5353957",
"0.5285262",
"0.52763546",
"0.52718407",
"0.5238774",
"0.52199244",
"0.5215001",
"0.51841223",
"0.51752746",
"0.51636684",
"0.51521444",
"0.5150232",
"0.5122446",
"0.5... | 0.6990563 | 0 |
PATCH/PUT /minisounds/1 PATCH/PUT /minisounds/1.json | def update
respond_to do |format|
if @minisound.update(minisound_params)
format.html { redirect_to @minisound, notice: 'Minisound was successfully updated.' }
format.json { render :show, status: :ok, location: @minisound }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.h... | [
"0.5810324",
"0.5779018",
"0.5771261",
"0.57280445",
"0.5701555",
"0.568239",
"0.5679738",
"0.5656366",
"0.56290114",
"0.56186855",
"0.56155884",
"0.5606402",
"0.5595152",
"0.55873173",
"0.55774105",
"0.5574383",
"0.5551537",
"0.5548881",
"0.55415165",
"0.55311704",
"0.551002... | 0.69507194 | 0 |
DELETE /minisounds/1 DELETE /minisounds/1.json | def destroy
@minisound.destroy
respond_to do |format|
format.html { redirect_to minisounds_url, notice: 'Minisound was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @compound = Compound.find(params[:id])\n @compound.destroy\n\n respond_to do |format|\n format.html { redirect_to compounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @minicurso = Minicurso.find(params[:id])\n @minicurso.destroy\n\n respond... | [
"0.6557799",
"0.6532743",
"0.6504515",
"0.64920896",
"0.6476177",
"0.6430612",
"0.64197105",
"0.63616014",
"0.6337825",
"0.6337825",
"0.6337825",
"0.6335508",
"0.6318131",
"0.6309",
"0.63047403",
"0.63037443",
"0.6301255",
"0.6278031",
"0.6273764",
"0.6270861",
"0.62663835",
... | 0.73337567 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_minisound
@minisound = Minisound.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 minisound_params
params.require(:minisound).permit(:video_id, :name, :playtime)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
GET /laporan_guru_agama_katolik GET /laporan_guru_agama_katolik.json | def index
@laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.order("created_at DESC").page(params[:daftar_laporan_guru_agama_katolik_page]).per(6)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_laporan_guru_agama_katolik\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.find(params[:id])\n end",
"def laporan_guru_agama_katolik_params\n params.require(:laporan_guru_agama_katolik).permit(:judul, :tautan, :pengguna_id)\n end",
"def create\n @laporan_guru_agama_katolik = ... | [
"0.69260585",
"0.6537066",
"0.6405912",
"0.63501394",
"0.6334183",
"0.6253596",
"0.6247635",
"0.6206109",
"0.61929625",
"0.6157312",
"0.61137056",
"0.60862976",
"0.60839856",
"0.60523677",
"0.60357934",
"0.59848934",
"0.5962379",
"0.5947529",
"0.5932273",
"0.59098387",
"0.589... | 0.7205009 | 0 |
GET /laporan_guru_agama_katolik/1 GET /laporan_guru_agama_katolik/1.json | def show
@pengguna = current_pengguna
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.order(\"created_at DESC\").page(params[:daftar_laporan_guru_agama_katolik_page]).per(6)\n end",
"def set_laporan_guru_agama_katolik\n @laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.find(params[:id])\n end",
"def show\n @kan... | [
"0.7103911",
"0.6802757",
"0.6531669",
"0.64477026",
"0.63899577",
"0.6389182",
"0.6381669",
"0.63721967",
"0.63647383",
"0.63262075",
"0.6312964",
"0.6304024",
"0.62825996",
"0.6256775",
"0.6192643",
"0.6178175",
"0.61738414",
"0.6159612",
"0.614342",
"0.6139118",
"0.6132644... | 0.0 | -1 |
POST /laporan_guru_agama_katolik POST /laporan_guru_agama_katolik.json | def create
@laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.new(laporan_guru_agama_katolik_params)
@laporan_guru_agama_katolik.pengguna_id = current_pengguna.id
respond_to do |format|
if @laporan_guru_agama_katolik.save
format.html { redirect_to @laporan_guru_agama_katolik, notice: 'Lapo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def laporan_guru_agama_katolik_params\n params.require(:laporan_guru_agama_katolik).permit(:judul, :tautan, :pengguna_id)\n end",
"def create\n @data_pendidikan_agama_katolik = DataPendidikanAgamaKatolik.new(data_pendidikan_agama_katolik_params)\n @data_pendidikan_agama_katolik.pengguna_id = curren... | [
"0.7352186",
"0.7144841",
"0.6938219",
"0.6814624",
"0.6757636",
"0.668251",
"0.6607814",
"0.6591382",
"0.65672886",
"0.6493333",
"0.6421687",
"0.6409621",
"0.63728374",
"0.63635546",
"0.63586664",
"0.6349154",
"0.6342618",
"0.6315826",
"0.626483",
"0.62641585",
"0.62149197",... | 0.7780069 | 0 |
PATCH/PUT /laporan_guru_agama_katolik/1 PATCH/PUT /laporan_guru_agama_katolik/1.json | def update
respond_to do |format|
if @laporan_guru_agama_katolik.update(laporan_guru_agama_katolik_params)
format.html { redirect_to @laporan_guru_agama_katolik, notice: 'Laporan guru agama katolik was successfully updated.' }
format.json { render :show, status: :ok, location: @laporan_guru_ag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @data_pendidikan_agama_katolik.update(data_pendidikan_agama_katolik_params)\n format.html { redirect_to @data_pendidikan_agama_katolik, notice: 'Data pendidikan agama katolik was successfully updated.' }\n format.json { render :show, status: :ok, locat... | [
"0.7039956",
"0.6972694",
"0.6805268",
"0.66803",
"0.6663917",
"0.66434264",
"0.65959215",
"0.65685934",
"0.65548205",
"0.6520739",
"0.6519527",
"0.65147036",
"0.6506645",
"0.64959574",
"0.64880997",
"0.6486782",
"0.6457795",
"0.64471954",
"0.6437101",
"0.64309645",
"0.642018... | 0.7289591 | 0 |
DELETE /laporan_guru_agama_katolik/1 DELETE /laporan_guru_agama_katolik/1.json | def destroy
@laporan_guru_agama_katolik.destroy
respond_to do |format|
format.html { redirect_to laporan_guru_agama_katolik_index_url, notice: 'Laporan guru agama katolik was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @data_pendidikan_agama_katolik.destroy\n respond_to do |format|\n format.html { redirect_to data_pendidikan_agama_katolik_index_url, notice: 'Data pendidikan agama katolik was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_kea... | [
"0.7438234",
"0.7408621",
"0.729889",
"0.72764844",
"0.7214719",
"0.72103953",
"0.7210284",
"0.720453",
"0.71473044",
"0.7114095",
"0.71108556",
"0.70795846",
"0.70492226",
"0.70469266",
"0.70319855",
"0.7027935",
"0.7024029",
"0.7016501",
"0.7012847",
"0.7012417",
"0.7011378... | 0.772773 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_laporan_guru_agama_katolik
@laporan_guru_agama_katolik = LaporanGuruAgamaKatolik.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def laporan_guru_agama_katolik_params
params.require(:laporan_guru_agama_katolik).permit(:judul, :tautan, :pengguna_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.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Add given hash or block and return new config object | def add(config_or_block)
self.class.new @config_list + Array.wrap(config_or_block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_block name, hash\n\t\t\t@blocks ||= {}\n\t\t\t@blocks[name] = hash\n\t\tend",
"def add(name, &block)\n blocks[name.to_sym] = block\n end",
"def ingest_configuration_block!(hash, &block)\n hash.each do |k, v|\n value = if v.is_a?(Hash)\n ingest_configuration_bl... | [
"0.6975591",
"0.6295234",
"0.61010134",
"0.60714036",
"0.6066916",
"0.6050589",
"0.59973544",
"0.5941835",
"0.59062546",
"0.5904485",
"0.5887665",
"0.58731943",
"0.5832744",
"0.5749853",
"0.57388467",
"0.5735011",
"0.5719758",
"0.56737554",
"0.56645495",
"0.56559",
"0.56559",... | 0.72648376 | 0 |
Return a new configuration object bound to the given instance. This instance will be instance_eval'ed with any procs in the config. | def bind(instance)
self.class.new @config_list.dup, instance
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile\n @config_list.inject({}) do |config, hash_or_proc|\n case hash_or_proc\n when Hash\n config.deep_merge hash_or_proc\n when Proc\n instance or raise InstanceNotBoundError\n c = instance.instance_eval(&hash_or_proc)\n c.is_a?(Hash) || c == ni... | [
"0.6568649",
"0.6433652",
"0.60249954",
"0.5984646",
"0.5959399",
"0.5957815",
"0.5957815",
"0.5894475",
"0.58758414",
"0.5848547",
"0.5848547",
"0.5831501",
"0.58245915",
"0.57777625",
"0.5754851",
"0.57050693",
"0.5634089",
"0.5610126",
"0.55681443",
"0.55339044",
"0.550874... | 0.67852825 | 0 |
Return the compiled config. This will be a hash built by combining added hashes and blocks. | def config
@config ||= compile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile\n @config_list.inject({}) do |config, hash_or_proc|\n case hash_or_proc\n when Hash\n config.deep_merge hash_or_proc\n when Proc\n instance or raise InstanceNotBoundError\n c = instance.instance_eval(&hash_or_proc)\n c.is_a?(Hash) || c == ni... | [
"0.70549715",
"0.645971",
"0.62916964",
"0.6029206",
"0.5997004",
"0.5885874",
"0.58523005",
"0.58463794",
"0.5797542",
"0.5766021",
"0.57416266",
"0.56729025",
"0.5577945",
"0.55507797",
"0.5541904",
"0.5541904",
"0.5541904",
"0.55350095",
"0.5531994",
"0.55010206",
"0.54798... | 0.6664828 | 1 |
Merge list of hashes and blocks. | def compile
@config_list.inject({}) do |config, hash_or_proc|
case hash_or_proc
when Hash
config.deep_merge hash_or_proc
when Proc
instance or raise InstanceNotBoundError
c = instance.instance_eval(&hash_or_proc)
c.is_a?(Hash) || c == nil or raise In... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(*hashes, &block)\n dup.update(*hashes, &block)\n end",
"def merge(*other_hashes, &blk); end",
"def merge!(*other_hashes, &blk); end",
"def deep_merge(*other_hashes, &blk); end",
"def merge(hash); end",
"def merge(hash); end",
"def merge(hash); end",
"def merge!(hsh)\n raise Arg... | [
"0.6799683",
"0.6786558",
"0.6630177",
"0.6042747",
"0.6007586",
"0.6007586",
"0.6007586",
"0.5961966",
"0.5896746",
"0.5829935",
"0.5690515",
"0.56281096",
"0.5524188",
"0.5438165",
"0.5432639",
"0.54256326",
"0.5409345",
"0.5319474",
"0.5302938",
"0.5280837",
"0.5239221",
... | 0.0 | -1 |
Order.tax_zone.tax_rates is used here to check if the order is taxable by Tax Cloud. It's not possible check against the order's tax adjustments because an adjustment is not created for 0% rates. However, US orders must be submitted to Tax Cloud even when the rate is 0%. Note that we explicitly use ship_address instead... | def is_taxed_using_tax_cloud?
::Spree::TaxRate.for_address(ship_address).any? { |rate| rate.calculator_type == 'Spree::Calculator::TaxCloudCalculator' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tax_zone\n # Handle case of shipping across state boundaries first\n return nil if (retailer && (retailer.physical_address.state_id != ship_address.state_id))\n \n # Handle other cases:\n if Spree::Config[:tax_using_retailer_address]\n if retailer\n zone_address = retailer.physical_a... | [
"0.67445195",
"0.64885736",
"0.64810884",
"0.6389201",
"0.6353229",
"0.6327538",
"0.6295835",
"0.62660307",
"0.6210555",
"0.615835",
"0.6079887",
"0.60322136",
"0.59983456",
"0.59750485",
"0.5974582",
"0.59721017",
"0.5966243",
"0.59077084",
"0.58879435",
"0.58596754",
"0.585... | 0.70569694 | 0 |
GET /hands/1 GET /hands/1.json | def show
@hand = Hand.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @hand }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @hands = Hand.all\n end",
"def show\n @hand_state = HandState.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hand_state }\n end\n end",
"def index\n @economy_hands = EconomyHand.all\n\n respond_to do |format|\n ... | [
"0.67723274",
"0.6753142",
"0.669063",
"0.64312834",
"0.63980657",
"0.63737243",
"0.63526034",
"0.6323537",
"0.6305141",
"0.61993444",
"0.6167534",
"0.6167534",
"0.61538374",
"0.61430097",
"0.6124894",
"0.60230935",
"0.60146844",
"0.59938633",
"0.5981042",
"0.5971092",
"0.596... | 0.7394412 | 1 |
Prepare things for rooms | def ready(packet)
@connected = true
send_nick()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_room\n unless @dungeon.first_room\n @enemy = Zarta::Enemy.new(@dungeon) if enemy_spawned\n end\n @dungeon.first_room = false\n @weapon = Zarta::Weapon.new(@dungeon) if weapon_spawned\n @stairs = stairs_spawned\n end",
"def initialize\n @rooms = make_rooms\n ... | [
"0.6710112",
"0.63357824",
"0.60576016",
"0.6022315",
"0.59045017",
"0.588234",
"0.5855475",
"0.58454466",
"0.5801395",
"0.57919294",
"0.5782438",
"0.5776175",
"0.57736516",
"0.5736357",
"0.5708833",
"0.5708833",
"0.5708429",
"0.56951797",
"0.5641942",
"0.56294656",
"0.562869... | 0.0 | -1 |
Identify by a nick in the room | def send_nick(n=@nick)
@nick = n
@connection.send_data(make_packet("nick", {"name" => n}))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nickname\n @nick\n end",
"def invent_nick(jid)\n /^([^@]+)/ =~ jid.to_s\n return jid if not $1 or not User.valid_nick?($1)\n return $1 if not get_user_with_nick($1)\n (2 .. 100).each do |i|\n new_nick = \"#{$1}#{i}\"\n return new_nick if not get_user_with_nick(new_nick)\n end... | [
"0.71576816",
"0.70470214",
"0.7014333",
"0.6997151",
"0.6871745",
"0.6869566",
"0.68179",
"0.66965264",
"0.6646179",
"0.6578393",
"0.6558349",
"0.6550459",
"0.6544399",
"0.6506802",
"0.6491552",
"0.6444606",
"0.6355535",
"0.6350498",
"0.6338591",
"0.6299051",
"0.6296539",
... | 0.6038118 | 42 |
Send a message in the room | def send_message(content, parent=nil)
if parent
@connection.send_data(make_packet("send", {"content" => content.to_s, "parent" => parent}))
else
@connection.send_data(make_packet("send", {"content" => content.to_s}))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_room_msg\n r = params[:r]\n m = params[:m]\n u = params[:u]\n MsgUtil.send_room_msg(u, r, m)\n success()\n end",
"def send_message(data)\n current_user.messages.create!(body: data[\"message\"], chat_room_id: data[\"chat_room_id\"])\n # the next line broadcasts... | [
"0.7930646",
"0.78040284",
"0.7580107",
"0.75514656",
"0.75463784",
"0.7443277",
"0.73897904",
"0.7365156",
"0.7352317",
"0.7342158",
"0.7251314",
"0.72377723",
"0.7229373",
"0.7229373",
"0.72246164",
"0.7217412",
"0.71843445",
"0.7152043",
"0.7126366",
"0.7101068",
"0.708552... | 0.0 | -1 |
Close connections and timers | def disconnect()
@connection.stop()
@timer.stop()
@broadcast.stop()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close\n inactive!\n close_connections\n end",
"def close\n @closing = true\n cancel_ping_timer\n cancel_reconnect_timer\n close_connection_after_writing if connected?\n process_disconnect if reconnecting?\n end",
"def close_connections\n @connections.values.each(&:close)... | [
"0.80322015",
"0.7925483",
"0.77167",
"0.7532413",
"0.7518587",
"0.7509835",
"0.7364152",
"0.73387057",
"0.72770107",
"0.72552776",
"0.7254143",
"0.7215758",
"0.72124654",
"0.7210961",
"0.7174869",
"0.7124224",
"0.71160007",
"0.71075135",
"0.7094734",
"0.70744544",
"0.7073709... | 0.6533878 | 94 |
retrieve fs entries from /etc/fstab or /etc/mtab or /proc/mounts | def initialize (file = '/etc/fstab')
@source_file = file
@fs_by_id = Hash.new
File.foreach(file) do |line|
dev, mp, fstype, options = line.split
next if options == nil
next if line[0] == ?#
next if mp[0] != ?/ # skip pseudo fs
next if NOFS.has_key? fstype
next i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mounts\n mount_hash = {}\n mounts = File.open(\"/etc/mtab\", \"r\").read.split(\"\\n\").map{|l| l.split(/\\s+/)}\n mounts.each{|m| mount_hash[m[1]] = m[0] unless %w[devpts udev sysfs tmpfs none proc].include?(m[0])}\n mount_hash\nend",
"def mounts\r\n @mounts.list\r\n end",
"def disk_space(... | [
"0.81046075",
"0.6686974",
"0.6630306",
"0.660275",
"0.65633863",
"0.6548901",
"0.65109235",
"0.64918053",
"0.63250965",
"0.6243402",
"0.6198823",
"0.6193169",
"0.617897",
"0.6118589",
"0.61134255",
"0.60924166",
"0.60812926",
"0.60573554",
"0.6041964",
"0.6037892",
"0.596732... | 0.51574713 | 85 |
a = a | b | def union(b)
@pages.update b.pages
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitSetOr (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] || b[i]\n\t\tend\n\t\treturn result\n\tend",
"def |(other)\n\t\tself.class.new(value | other)\n\tend",
"def xor(a,b)\n (a | b) - (a & b)\n end",
"def &(other)\n false\n end",
"def |(other)\n return ... | [
"0.67818004",
"0.6722981",
"0.6710898",
"0.66848433",
"0.6599816",
"0.6557163",
"0.6551164",
"0.6520654",
"0.65160024",
"0.65160024",
"0.65160024",
"0.6456418",
"0.63838387",
"0.6294935",
"0.62922597",
"0.62276864",
"0.6211043",
"0.6210711",
"0.6205724",
"0.6183703",
"0.61832... | 0.0 | -1 |
a = a & b | def intersection(b)
@pages.delete_if { |k, v| not b.pages.include?(k) }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitSetAnd (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] && b[i]\n\t\tend\n\t\treturn result\n\tend",
"def bitwise_and(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == b[index]\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\... | [
"0.7705294",
"0.7310903",
"0.7205983",
"0.71032614",
"0.7067119",
"0.6854914",
"0.6769599",
"0.66577524",
"0.6569824",
"0.65206575",
"0.64865756",
"0.6371127",
"0.62811446",
"0.62763906",
"0.6250348",
"0.6241451",
"0.62333244",
"0.6222573",
"0.6222573",
"0.6222573",
"0.617811... | 0.0 | -1 |
a = a b | def difference(b)
@pages.delete_if { |k, v| b.pages.include?(k) }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(a,b)\na,b = b,a\nend",
"def swap(a, b)\n\ta,b=b,a\nend",
"def test(a, b)\n a = b - 1\n b = a + 3\nend",
"def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n end",
"def demo(a,b)\n\ta = a+2\n\tb = b+ 3\nend",
"def swap(a,b)\n return b,a\nend",
"def swap!(a,b)\n self[a], self[b]... | [
"0.8211058",
"0.7870475",
"0.76075286",
"0.7331097",
"0.7291055",
"0.72858477",
"0.7265086",
"0.70428467",
"0.70089567",
"0.6951317",
"0.6930363",
"0.6837598",
"0.682915",
"0.6754721",
"0.66394323",
"0.6613401",
"0.66041356",
"0.643501",
"0.6426306",
"0.6421003",
"0.6399016",... | 0.0 | -1 |
a = a | b | def union(b)
b.each do |bf|
af = @cfile_by_name[bf.file]
if af
af.union bf
else
@cfile_by_name[bf.file] = bf
end
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitSetOr (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] || b[i]\n\t\tend\n\t\treturn result\n\tend",
"def |(other)\n\t\tself.class.new(value | other)\n\tend",
"def xor(a,b)\n (a | b) - (a & b)\n end",
"def &(other)\n false\n end",
"def |(other)\n return ... | [
"0.67822003",
"0.6723063",
"0.6710966",
"0.66846085",
"0.6600051",
"0.6557301",
"0.65520406",
"0.6521133",
"0.65154725",
"0.65154725",
"0.65154725",
"0.6456149",
"0.6384036",
"0.6294734",
"0.6291878",
"0.6227479",
"0.6211261",
"0.6210893",
"0.62051284",
"0.6183759",
"0.618331... | 0.0 | -1 |
a = a & b | def intersection(b)
@cfile_by_name.each_value do |af|
bf = b[af.file]
if bf
af.intersection bf
else
@cfile_by_name.delete af.file
end
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitSetAnd (a,b)\n\t\tresult = Array.new\n\t\tfor i in 0...(a.size)\n\t\t\tresult[i] = a[i] && b[i]\n\t\tend\n\t\treturn result\n\tend",
"def bitwise_and(a, b)\n\tresult = ''\n\ta.each_char.with_index do |val, index|\n\t\tif val == b[index]\n\t\t\tresult.concat '1'\n\t\telse\n\t\t\tresult.concat '0'\n\t\tend\... | [
"0.7705294",
"0.7310903",
"0.7205983",
"0.71032614",
"0.7067119",
"0.6854914",
"0.6769599",
"0.66577524",
"0.6569824",
"0.65206575",
"0.64865756",
"0.6371127",
"0.62811446",
"0.62763906",
"0.6250348",
"0.6241451",
"0.62333244",
"0.6222573",
"0.6222573",
"0.6222573",
"0.617811... | 0.0 | -1 |
a = a b | def difference(b)
@cfile_by_name.each_value do |af|
bf = b[af.file]
if bf != nil
af.difference bf
end
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(a,b)\na,b = b,a\nend",
"def swap(a, b)\n\ta,b=b,a\nend",
"def test(a, b)\n a = b - 1\n b = a + 3\nend",
"def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n end",
"def demo(a,b)\n\ta = a+2\n\tb = b+ 3\nend",
"def swap(a,b)\n return b,a\nend",
"def swap!(a,b)\n self[a], self[b]... | [
"0.8211058",
"0.7870475",
"0.76075286",
"0.7331097",
"0.7291055",
"0.72858477",
"0.7265086",
"0.70428467",
"0.70089567",
"0.6951317",
"0.6930363",
"0.6837598",
"0.682915",
"0.6754721",
"0.66394323",
"0.6613401",
"0.66041356",
"0.643501",
"0.6426306",
"0.6421003",
"0.6399016",... | 0.0 | -1 |
Take a snapshot of /proc/filecache. | def snapshot(condition = 'true')
filecache = CachedFile.filecache
read_filecache_index filecache
@cfile_by_name.each_value do |cfile|
if cfile.cached > 0
cfile.init_pages { |idx, len, state, refcnt| eval condition }
end
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snapshot_filesystem\n mtimes = {}\n\n files = @files.map { |file| Dir[file] }.flatten.uniq\n\n files.each do |file|\n if File.exists? file\n mtimes[file] = File.stat(file).mtime\n end\n end\n\n mtimes\n end",
"def cached_render_memory... | [
"0.58968955",
"0.5805835",
"0.58024514",
"0.5715185",
"0.56952596",
"0.5673774",
"0.5643448",
"0.5602026",
"0.55706",
"0.55423516",
"0.5524746",
"0.55000186",
"0.54993767",
"0.5496851",
"0.5496111",
"0.5492397",
"0.5485572",
"0.5474943",
"0.5474943",
"0.5474943",
"0.5474943",... | 0.57338977 | 3 |
get the cached file list from /proc/filecache. | def read_filecache_index(filecache)
CachedFile.reset_seq
headers = []
filecache.syswrite('ls')
filecache.rewind
filecache.each_line do |line|
if line[0] == ?#
headers = line.split
headers.shift
if headers[0] == 'filecache' then
module_version = headers[1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_files\n Dir.glob(File.join(@cache_dir, '*'))\n .map{|f| f.gsub(/#{@cache_dir}\\/?/, '')}\n .sort\n end",
"def find_caches\n Dir.glob(File.join(@root, '**/*.cache')).reduce([]) { |stats, filename|\n stat = safe_stat(filename)\n # stat maybe nil if file was re... | [
"0.7370528",
"0.7268852",
"0.7172068",
"0.6951984",
"0.68737113",
"0.64663565",
"0.6286145",
"0.6278183",
"0.62148064",
"0.62046677",
"0.61141175",
"0.60531807",
"0.60452783",
"0.60034126",
"0.59824866",
"0.5980867",
"0.5967219",
"0.59614074",
"0.59545743",
"0.59450203",
"0.5... | 0.66212994 | 5 |
Load the presaved snapshot of /proc/filecache from a file or dir | def load(path)
if File.file? path
load_file path
elsif File.directory? path
Dir.foreach(path) do |file|
file = "#{path}/#{file}"
next unless File.stat(file).file?
load_file file
end
else
$stderr.puts "#{path} not a file or directory."
exit 1
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_file_cache(file)\n puts \"loading stuff from #{file}\"\n File.open(file, 'r') do |input|\n Marshal.load(input.read)\n end\n end",
"def data_cache(fpath)\n (@data_caches ||= []) << fpath\n return fpath\n end",
"def load_local_cache\n return nil unless File.exists?(LOCAL_CA... | [
"0.6672944",
"0.6169494",
"0.59106946",
"0.59044886",
"0.58924866",
"0.58921814",
"0.5863391",
"0.5819762",
"0.57779837",
"0.5777568",
"0.5749835",
"0.57419854",
"0.57245976",
"0.57231957",
"0.5706084",
"0.5663693",
"0.5620852",
"0.55900955",
"0.55813706",
"0.5561835",
"0.555... | 0.0 | -1 |
Load cached files' info from a presaved file. | def load_file(file)
CachedFile.reset_seq
cfile = nil
File.foreach(file) do |line|
next if line.empty?
next if line[0] == ?#
line.chomp!
if line[0] == ?/
cfile = CachedFile.new line
next unless File.exist?(line) # sorry for the creat and abandon fuss
cfile.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_file_cache(file)\n puts \"loading stuff from #{file}\"\n File.open(file, 'r') do |input|\n Marshal.load(input.read)\n end\n end",
"def load\n if File.exist?(@file_path)\n\n @_cache = JSON File.open(@file_path, &:read).strip\n else\n $... | [
"0.68843466",
"0.6756553",
"0.6442178",
"0.6302698",
"0.61665505",
"0.60234004",
"0.59443253",
"0.5874848",
"0.586737",
"0.586737",
"0.5859239",
"0.5794853",
"0.5791543",
"0.5747404",
"0.57406646",
"0.5714166",
"0.5706454",
"0.56349736",
"0.56273985",
"0.5618195",
"0.5586561"... | 0.52850926 | 44 |
Creates a new App instance. | def initialize(app_bundle_path)
@path = File.expand_path(app_bundle_path)
if !App.valid?(app_bundle_path)
if App.cached_app_on_simulator?(app_bundle_path)
raise RuntimeError, %Q{
App is "cached" on the simulator.
#{app_bundle_path}
This can happen if there was an incomplete install or u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end",
"def new\n puts \"Creating new blank Praxis app under #{app_name}\"\n create_root_files\n create_config... | [
"0.7870538",
"0.7640673",
"0.72283405",
"0.71094316",
"0.7086358",
"0.7038164",
"0.7009703",
"0.69701815",
"0.6915618",
"0.6841742",
"0.6841453",
"0.68192816",
"0.68180037",
"0.6802538",
"0.6790683",
"0.6786979",
"0.678153",
"0.6702812",
"0.6678305",
"0.6678035",
"0.66758007"... | 0.0 | -1 |
Is this a valid app? | def valid?
App.valid?(path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_app?(app)\n !!(app =~ APP_REGEX)\n end",
"def valid_apps\n apps.select { |app| app.valid? }\n end",
"def app?\n app_host = Radiant.config['app.host']\n match = unless app_host.blank?\n request.host == app_host\n else\n request.host =~ /^app\\./\n end\n !!match\n ... | [
"0.79393876",
"0.6913875",
"0.68905956",
"0.68200004",
"0.68200004",
"0.68141043",
"0.67631054",
"0.6584829",
"0.65410805",
"0.6536357",
"0.65136474",
"0.6476398",
"0.6451508",
"0.6375936",
"0.6370027",
"0.6357075",
"0.6356346",
"0.634567",
"0.634567",
"0.634567",
"0.63446105... | 0.7342881 | 1 |
Returns the arches for the binary. | def arches
@arches ||= lipo.info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nics\n if !@nics[:macs].empty?\n return @nics.reject {|k| k == :macs }\n end\n\n info_nics\n end",
"def system_bins\n %w[\n cal col colcrt colrm\n getopt\n hexdump\n logger look\n mesg more\n nologin\n renice rev\n ... | [
"0.5222067",
"0.5077296",
"0.5006084",
"0.5006084",
"0.49460915",
"0.49194238",
"0.4915931",
"0.4906189",
"0.4901691",
"0.4856426",
"0.4829221",
"0.48280406",
"0.4822663",
"0.4803449",
"0.4722294",
"0.46761513",
"0.46761513",
"0.46694702",
"0.46603346",
"0.46172515",
"0.46104... | 0.5481402 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.