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 |
|---|---|---|---|---|---|---|
GET /profile user profile page | def show
@user = get_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end",
"def profile\n @user = @current_user\n\n render :show\n\n end",
"def show\n\n\t\t@current_prof... | [
"0.783252",
"0.7633896",
"0.7604624",
"0.7599385",
"0.7590725",
"0.75863624",
"0.7525387",
"0.7451254",
"0.74401575",
"0.7413052",
"0.7407765",
"0.7368251",
"0.73409045",
"0.7334895",
"0.72891486",
"0.72476494",
"0.71652484",
"0.71437925",
"0.71229607",
"0.711477",
"0.7104127... | 0.0 | -1 |
GET /user/edit edit user details page | def edit
@user = User.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n # find the user we want to edit by id\n # this will send the @user to the edit page with a form\n @user = User.find(params[:id])\n end",
"def edit\n @page_title = 'Edit user'\n @user = User.find(params[:id])\n end",
"def edit\n # return an HTML form for editing a specific user\n ... | [
"0.84906334",
"0.8472972",
"0.84689885",
"0.84401673",
"0.83842653",
"0.8364979",
"0.83475345",
"0.8310337",
"0.8310337",
"0.83088565",
"0.8306891",
"0.8299011",
"0.8291017",
"0.8253608",
"0.82287407",
"0.8227356",
"0.81922036",
"0.81922036",
"0.8188595",
"0.8182211",
"0.8182... | 0.8198299 | 45 |
POST create user method | def create
respond_to do |format|
# Check if user ticked T&C
if (signup_params[:tos].to_i == 0)
format.html{ redirect_to request.referrer, notice: "You must accept the Terms & Conditions to register." }
format.json { head :no_content }
else
# Check if username taken
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_user(body)\n post 'create_user', body\n end",
"def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity... | [
"0.81523156",
"0.81424284",
"0.79537934",
"0.79526454",
"0.7944768",
"0.7944643",
"0.79202986",
"0.79021823",
"0.7888759",
"0.7883854",
"0.7879413",
"0.78767025",
"0.78671294",
"0.7864239",
"0.7863465",
"0.7861133",
"0.78564054",
"0.78510755",
"0.7847252",
"0.78383636",
"0.78... | 0.0 | -1 |
POST method to update user details | def update
respond_to do |format|
@user = User.find(params[:id])
@user = @user.update(signup_params)
if @user
format.html{ redirect_to profile_path, notice: "User details successfully updated!" }
format.json { head :no_content }
else
format.html{ redirect_to request.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_user\n end",
"def update\n if @user.update_attributes(user_params)\n head :ok\n else\n head :internal_server_error\n end\n end",
"def update_details\n user = User.find_by_id(params[:user_id])\n if user.update_attributes(:username => params[:user_name], :phone => params[:... | [
"0.7831203",
"0.77420074",
"0.77260375",
"0.7725586",
"0.76945937",
"0.7613484",
"0.7588535",
"0.7565829",
"0.75631773",
"0.75536865",
"0.75404406",
"0.75404406",
"0.7535992",
"0.7533322",
"0.7529704",
"0.75115335",
"0.7508085",
"0.7501162",
"0.74933606",
"0.74897575",
"0.746... | 0.0 | -1 |
DELETE method for deleting user | def destroy
User.find(params[:id]).destroy
respond_to do |format|
format.html { redirect_to request.referrer, notice: "User was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_user\n end",
"def delete_user\n client.delete(user)\n end",
"def delete_user(user)\n delete user_path(user)\n end",
"def destroy\n\t\t@user.delete\n\tend",
"def delete\n connection.delete_user id\n nil\n end",
"def delete\n @user = User.find(params[:id])\... | [
"0.9022467",
"0.8633489",
"0.83311665",
"0.83130276",
"0.8303246",
"0.8255992",
"0.8240318",
"0.8235241",
"0.82315445",
"0.82122034",
"0.81959593",
"0.8183543",
"0.81709903",
"0.8166596",
"0.8166596",
"0.8161949",
"0.8161949",
"0.815241",
"0.815195",
"0.8147596",
"0.813443",
... | 0.0 | -1 |
subscribe/unsuscribe to newsletter like a toggle | def newsletter_subscription_switch
respond_to do |format|
if subscribed_newsletter(get_user)
NewsletterEmail.all.each do |newsletter|
if newsletter.email == get_user.email
newsletter.destroy
format.html { redirect_to request.referrer, notice: "Successfully Unsubscribe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_subscription!\n self.unsubscribed = !unsubscribed\n save\n end",
"def subscribe\n self.subscribed = true\n end",
"def update_newsletter_subscription!\n return unless self.user.present?\n\n if self.receives_newsletter?\n NewsletterSubscriptionsWorker.perform_async(:subscribe, se... | [
"0.7154406",
"0.70690334",
"0.696578",
"0.6914584",
"0.68591493",
"0.6833465",
"0.6824032",
"0.67929304",
"0.6779154",
"0.67497164",
"0.67199254",
"0.65689373",
"0.6555938",
"0.65199476",
"0.6470654",
"0.6444099",
"0.64058554",
"0.6400824",
"0.63773423",
"0.6368427",
"0.63374... | 0.6041104 | 46 |
helper boolean if user subscribed to newsletter | def subscribed_newsletter(user)
NewsletterEmail.all.each do |newsletter|
if newsletter.email == user.email
return true
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribed?(user)\n user.subscription.subscribed==true\n end",
"def subscribed?\n self.subscription == :subscribed\n end",
"def subscribed?\n self.type == :subscribed\n end",
"def subscribed?\n !@attributes.nil? && @attributes.include?(:Subscribed)\n end",
"def suscripti... | [
"0.79786116",
"0.7732335",
"0.76864374",
"0.7508026",
"0.7478627",
"0.74418694",
"0.7429569",
"0.742871",
"0.73323995",
"0.73193383",
"0.7256607",
"0.72214943",
"0.72214943",
"0.72170264",
"0.72046447",
"0.71799815",
"0.7103862",
"0.7061008",
"0.7045849",
"0.7022794",
"0.6989... | 0.79683155 | 1 |
allowed list of params for user model | def signup_params
params.require(:user).permit(:name,:email,
:password, :password_confirmation, :tos)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_params\r\n end",
"def user_params\n end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,... | [
"0.7526219",
"0.74991363",
"0.7293044",
"0.72812873",
"0.7276514",
"0.7240971",
"0.7222998",
"0.6969711",
"0.6927366",
"0.6812922",
"0.6809194",
"0.6808773",
"0.68087214",
"0.6805598",
"0.67886275",
"0.6785294",
"0.6738512",
"0.6732801",
"0.67090434",
"0.6708266",
"0.6708266"... | 0.0 | -1 |
score can only be calculated when the number of all ingredients are known | def getCookieVal(ingredients, portions, doCals, cals)
sums = Array.new(ingredients[0].length, 0)
ingredients.each_with_index do |ing, i|
ing.each_with_index do |property, j|
sums[j] += property*portions[i]
end
end
if doCals == true
tmpCals = 0
porti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score(combo)\n @ingredients.map { |arr| arr[0..arr.size-2] } # skip last element\n .map.with_index do |set, i|\n set.map { |val| val * combo[i] } # multiply ingredient values by # of teaspoons\n end.transpose.map { |x| x.reduce(:+) } # multiply elementwise: https://stackoverflow.com/a/2682983/\n ... | [
"0.7156011",
"0.6764601",
"0.6651725",
"0.6566235",
"0.6463136",
"0.6278544",
"0.6271827",
"0.6210527",
"0.61915326",
"0.6178206",
"0.61620384",
"0.61169124",
"0.6108558",
"0.61062557",
"0.6105286",
"0.60791427",
"0.6049652",
"0.60438484",
"0.6042123",
"0.6028249",
"0.6016916... | 0.0 | -1 |
i need to find every possible way to break 100 into 5 different groups, then get the cookie values of each one this looks a bit like a tree... | def cookieScoring(portionsLeft, ingStored, ingredients, portions, doCals, cals)
array = []
if(ingStored == 3)
return getCookieVal(ingredients, portions + [portionsLeft], doCals, cals)
end
for i in 0...portionsLeft
array.push(cookieScoring(portionsLeft-i, ingStored+1, ingredien... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_groups(list)\n\n # decides how many accountability groups to make\n no_of_groups = (list.length/5.0).ceil\n sets = []\n\n # loops once per accountability group to assign cohortians\n no_of_groups.times do\n\n set = []\n while set.length < 5 && list.length > 0\n selected = rand(list.len... | [
"0.6013513",
"0.59939355",
"0.59848815",
"0.5944515",
"0.5723134",
"0.57037723",
"0.56825364",
"0.56567365",
"0.5643668",
"0.5639371",
"0.56365454",
"0.55922675",
"0.557667",
"0.55641115",
"0.5556793",
"0.555322",
"0.55507314",
"0.5548603",
"0.5517116",
"0.5503994",
"0.547824... | 0.52287436 | 42 |
Retrieves the directory that contains configuration files Assumes the relative path of the directory from this module is "../config" ==== Args _file_path_ :: a file path to get the directory path which contains configuration files ==== Return returns the configuration directory | def get_config_directory()
config_directory= File.join(@base_directory, "config")
return config_directory
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_file_path(config_file_path=nil)\n @config_file_path ||= config_file_path || File.join(config_path, config_filename)\n end",
"def relative_config_file\n File.join(@settings[:config_dir], @settings[:config_file])\n end",
"def path\n @path ||= File.dirname @config_file\n end",
... | [
"0.73230493",
"0.72647303",
"0.72159773",
"0.7191327",
"0.71138984",
"0.7089273",
"0.7064412",
"0.7048417",
"0.7023564",
"0.70218647",
"0.70218647",
"0.68489224",
"0.6800894",
"0.6591304",
"0.6540288",
"0.6531139",
"0.65225285",
"0.6510195",
"0.6463788",
"0.6439756",
"0.64345... | 0.69724625 | 11 |
Retrieves yaml configuration hash values ==== Args yaml file name ==== Return configuration hash values | def get_yaml_config(config_file_name)
if config_file_name.nil?; raise NilError.new("config_file_name is nil");end
file = File.join(get_config_directory, config_file_name)
if !File.exists?(file); raise FileNotFoundError.new("the file does not exist");end
yaml_config = YAML.load(File.open(file))
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n require 'yaml'\n hash = YAML.load(File.read(self.yaml_file)) #gets hash from yaml file\n return hash\n end",
"def get_config config_file = \"_config.yml\"\n config_file = File.join(path, config_file)\n yml_data = YAML.load_file(config_file)\n return yml_data\n end",
"def... | [
"0.7296398",
"0.70843",
"0.70831287",
"0.70710754",
"0.7057931",
"0.7031724",
"0.6999249",
"0.6893561",
"0.6893529",
"0.6861414",
"0.68518233",
"0.68180585",
"0.6695499",
"0.66553396",
"0.66551036",
"0.6627667",
"0.6606878",
"0.66064745",
"0.65969914",
"0.65803635",
"0.657273... | 0.68009883 | 12 |
frozen_string_literal: true This just a script to check/install dependencies No need to restrict the lenght of this method from rubocop | def main
puts 'Ruby bootstrap...'
puts 'Check sqlite3'
if system('sqlite3 --version')
puts 'Ok'
else
puts 'Ko: sqlite3 is required'
puts 'https://guides.rubyonrails.org/getting_started.html'
exit 1
end
puts 'Update Ruby gem manager'
system('gem update --system')
puts 'Install bundler'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(verbose = true)\n structure = Shelly::StructureValidator.new\n\n if verbose or structure.invalid? or structure.warnings?\n say \"Checking Shelly Cloud requirements\\n\\n\"\n end\n\n print_check(structure.gemfile?, \"Gemfile is present\",\n \"Gemfile is missin... | [
"0.6306032",
"0.62900776",
"0.6288343",
"0.60976017",
"0.6052031",
"0.6052031",
"0.6026844",
"0.60163164",
"0.6009898",
"0.5986404",
"0.59666437",
"0.5884607",
"0.5818567",
"0.5784676",
"0.5781597",
"0.57706076",
"0.57425606",
"0.56611943",
"0.56611943",
"0.5632177",
"0.56033... | 0.0 | -1 |
creates a new contact record POST /contacts.json | def create
@contact = Contact.new()
@contact.fname = params[:fname]
@contact.lname = params[:lname]
@contact.email = params[:email]
@contact.reason = params[:reason]
@contact.message = params[:message]
@contact.save
respond_with(@contact)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_contact(params={})\n @obj.post('create-contact', @auth.merge(params))\n end",
"def create_contact(options = {})\n post(:contacts, contacts: [options]).pop\n end",
"def create\n contact = Contact.create(contact_params)\n\n if contact.new_record?\n render json: { errors:... | [
"0.8188983",
"0.80152357",
"0.7968094",
"0.7956659",
"0.7937738",
"0.79196745",
"0.78646153",
"0.785784",
"0.7847249",
"0.776942",
"0.7767262",
"0.77431315",
"0.7730773",
"0.7720865",
"0.7705016",
"0.76952666",
"0.7679164",
"0.7656089",
"0.7656089",
"0.7656089",
"0.7656089",
... | 0.7536466 | 31 |
GET /admin/attributes GET /admin/attributes.json | def index
@admin_attributes = Admin::Attribute.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_custom_attributes\n endpoint = \"/api/#{@version}/custom-attributes/\"\n make_get_request(endpoint)\n end",
"def attributes\n data[:attributes]\n end",
"def attributes\n @attributes\n end",
"def attributes\n @attributes\n end",
"def index\n @attributes = Attr... | [
"0.6996089",
"0.69909656",
"0.68463385",
"0.67950547",
"0.67254424",
"0.67098457",
"0.6694147",
"0.6663991",
"0.6663991",
"0.6663991",
"0.665973",
"0.6653872",
"0.66109866",
"0.66025114",
"0.65787196",
"0.6554226",
"0.65378946",
"0.6535757",
"0.6531868",
"0.6517511",
"0.64811... | 0.7219234 | 0 |
GET /admin/attributes/1 GET /admin/attributes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @admin_attributes = Admin::Attribute.all\n end",
"def fetch_custom_attributes\n endpoint = \"/api/#{@version}/custom-attributes/\"\n make_get_request(endpoint)\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def show\n ... | [
"0.70000994",
"0.6912933",
"0.6761904",
"0.6743938",
"0.6695508",
"0.66813326",
"0.65963805",
"0.65299463",
"0.6497561",
"0.6496806",
"0.6391024",
"0.6390171",
"0.6365609",
"0.6358007",
"0.633397",
"0.63084924",
"0.62600905",
"0.62324035",
"0.6218394",
"0.6196419",
"0.6169174... | 0.0 | -1 |
POST /admin/attributes POST /admin/attributes.json | def create
@admin_attribute = Admin::Attribute.new(admin_attribute_params)
respond_to do |format|
if @admin_attribute.save
format.html { redirect_to admin_attributes_path, notice: 'Attribute was successfully created.' }
format.json { render :show, status: :created, location: @admin_attrib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(attributes)\n put(\"admin/user\", body: attributes)\n response\n end",
"def attribute_params\n params.require(:attribute).permit(:attribute_id, :attribute_type, :name, :sex, :is_neuter)\n end",
"def create\n @attribute = Attribute.new(attribute_params)\n\n respond_to do |f... | [
"0.64700645",
"0.6430645",
"0.63757426",
"0.62234634",
"0.61844474",
"0.61745054",
"0.6173934",
"0.6158935",
"0.61341107",
"0.61109",
"0.6089218",
"0.6084378",
"0.60559446",
"0.6051482",
"0.60387063",
"0.60253716",
"0.6003295",
"0.5982845",
"0.5978964",
"0.5973441",
"0.597295... | 0.7335684 | 0 |
PATCH/PUT /admin/attributes/1 PATCH/PUT /admin/attributes/1.json | def update
respond_to do |format|
if @admin_attribute.update(admin_attribute_params)
format.html { redirect_to admin_attributes_path, notice: 'Attribute was successfully updated.' }
format.json { render :show, status: :ok, location: @admin_attribute }
else
format.html { render :e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update(attributes)\n p... | [
"0.6740527",
"0.6535032",
"0.6509791",
"0.64018416",
"0.6333868",
"0.6304487",
"0.62972414",
"0.62777144",
"0.62472415",
"0.6230308",
"0.6165869",
"0.61467856",
"0.61181825",
"0.60978687",
"0.60874385",
"0.6070939",
"0.6070939",
"0.6064258",
"0.60625803",
"0.60538507",
"0.604... | 0.6995225 | 0 |
DELETE /admin/attributes/1 DELETE /admin/attributes/1.json | def destroy
@admin_attribute.destroy
respond_to do |format|
format.html { redirect_to admin_attributes_url, notice: 'Attribute was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @attribute = Attribute.find(params[:id])\n @attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to attributes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attribute = Attribute.find(params[:id])\n @attribute.destroy\n\n res... | [
"0.74327254",
"0.74327254",
"0.73476636",
"0.71919894",
"0.71272916",
"0.7048351",
"0.70438236",
"0.7006056",
"0.69763595",
"0.69154453",
"0.68824035",
"0.68708575",
"0.6847039",
"0.68298626",
"0.67879987",
"0.6779805",
"0.6763877",
"0.67631024",
"0.6740199",
"0.67372286",
"0... | 0.7639216 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_admin_attribute
@admin_attribute = Admin::Attribute.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_attribute_params
params.require(:admin_attribute).permit(:name, :description, :orderby, :product_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 |
Validates the size of an uploaded image. | def picture_size
if image.size > 5.megabytes
errors.add(:image, "should be less than 5MB")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_file_size\n valid?\n errors[:image_file_size].blank?\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n end\n end",
"def image_size\n if image.size > 5.megabytes\n errors.add(:image, \"should be less than 5MB\")\n en... | [
"0.81637347",
"0.8079051",
"0.8079051",
"0.8003139",
"0.7916184",
"0.7916184",
"0.7916184",
"0.7916184",
"0.79064566",
"0.7906087",
"0.7885418",
"0.7807197",
"0.775829",
"0.7700132",
"0.7685169",
"0.7663827",
"0.7663827",
"0.7636363",
"0.7587517",
"0.7561342",
"0.7538192",
... | 0.7771205 | 12 |
defining how I sort these items allows me to have access to sorting, min and max | def <=>(other_node)
data <=> other_node.data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_entries; end",
"def sort2(array, max_value)\n\nend",
"def sort\n @items.sort { |x,y| x.rank <=> y.rank }\n end",
"def sort_params; end",
"def sort_params; end",
"def sort_entries=(_arg0); end",
"def bigSorting(unsorted)\n\nend",
"def e5115_sublinear_sort(values)\n end",
"def sorte... | [
"0.6912685",
"0.67152745",
"0.65107703",
"0.6463974",
"0.6463974",
"0.6392887",
"0.63677365",
"0.6315759",
"0.6299295",
"0.62421596",
"0.6235965",
"0.6227744",
"0.6207185",
"0.6181304",
"0.614886",
"0.61196125",
"0.6113748",
"0.60760635",
"0.6060817",
"0.606074",
"0.606074",
... | 0.0 | -1 |
can refactor this into a single function using metaprogramming | def insert_right(value)
right.insert(value) or self.right = Node.new(value, self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dynamic?; end",
"def custom; end",
"def custom; end",
"def dynamic; end",
"def generic?; true; end",
"def common\n \n end",
"def private; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def formation; end",
"def transformations; end",
"def processor; end",
"def conditiona... | [
"0.5721318",
"0.55159754",
"0.55159754",
"0.5502165",
"0.5489769",
"0.5427783",
"0.54178065",
"0.53743374",
"0.53743374",
"0.5363913",
"0.5352237",
"0.53222364",
"0.53201526",
"0.53201526",
"0.5268629",
"0.5250908",
"0.5250908",
"0.5250908",
"0.5250908",
"0.5196356",
"0.51771... | 0.0 | -1 |
takes in an argument of a song and associates that song with the artist by telling the song that it belongs to that artist | def add_song(song)
@@songs << song
song.artist = self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(song) # Third, we create 'add_song' to associate a song name with a particular artist.\n song.artist = self # When we call 'song.artist', we set the result equal to 'self', or the artist on which we are calling the method.\n end",
"def add_song(song)\n song.artist = self \n end",
"de... | [
"0.7996649",
"0.7791332",
"0.77867454",
"0.77867454",
"0.77867454",
"0.77867454",
"0.77867454",
"0.77867454",
"0.77049667",
"0.76709396",
"0.765752",
"0.765752",
"0.765752",
"0.7640474",
"0.7562574",
"0.7558999",
"0.75461686",
"0.75382566",
"0.75220686",
"0.75060433",
"0.7503... | 0.7362871 | 43 |
takes in an argument of a song name, creates a new song with it and associates the song and artist | def add_song_by_name(song_name)
song = Song.new(song_name)
@@songs << song
song.artist = self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song_by_name(song_name)\n # Create a new song called \"song\" with argument passed in.\n song = Song.new(song_name)\n # Associate it with the artist\n song.artist = self\n end",
"def add_song_by_name(name) #takes in argument name of (song)\n song = Song.new(name) #creatin... | [
"0.8542963",
"0.8230684",
"0.8115675",
"0.81138307",
"0.81138307",
"0.81138307",
"0.8096487",
"0.80636936",
"0.80636936",
"0.7983315",
"0.7978353",
"0.7943361",
"0.7905465",
"0.78532034",
"0.7799488",
"0.7748304",
"0.7671807",
"0.7671355",
"0.76603174",
"0.7657133",
"0.764363... | 0.78988653 | 13 |
GET /mwod_video_links/1 GET /mwod_video_links/1.json | def show
@mwod_video_link = MwodVideoLink.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @mwod_video_link }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @mwod_video_link = MwodVideoLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mwod_video_link }\n end\n end",
"def destroy\n @mwod_video_link = MwodVideoLink.find(params[:id])\n @mwod_video_link.destroy\n\n respond_to do |format|... | [
"0.7282044",
"0.6488171",
"0.6401296",
"0.6204437",
"0.6183267",
"0.615138",
"0.61467814",
"0.61451125",
"0.6115718",
"0.60934395",
"0.60802835",
"0.6064381",
"0.6027458",
"0.60172856",
"0.60148174",
"0.5998475",
"0.5996388",
"0.5981093",
"0.59738207",
"0.59499645",
"0.594251... | 0.7808279 | 0 |
GET /mwod_video_links/new GET /mwod_video_links/new.json | def new
@mwod_video_link = MwodVideoLink.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @mwod_video_link }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @mwod_video_link = MwodVideoLink.new(params[:mwod_video_link])\n\n respond_to do |format|\n if @mwod_video_link.save\n format.html { redirect_to @mwod_video_link, notice: 'Mwod video link was successfully created.' }\n format.json { render json: @mwod_video_link, status: :crea... | [
"0.7506728",
"0.71878767",
"0.71878767",
"0.71878767",
"0.71878767",
"0.71878767",
"0.7130238",
"0.71192735",
"0.6936082",
"0.6930009",
"0.68788034",
"0.6871042",
"0.6847739",
"0.6832324",
"0.6768933",
"0.6768683",
"0.6768683",
"0.6768683",
"0.6768683",
"0.6768683",
"0.676868... | 0.81805366 | 0 |
POST /mwod_video_links POST /mwod_video_links.json | def create
@mwod_video_link = MwodVideoLink.new(params[:mwod_video_link])
respond_to do |format|
if @mwod_video_link.save
format.html { redirect_to @mwod_video_link, notice: 'Mwod video link was successfully created.' }
format.json { render json: @mwod_video_link, status: :created, locati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @mwod_video_link = MwodVideoLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mwod_video_link }\n end\n end",
"def destroy\n @mwod_video_link = MwodVideoLink.find(params[:id])\n @mwod_video_link.destroy\n\n respond_to do |format|... | [
"0.70490366",
"0.6257501",
"0.6229307",
"0.62059385",
"0.61791116",
"0.6144754",
"0.6119927",
"0.6084091",
"0.6084091",
"0.60659224",
"0.59315395",
"0.59147704",
"0.5912898",
"0.5906414",
"0.5903996",
"0.59001935",
"0.589018",
"0.587556",
"0.586194",
"0.58618546",
"0.5848427"... | 0.7545633 | 0 |
PUT /mwod_video_links/1 PUT /mwod_video_links/1.json | def update
@mwod_video_link = MwodVideoLink.find(params[:id])
respond_to do |format|
if @mwod_video_link.update_attributes(params[:mwod_video_link])
format.html { redirect_to @mwod_video_link, notice: 'Mwod video link was successfully updated.' }
format.json { head :no_content }
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @video = Video.find(params[:id])\n params[:video][:token] = token_from_link params[:video][:token]\n\n respond_to do |format|\n if @video.update_attributes(params[:video])\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head ... | [
"0.67596924",
"0.67530155",
"0.652135",
"0.65103626",
"0.64892507",
"0.6413703",
"0.63664293",
"0.63600236",
"0.6276912",
"0.62495494",
"0.6210595",
"0.6185317",
"0.61293405",
"0.6115868",
"0.61061394",
"0.6031286",
"0.6005687",
"0.5984562",
"0.5984447",
"0.597818",
"0.596574... | 0.7512197 | 0 |
DELETE /mwod_video_links/1 DELETE /mwod_video_links/1.json | def destroy
@mwod_video_link = MwodVideoLink.find(params[:id])
@mwod_video_link.destroy
respond_to do |format|
format.html { redirect_to mwod_video_links_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n deleted_url = @localvdo.video.url \n vdo_obj = Video.where(local_link: deleted_url).all\n vdo_obj.each do |vdo|\n vdo.inLocal = false\n vdo.local_link = \"\"\n vdo.save!\n end\n @localvdo.destroy\n @user = User.find(session[:user_id])\n respond_to do |format|\n ... | [
"0.71999407",
"0.70407677",
"0.70303243",
"0.7020639",
"0.7014115",
"0.6990792",
"0.6990792",
"0.69880944",
"0.69880944",
"0.69880944",
"0.69680446",
"0.6958942",
"0.6942952",
"0.69414806",
"0.6894754",
"0.68417513",
"0.6839609",
"0.6821231",
"0.68106014",
"0.6808274",
"0.680... | 0.7984418 | 0 |
Gets the rendered string for a given set of Selectors Delegate method of ruleset_to_css | def selectors_to_css(sels, style, args)
indent = args.depth * style.subrule_indent # Number of spaces
indent_str = ' ' * indent
selector_strs = sels.map { |sel| sel.to_css(style) }
r = CUtil::String.new
r.replace selector_strs.join(style.comma)
r.prepend! indent_str
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def css_render\n css_list.join(\"\\n\")\n end",
"def to_css\n queries.map {|q| q.to_css}.join(', ')\n end",
"def to_css\n queries.map {|q| q.to_css}.join(', ')\n end",
"def to_css chain = :desc, css = []\n self.traverse :branch do |path, node|\n properties = node.injec... | [
"0.6038076",
"0.59211105",
"0.59211105",
"0.5844062",
"0.5744287",
"0.5723326",
"0.5663038",
"0.5663038",
"0.5663038",
"0.5663038",
"0.5655779",
"0.5639193",
"0.56085366",
"0.5512023",
"0.5454907",
"0.5454696",
"0.54454947",
"0.54348767",
"0.54289585",
"0.5361121",
"0.5331223... | 0.60522157 | 0 |
Gets the rendered string for a given set of Rules and Comments Delegate method of ruleset_to_css | def rules_and_comments_to_css(items, style, args)
r = ''
if items.size > 0
item_strs = items.map do |item|
item.to_css(style,
:context => :ruleset,
:depth => (args.depth + 1))
end
r << style.subrule_before
r << item_strs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_citrus # :nodoc:\n rules.map {|r| r.to_embedded_s }.join(' | ')\n end",
"def to_citrus # :nodoc:\n rules.map {|r| r.to_embedded_s }.join(' | ')\n end",
"def to_citrus # :nodoc:\n rules.map {|r| r.to_embedded_s }.join(' ')\n end",
"def rule_js\n @rules.collect { |sel, j... | [
"0.6506074",
"0.6492345",
"0.6484963",
"0.6167861",
"0.6147192",
"0.5984809",
"0.5979847",
"0.59259874",
"0.5865921",
"0.5865921",
"0.58317983",
"0.5745621",
"0.57167244",
"0.5702256",
"0.5692695",
"0.5691143",
"0.5680768",
"0.5663323",
"0.5603224",
"0.5475519",
"0.5472047",
... | 0.64560914 | 3 |
Returns a unique, deterministically reproducible index into an array We are hashing based on strings, let's use the ascii value of each string as a starting point. | def index(key, size)
key.sum % size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend",
"def generateKey(string)\r\n key = {}\r\n stringIterator = 0\r\n\r\n (string.length).times do\r\n charactersIterator = string[stringIterator] - 1\r\n divisorsIterator = 0\r\n divisors =... | [
"0.63834584",
"0.62408745",
"0.6144398",
"0.60990644",
"0.60592127",
"0.6046242",
"0.6042425",
"0.60280126",
"0.5992942",
"0.5906817",
"0.5871855",
"0.5838909",
"0.58250093",
"0.5816861",
"0.57664907",
"0.57522625",
"0.5751663",
"0.57400036",
"0.5729892",
"0.57130796",
"0.570... | 0.0 | -1 |
Simple method to return the number of items in the hash | def size
@items.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n return @hash.length\n end",
"def length\n hash.keys.length\n end",
"def size\n @hash.size\n end",
"def size\n @hash.size\n end",
"def size\n @hash.size\n end",
"def size\n @hash_array.length\n end",
"def size\n @hash_array.length\n end",
"def size\n ... | [
"0.82830465",
"0.82106954",
"0.8109915",
"0.8109915",
"0.8109915",
"0.79695594",
"0.79695594",
"0.78124315",
"0.77486163",
"0.76849425",
"0.7678069",
"0.7656559",
"0.7636084",
"0.76298493",
"0.761464",
"0.761464",
"0.7574793",
"0.7569945",
"0.7478816",
"0.7444118",
"0.7398974... | 0.0 | -1 |
skip_before_filter :require_admin!, only: [:index] | def index
@teams = Team.all.order(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n prevent_non_admin\n end",
"def require_admin\n unless view_context.admin?\n redirect_to root_url\n end\n end",
"def require_admin\n end",
"def index?\n not admin.nobody?\n end",
"def require_admin\n redirect_to root_path unless admin_logged_in?\n end",
"def require_ad... | [
"0.83416647",
"0.78828734",
"0.77555776",
"0.7725058",
"0.7640918",
"0.7608983",
"0.7522405",
"0.7518186",
"0.7497426",
"0.7460112",
"0.7452522",
"0.740198",
"0.7378353",
"0.73238117",
"0.7279743",
"0.72277373",
"0.72252095",
"0.72203976",
"0.7181341",
"0.71766156",
"0.715376... | 0.0 | -1 |
POST /comments POST /comments.json | def create
@article.comments << Comment.new(comment_params)
respond_to do |format|
if @article.save
format.html { redirect_to article_show_path(@article), notice: 'Comment was successfully created.' }
format.json { render :show, status: :created, location: @article }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @comment = @post.comments.new(comment_params)\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n\n end",
"def comment options={}\n client.post(\"/#{id}/comments\", options)\n end",
... | [
"0.75120175",
"0.74212646",
"0.7374645",
"0.72364116",
"0.7205224",
"0.7086658",
"0.7069151",
"0.70549524",
"0.7049054",
"0.6989455",
"0.69825",
"0.69657713",
"0.69578165",
"0.6910411",
"0.6909373",
"0.68731725",
"0.6871654",
"0.6822542",
"0.6810818",
"0.6787486",
"0.6785412"... | 0.6240034 | 88 |
Use callbacks to share common setup or constraints between actions. | def set_article
@article = Article.friendly.find(params[:article_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 comment_params
params.require(:comment).permit(:body)
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 |
their way def num_points_scored(name) player = find_the_player(name) player.fetch(:points) end | def shoe_size(player)
shoe_size = nil
my_hash = game_hash
my_hash.each do |home_or_away, data|
data.each do |attribute, more_data|
if attribute == :players
more_data.each do |person|
person.each do |name, stats|
shoe_size = stats[:shoe] if name == player
end
end
end
end
end
shoe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_points_scored(name)\n players = get_all_players\n find_player(players, name)[:points]\nend",
"def num_points_scored(player_name)\n players = get_players\n \n found_player = find_player(players, player_name)\n \n # return that player's points\n found_player[:points]\nend",
"def num_points_scored... | [
"0.9332687",
"0.9313195",
"0.9264622",
"0.9263182",
"0.923879",
"0.92234075",
"0.9130939",
"0.8989397",
"0.89307433",
"0.8861799",
"0.8861799",
"0.8857704",
"0.8826435",
"0.8791458",
"0.8706561",
"0.86948603",
"0.8657612",
"0.8641563",
"0.8619944",
"0.85844505",
"0.85686487",... | 0.0 | -1 |
def shoe_size(name) player = find_the_player(name) player.fetch(:shoe) end | def team_colors(team_name)
right_team = nil
game_hash.each do |home_or_away, data|
data.each do |attribute, value|
if attribute == :team_name && value == team_name
right_team = home_or_away
end
end
end
return game_hash[right_team][:colors]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shoe_size(name)\n player_stats(name)[:shoe]\nend",
"def shoe_size(player_name)\n # get list of players\n players = get_players\n # find player with matching name\n found_player = find_player(players, player_name)\n # return player's shoe size\n found_player[:shoe]\nend",
"def shoe_size(playerName)\n... | [
"0.9302594",
"0.92556155",
"0.91573715",
"0.91326904",
"0.8942211",
"0.87437814",
"0.8723234",
"0.87060565",
"0.87060565",
"0.86393297",
"0.8624755",
"0.8544635",
"0.85344255",
"0.8523456",
"0.85232085",
"0.8510016",
"0.8475273",
"0.8471034",
"0.8462931",
"0.84435624",
"0.843... | 0.0 | -1 |
def team_colors(team_name) team = find_the_team(team_name) team.fetch(:colors) end | def team_names
new_hash = game_hash
new_hash.map{|key, value| new_hash[key][:team_name]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team_colors(team_name)\n found_team = all_team_info(team_name)\n found_team[:colors]\nend",
"def team_colors(team_name)\n one_team_stats(team_name)[:colors]\nend",
"def team_colors (team_name)\n lookup_by_team(team_name)[:colors];\nend",
"def team_colors(teamName)\n teamSelect(teamName)[:colors]\n\... | [
"0.93255633",
"0.9154865",
"0.9126212",
"0.9006815",
"0.89385706",
"0.89017946",
"0.8772248",
"0.8691729",
"0.8659762",
"0.8652956",
"0.85841393",
"0.8554704",
"0.85512954",
"0.85421365",
"0.85390824",
"0.8515352",
"0.84799707",
"0.8471758",
"0.8467969",
"0.84635586",
"0.8451... | 0.5869007 | 89 |
def player_stats(player_name) find_the_player(player_name) end | def big_shoe_rebounds
biggest_shoes_player = nil
shoe_size_tracker = 0
rebounds_stat = nil
game_hash.each do |home_or_away, data|
data.each do |attribute, more_data|
if attribute == :players
more_data.each do |player|
player.each do |name, stats|
stats.each do |stat, val|
if stat == :shoe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_stats (player_name)\n lookup_by_player(player_name);\nend",
"def player_stats(playerName)\n players[playerName]\nend",
"def player_stats(name)\n players[name]\nend",
"def player_stats(name)\n all_players.find do |player|\n player[:player_name] == name\n end\nend",
"def player_stats(play... | [
"0.9337769",
"0.90031314",
"0.8910444",
"0.86710733",
"0.86103857",
"0.819517",
"0.81814975",
"0.81627214",
"0.81100285",
"0.8068436",
"0.8044484",
"0.8026422",
"0.7950023",
"0.7925812",
"0.7902363",
"0.7831576",
"0.77840185",
"0.7775674",
"0.7754169",
"0.7752485",
"0.7741258... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.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 |
Determina si un string es un uri. externo. | def uri?(string)
uri = URI.parse(string)
%w( http https ).include?(uri.scheme)
rescue URI::BadURIError
false
rescue URI::InvalidURIError
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri?(string)\n\t\turi = URI.parse(string)\n\t\t%w( http https ).include?(uri.scheme)\n\trescue URI::BadURIError\n\t\tfalse\n\trescue URI::InvalidURIError\n\t\tfalse\n\tend",
"def uri?(string)\n URI.parse(string)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end",
"de... | [
"0.82194984",
"0.8182195",
"0.8134766",
"0.8016956",
"0.79378754",
"0.7920691",
"0.7900691",
"0.7885327",
"0.75974333",
"0.7544457",
"0.74792516",
"0.7393992",
"0.728796",
"0.7281854",
"0.7271391",
"0.7271391",
"0.720804",
"0.71783787",
"0.71661025",
"0.7126003",
"0.71192956"... | 0.7961114 | 5 |
This creates an array of each line, the first element of each set of 3 arrays creates a key in the dictionary corresponding to a letter | def get_braille_arrays
string = braille_to_string
lines = string.scan(/.{1,80}/)
pairs = lines.map do |string|
string.scan(/../)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_by_starting_letter(arr_letters)\n #hash that itera and create a key with the first letter\n hash = Hash.new { |k, v| k[v] = [] }\n #put the word into the hash how an array\n arr_letters.each do |word|\n hash[word[0]] << word\n end\n #return the hash full\n hash\nend",
"def my_hash_maker( the... | [
"0.64710784",
"0.6453054",
"0.6328704",
"0.6168712",
"0.61432856",
"0.6130325",
"0.59979355",
"0.5920119",
"0.58568347",
"0.5800948",
"0.574276",
"0.5738714",
"0.5707053",
"0.57016945",
"0.570119",
"0.566393",
"0.5612347",
"0.56001043",
"0.5568797",
"0.55656946",
"0.54792976"... | 0.0 | -1 |
Scan the arrays you got into groups of 3 to prep for zip method | def group_braille_arrays
get_braille_arrays.each_slice(3).to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_zip(arr1, arr2, arr3)\n arr = []\n nest_arr = []\n arr1.each do |i|\n k = [] #initialize a temporary array\n k.push(i) #pushed first val\n k.push(arr2[arr1.index(i)]) #pushed 2nd val\n k.push(arr3[arr1.index(i)]) #pushed 3rd val\n nest_arr = k #assigned to nest_arr\n arr.push(nest_a... | [
"0.70543796",
"0.69925183",
"0.689408",
"0.6842398",
"0.67721516",
"0.6622999",
"0.6604379",
"0.6560732",
"0.65422535",
"0.6517821",
"0.6504323",
"0.64670575",
"0.64298445",
"0.6428582",
"0.6391053",
"0.63900715",
"0.6351235",
"0.62682396",
"0.6248003",
"0.6175948",
"0.616215... | 0.61455566 | 21 |
Called by the framework after user has closed the Connection Settings dialog. | def connection_settings_edited(conn_settings_serializer)
@conn_settings_ser = conn_settings_serializer
update_account_combo_list
select_active_account
account_parameters_changed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_close\n end",
"def connection_settings_edited(conn_settings_serializer)\n @conn_settings_ser = conn_settings_serializer\n\n data = fetch_conn_settings_data\n @ui.dest_account_combo.reset_content( data.keys )\n selected_settings_name = PShelterConnectionSettings.fetch_selected_settings_name... | [
"0.5830382",
"0.57450026",
"0.5707748",
"0.5614238",
"0.5573927",
"0.55532116",
"0.5532631",
"0.55293614",
"0.5524456",
"0.55231416",
"0.55165535",
"0.55105686",
"0.55041695",
"0.5501667",
"0.5476185",
"0.5453197",
"0.5442104",
"0.54362804",
"0.5426024",
"0.5426024",
"0.53922... | 0.5470919 | 16 |
GET /my_prayer_requests/1 GET /my_prayer_requests/1.json | def show
@my_prayer_request = PrayerRequest.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @my_prayer_request }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end",
"def show\n @prayer_request = PrayerRequest.find(params[:id])\n\... | [
"0.7004725",
"0.6732923",
"0.62993014",
"0.6249266",
"0.6226791",
"0.61545694",
"0.6143995",
"0.6142847",
"0.6100685",
"0.60892063",
"0.60324484",
"0.59949416",
"0.5993826",
"0.59806406",
"0.59806406",
"0.59743166",
"0.595669",
"0.59391564",
"0.59315",
"0.5807797",
"0.5807525... | 0.6888053 | 1 |
GET /my_prayer_requests/new GET /my_prayer_requests/new.json | def new
@my_prayer_request = PrayerRequest.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @my_prayer_request }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @prayer_request = PrayerRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prayer_request }\n end\n end",
"def new\n @prayer_request = PrayerRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js... | [
"0.75835794",
"0.7583574",
"0.70549697",
"0.70493805",
"0.70493805",
"0.70493805",
"0.70493805",
"0.70493805",
"0.6895971",
"0.689536",
"0.68223304",
"0.67671955",
"0.67179024",
"0.6688191",
"0.6681904",
"0.65644383",
"0.6542025",
"0.6537288",
"0.64664483",
"0.6449208",
"0.63... | 0.7631076 | 0 |
POST /my_prayer_requests POST /my_prayer_requests.json | def create
@my_prayer_request = PrayerRequest.new(params[:my_prayer_request])
respond_to do |format|
if @my_prayer_request.save
format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully created.' }
format.json { render json: @my_prayer_request, status: :cre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @prayer_request = PrayerRequest.new(params[:prayer_request])\n\n respond_to do |format|\n if @prayer_request.save\n format.html { redirect_to prayer_requests_path, notice: 'Prayer request was successfully created.' }\n format.json { render json: @prayer_request, status: :creat... | [
"0.6224528",
"0.60613793",
"0.5879717",
"0.5825523",
"0.5745883",
"0.57323176",
"0.5730027",
"0.5713485",
"0.56700116",
"0.5669872",
"0.5653539",
"0.5640016",
"0.56256795",
"0.56240153",
"0.56146234",
"0.5596725",
"0.5571884",
"0.5547821",
"0.5525774",
"0.55233145",
"0.548839... | 0.64645225 | 0 |
PUT /my_prayer_requests/1 PUT /my_prayer_requests/1.json | def update
@my_prayer_request = PrayerRequest.find(params[:id])
respond_to do |format|
if @my_prayer_request.update_attributes(params[:my_prayer_request])
format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully updated.' }
format.json { head :no_content }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @prayer_request.update_attributes(params[:prayer_request])\n format.html { redirect_to @prayer_request, notice: 'Prayer request was successfully updated.' }\n format.json { head :no_content }\n ... | [
"0.6194415",
"0.6180455",
"0.6180455",
"0.6180455",
"0.6180455",
"0.6160292",
"0.6029619",
"0.59960514",
"0.59908044",
"0.5729846",
"0.57140696",
"0.5633332",
"0.55902493",
"0.55836797",
"0.5580937",
"0.5573649",
"0.5541964",
"0.55353206",
"0.551685",
"0.5504224",
"0.5498629"... | 0.6376572 | 0 |
DELETE /my_prayer_requests/1 DELETE /my_prayer_requests/1.json | def destroy
@my_prayer_request = PrayerRequest.find(params[:id])
@my_prayer_request.destroy
respond_to do |format|
format.html { redirect_to my_prayer_requests_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @prayer_request = PrayerRequest.find(params[:id])\n @prayer_request.destroy\n\n respond_to do |format|\n format.html { redirect_to prayer_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request = PrayerRequest.find(params[:id])\n @prayers... | [
"0.7229062",
"0.7035959",
"0.6979271",
"0.69493324",
"0.69409",
"0.68907326",
"0.686872",
"0.686872",
"0.686872",
"0.6850495",
"0.6835",
"0.6814177",
"0.68044853",
"0.6799398",
"0.6788598",
"0.6777768",
"0.6775604",
"0.6775604",
"0.6775604",
"0.6775604",
"0.6775604",
"0.677... | 0.7345097 | 0 |
wrappers for category methods | def create_category(options = {})
ActiveSupport::Deprecation.warn('create_category deprecated. Will be removed. Use community.categories.create.')
self.categories.create options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, args)\n @categories.send(method, *args)\n end",
"def category; end",
"def category\n super\n end",
"def set_category\n end",
"def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def _category\n @_category ||= if category\n ... | [
"0.7133746",
"0.68663037",
"0.6282159",
"0.62477374",
"0.6091469",
"0.6036227",
"0.60255116",
"0.60191935",
"0.59565246",
"0.5927797",
"0.5826131",
"0.5778078",
"0.57301915",
"0.5714193",
"0.5710978",
"0.569997",
"0.5698294",
"0.5661674",
"0.5660879",
"0.56260496",
"0.560541"... | 0.0 | -1 |
Converts office documents to their counterpart (e.g. MS Word > LibreOffice word, or MS Excel > LibreOffice Sheet) or to PDF. Calls the external 'libreoffice' utility to achieve this. | def libreoffice( format: )
suffixes = {
'pdf' => {
'.*' => 'pdf',
},
'msoffice' => {
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx',
'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_document_to_img_or_flatten\n if document_extension.microsoft_file?\n ConvertMicrosoftFileToPdfJob.perform_later(self.id)\n elsif document_extension.image_file?\n ConvertDocumentImgToPdfJob.perform_later(self.id)\n elsif document_extension.pdf_file?\n if is_source_chat?\n ... | [
"0.6363534",
"0.6182482",
"0.6080377",
"0.5984766",
"0.5925793",
"0.5865532",
"0.5804259",
"0.560329",
"0.5562955",
"0.5480696",
"0.5382684",
"0.5382684",
"0.53465605",
"0.5331433",
"0.5314622",
"0.52622706",
"0.52434963",
"0.5213301",
"0.52129835",
"0.52129835",
"0.52029556"... | 0.71939 | 0 |
Configure client PXE boot | def configure_vs_pxe_client(client_name,client_mac,service_name)
tftp_pxe_file = client_mac.gsub(/:/,"")
tftp_pxe_file = tftp_pxe_file.upcase
tftp_boot_file = "boot.cfg.01"+tftp_pxe_file
tftp_pxe_file = "01"+tftp_pxe_file+".pxelinux"
test_file = $tftp_dir+"/"+tftp_pxe_file
if !File.exists?(test_file... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_xb_pxe_client(client_name,client_ip,client_mac,client_arch,service_name,publisher_host)\n os_version = service_name.split(/_/)[1..2].join(\".\")\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tmp_file = \"/tmp/pxecfg\"\n if service_name.match(/openbs... | [
"0.7285672",
"0.71396995",
"0.68608826",
"0.61053425",
"0.5987536",
"0.59707755",
"0.5965519",
"0.59560055",
"0.5818437",
"0.580843",
"0.5726855",
"0.56965613",
"0.5680233",
"0.56613106",
"0.5615442",
"0.56022555",
"0.5581577",
"0.55595964",
"0.5540239",
"0.55371904",
"0.5512... | 0.7333242 | 0 |
Unconfigure client PXE boot | def unconfigure_vs_pxe_client(client_name)
client_mac = get_client_mac(client_name)
if !client_mac
puts "Warning:\tNo MAC Address entry found for "+client_name
exit
end
tftp_pxe_file = client_mac.gsub(/:/,"")
tftp_pxe_file = tftp_pxe_file.upcase
tftp_pxe_file = "01"+tftp_pxe_file+".pxelinux"
tftp_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unconfigure_xb_pxe_client(client_name)\n client_mac=get_client_mac(client_name)\n if !client_mac\n puts \"Warning:\\tNo MAC Address entry found for \"+client_name\n exit\n end\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\... | [
"0.7647324",
"0.7370394",
"0.7302973",
"0.6489282",
"0.6287797",
"0.6208296",
"0.60390174",
"0.5931701",
"0.5918139",
"0.5911586",
"0.59012055",
"0.57473207",
"0.5727864",
"0.57167184",
"0.5701643",
"0.5701151",
"0.56812567",
"0.56747615",
"0.5656268",
"0.5630624",
"0.5629698... | 0.77402914 | 0 |
Output the VSphere file header | def output_vs_header(output_file)
if $verbose_mode == 1
puts "Creating:\tVSphere file "+output_file
end
file=File.open(output_file, 'w')
$q_order.each do |key|
if $q_struct[key].type == "output"
if !$q_struct[key].parameter.match(/[A-z]/)
output=$q_struct[key].value+"\n"
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_vs_header(options,output_file)\n if options['verbose'] == true\n handle_output(options,\"Information:\\tCreating vSphere file #{output_file}\")\n end\n dir_name = File.dirname(output_file)\n top_dir = dir_name.split(/\\//)[0..-2].join(\"/\")\n if options['verbose'] == true\n handle_output(op... | [
"0.7956956",
"0.7105202",
"0.69194216",
"0.6846729",
"0.682574",
"0.6814135",
"0.6796625",
"0.6735572",
"0.6716892",
"0.67039144",
"0.66977453",
"0.66916466",
"0.66916466",
"0.66916466",
"0.66618365",
"0.66521716",
"0.6583263",
"0.6579067",
"0.6568893",
"0.65645033",
"0.65596... | 0.8010387 | 0 |
Output the ks packages list | def output_vs_post_list(post_list,output_file)
file=File.open(output_file, 'a')
post_list.each do |line|
output=line+"\n"
file.write(output)
end
file.close
return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_ks_pkg_list(options,pkg_list,output_file)\n tmp_file = \"/tmp/ks_pkg_\"+options['name']\n file = File.open(tmp_file, 'w')\n output = \"\\n%packages\\n\"\n file.write(output)\n pkg_list.each do |pkg_name|\n output = pkg_name+\"\\n\"\n file.write(output)\n end\n if options['service'].to... | [
"0.7172294",
"0.6530226",
"0.64344156",
"0.6309816",
"0.6209748",
"0.61713475",
"0.6169851",
"0.61521065",
"0.6137225",
"0.6113958",
"0.61100817",
"0.60943496",
"0.6083018",
"0.60221654",
"0.59892505",
"0.59764093",
"0.5965066",
"0.59460557",
"0.58790827",
"0.58586586",
"0.58... | 0.0 | -1 |
Initializes things, you need to give it a fully configured up copy of MCollective::Client, specifically you should have set options already. If you set true as the 2nd param it'll load up rdialog for you so you can use the helper functions. If you dont and try to use rdialog related functions you'll get weird exception... | def initialize(client, with_rdialog=false)
@discovered_clients = nil
@client = client
@options = client.options
if with_rdialog
require 'rdialog'
@dialog = RDialog.new
@dialog.backtitle = "Exim ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(options)\n @client_options = options.merge(client: self)\n end",
"def init_client; end",
"def initialize(client, options = {})\n raise Xeroizer::InvalidClientError.new unless [OAuth, OAuth2].member?(client.class)\n @xero_url = options[:xero_url] || \"https://api.xero.com/ap... | [
"0.6778187",
"0.6578615",
"0.6435152",
"0.6408056",
"0.63914883",
"0.63298506",
"0.6208935",
"0.6163965",
"0.61628556",
"0.61157036",
"0.60725385",
"0.60679585",
"0.6067537",
"0.6067537",
"0.6041664",
"0.6011708",
"0.6001721",
"0.5990367",
"0.597721",
"0.5936896",
"0.5929123"... | 0.78745824 | 0 |
Displays some text while you do something in the background | def infobox(msg, title, height = 5, width = 40)
@dialog.title = "\"#{title}\""
@dialog.infobox("\n" + msg, height, width)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process\n @viewport.visible = true\n while Core::LOCK.locked?\n Graphics.update\n @text.text = @texts[Graphics.frame_count % 60 / 20] if Graphics.frame_count % 20 == 0\n end\n @viewport.visible = false\n end",
"def display_message!(*lines)\n display_message(*lines)\n ... | [
"0.68535686",
"0.6686648",
"0.64565796",
"0.6444821",
"0.6435856",
"0.640916",
"0.6366326",
"0.6363932",
"0.63607085",
"0.6243724",
"0.62209135",
"0.61815363",
"0.61815363",
"0.61255866",
"0.6111053",
"0.60937893",
"0.60768354",
"0.6071271",
"0.6024081",
"0.6017232",
"0.60111... | 0.0 | -1 |
Show the string in a dialog box with a specified title | def textbox(msg, title)
File.open("/tmp/tmp.#{$$}", 'w') {|f| f.write("\n" + msg.to_s) }
title.sub!(/"/, "\\\"")
@dialog.title = "\"#{title}\""
@dialog.textbox("/tmp/tmp.#{$$}")
File.unlink("/tm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infobox(msg, title, height = 5, width = 40)\n @dialog.title = \"\\\"#{title}\\\"\"\n @dialog.infobox(\"\\n\" + msg, height, width)\nend",
"def dialog_msgbox(title, text)\n\n dialog_args = []\n\n dialog_args.push(\"--clear\", \"--no-cancel\",\n \"--title\", title.to_s,\n ... | [
"0.73582697",
"0.7098112",
"0.7079861",
"0.7028664",
"0.7019978",
"0.6982826",
"0.69827634",
"0.6904501",
"0.6830842",
"0.6372534",
"0.63641965",
"0.6345593",
"0.6321875",
"0.6251841",
"0.6238766",
"0.6236402",
"0.6158197",
"0.60308707",
"0.6012298",
"0.6000924",
"0.59636724"... | 0.69298357 | 7 |
Ask the user for something, return the entered text | def ask(what, title)
@dialog.title = "\"#{title}\""
res = @dialog.inputbox("'#{what}'")
raise CancelPressed.new unless res
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_user_for(something)\n puts \"What is the recipe #{something} ?\"\n return gets.chomp\n end",
"def ask_user_for(something)\n # Print question asking for the name, price, or something else\n puts \"What is the #{something.capitalize}?\"\n print \"> \"\n # return the user´s input\n ret... | [
"0.7964009",
"0.78274155",
"0.7710358",
"0.767752",
"0.7672974",
"0.7590265",
"0.75744146",
"0.7547571",
"0.751397",
"0.7481804",
"0.7472213",
"0.7410831",
"0.7397175",
"0.7390107",
"0.73813194",
"0.73736477",
"0.7350292",
"0.7350292",
"0.7318595",
"0.7309615",
"0.72807664",
... | 0.0 | -1 |
Shows a list of options and lets the user choose one | def choose(choices, title)
@dialog.title = "\"#{title}\""
res = @dialog.menu(title, choices)
raise CancelPressed.new unless res
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_from_list(question, list)\n ui.choose_from_list question, list\n end",
"def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what... | [
"0.7181122",
"0.7048328",
"0.70123655",
"0.6892284",
"0.68794775",
"0.68792945",
"0.6852025",
"0.6832611",
"0.6800041",
"0.6772683",
"0.6688377",
"0.6677057",
"0.6598785",
"0.656241",
"0.6561706",
"0.65510786",
"0.6516383",
"0.6504605",
"0.6499889",
"0.6499889",
"0.64774376",... | 0.6033985 | 61 |
does a discovery and store the discovered clients so we do not need to do a discovery for every command we wish to run | def discover
if @discovered_clients == nil
@discovered_clients = @client.discover(@options[:filter], @options[:disctimeout])
end
@discovered_clients
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discover_chef_clients!\n servers.each(&:chef_client)\n end",
"def discover\n @discovery.send_discovery_message\n end",
"def discover\n send_discovery_message\n @first_device_ip = listen_for_responses\n end",
"def discovery_cache; end",
"def auto_discover_nodes!\n @serv... | [
"0.64907914",
"0.64774895",
"0.62452275",
"0.61863923",
"0.6168478",
"0.6126431",
"0.60773784",
"0.60690516",
"0.60690516",
"0.5858986",
"0.5803189",
"0.57963693",
"0.5785328",
"0.57766485",
"0.5757104",
"0.5748984",
"0.5720868",
"0.5700483",
"0.5639717",
"0.5608386",
"0.5570... | 0.73083997 | 0 |
Resets the client so it will rediscover etc | def reset
@discovered_clients = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_client\n @client = nil\n init_client\n end",
"def reset\n @client = nil\n end",
"def reset!\n client.reset!\n end",
"def reset_client!\n @client = nil\n end",
"def reset\n @client = nil\n return self\n end",
"def reset\n @config... | [
"0.853557",
"0.85345125",
"0.8462355",
"0.83876944",
"0.7869063",
"0.7774353",
"0.763086",
"0.7487638",
"0.72119576",
"0.71753865",
"0.7067848",
"0.6985584",
"0.6962762",
"0.6945069",
"0.69097656",
"0.6834936",
"0.6798573",
"0.67736924",
"0.67513436",
"0.6738376",
"0.6651477"... | 0.79574066 | 4 |
helper to return the text of responses from hosts in a consistant way | def printhostresp(response)
text = ""
response.each do |resp|
if resp[:body].is_a?(String)
text += "#{resp[:senderid]}:"
text += " " + resp[:body].split("\n").join("\n ") + "\n\n"
elsif resp[:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answer_string(host)\n answers[host.name].map { |k,v| \"#{k}=#{v}\" }.join(\"\\n\")\n end",
"def reply_text\n return \"No response.\" if response.nil?\n return (not response.first.last.kind_of?(Hash) or response.first.last[\"reply_text\"].nil?) ? \"Unexpected response hash.\" : respo... | [
"0.67572314",
"0.65953934",
"0.636931",
"0.6168068",
"0.60746884",
"0.59405226",
"0.58759564",
"0.58282286",
"0.5820479",
"0.57862747",
"0.57854295",
"0.57801616",
"0.5761217",
"0.5743284",
"0.5701991",
"0.5683419",
"0.5665541",
"0.5662781",
"0.5651475",
"0.56489694",
"0.5648... | 0.762413 | 0 |
helper that returns the text of the mailq in a way similar to the exim mailq command | def printmailq(mailq)
text = ""
mailq.each do |m|
m[:frozen] ? frozen = "*** frozen ***" : frozen = ""
text += "%3s%6s %s %s %s\n" % [ m[:age], m[:size], m[:msgid], m[:sender], frozen ]
m[:recip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summarytext\n File.open(\"/tmp/tmp.#{$$}\", 'w') {|f| f.write(printmailq(mailq)) }\n\n out = %x[/bin/cat /tmp/tmp.#{$$} | /usr/sbin/exiqsumm]\n\n File.unlink(\"/tmp/tmp.#{$$}\")\n\n out\n end",
"def mailq\n mailq = []\n\n ... | [
"0.6791193",
"0.6638607",
"0.64801055",
"0.628291",
"0.6263532",
"0.61715955",
"0.6170912",
"0.6148374",
"0.6126769",
"0.60979265",
"0.60575145",
"0.6057405",
"0.6038348",
"0.6005735",
"0.5972582",
"0.59367883",
"0.5903108",
"0.5889005",
"0.588602",
"0.58709997",
"0.5858873",... | 0.74023163 | 0 |
Creates a request that confirms with what the remote end expects. Sends the request off to the collective and either runs your block with the response or returns it. | def req(command, recipient="", sender="", msgid="", queuematch="")
req = {:command => command,
:recipient => recipient,
:sender => sender,
:msgid => msgid,
:queuematch => queuematch}
result ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _send_request request, &block\n @response_waited[request.id] = block if block_given?\n send_data request.to_s + \"\\n\"\n request\n end",
"def request(*args, &block); end",
"def request(*args, &blk)\n (@client ||= connect).request(*args, &blk)\n end",
"def send_request; ... | [
"0.63190097",
"0.6215372",
"0.6141705",
"0.60640657",
"0.60610026",
"0.60364276",
"0.5974022",
"0.59497267",
"0.5901962",
"0.58416307",
"0.5782254",
"0.57301664",
"0.5718761",
"0.5714242",
"0.57064354",
"0.5689678",
"0.5683932",
"0.56782675",
"0.5660552",
"0.5647649",
"0.5646... | 0.0 | -1 |
Retrieves the mailq and returns the array of data | def mailq
mailq = []
req("mailq") do |resp|
mailq.concat [resp[:body]].flatten
end
mailq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imap_readmail\n q = Queue.new\n imap.search([imap_search_for]).each do |message_id|\n msg = imap.fetch(message_id, 'RFC822')[0].attr['RFC822']\n mail = Mail.new(msg)\n case_id = get_case_id(mail)\n e = Email.create(case_id: case_id, date: mail.date, is_sent: false, raw: MailCompressor... | [
"0.6339167",
"0.6318095",
"0.60299015",
"0.6027242",
"0.5842247",
"0.5793888",
"0.57884246",
"0.577855",
"0.5766614",
"0.5689869",
"0.5669896",
"0.5633891",
"0.561653",
"0.55928075",
"0.55903214",
"0.5585254",
"0.55670595",
"0.5559421",
"0.55146104",
"0.5514472",
"0.5494676",... | 0.8008157 | 0 |
Takes the mailq output and pass it through exiqsum, exiqsum must be locally avail | def summarytext
File.open("/tmp/tmp.#{$$}", 'w') {|f| f.write(printmailq(mailq)) }
out = %x[/bin/cat /tmp/tmp.#{$$} | /usr/sbin/exiqsumm]
File.unlink("/tmp/tmp.#{$$}")
out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mailq\n mailq = []\n\n req(\"mailq\") do |resp|\n mailq.concat [resp[:body]].flatten\n end\n\n mailq\n end",
"def printmailq(mailq)\n text = \"\"\n mailq.each do |m|\n m[... | [
"0.6241192",
"0.6198267",
"0.57926226",
"0.56996495",
"0.5620124",
"0.5620124",
"0.5607003",
"0.55538356",
"0.5507197",
"0.54938495",
"0.5492186",
"0.5465267",
"0.5456894",
"0.54126656",
"0.54043686",
"0.5386185",
"0.53858936",
"0.53324974",
"0.5282312",
"0.5273043",
"0.52673... | 0.7079232 | 0 |
Retries delivery for a specified message | def retrymsg(msgid)
req("retrymsg", "", "", msgid, "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attempt_redelivery(message_id = '*')\n attempt = false\n begin\n unless(@delivering)\n @delivering = true\n attempt = true\n Dir.glob(File.join(message_directory, \"#{message_id}.json\")).each do |file|\n debug \"Redelivery processing: #{file... | [
"0.71423084",
"0.691075",
"0.6749404",
"0.6740486",
"0.66082907",
"0.63887495",
"0.63363934",
"0.62903166",
"0.6244906",
"0.6224709",
"0.6140325",
"0.6136214",
"0.6115747",
"0.6084133",
"0.6084133",
"0.60093606",
"0.6004012",
"0.5969695",
"0.5945338",
"0.59419984",
"0.5908289... | 0.7286403 | 0 |
Adds a recipient to a given message | def addrecipient(msgid, recipient)
req("addrecipient", recipient, "", msgid, "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_recipient(recipient, params = {})\n @api.post(\"#{@api.path}/Group/#{@id}/Recipient\", body: recipient, params: params)\n end",
"def add_recipient(data)\n channel_id = data['channel_id'].to_i\n channel = self.channel(channel_id)\n\n recipient_user = ensure_user(data['user'])\n ... | [
"0.7633839",
"0.7501481",
"0.7449744",
"0.7101235",
"0.6978294",
"0.69358397",
"0.67305523",
"0.6460093",
"0.63908553",
"0.6367121",
"0.63047516",
"0.6178093",
"0.6149987",
"0.614213",
"0.6115706",
"0.61100364",
"0.6083236",
"0.60508776",
"0.60506934",
"0.6022398",
"0.6010293... | 0.8166 | 0 |
Sets the sender for a messageid | def setsender(msgid, sender)
req("setsender", "", sender, msgid, "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sender_message=(value)\n @sender_message = value\n end",
"def sender_user_id=(value)\n @sender_user_id = value\n end",
"def sender=(hostname)\n @message[:sender] = hostname\n end",
"def message_id=(value)\n @message_id = value\n ... | [
"0.69393563",
"0.69386786",
"0.67046034",
"0.65834695",
"0.64479107",
"0.6374767",
"0.62986034",
"0.6292693",
"0.62841976",
"0.6246757",
"0.61421794",
"0.61420184",
"0.61420184",
"0.61216414",
"0.6099831",
"0.6099831",
"0.59383684",
"0.59320647",
"0.58738",
"0.5857647",
"0.58... | 0.6270066 | 9 |
Mark an entire message as delivered | def markmsgdelivered(msgid)
req("markmsgdelivered", "", "", msgid, "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redelivered=(redelivered); @message_impl.setRedelivered redelivered; end",
"def markrecipdelivered(msgid, recipient)\n req(\"markrecipdelivered\", recipient, \"\", msgid, \"\")\n end",
"def deliver_now!\n message.deliver!\n end",
"def deliver_now\n message.deliver\n... | [
"0.73234",
"0.69591844",
"0.6929527",
"0.6897304",
"0.67788523",
"0.67282003",
"0.65661955",
"0.65614593",
"0.65049446",
"0.640396",
"0.6331033",
"0.62870914",
"0.62651366",
"0.62621737",
"0.6232719",
"0.619073",
"0.6177869",
"0.61599106",
"0.6143117",
"0.61415845",
"0.611740... | 0.7927764 | 0 |
Marks a single recipient on a message as delivered | def markrecipdelivered(msgid, recipient)
req("markrecipdelivered", recipient, "", msgid, "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markmsgdelivered(msgid)\n req(\"markmsgdelivered\", \"\", \"\", msgid, \"\")\n end",
"def invitation_delivered(recipient, sender, token)\n\t\tsender_value = sender.is_a?(User) ? \"user:#{sender.to_param}\" : sender.try(:to_s)\n\t\temail_deliveries.create recipient: recipient, sender... | [
"0.7355923",
"0.6847372",
"0.65955096",
"0.6511813",
"0.65088326",
"0.6499564",
"0.64413625",
"0.6370329",
"0.6360965",
"0.6325327",
"0.62758666",
"0.62224317",
"0.61331666",
"0.61245704",
"0.6118357",
"0.6076986",
"0.60629565",
"0.6051112",
"0.6036613",
"0.6034502",
"0.60168... | 0.74322796 | 0 |
Gives up on a message with NDR | def giveup(msgid)
req("giveup", "", "", msgid, "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def b_rdt_send message\n puts 'B Sending Data Unreliably...'\n packet = Packet.new\n packet.payload = message.data\n b_udt_send packet\nend",
"def create_arp_reply message\nend",
"def send_raw(to, msg, dlr_url='')\n raise \"To should not be a user in send_raw\" if to.instance_of?(User)\n\n log_an... | [
"0.6099727",
"0.60931504",
"0.6005843",
"0.598709",
"0.5877157",
"0.5779144",
"0.57563823",
"0.5745289",
"0.56133074",
"0.5608717",
"0.56067604",
"0.56067604",
"0.5589571",
"0.5569905",
"0.55489725",
"0.55354863",
"0.5530785",
"0.5520279",
"0.5476176",
"0.5452144",
"0.5452144... | 0.0 | -1 |
Removes a specified message from the queue | def rm(msgid)
req("rm", "", "", msgid, "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_message(id)\n with_queue_control do |control|\n control.remove_message(id)\n end\n end",
"def _put_back_on_queue(message)\n future = nil\n _redis.multi do\n _redis.rpush(@queue, message)\n future = _redis.lrem(@in_progress_queue, 1, message)\n e... | [
"0.81427765",
"0.75688535",
"0.75146186",
"0.73521936",
"0.7350424",
"0.73474896",
"0.72198933",
"0.719688",
"0.7021278",
"0.7006523",
"0.6946013",
"0.6926395",
"0.68996584",
"0.6871562",
"0.68390197",
"0.68212616",
"0.6820312",
"0.68101484",
"0.67928535",
"0.6773332",
"0.675... | 0.6339474 | 56 |
Delivers all messages matching a patten | def delivermatching(pattern)
req("delivermatching", "", "", "", pattern)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_match message\n return false if reject_not_ack(message)\n return false unless type_match?(message)\n #@notifier.log \"#{identifier}: Looking at #{message.type} #{message.m_id_short}\", level: :collect\n if @block\n status = [@block.call(message)].flatten\n return unles... | [
"0.6129556",
"0.5993614",
"0.5816386",
"0.57539773",
"0.5718296",
"0.5434292",
"0.5424484",
"0.5381404",
"0.5343172",
"0.5324095",
"0.52997756",
"0.52707005",
"0.5246353",
"0.5238894",
"0.52073634",
"0.5206033",
"0.51933074",
"0.5181218",
"0.51444703",
"0.51195556",
"0.510782... | 0.62940824 | 0 |
Does a routing test | def testaddress(address)
req("testaddress", address, "", "", "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_routes\n assert_routing(\n { :path => \"/api/0.6/amf/read\", :method => :post },\n { :controller => \"amf\", :action => \"amf_read\" }\n )\n assert_routing(\n { :path => \"/api/0.6/amf/write\", :method => :post },\n { :controller => \"amf\", :action => \"amf_write\" }\n )\n... | [
"0.7440257",
"0.7363617",
"0.7240815",
"0.72254115",
"0.7156744",
"0.70925623",
"0.7068636",
"0.7068636",
"0.7068636",
"0.7068636",
"0.7068636",
"0.7068636",
"0.7068636",
"0.7068636",
"0.7068636",
"0.7068636",
"0.7068636",
"0.70261985",
"0.6897797",
"0.6890414",
"0.6890211",
... | 0.0 | -1 |
Catchall for the rest, they're mostly the same but this gives us the ability to only improve when needed | def method_missing(method_name, *args)
req(method_name.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def catch_exceptions; end",
"def weber; end",
"def post_match() end",
"def calls; end",
"def calls; end",
"def optimize_every; end",
"def checks; end",
"def probers; end",
"def common\n \n end",
"def fallbacks=(_arg0); end",
"def faint; end",
"def faint; end",
"def _all; end",
"def ig... | [
"0.5655763",
"0.56454486",
"0.5498528",
"0.54772997",
"0.54772997",
"0.5442914",
"0.5435787",
"0.5364402",
"0.5363953",
"0.5353757",
"0.533146",
"0.533146",
"0.5298147",
"0.52820796",
"0.52702236",
"0.52702236",
"0.5233985",
"0.5197854",
"0.5189086",
"0.51860315",
"0.51695085... | 0.0 | -1 |
Creates the wrapper, executing the pfSense shell. The provided code block is yielded this wrapper for execution. | def initialize(base_shell, &block)
raise ArgumentError, 'a code block is required' unless block_given?
raise ArgumentError, 'the base shell must be a valid shell' unless base_shell.is_a?(::Shells::ShellBase)
self.shell = base_shell
wrapper = self
code_block = block
self.out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_shell_instance(&blk)\n no_current = @current.nil?\n if no_current\n Chef::Log.debug(\"RVM::Shell::ChefWrapper subprocess executing with \" +\n \"environment of: [#{shell_params.inspect}].\")\n @current = popen4(self.shell_executable, shell_params)\n invoke_setup!\n ... | [
"0.65066665",
"0.65066665",
"0.6291781",
"0.6215103",
"0.61409396",
"0.61178267",
"0.6116483",
"0.61143774",
"0.6083596",
"0.5951734",
"0.587506",
"0.57976305",
"0.57771945",
"0.5753519",
"0.57471937",
"0.5742776",
"0.57331806",
"0.57272804",
"0.5722935",
"0.5698511",
"0.5674... | 0.74740374 | 0 |
Executes a series of commands on the pfSense shell. | def exec(*commands)
ret = ''
commands.each { |cmd| ret += shell.exec(cmd) }
ret + shell.exec('exec')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute\n\t\tdoCommandList.each do |commandItem|\n\t\t\tcommandItem.execute\n\t\tend\n\tend",
"def exec_commands(cmds)\n exec_tape(cmds)\n exec_out(cmds)\n exec_head(cmds)\n exec_trans(cmds)\n end",
"def shell(commands)\n commands.split(\"\\n\").each { |i| run(i) }\n end",
... | [
"0.64835477",
"0.63334227",
"0.6282367",
"0.6195354",
"0.6186786",
"0.61540437",
"0.6113914",
"0.6097183",
"0.60459673",
"0.59513795",
"0.5934931",
"0.5865207",
"0.58582145",
"0.5856729",
"0.58503443",
"0.5786805",
"0.5781441",
"0.57624274",
"0.57529634",
"0.57079345",
"0.568... | 0.5565503 | 24 |
Reloads the pfSense configuration on the device. | def parse_config
exec 'parse_config(true);'
self.config_parsed = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload!\n @configuration = nil\n load\n self\n end",
"def reload\n converge_it(\"Reloading #{new_resource.device}\") do\n adapter.disable\n sleep 5\n adapter.enable\n end\n end",
"def reload_configuration!\n @configu... | [
"0.6427599",
"0.63784826",
"0.6248536",
"0.6248536",
"0.6196722",
"0.61756843",
"0.6081093",
"0.59650725",
"0.5925451",
"0.5861582",
"0.58337176",
"0.56937784",
"0.565875",
"0.55898863",
"0.5580461",
"0.55787337",
"0.557693",
"0.5547555",
"0.5532679",
"0.5532679",
"0.5474571"... | 0.0 | -1 |
Determines if the configuration has been parsed during this session. | def config_parsed?
config_parsed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_file_loaded?\n @config_file_loaded\n end",
"def config?\n raw_config.present?\n end",
"def configured?\n @configuration != nil\n end",
"def configuration?\n get_mode.to_s.include?('config')\n end",
"def configured?\n configuration_exists?\n end",
"... | [
"0.7249847",
"0.71911544",
"0.7125894",
"0.7016165",
"0.6890245",
"0.6883982",
"0.68572843",
"0.6810626",
"0.67566353",
"0.6718567",
"0.6713437",
"0.66808397",
"0.6663735",
"0.66036403",
"0.6440362",
"0.63981616",
"0.6260228",
"0.6238436",
"0.61852187",
"0.6123952",
"0.609723... | 0.851722 | 0 |
Gets a configuration section from the pfSense device. | def get_config_section(section_name)
parse_config unless config_parsed?
JSON.parse exec("echo json_encode($config[#{section_name.to_s.inspect}]);").strip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config\n if @resource[:section]\n return node.get_config(params: \"section #{@resource[:section]}\", as_string: true)\n end\n node.running_config\n end",
"def device_configuration\n return @device_configuration\n end",
"def [](section_name)\n config[secti... | [
"0.7116275",
"0.6396596",
"0.63556635",
"0.6348594",
"0.6231296",
"0.61805445",
"0.61429715",
"0.61429715",
"0.60288996",
"0.6019953",
"0.60040766",
"0.6003026",
"0.60010123",
"0.5963848",
"0.5902916",
"0.59013474",
"0.5884929",
"0.5874441",
"0.5867441",
"0.5781805",
"0.57728... | 0.62533003 | 4 |
Sets a configuration section to the pfSense device. Returns the number of changes made to the configuration. | def set_config_section(section_name, values, message = '')
current_values = get_config_section(section_name)
changes = generate_config_changes("$config[#{section_name.to_s.inspect}]", current_values, values)
if changes&.any?
if message.to_s.strip == ''
message = "Updating #{sect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_section_configuration\n @section_configuration = SectionConfiguration.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @section_configuration.update(section_configuration_params)\n format.html { redirect_to @section_configuration, notice: 'Section configuration w... | [
"0.6629754",
"0.5810939",
"0.56543696",
"0.55821085",
"0.55327106",
"0.5510472",
"0.5454995",
"0.5439952",
"0.5346559",
"0.53461885",
"0.53461885",
"0.53461885",
"0.53461885",
"0.53461885",
"0.53461885",
"0.53461885",
"0.53461885",
"0.53461885",
"0.53461885",
"0.53461885",
"0... | 0.6379118 | 1 |
Apply the firewall configuration. You need to apply the firewall configuration after you make changes to aliases, NAT rules, or filter rules. | def apply_filter_config
exec(
'require_once("shaper.inc");',
'require_once("filter.inc");',
'filter_configure_sync();'
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_firewall\n\t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p tcp -m tcp --dport 389 -j ACCEPT`\n \t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p udp -m udp --dport 389 -j ACCEPT`\n\t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p tcp -m tcp --dport 636 -j ACCEPT`\n \t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p udp -m ud... | [
"0.7022357",
"0.581617",
"0.5643115",
"0.5546011",
"0.553809",
"0.5532999",
"0.549669",
"0.5471205",
"0.5229268",
"0.5225296",
"0.5209037",
"0.5173828",
"0.51401854",
"0.5132938",
"0.51138884",
"0.5073361",
"0.50478643",
"0.50311714",
"0.5024853",
"0.5017663",
"0.49261874",
... | 0.5003332 | 20 |
Applies the user configuration for the specified user. | def apply_user_config(user_id)
user_id = user_id.to_i
exec(
'require_once("auth.inc");',
"$user_entry = $config[\"system\"][\"user\"][#{user_id}];",
'$user_groups = array();',
'foreach ($config["system"]["group"] as $gidx => $group) {',
' if (is_arra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_to_user(user_id)\n params = {:user_id => user_id}\n post(:apply_to_user, params)\n end",
"def for_user(user)\n self.class.new(@config, user)\n end",
"def merge_user!(other_user:)\n # these methods do not invoke callbacks, since not really needed for taking ownership\n C... | [
"0.6302861",
"0.61864656",
"0.6166653",
"0.6087126",
"0.6052127",
"0.600498",
"0.5965915",
"0.5931665",
"0.5930868",
"0.5910159",
"0.59006315",
"0.5893484",
"0.5892724",
"0.5867153",
"0.5850504",
"0.5838075",
"0.5831839",
"0.5825689",
"0.5825689",
"0.57767814",
"0.5771584",
... | 0.77708924 | 0 |
Enabled public key authentication for the current pfSense user. Once this has been done you should be able to connect without using a password. | def enable_cert_auth(public_key = '~/.ssh/id_rsa.pub')
cert_regex = /^ssh-[rd]sa (?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)? \S*$/m
# get our cert unless the user provided a full cert for us.
unless public_key =~ cert_regex
public_key = File.expand_path(public_key)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_key=(k)\n return self.authentication.public_key = k\n end",
"def public_key=(k)\n return self.authentication.public_key = k\n end",
"def capable_plain_auth?; end",
"def set_ssl_public_key_in_session\n if encryption_required?\n key = OpenSSL::PKey::RSA.new(session[:key] ... | [
"0.6141544",
"0.6141544",
"0.5791559",
"0.5685176",
"0.5652304",
"0.5647371",
"0.5567909",
"0.5567909",
"0.5550744",
"0.5550744",
"0.55392694",
"0.55293596",
"0.55248606",
"0.5519466",
"0.55022144",
"0.55022144",
"0.5496284",
"0.5496284",
"0.54867977",
"0.54772115",
"0.547563... | 0.6812652 | 0 |
Exits the shell session immediately and requests a reboot of the pfSense device. | def reboot
raise Shells::NotRunning unless running?
raise Shells::PfSenseCommon::RestartNow
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power_down\n send_to_vm('system_powerdown')\n end",
"def reboot!\n self.reboot(\"HARD\")\n end",
"def halt\n execute(\"controlvm\", @uuid, \"poweroff\")\n end",
"def reboot(_hard = false)\n return if @cloud_id.nil?\n stop\n start\n end",
"def re... | [
"0.65780616",
"0.6558434",
"0.6273087",
"0.6251806",
"0.62178814",
"0.6064907",
"0.6046774",
"0.5968164",
"0.59502923",
"0.59092027",
"0.59092027",
"0.590405",
"0.5858991",
"0.58339447",
"0.58325523",
"0.5827072",
"0.58267134",
"0.57787514",
"0.5772533",
"0.5751604",
"0.57516... | 0.73539996 | 0 |
Exits the shell session immediately. | def quit
raise Shells::NotRunning unless running?
raise Shells::ShellBase::QuitNow
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exit_session\n @window.dispose\n @viewport.dispose\n ShellOptions.save\n end",
"def cmd_exit(*args)\n\t\tshell.stop\n\tend",
"def shell_close()\n self.kill\n end",
"def exit\n send_cmd \"exit\"\n nil\n end",
"def stop\n Prompt.restore\n Hook.unregister\n end",
... | [
"0.6704952",
"0.6626305",
"0.65454465",
"0.6351174",
"0.6288768",
"0.61938524",
"0.6189323",
"0.6173546",
"0.6172976",
"0.6171902",
"0.6157005",
"0.61025673",
"0.60864496",
"0.60828257",
"0.6082614",
"0.60799736",
"0.6072901",
"0.6030283",
"0.598458",
"0.5968387",
"0.59675384... | 0.6650292 | 1 |
creates 20 recipes, one for each user | def associate_ingredients_to_recipes
Recipe.all.each do |recipe|
5.times do
recipe.ingredients << Ingredient.all.sample
end
recipe.ingredients = recipe.ingredients.uniq
while recipe.ingredients.count < 5
recipe.ingredients << Ingredient.all.sample
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userFill(holder)\n holder.each do | x |\n a_user = User.create!(x)\n recipeMaker(3, a_user)\n end\n # call recipeMaker like 3 times here, which will call subcategories\nend",
"def create_ingredients(recipe, count: 2)\n (1..count).map do |i|\n create :ingredient, recipe_id: reci... | [
"0.71042645",
"0.6936998",
"0.6574878",
"0.65647864",
"0.6507678",
"0.64464486",
"0.64320713",
"0.6408215",
"0.6363888",
"0.6359329",
"0.63298595",
"0.6313044",
"0.62965447",
"0.62717843",
"0.62237835",
"0.6198082",
"0.6195931",
"0.61866033",
"0.61729264",
"0.6151063",
"0.614... | 0.6184878 | 18 |
POST /candidates POST /candidates.json | def create
@candidate = Candidate.new(params[:candidate])
respond_to do |format|
if @candidate.save
session[:candidate_id]=@candidate.id
TestQuestion.generate_candidate_questions(@candidate.id,session[:test_id])
Result.generate_result(@candidate.id,session[:test_id])
flash[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @candidate = current_user.candidates.new(candidate_params)\n respond_to do |format|\n if @candidate.save\n format.html { redirect_to @candidate, notice: 'Candidate was successfully created.' }\n format.json { render :show, status: :created, location: @candidate }\n else\n... | [
"0.7399355",
"0.6904368",
"0.6874747",
"0.6840404",
"0.6840404",
"0.6840404",
"0.6840404",
"0.6836909",
"0.681982",
"0.67530876",
"0.67346483",
"0.6661026",
"0.66238564",
"0.6538402",
"0.64989924",
"0.64921826",
"0.6466355",
"0.6316517",
"0.63106084",
"0.6291944",
"0.62635297... | 0.627492 | 20 |
PUT /candidates/1 PUT /candidates/1.json | def update
@candidate = Candidate.find(params[:id])
respond_to do |format|
if @candidate.update_attributes(params[:candidate])
flash[:notice]='Successfully updated Details!'
format.html { redirect_to :controller=>"test_center",:action=>"instructions" }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @candidate = Candidate.find(params[:id])\n\n respond_to do |format|\n if @candidate.update_attributes(params[:candidate])\n format.html { redirect_to @candidate, notice: 'Candidate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html... | [
"0.6829255",
"0.6770475",
"0.66714746",
"0.6655466",
"0.6655466",
"0.6655466",
"0.6655466",
"0.6655466",
"0.6655466",
"0.6655466",
"0.6548397",
"0.6479073",
"0.6457407",
"0.6452191",
"0.641874",
"0.641874",
"0.6387723",
"0.63215894",
"0.63051325",
"0.63051325",
"0.63051325",
... | 0.63642025 | 17 |
DELETE /candidates/1 DELETE /candidates/1.json | def destroy
@candidate = Candidate.find(params[:id])
@candidate.destroy
respond_to do |format|
format.html { redirect_to candidates_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redirect_to candidates_url, notice: 'Candidate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @candidate.destroy\n respond_to do |format|\n format.html { redire... | [
"0.7173674",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.717342",
"0.71688795",
"0.71688795",
"0.71688795",
"0.7097595",
"0.7083692",
"0.68879616",
"0.67611915",
"0.67196244",
"0.6716783",
"0.6708224",
"0.6674849",
"0.6648467",
"0.6633264",
"0... | 0.7436304 | 1 |
NdV 2102009: geef alleen 'verwijderde items' terug als dit voor alle keys het antwoord is | def find_auto_folder(msg)
result = nil
msg_get_keys(msg).each {
|key|
tuple = @library[key]
result = tuple.list[0] if (tuple != nil) && tuple.auto
}
if (result != nil) && (result.path =~ /Verwijderde items/)
puts "*** #keys for auto-delete (moet 1 zijn): #{msg_get_keys(msg).length}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_newkeys; end",
"def remove_item(groccery_items, key)\n groccery_items.delete(key)\n p groccery_items\nend",
"def list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend",
"def remove_from_list(item_to_rmv)\n item_to_rmv.to_str\n updated_list = Hash.new\n ... | [
"0.5985153",
"0.5978308",
"0.573573",
"0.5733107",
"0.56273514",
"0.56273514",
"0.559684",
"0.5593555",
"0.558044",
"0.55375385",
"0.5536744",
"0.5526515",
"0.5524893",
"0.5505202",
"0.5492967",
"0.5484513",
"0.5468726",
"0.54646933",
"0.5463106",
"0.54535717",
"0.53995526",
... | 0.0 | -1 |
move folder to top of lists for each recipient only move it if it is already in the list (and the list exists) | def move_to_top(msg, mail_folder)
keys = msg_get_keys(msg)
keys.each {
|key|
tuple = @library[key]
list = nil
list = tuple.list if tuple != nil
if list != nil
item = list.delete(mail_folder)
list.insert(0, item) if item != nil
end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move\n begin\n conversation = params['conversation']\n message = @frontapp_service.get_message(conversation)\n if(@frontapp_service.has_spam_tag?(conversation) && !@frontapp_service.in_spam_inbox?(conversation))\n # has spam tag and is moved to non-spam folder\n Rails.logger.inf... | [
"0.5869432",
"0.580066",
"0.5683169",
"0.5678388",
"0.5667837",
"0.5645735",
"0.5641942",
"0.56063855",
"0.55972964",
"0.55592746",
"0.55432206",
"0.55385625",
"0.55385625",
"0.5535058",
"0.5535058",
"0.55278015",
"0.55236316",
"0.5522101",
"0.5484351",
"0.54293865",
"0.54078... | 0.6795257 | 0 |
GET /study_process_graphics GET /study_process_graphics.json | def index
@study_process_graphics = @year.study_process_graphics
@search = @study_process_graphics.search(params[:q])
@groups=@search.result(:distinct => true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def study_process_graphic_params\n params[:study_process_graphic]\n end",
"def set_study_process_graphic\n @study_process_graphic = StudyProcessGraphic.find(params[:id])\n end",
"def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\... | [
"0.6975183",
"0.6804101",
"0.6182605",
"0.6182605",
"0.615172",
"0.6025828",
"0.59964347",
"0.5933641",
"0.5857659",
"0.56802106",
"0.56552655",
"0.5517512",
"0.5488387",
"0.54442763",
"0.5442967",
"0.5435826",
"0.5427283",
"0.5424627",
"0.5380775",
"0.5368246",
"0.5368246",
... | 0.57067037 | 9 |
GET /study_process_graphics/1 GET /study_process_graphics/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_study_process_graphic\n @study_process_graphic = StudyProcessGraphic.find(params[:id])\n end",
"def study_process_graphic_params\n params[:study_process_graphic]\n end",
"def show\n @graphic = Graphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\... | [
"0.69047457",
"0.6859018",
"0.6368315",
"0.6368315",
"0.60356766",
"0.60265356",
"0.6000465",
"0.58847743",
"0.586909",
"0.58445007",
"0.5797634",
"0.5701323",
"0.56745994",
"0.5660942",
"0.56494623",
"0.5640834",
"0.56321347",
"0.5625826",
"0.5600194",
"0.5594968",
"0.559282... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.