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 |
|---|---|---|---|---|---|---|
update user information for bot questions | def information_edit
if request.post?
if current_user.update(params.require(:user).permit(User::INFORMATION_ATTRS))
render_success_message('Information successfully saved.', render_to_string(partial: 'information', locals:{user: current_user}))
else
render_error_model(curent_us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # Do not support updating an answer for now\n # Once you have answered there is no return\n end",
"def update_user\n end",
"def update\n clear_screen\n puts \"Please enter a new username\".colorize(:yellow)\n user_input = gets.chomp.downcase\n #binding.pry\n self.user.update(n... | [
"0.6892766",
"0.6870422",
"0.6687919",
"0.6678747",
"0.64590794",
"0.64487237",
"0.6408342",
"0.6386861",
"0.6378494",
"0.63376886",
"0.63250905",
"0.629066",
"0.62789065",
"0.62617207",
"0.6227199",
"0.62215817",
"0.62030745",
"0.6202987",
"0.6155378",
"0.61422074",
"0.61422... | 0.0 | -1 |
ajax service to continue with bot question | def continue_bot_questions
flash[:notice] = "This feature has been disabled. Please contact to administrator"
return redirect_to home_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mechanic_quest; end",
"def http_callback\n # sleep 4\n if @params[\"status\"] == \"error\"\n @answer_backend = {\"submit_error_message\"=> Localization::Request[:no_network]}\n WebView.navigate url_for :action => :request, :query => @answer_backend\n end\n @answer_backend = Rho::JSON.pa... | [
"0.647479",
"0.64729667",
"0.6268678",
"0.6268209",
"0.6129098",
"0.6126439",
"0.6119413",
"0.6095128",
"0.60646254",
"0.6020372",
"0.5986315",
"0.5974805",
"0.5774456",
"0.573233",
"0.570377",
"0.5702008",
"0.56992394",
"0.5674307",
"0.5674272",
"0.56725866",
"0.56673783",
... | 0.5888387 | 12 |
list of all accepted praying feeds (created by current user) | def my_praying_list
@content_prayers = current_user.contents.filter_prays.no_answered.page(params[:page]).per(3)
@content_prayers = @content_prayers.where(id: params[:content_id]) if params[:content_id].present?
render partial: true, locals: { content_prayers: @content_prayers }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feeds\n all.select { |c| c.google_id =~ /^feed/ }\n end",
"def feeds\n @user = current_user\n @subscribed_ids = @user.subscriptions.pluck(:feed_uid)\n end",
"def index\n people_in_feed = current_user.feed_list\n @posts = Post.where(user: people_in_feed)\n end",
"def index\n ... | [
"0.7018988",
"0.683783",
"0.6697642",
"0.65541834",
"0.63971686",
"0.6362807",
"0.63539886",
"0.63440746",
"0.61640525",
"0.6042804",
"0.59772766",
"0.5971994",
"0.59540457",
"0.5951526",
"0.58786905",
"0.58595234",
"0.5857963",
"0.58494914",
"0.5831484",
"0.58267045",
"0.581... | 0.0 | -1 |
list of all accepted praying feeds (praying for others) | def my_praying_list_of_others
@content_prayers = current_user.content_prayers.accepted.no_answered.exclude_owner.page(params[:page]).per(3)
render partial: true, locals: { content_prayers: @content_prayers }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feeds\n all.select { |c| c.google_id =~ /^feed/ }\n end",
"def feed_items\n []\n end",
"def filter_by_accepting_proposals(collection)\n collection.where(\"request_for_proposals.state = ?\", 'pending')\n end",
"def feed\n @bookings = Booking.find_waiting_pickup\n respond_... | [
"0.69479865",
"0.6148603",
"0.5899469",
"0.5844874",
"0.57908785",
"0.57814294",
"0.57266635",
"0.5696564",
"0.56688756",
"0.56672084",
"0.56256336",
"0.5607401",
"0.5602008",
"0.5591362",
"0.5581918",
"0.55763316",
"0.55692154",
"0.55692154",
"0.5504587",
"0.54758054",
"0.54... | 0.0 | -1 |
list of all accepted and answered praying feeds | def my_praying_list_answered
@content_prayers = current_user.content_prayers.answered.accepted.page(params[:page]).per(3)
render partial: true, locals: { content_prayers: @content_prayers }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def feeds\n all.select { |c| c.google_id =~ /^feed/ }\n end",
"def feeds\n\t\tuser = User.find_by_id(params[:user_id])\n\t\tunless user\n\t\t\trender json: {error: \"user not fonud\"} and return\n\t\tend\n\t\tcq = CompletedQuest.where(user_id: user.friends.ids).order(created_at: :desc).limit(10)\... | [
"0.69654846",
"0.61455834",
"0.61304706",
"0.6122362",
"0.6087533",
"0.6001919",
"0.5986516",
"0.595998",
"0.5923718",
"0.58985305",
"0.58307415",
"0.57991123",
"0.57977575",
"0.57843935",
"0.5725506",
"0.5707281",
"0.57012093",
"0.56991863",
"0.56719244",
"0.56704944",
"0.56... | 0.0 | -1 |
list of all pending and non answered praying feeds (requests) | def my_praying_list_requests
@content_prayers = current_user.content_prayers.no_answered.pending.page(params[:page]).per(3)
@content_prayers = @content_prayers.where(content_id: params[:content_id]) if params[:content_id].present?
render partial: true, locals: { content_prayers: @content_prayers }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def received_friend_requests\n self.followers.where(\"friend_status = 'PENDING'\")\n end",
"def friend_requests\n FriendRequest.all.select do |req|\n req.to_user_id == self.id && req.pending\n end\n end",
"def get_pending_requests\n r = Request.where(:assigned => self , :done => false).to_a\... | [
"0.6637702",
"0.6562422",
"0.6431446",
"0.6349358",
"0.6318353",
"0.6309703",
"0.62497",
"0.62350065",
"0.62127316",
"0.6207682",
"0.6207356",
"0.61780745",
"0.61500084",
"0.614724",
"0.6121276",
"0.6110391",
"0.61034673",
"0.61034673",
"0.60844195",
"0.6082027",
"0.6077131",... | 0.53625154 | 91 |
current user blocks an user | def block_user
current_user.block_user!(params[:user_id])
redirect_to :back, notice: "#{User.find(params[:user_id]).full_name(false)} has been successfully blocked"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_user\n SecurityService.block_user(params[:id])\n redirect_to '/users/', notice: \"Käyttäjä ei voi enää luoda kursseja.\"\n end",
"def blocked\n @user = current_user\n @blockedUsers = current_user.blocks\n\n end",
"def blocked_user\n is_blocked = false \n\n if params[:id]\n @u... | [
"0.78406936",
"0.77903336",
"0.77370334",
"0.7735032",
"0.77243936",
"0.7582973",
"0.756715",
"0.74385583",
"0.7355044",
"0.7242712",
"0.71112466",
"0.71091247",
"0.70354307",
"0.7018305",
"0.6993503",
"0.69348335",
"0.6835334",
"0.6823376",
"0.68208206",
"0.67205995",
"0.671... | 0.79817843 | 0 |
current user unblocks an user | def unblock_user
current_user.unblock_user!(params[:user_id])
redirect_to :back, notice: "#{User.find(params[:user_id]).full_name(false)} has been successfully unblocked"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unblock\n current_user.unblock_user(@user.id)\n render json: {ok: 1}\n end",
"def unblock_user(id)\n delete(\"UserBlock/#{id}\")\n end",
"def unblock_user\n SecurityService.unblock_user(params[:id])\n redirect_to '/users/', notice: \"Käyttäjän blokkaus poistettu. Hän vo... | [
"0.8271838",
"0.8019223",
"0.78386056",
"0.7695738",
"0.7488569",
"0.7364417",
"0.73124707",
"0.72943544",
"0.7032734",
"0.7029632",
"0.7006951",
"0.6971694",
"0.692044",
"0.6909476",
"0.6909476",
"0.6891085",
"0.68754447",
"0.67448187",
"0.67322433",
"0.66975117",
"0.6694118... | 0.80001205 | 2 |
current user unblocks an user | def follow_user
user = User.find(params[:user_id])
authorize! :follow, user
current_user.follow(user)
render_success_message("You are following #{user.full_name(false)}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unblock\n current_user.unblock_user(@user.id)\n render json: {ok: 1}\n end",
"def unblock_user(id)\n delete(\"UserBlock/#{id}\")\n end",
"def unblock_user\n current_user.unblock_user!(params[:user_id])\n redirect_to :back, notice: \"#{User.find(params[:user_id]).ful... | [
"0.82721937",
"0.80185086",
"0.80002946",
"0.78388673",
"0.76961434",
"0.7488241",
"0.736475",
"0.73108715",
"0.7294399",
"0.7031431",
"0.70282894",
"0.70057243",
"0.6970087",
"0.6920287",
"0.6907542",
"0.6907542",
"0.68899757",
"0.6874751",
"0.6741368",
"0.67319214",
"0.6697... | 0.0 | -1 |
current user unblocks an user | def unfollow_user
user = User.find(params[:user_id])
current_user.unfollow(user)
render_success_message("You are not anymore following #{user.full_name(false)}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unblock\n current_user.unblock_user(@user.id)\n render json: {ok: 1}\n end",
"def unblock_user(id)\n delete(\"UserBlock/#{id}\")\n end",
"def unblock_user\n current_user.unblock_user!(params[:user_id])\n redirect_to :back, notice: \"#{User.find(params[:user_id]).ful... | [
"0.8271838",
"0.8019223",
"0.80001205",
"0.78386056",
"0.7695738",
"0.7488569",
"0.7364417",
"0.73124707",
"0.72943544",
"0.7032734",
"0.7029632",
"0.7006951",
"0.6971694",
"0.692044",
"0.6909476",
"0.6909476",
"0.6891085",
"0.68754447",
"0.67448187",
"0.67322433",
"0.6697511... | 0.0 | -1 |
remove a specific following suggestion | def cancel_follow_suggestion
current_user.ignore_suggested_following(params[:user_id])
head(:no_content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignore_suggested_following(_user_id)\n follow_suggestions.where(user_id: _user_id).delete_all\n rejected_follow_suggestions.create(user_id: _user_id)\n end",
"def decline_suggestion(id)\n delete(\"suggestions/#{id}\")\n end",
"def remove_no_longer_following(friendings, user,cursor=-1)\n ... | [
"0.68088055",
"0.6786115",
"0.64408284",
"0.6292058",
"0.62503237",
"0.61875093",
"0.61073095",
"0.6054283",
"0.60293037",
"0.60293037",
"0.5969551",
"0.59417486",
"0.58993024",
"0.58993024",
"0.58993024",
"0.5898356",
"0.5893563",
"0.58903766",
"0.5844369",
"0.58365715",
"0.... | 0.6794232 | 1 |
delete current user account and all related information | def delete_account
UserMailer.delete_account(current_user, confirm_delete_users_url(code: ApplicationHelper.encrypt_text("#{Date.today}::#{current_user.id}"))).deliver_later
redirect_to :back, notice: 'We sent you an email to confirm your request. Please review your email and confirm the action.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_user_account\n # delete their favorites before deleting user\n User.all.destroy(current_user.id)\n puts \"\n Your account have been removed! I will never tell, xoxo\n \"\n \n... | [
"0.82062554",
"0.7929785",
"0.7917381",
"0.7916957",
"0.7798136",
"0.768536",
"0.76463425",
"0.7621672",
"0.7566646",
"0.75501955",
"0.7494343",
"0.74635273",
"0.7462463",
"0.74622995",
"0.7457947",
"0.7443855",
"0.7436844",
"0.7431885",
"0.7422057",
"0.7386303",
"0.7366392",... | 0.72026587 | 39 |
Ok, node is connected and ready to work | def post_init
JR::JobLogger.log("#{@node.name} ready to work")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_completed\n JR::JobLogger.log('Begin distributor handshake')\n data = {node_info: {name: @node.config[:name], server: @node.server} }\n data = Marshal.dump(data)\n send_data(data)\n end",
"def connected?; end",
"def connected?; end",
"def connected?; end",
"d... | [
"0.7106397",
"0.69934136",
"0.69934136",
"0.69934136",
"0.68196446",
"0.6782766",
"0.6782766",
"0.67589694",
"0.6727685",
"0.6695",
"0.6679627",
"0.6665446",
"0.6641396",
"0.65849453",
"0.65849453",
"0.64832604",
"0.64830834",
"0.64785796",
"0.64714676",
"0.6471245",
"0.64318... | 0.0 | -1 |
It is the place where job life cycle begins. This method: receives data from distributor; saves them in storage; returns 'ok' to unlock node connection; and schedules job; | def receive_data(data)
hash = Marshal.load(data)
JR::JobLogger.log("#{@node.name} received job: #{hash}")
hash.merge!('node' => @node.name)
@storage.save(hash) do |hash|
@node.schedule(hash)
end
send_data('ok')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_job(job, node)\r\n\t\t\treturn if @shutdown\r\n\t\t\tretries = 0\r\n\t\t\r\n\t\t\tbegin\r\n\t\t\t\treturn if @shutdown\r\n\t\t\t\tklass = job.class_name.constantize\r\n\t\t\t\traise NoClassError.new(\"Job cannot find class #{job.inspect}.\") if klass.to_s.empty?\r\n\t\t\t\t\r\n\t\t\t\tjob_args = YAML::load... | [
"0.6393763",
"0.6152351",
"0.61212546",
"0.59671205",
"0.5961606",
"0.59106505",
"0.5873358",
"0.55673397",
"0.5555035",
"0.5517588",
"0.55091995",
"0.5412462",
"0.5399899",
"0.53449494",
"0.5328511",
"0.53110874",
"0.5297388",
"0.52932954",
"0.5288458",
"0.5282864",
"0.52711... | 0.66077214 | 0 |
Returns a sortstring (in SQL) based on the given GET parameter and table column to sort on | def get_sort_order (get_param, column_name)
if params[get_param] && !params[get_param].empty?
if params[get_param].downcase == "asc"
if column_name.kind_of?(Array)
"#{column_name.join(' ASC, ')} ASC"
else
"#{column_name} ASC"
end
else
if column_name.kind_of?(Array)
"#{co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_sql_helper(param)\n return param.gsub('_reverse',\" DESC\")\n end",
"def sort_table column, human_name, date_param = nil\n\t\thtml = \"\"\n\t\t\n\t\t# if already sorting by this column then it reverses the sort\n\t\tif (request.url.include? column) && !(request.url.include? \"DESC\")\n\t\t\tif date_... | [
"0.7378696",
"0.7344715",
"0.7119452",
"0.71108204",
"0.70548",
"0.7030879",
"0.70226824",
"0.702231",
"0.69000477",
"0.6882688",
"0.6861521",
"0.6818387",
"0.67997897",
"0.67875487",
"0.6777091",
"0.6769865",
"0.6749354",
"0.6745081",
"0.67338103",
"0.6721433",
"0.6715099",
... | 0.6904893 | 8 |
Admin login action. Generates a login page. Template: admin/login.rhtml | def login
@user = @current_user || User.new
# If logged in, redirect to the pending orders page. This only happens if we didn't jump_to
# something in require_authorisation: it's pretty confusing if you get the login screen again
# _after_ you successfully logged in!
if @user.permissions >= :client
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n render :layout => 'login_user'\n end",
"def login\n\t#Login Form\n end",
"def loginpage\n end",
"def login\n # when we log in, we're looking at a page that looks like all other pages,\n # so we need some data for the layout\n @tags = Post.tag_counts\n # create a new author to... | [
"0.7763911",
"0.7638752",
"0.7584325",
"0.757787",
"0.7574247",
"0.7574001",
"0.75129914",
"0.7464359",
"0.7444438",
"0.73881966",
"0.7331393",
"0.7222936",
"0.7171002",
"0.7142577",
"0.7084237",
"0.70805585",
"0.7053972",
"0.70339525",
"0.70339525",
"0.7027532",
"0.70041984"... | 0.0 | -1 |
Displays a list of products for editing. Also handles deleting/undeleting products, and bulkadding products to categories. Template: admin/products.rhtml | def products
@current_area = 'products'
@current_menu = 'products'
sort_order ||= get_sort_order("s-code", "product_code")
sort_order ||= get_sort_order("s-name", "product_name")
sort_order ||= "product_name ASC"
page = params[:page] ? params[:page].to_i : 1
items_per_page = 30
offset = (pag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_view\n @products = Product.all\n end",
"def edit\n @product = Product.find(params[:id])\n @categories = Category.find(:all)\n end",
"def products_list\n\t\t@view.products_list\n\t\tproducts = @store.products\n\t\tproducts.each do |product|\n\t\t\tputs \"Name: #{product.name} ---> Price: #{... | [
"0.6987995",
"0.69129",
"0.6870167",
"0.6559529",
"0.6538351",
"0.6455489",
"0.64413255",
"0.6437622",
"0.6376507",
"0.63220304",
"0.62978613",
"0.6276998",
"0.6233087",
"0.6229371",
"0.6223562",
"0.61846864",
"0.61846864",
"0.6184298",
"0.61470455",
"0.6129801",
"0.6120447",... | 0.6693776 | 3 |
Displays a list of deleted products. Also handles undeleting products. Template: admin/deleted_products.rhtml | def deleted_products
@current_area = 'deleted_products'
@current_menu = 'products'
sort_order ||= get_sort_order("s-code", "product_code")
sort_order ||= get_sort_order("s-name", "product_name")
sort_order ||= "product_name ASC"
page = params[:page] ? params[:page].to_i : 1
items_per_page = 30
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @product.destroy\n prepare_products(25,'any')\n render :template => 'manage/products/index' and return\n end",
"def destroy\n @product = Product.find params[:id]\n @product.destroy\n flash[:success] = \"Product deleted\"\n redirect_to admin_products_path\n end",
"def destro... | [
"0.6634881",
"0.64517957",
"0.63992804",
"0.63767433",
"0.633572",
"0.633052",
"0.62984097",
"0.627465",
"0.627465",
"0.6265274",
"0.626059",
"0.62180424",
"0.6215009",
"0.62040854",
"0.61846465",
"0.616092",
"0.6158781",
"0.6158781",
"0.61106485",
"0.60900956",
"0.6046175",
... | 0.7948514 | 0 |
Form for creating a new product. The actual work of creating a product is done by +create+. New: Creates a new product. Redirects to +productoptions+ on success so the options can be set. Templates: admin/new.rhtml, admin/_product_form.rhtml | def new
@current_area = 'products'
if request.post?
@current_menu = 'products'
if params[:product][:categories]
product_categories = params[:product][:categories].map { |c| Category.find(c.to_i) }
else
product_categories = []
end
params[:product][:categories] = []
params[:produ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @product = Product.new(@editable_params)\n\n if @product.save\n @product_section = 'options'\n render :template => 'manage/products/options_images_form' and return\n else\n prepare_products(25,'any')\n render :template => 'manage/products/index' and return\n end\n end"... | [
"0.74193954",
"0.7241117",
"0.7091679",
"0.6994233",
"0.69834685",
"0.6980538",
"0.69008696",
"0.6869681",
"0.6826161",
"0.68094736",
"0.68054074",
"0.6774903",
"0.67400074",
"0.6739771",
"0.67387813",
"0.6661485",
"0.663905",
"0.66384023",
"0.66351867",
"0.6631993",
"0.66270... | 0.6506022 | 30 |
Displays a product for editing. Templates: admin/product.rhtml, admin/_product_form.rhtml | def product
@current_area = 'products'
@current_menu = 'products'
if params[:save]
@product = Product.find(params[:id])
if params[:delete_image]
Image.delete(@product.image.id)
return false # we don't need to process anything more
end
if params[:product][:categories]
params... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@product = Product.find(params[:id])\n\tend",
"def edit\n\t\t@product = Product.find(params[:id])\n\tend",
"def edit\n\t\t@product = Product.find(params[:id]) #record for edit\n\tend",
"def edit\n @product = Product.find(params[:id])\n end",
"def edit\n @product = Product.find(params[:... | [
"0.78849804",
"0.78849804",
"0.78065",
"0.7767493",
"0.7767493",
"0.7767493",
"0.7754622",
"0.7729591",
"0.77009255",
"0.7563795",
"0.7555681",
"0.74013984",
"0.7182824",
"0.6938335",
"0.6905802",
"0.68947023",
"0.6889723",
"0.68621695",
"0.686208",
"0.6853084",
"0.68169343",... | 0.6507677 | 42 |
Adds an option to a product and redirects to the product's details page. | def add_option
@current_menu = 'products'
if params[:option_id]
@product = Product.find(params[:id])
cur_option = Option.find(params[:option_id])
option_values = OptionValue.find(:all, :conditions => [ "option_id = #{cur_option[:id]}" ])
option_values.each do |cur_option_value|
cur_defaul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_product\n product = Product.find(params[:product][:id])\n unless @invoice_service.add_product(product)\n redirect_to products_path\n return\n end\n\n redirect_to_origin(params[:origin][:code], product)\n end",
"def create\n @option = Option.new(option_params)\n\n respond_to d... | [
"0.65813",
"0.65371436",
"0.65187556",
"0.6449836",
"0.63978314",
"0.6259433",
"0.6204627",
"0.6160969",
"0.6132539",
"0.61108863",
"0.6049939",
"0.60172474",
"0.59835273",
"0.5974672",
"0.5953263",
"0.5932059",
"0.58850074",
"0.58759505",
"0.5873616",
"0.5866746",
"0.5849733... | 0.8001455 | 0 |
Updates a product's options and redirects to the product's details page. | def update_options
@current_menu = 'products'
@product = Product.find(params[:id])
if params[:hide_option_value]
cur_option_value = nil
params[:hide_option_value].each_key do |cur_option_value_id|
cur_option_value = OptionValue.find(cur_option_value_id)
end
ProductOptionValue.delete_al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @product_option = ProductOption.find(params[:product_option][:id])\n @product = Product.find(params[:product_id])\n @product_option.update_attributes(params[:product_option])\n \n @available_options = ProductOption.find(:all, :order => 'name')\n end",
"def update\n res... | [
"0.7683195",
"0.71396047",
"0.7096905",
"0.7074948",
"0.69970894",
"0.6867181",
"0.67554504",
"0.6708696",
"0.6692355",
"0.66497916",
"0.66497296",
"0.66148365",
"0.6597026",
"0.65647167",
"0.6557933",
"0.65537506",
"0.65537506",
"0.65537506",
"0.6500407",
"0.64978373",
"0.64... | 0.75668585 | 1 |
Colours the specified text by prepending it with the standard terminal colour code for the specified colour. A reset code is appended in order to avoid accidentally colourising subsequent text. | def color(text, color)
if COLORS[color]
"#{start_color color}#{text}#{reset_color}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colorize(color, text)\n \"\\e[#{color}m#{text}\\e[0m\"\n end",
"def color(text, color_code)\n \"#{color_code}#{text}\\e[0m\"\n end",
"def colorize(text, color_code); \"#{color_code}#{text}\\033[0m\"; end",
"def colorize(text, color)\n\t\"\\e[#{Colors[color]}m#{text}\\e[0m\"\nend",
"def ... | [
"0.7313717",
"0.7307564",
"0.72916657",
"0.72091377",
"0.7192562",
"0.6995001",
"0.6981535",
"0.6970703",
"0.69346046",
"0.6875803",
"0.6834511",
"0.68333614",
"0.68025905",
"0.6736442",
"0.6711344",
"0.6711239",
"0.6696829",
"0.66914624",
"0.66914624",
"0.66914624",
"0.66845... | 0.76451004 | 0 |
The terminal reset code | def reset_color
"\e[#{COLORS[:reset]}m"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n write(SYSTEM_RESET)\n end",
"def reset_terminal\n # Reset the terminal to a useable state (undo all changes).\n # '\\e[?7h': Re-enable line wrapping.\n # '\\e[?25h': Unhide the cursor.\n # '\\e[2J': Clear the terminal.\n # '\\e[;r': Set the scroll region to its default value.\n # ... | [
"0.72713196",
"0.7031503",
"0.69630224",
"0.6790025",
"0.6665894",
"0.6638982",
"0.6636401",
"0.65410316",
"0.6514906",
"0.64562094",
"0.6440759",
"0.6419025",
"0.64105844",
"0.63279104",
"0.63279104",
"0.63279104",
"0.63279104",
"0.63279104",
"0.63279104",
"0.63279104",
"0.6... | 0.63852483 | 13 |
The code for the specified colour with the necessary escape characters | def start_color color
"\e[#{COLORS[color]}m"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code\n index = 16 +\n RGB.to_ansi_domain(@red) * 36 +\n RGB.to_ansi_domain(@green) * 6 +\n RGB.to_ansi_domain(@blue)\n\n \"#{@ground_code};5;#{index}\"\n end",
"def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end",
"def c... | [
"0.7642137",
"0.73843783",
"0.73776996",
"0.7224933",
"0.71943617",
"0.7171978",
"0.7118898",
"0.7115181",
"0.71000063",
"0.70738393",
"0.70732313",
"0.70309836",
"0.70309836",
"0.70309836",
"0.7015291",
"0.701429",
"0.69795287",
"0.6916966",
"0.69014394",
"0.68910843",
"0.68... | 0.0 | -1 |
Da PostStudie: Alle in Gruppe pinned und Gruppe low a | def set_group_belonging
#group_number = self.id % 4
#self.update_attributes(group: group_number)
self.update_attributes(group: 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pin!\n update_attribute(:pinned, true)\n end",
"def pin!\n update_attribute(:pinned, true)\n end",
"def pinned?\n @pin\n end",
"def pinned_scripts; end",
"def toggle_is_pinned!\n self.is_pinned = (self.is_pinned ? false : true) # will change true to false and false to true\n end",
... | [
"0.605668",
"0.6019432",
"0.5916778",
"0.55889344",
"0.5319575",
"0.5278756",
"0.5267904",
"0.5163098",
"0.5137336",
"0.5103434",
"0.50879645",
"0.501516",
"0.5001782",
"0.4996072",
"0.49841282",
"0.4968468",
"0.4966951",
"0.4961392",
"0.49568513",
"0.49475455",
"0.49404857",... | 0.0 | -1 |
[ ['Users', user_path], ['Roles'] ] | def breadcrumb
Array(@breadcrumb)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roles\n self.dig_for_array(\"roles\")\n end",
"def roles_path\n @roles_path ||= '/api/v2/roles'\n end",
"def roles\n roles_from_users\n end",
"def roles\n @users = User.order(\"user_name\").all\n end",
"def roles\r\n @roles ||= user_roles.map(&:name)\r\n end",
"def get... | [
"0.7140801",
"0.7134264",
"0.70727164",
"0.7010829",
"0.67739356",
"0.6705192",
"0.6684682",
"0.65716153",
"0.6560637",
"0.65571934",
"0.652195",
"0.64523685",
"0.64416736",
"0.6419677",
"0.64140594",
"0.6386049",
"0.6379618",
"0.6371931",
"0.6298147",
"0.62960696",
"0.629342... | 0.0 | -1 |
Replace this with your real tests. | def test_truth
assert_kind_of Teacher, @teacher
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testing\n # ...\n end",
"def __dummy_test__\n end",
"def tests; end",
"def tests; end",
"def spec; end",
"def spec; end",
"def self_test; end",
"def self_test; end",
"def test \n end",
"def test_0_dummy\n\t\tend",
"def test\n\n end",
"def test\n end",
"def test\n end"... | [
"0.7446459",
"0.6956364",
"0.69155836",
"0.69155836",
"0.6864151",
"0.6864151",
"0.66406286",
"0.66406286",
"0.66253287",
"0.6547665",
"0.6524571",
"0.6484549",
"0.6484549",
"0.6484549",
"0.6403847",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188"... | 0.0 | -1 |
To generate further elements of the sequence we take the sum of the previous two elements. For example the first 6 fibonacci numbers are 1, 1, 2, 3, 5, 8. Write a method `fibonacci` that takes in a number length and returns the fibonacci sequence up to the given length. | def fibonacci(length)
arr = []
if length == 1
arr << 1
end
if length >= 2
arr.push(1,1)
end
if length > 2
(length-2).times do
arr << (arr[-1] + arr[-2])
end
end
return arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibonacci(length)\n if length == 0\n return []\n elsif length == 1\n return [1]\n end\n sequence = [1,1]\n\n (length - 2).times do\n sequence << sequence[-1] + sequence[-2]\n end\n\n return sequence\nend",
"def fibonacci(length)\n sequence = []\n prev1 = 1\n prev2 = 0\n while sequence.len... | [
"0.8735018",
"0.86669606",
"0.8607346",
"0.85467434",
"0.8479478",
"0.8454481",
"0.8401385",
"0.8397317",
"0.8321352",
"0.8252468",
"0.81932265",
"0.8192653",
"0.8082691",
"0.80537844",
"0.80523485",
"0.7995509",
"0.7982591",
"0.7981171",
"0.7964102",
"0.7918749",
"0.7918749"... | 0.8249218 | 10 |
This should pass, but it doesn't | def test_parse_array_of_hashes_starting_with_array
@params = {
packs: [
{
dogs: ['Spot', 'Fido', 'Rover'],
location: 'San Francisco',
},
{
dogs: ['Doggie', 'Lassie'],
location: 'Canada',
},
],
}
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check ; true ; end",
"def verify_iss; end",
"def verify_iss; end",
"def passes; end",
"def passes; end",
"def issn; end",
"def internship_passed; end",
"def pass; end",
"def pass; end",
"def checks; end",
"def valid; end",
"def passed?; end",
"def passed?; end",
"def passed?; end",
... | [
"0.67853224",
"0.6667375",
"0.6667375",
"0.6657731",
"0.6657731",
"0.6587882",
"0.6539038",
"0.65333414",
"0.65333414",
"0.6522191",
"0.64480263",
"0.642326",
"0.642326",
"0.642326",
"0.6415424",
"0.63820213",
"0.63820213",
"0.63820213",
"0.63793933",
"0.63793933",
"0.6374685... | 0.0 | -1 |
This should NOT pass, but it does | def test_all_the_dogs_are_in_one_pack
@params = {
packs: [
{
dogs: ['Spot', 'Fido', 'Rover'],
location: 'San Francisco',
},
{
dogs: ['Doggie', 'Lassie'],
location: 'Canada',
},
],
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def semact?; false; end",
"def pass; end",
"def pass; end",
"def missed?; end",
"def internship_passed; end",
"def ignores; end",
"def check ; true ; end",
"def failures; end",
"def failures; end",
"def failures; end",
"def checks; end",
"def verify_iss; end",
"def verify_iss; end",
"def ... | [
"0.66174793",
"0.65638906",
"0.65638906",
"0.6510625",
"0.6491398",
"0.64793587",
"0.6462472",
"0.64095026",
"0.64095026",
"0.64095026",
"0.63428813",
"0.6320875",
"0.6320875",
"0.63117445",
"0.62986106",
"0.62986106",
"0.6294546",
"0.6294546",
"0.6290073",
"0.6290073",
"0.62... | 0.0 | -1 |
url: /api/v1/chats/learn method: POST returns json hash | def learn
begin
pattern = params[:chat][:pattern].strip
template = params[:chat][:template]
teach_bot(pattern,template)
response = {error: false,message: "Bot is trained."}
render json: response,status: :ok
rescue Exception => e
response = {error: true,message: e.message}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @learn = Learn.new(params[:learn])\n\n respond_to do |format|\n if @learn.save\n format.html { redirect_to @learn, notice: 'Learn was successfully created.' }\n format.json { render json: @learn, status: :created, location: @learn }\n else\n format.html { render ac... | [
"0.6302678",
"0.6052081",
"0.5799401",
"0.56193614",
"0.5543633",
"0.5515746",
"0.5492053",
"0.5433522",
"0.5404349",
"0.5390729",
"0.5351198",
"0.53273064",
"0.53223276",
"0.5321582",
"0.5316271",
"0.5295577",
"0.5217526",
"0.52147937",
"0.5202199",
"0.5191401",
"0.51819927"... | 0.6516297 | 0 |
Description: This method is used to send Email Alerts based on Host | def buildDetails(host)
# Build options Hash
options = {}
options[:object] = "Host - #{host.name}"
# Set alert to alert description
options[:alert] = $evm.root['miq_alert_description']
# Get Appliance name from model unless specified below
appliance = nil
# appliance ||= $evm.object['appliance']
app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_host\n OrganisationMailer.notify_host\n end",
"def send_email_alert(sender_email, sender_pass, recipients, subject, body)\n log \"Sending e-mail alert.\"\n recipients.each do |r|\n Pony.mail(:to => r, :via => :smtp, :via_options => {\n :address => 'smtp.gmail.com',\n :port => '5... | [
"0.7617293",
"0.73263025",
"0.7131078",
"0.6527338",
"0.64950836",
"0.64768034",
"0.64652634",
"0.6455243",
"0.6416898",
"0.63819027",
"0.6358547",
"0.63287586",
"0.63216203",
"0.62844193",
"0.6282075",
"0.6272407",
"0.6270931",
"0.62471884",
"0.62391895",
"0.6225973",
"0.621... | 0.0 | -1 |
update the page search index | def after_save
self.blockable.touch if self.blockable_type == 'Page'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_page_on_index(page)\n if params[:search]\n target = page.toolbox.last.find(\"div.search_results.#{model_name.pluralize}\")\n if collection.empty?\n target.html(\"No #{resource_name.pluralize.humanize} found.\")\n else\n target.html(page.context.list_of(collect... | [
"0.7634612",
"0.74469894",
"0.7385181",
"0.72326356",
"0.72326356",
"0.7022179",
"0.6888656",
"0.67513186",
"0.67368424",
"0.6691106",
"0.66697556",
"0.6644989",
"0.6602277",
"0.65916467",
"0.65722835",
"0.65693295",
"0.6560474",
"0.6521759",
"0.6521759",
"0.6454163",
"0.6436... | 0.0 | -1 |
This strips off the surrounding entered by the editor | def just_text
return $1 if text =~ /^<p>(.*)<\/p>$/
text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaporate\n self.gsub(/\\s/, '')\n end",
"def remove_extra_bars(contents)\n\t\t\tcontents = contents.gsub(/\\A\\|/, \"\")\n\t\t\tcontents = contents.gsub(/\\|\\Z/, \"\")\n\t\t\tcontents\n\t\tend",
"def trimming_for_diff_text(code)\n # gsub(/^\\s*$/, '') means remove empty lines\n code.strip.g... | [
"0.6225936",
"0.612136",
"0.6072571",
"0.6065322",
"0.599003",
"0.5858985",
"0.5848469",
"0.5840056",
"0.58316517",
"0.5762491",
"0.57016265",
"0.56556714",
"0.55767447",
"0.5575595",
"0.5573783",
"0.5568985",
"0.55644107",
"0.5556393",
"0.5537181",
"0.5536058",
"0.553438",
... | 0.0 | -1 |
GET /lent_types GET /lent_types.json | def index
@search_name = params[:search_name]
# INICIO RANSACK
@query = LentType.ransack(params[:q])
@query.name_cont = @search_name if @search_name.present?
# PAGINACION Y ORDEN
@results = @query.result(distinct: true).paginate(:page => params[:page] )
# RESULTADO FINAL
@le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n ... | [
"0.70580477",
"0.69299716",
"0.6821989",
"0.6708997",
"0.6684637",
"0.6525457",
"0.64939696",
"0.6492747",
"0.6487585",
"0.6487585",
"0.6445781",
"0.63919926",
"0.6390194",
"0.63321",
"0.63088167",
"0.62934476",
"0.62826365",
"0.6237898",
"0.6210284",
"0.61986786",
"0.6195020... | 0.0 | -1 |
GET /lent_types/1 GET /lent_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def show\n if params[:term]\n @types = Type.all(:condition... | [
"0.6682793",
"0.6681855",
"0.6612122",
"0.65763396",
"0.6524179",
"0.6521501",
"0.6521501",
"0.6483231",
"0.6465816",
"0.6445378",
"0.64028084",
"0.62532127",
"0.6251509",
"0.62302536",
"0.62251294",
"0.61893123",
"0.61893123",
"0.617578",
"0.61638856",
"0.61441654",
"0.61358... | 0.0 | -1 |
POST /lent_types POST /lent_types.json | def create
@lent_type = LentType.new(lent_type_params)
respond_to do |format|
if @lent_type.save
format.html {
redirect_to @lent_type
flash[:success] = 'Se ha creado.' }
format.json { render :show, status: :created, location: @lent_type }
else
format.htm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lent_type_params\n params.require(:lent_type).permit(:name)\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",... | [
"0.6833278",
"0.64103204",
"0.63928336",
"0.63565767",
"0.63565767",
"0.63371384",
"0.63371384",
"0.6223775",
"0.6206669",
"0.6109853",
"0.61057246",
"0.6095071",
"0.60775834",
"0.60651666",
"0.60519874",
"0.6039691",
"0.60236",
"0.60111046",
"0.5950418",
"0.59493357",
"0.594... | 0.59318024 | 22 |
PATCH/PUT /lent_types/1 PATCH/PUT /lent_types/1.json | def update
respond_to do |format|
if @lent_type.update(lent_type_params)
format.html {
redirect_to @lent_type
flash[:success] = 'Se ha actualizado.' }
format.json { render :show, status: :ok, location: @lent_type }
else
format.html { render :edit }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @gl_type = GlType.find(params[:id])\n\n respond_to do |format|\n if @gl_type.update_attributes(gl_type_params)\n format.html { redirect_to gl_types_path, notice: 'Gl type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ... | [
"0.6737097",
"0.65492386",
"0.6384063",
"0.6361388",
"0.6330757",
"0.63240415",
"0.6317315",
"0.63042235",
"0.629319",
"0.6287459",
"0.6286179",
"0.6269771",
"0.6269715",
"0.6264098",
"0.625833",
"0.62530273",
"0.62506205",
"0.6226441",
"0.62235045",
"0.6202416",
"0.6197152",... | 0.64340764 | 2 |
DELETE /lent_types/1 DELETE /lent_types/1.json | def destroy
@lent_type.destroy
respond_to do |format|
format.html {
redirect_to lent_types_url
flash[:danger] = 'Se ha actualizado.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n ... | [
"0.7199608",
"0.7003331",
"0.6925114",
"0.6879226",
"0.68642",
"0.6835931",
"0.6820066",
"0.67497236",
"0.6718349",
"0.6714607",
"0.6714338",
"0.67128456",
"0.6712467",
"0.67115843",
"0.6707467",
"0.6700266",
"0.6699676",
"0.6698121",
"0.6696495",
"0.66844094",
"0.6666896",
... | 0.7031525 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_lent_type
@lent_type = LentType.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def lent_type_params
params.require(:lent_type).permit(:name)
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 |
Complete the join_words_to_make_a_palindrome function below. def join_words_to_make_a_palindrome(words) trie = Trie.new words.each do |word| trie.insert(word) end trie.prefix_match("ca") return trie.output end def is_palindrome(word) word == word.reverse end words = ["car"] print join_words_to_make_a_palindrome(words) ... | def join_words_to_make_a_palindrome(words)
(0...words.length).each do |i|
(0...words.length).each do |j|
if is_palindrome(words[i] + words[j])
return [words[i], words[j]]
end
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_palindrome(word) # define method with one parameter\n i = 0 # set i to zero for first index value is 0\n reversed_string = \"\" # create empty string to store concatenated string\n \n while i < word.length # run while loop as long as word length is greater than i value which increments by one\n char ... | [
"0.70437634",
"0.69929",
"0.69851434",
"0.6984143",
"0.68992347",
"0.68967",
"0.6889363",
"0.68379056",
"0.68357587",
"0.6801933",
"0.67429656",
"0.6742201",
"0.6734247",
"0.6728811",
"0.6711726",
"0.67078805",
"0.6707297",
"0.6702098",
"0.66998905",
"0.66892457",
"0.66751945... | 0.7296559 | 0 |
GET /credit_notes GET /credit_notes.json | def index
@credit_notes = CreditNote.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end",
"def get_credit_notes(options = {})\n\n request_params = {}\n\n request_params[:CreditNoteID] = options[:credit_note_id] if options[:credit_note_id]\n request_params[:CreditNoteNumber] = options[:credit_not... | [
"0.7736423",
"0.75205004",
"0.7175027",
"0.68375736",
"0.6818044",
"0.6624794",
"0.6616504",
"0.657105",
"0.65671855",
"0.6534461",
"0.6522532",
"0.64557123",
"0.6426416",
"0.6389807",
"0.6339624",
"0.6267273",
"0.6196011",
"0.6185826",
"0.6167478",
"0.6163219",
"0.615264",
... | 0.7338528 | 2 |
GET /credit_notes/1 GET /credit_notes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end",
"def get_credit_note(credit_note_id_or_number)\n request_params = {}\n\n url = \"#{@xero_url}/CreditNotes/#{CGI.escape(credit_note_id_or_number)}\"\n\n response_xml = http_get(@client, url, request_params)\n\n... | [
"0.74785703",
"0.72445244",
"0.7242929",
"0.71000403",
"0.682672",
"0.67288244",
"0.66638476",
"0.6652306",
"0.6573039",
"0.6445906",
"0.63941777",
"0.6392784",
"0.63379246",
"0.63284934",
"0.63239366",
"0.63102233",
"0.6294714",
"0.6293694",
"0.62884986",
"0.6283417",
"0.627... | 0.0 | -1 |
POST /credit_notes POST /credit_notes.json | def create
@credit_note = CreditNote.new(credit_note_params)
respond_to do |format|
if @credit_note.save
format.html { redirect_to @credit_note, notice: 'Credit note was successfully created.' }
format.json { render :show, status: :created, location: @credit_note }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_credit_notes(credit_notes)\n b = Builder::XmlMarkup.new\n request_xml = b.CreditNotes {\n credit_notes.each do | credit_note |\n credit_note.to_xml(b)\n end\n }\n\n response_xml = http_put(@client, \"#{@xero_url}/CreditNotes\", request_xml, {})\n\n respons... | [
"0.7590705",
"0.67459774",
"0.6743459",
"0.6705779",
"0.6578819",
"0.6541523",
"0.64919233",
"0.64332896",
"0.63996625",
"0.63491577",
"0.6252848",
"0.6224136",
"0.61906815",
"0.61519676",
"0.6144109",
"0.6136829",
"0.6134967",
"0.6127969",
"0.61118317",
"0.6106329",
"0.60820... | 0.729349 | 1 |
PATCH/PUT /credit_notes/1 PATCH/PUT /credit_notes/1.json | def update
respond_to do |format|
if @credit_note.update(credit_note_params)
format.html { redirect_to @credit_note, notice: 'Credit note was successfully updated.' }
format.json { render :show, status: :ok, location: @credit_note }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @note.update(note_params)\n render json: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { ... | [
"0.6652412",
"0.6642334",
"0.63998795",
"0.63928735",
"0.6349806",
"0.63352096",
"0.6320889",
"0.626188",
"0.625058",
"0.6245847",
"0.6230837",
"0.6216503",
"0.6203569",
"0.61999875",
"0.61944616",
"0.6194223",
"0.61784834",
"0.6170883",
"0.61601806",
"0.61523193",
"0.6145092... | 0.7012227 | 0 |
DELETE /credit_notes/1 DELETE /credit_notes/1.json | def destroy
@credit_note.destroy
respond_to do |format|
format.html { redirect_to credit_notes_url, notice: 'Credit note was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_note id\n @nimble.delete \"contact/notes/#{id}\"\n end",
"def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @note = Note.find(para... | [
"0.7266585",
"0.6989633",
"0.6958988",
"0.6956219",
"0.69465405",
"0.69361275",
"0.6930409",
"0.6930409",
"0.6930409",
"0.6930409",
"0.68975836",
"0.6896987",
"0.68857753",
"0.6862172",
"0.68300754",
"0.6793849",
"0.6785082",
"0.6770958",
"0.6743547",
"0.6710314",
"0.6700381"... | 0.7442134 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_credit_note
@credit_note = CreditNote.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def credit_note_params
params.require(:credit_note).permit(:creation_date, :informed_gross_amount, :sii_status, :receipt_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 |
initilize_account Set credit to 0 after the creation of an account | def initialize_account
self.credits = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @account_number = new_account_number\n @balance_total = 0\n @interest_rate = 0.0025 #per month or 3% per year.\n @balance_savings = 0\n @balance_checking = 0\n @@total_accounts += 1\n puts \"Your account has been created.\"\n end",
"def initial... | [
"0.72089255",
"0.689016",
"0.68633854",
"0.67935395",
"0.6675615",
"0.6672314",
"0.65775824",
"0.6521368",
"0.6509486",
"0.65017784",
"0.63508344",
"0.6329585",
"0.6264066",
"0.6234642",
"0.62095594",
"0.61975694",
"0.6187258",
"0.617763",
"0.61683357",
"0.6126723",
"0.612280... | 0.8186565 | 0 |
Change the metadata of a cookbook to point to gitlab .git/config | def gitconfig
return unless File.exist?('.git/config')
lines = File.read('.git/config').split("\n")
lines = lines.map do |line|
md = /^\s*url\s*=\s*ssh:\/\/git@git.nordstrom.net\/its\/(?<reponame>[\w_]+).git/.match(line)
line = " url = git@gitlab.nordstrom.com:chef/cookbooks/#{md[:reponame]}.git" i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cookbook_url_base\n \"cookbooks\"\n end",
"def init\n create_file options[:inventory_config] do\n<<-YML\n# sources:\n# - \"https://supermarket.getchef.com\"\n# cookbooks:\n# cookbook-name:\n# versions:\n# - \"~> 4.0.2\"\n# - \"> 5.0.0\"\n# git:\n# location: url | path\n... | [
"0.64021987",
"0.6361387",
"0.6219831",
"0.617521",
"0.6167477",
"0.6058048",
"0.6043586",
"0.5968073",
"0.59534335",
"0.5928288",
"0.5895243",
"0.5893998",
"0.5891303",
"0.5876352",
"0.58531",
"0.5847773",
"0.58475333",
"0.5807747",
"0.58055925",
"0.5800778",
"0.5797421",
... | 0.7238242 | 0 |
Just make sure we can access GH using the configured token. Without additional information (githubslug, PR number, etc) we can't test much else. | def receive_test
setup_http
if update_status?
receive_test_status
else
simple_failure("Nothing happened")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def github_check\n begin\n unless github.blank?\n RestClient.get \"https://github.com/#{github}\"\n end\n rescue\n errors.add :base, \"Invalid Github account.\"\n end\n end",
"def configure_github_access\n if Settings.instance.oauth_token\n @github = Octokit::Client.new(\n... | [
"0.6987271",
"0.69063216",
"0.6670418",
"0.66096777",
"0.6451489",
"0.6438553",
"0.63169277",
"0.62913465",
"0.62604547",
"0.6201934",
"0.6180783",
"0.6141135",
"0.61275446",
"0.6068439",
"0.6035664",
"0.60245895",
"0.60162324",
"0.601356",
"0.5991399",
"0.598966",
"0.5973963... | 0.0 | -1 |
load the configuration file and apply default settings | def initialize (file=DEFAULTS['cf'])
@everything = YAML.load(ERB.new(IO.read(file)).result)
raise "malformed ferret server config" unless @everything.is_a?(Hash)
@config = DEFAULTS.merge(@everything[RAILS_ENV] || {})
if @everything[RAILS_ENV]
@config['uri'] = socket.nil? ? "dru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults!\n __load_config( DEFAULTS )\n end",
"def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend",
"def load_configuration\n @config = {\n :start_date => Date.today - 1,\n :data_dir => default_data_dir\n }\n\n if File.exist?(config_file)\n @config = YAM... | [
"0.7454863",
"0.7432354",
"0.7402603",
"0.72949356",
"0.7240914",
"0.71125287",
"0.7087065",
"0.70868045",
"0.7067485",
"0.70564264",
"0.695132",
"0.69210035",
"0.69175863",
"0.6916219",
"0.6911205",
"0.68929714",
"0.68815696",
"0.6851558",
"0.68369514",
"0.6814072",
"0.68078... | 0.0 | -1 |
treat the keys of the config data as methods | def method_missing (name, *args)
@config.has_key?(name.to_s) ? @config[name.to_s] : super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods\n super + property.keys.map { |v| [\"configure_#{v}\".to_sym, \"request_#{v}\".to_sym] }.flatten\n end",
"def method_missing(method, *args, &block)\n @keys[method] ||= begin\n if klass = Caterer.config_keys.get(method)\n klass.new\n else\n super\n ... | [
"0.6714948",
"0.6682759",
"0.6662813",
"0.62429",
"0.62429",
"0.6218686",
"0.6178729",
"0.6154266",
"0.60916346",
"0.60742766",
"0.6068764",
"0.60193527",
"0.6008157",
"0.59765357",
"0.59703714",
"0.59669435",
"0.59669435",
"0.59634316",
"0.59396005",
"0.59349257",
"0.5934695... | 0.0 | -1 |
start the server as a daemon process | def start
raise "ferret_server not configured for #{RAILS_ENV}" unless (@cfg.uri rescue nil)
platform_daemon { run_drb_service }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n system(\"start-stop-daemon --start --chdir #{path} --chuid #{user} --exec #{daemon}\")\n end",
"def start\n parse_options\n\n if @daemon\n require \"facets/daemonize\"\n\n daemonize()\n\n # Save a process sentinel file.\n FileUtils.touch(File.join(\".temp\",\"d#{Process.... | [
"0.8032299",
"0.7825158",
"0.7640564",
"0.76295424",
"0.75922793",
"0.7549201",
"0.73180485",
"0.72718465",
"0.7206021",
"0.7147295",
"0.71244234",
"0.7115948",
"0.70781976",
"0.70554787",
"0.69508094",
"0.69493353",
"0.6930068",
"0.6908416",
"0.68890893",
"0.6875252",
"0.685... | 0.6930955 | 16 |
run the server and block until it exits | def run
raise "ferret_server not configured for #{RAILS_ENV}" unless (@cfg.uri rescue nil)
run_drb_service
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n raise 'Server has shutdown.' unless @server\n @server.run_till_terminated\n @server = nil\n end",
"def run\n connect = false\n until connect do\n begin\n call { |server| @server = server ; start }\n rescue\n Waves::Logger.error e.t... | [
"0.8045935",
"0.79045033",
"0.745705",
"0.745705",
"0.7413859",
"0.7399289",
"0.72445214",
"0.71269757",
"0.7079757",
"0.7079077",
"0.69708407",
"0.69611704",
"0.6960219",
"0.6925129",
"0.69240856",
"0.6810703",
"0.6806078",
"0.6789298",
"0.6770981",
"0.6764968",
"0.6747746",... | 0.0 | -1 |
handles all incoming method calls, and sends them on to the correct local index instance. Calls are not queued, so this will block until the call returned. | def method_missing(name, *args)
@logger.debug "\#method_missing(#{name.inspect}, #{args.inspect})"
index_name = args.shift
index = if name.to_s =~ /^multi_(.+)/
name = $1
ActsAsFerret::multi_index(index_name)
else
ActsAsFerret::get_index(index_name)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calls; end",
"def calls; end",
"def handle\n RJR::Logger.info \"Dispatching '#{@method}' request with parameters (#{@method_args.join(',')}) on #{@rjr_node_type}-node(#{@rjr_node_id})\"\n retval = instance_exec(*@method_args, &@handler)\n RJR::Logger.info \"#{@method} request with parameters (#{@m... | [
"0.58071804",
"0.58071804",
"0.56589943",
"0.5649159",
"0.563772",
"0.5583688",
"0.5583139",
"0.5542083",
"0.5484396",
"0.5483977",
"0.5483949",
"0.54773766",
"0.54630464",
"0.5427613",
"0.54243046",
"0.5415028",
"0.5384881",
"0.53842527",
"0.5354397",
"0.5340684",
"0.5336910... | 0.54036695 | 16 |
make sure we have a versioned index in place, building one if necessary | def ensure_index_exists(index_name)
@logger.debug "DRb server: ensure_index_exists for index #{index_name}"
definition = ActsAsFerret::get_index(index_name).index_definition
dir = definition[:index_dir]
unless File.directory?(dir) && File.file?(File.join(dir, 'segments')) && dir =~ %r{/\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_xapian_index()\n models = [Request, Response]\n if ! $existing_db\n ActsAsXapian::WriteableIndex.rebuild_index(models, verbose=false)\n $existing_db = true\n end\n end",
"def rebuild_index\n # Only rebuild if the index exists\n raise Mebla::Errors::MeblaIndexException.new(... | [
"0.7012751",
"0.69715565",
"0.67720455",
"0.66556996",
"0.6628233",
"0.661856",
"0.65860134",
"0.65836525",
"0.65799826",
"0.65614754",
"0.65512437",
"0.6542749",
"0.64292425",
"0.64215815",
"0.6408364",
"0.63980246",
"0.63727355",
"0.63703954",
"0.6358409",
"0.63419884",
"0.... | 0.6750278 | 3 |
disconnects the db connection for the class specified by class_name used only in unit tests to check the automatic reconnection feature | def db_disconnect!(class_name)
with_class class_name do |clazz|
clazz.connection.disconnect!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect\n\t\tbegin\n\t\t\tActiveRecord::Base.remove_connection\n\t\trescue ::Exception => e\n\t\t\tself.error = e\n\t\t\telog(\"DB.disconnect threw an exception: #{e}\")\n\t\tensure\n\t\t\t# Database drivers can reset our KCODE, do not let them\n\t\t\t$KCODE = 'NONE' if RUBY_VERSION =~ /^1\\.8\\./\n\t\tend\... | [
"0.6972306",
"0.6621366",
"0.64889497",
"0.6439219",
"0.63848746",
"0.6131039",
"0.6131039",
"0.6131039",
"0.6131039",
"0.6124312",
"0.6109738",
"0.61077106",
"0.61032295",
"0.60687506",
"0.6001233",
"0.5949351",
"0.5943962",
"0.5939331",
"0.5931821",
"0.5909424",
"0.588823",... | 0.88874525 | 0 |
hides LocalIndexrebuild_index to implement index versioning | def rebuild_index(index_name)
definition = ActsAsFerret::get_index(index_name).index_definition.dup
models = definition[:registered_models]
index = new_index_for(definition)
# TODO fix reconnection stuff
# reconnect_when_needed(clazz) do
# @logger.debug "DRb server: r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebuild_index\n aaf_index.rebuild_index\n end",
"def rebuild_index\n # Only rebuild if the index exists\n raise Mebla::Errors::MeblaIndexException.new(\"#{@slingshot_index_name} does not exist !! use #create_index to create the index first.\") unless index_exists?\n\n Mebla.log(\"Rebui... | [
"0.7383164",
"0.72171474",
"0.69259036",
"0.6735558",
"0.66467285",
"0.6641185",
"0.6599952",
"0.65702754",
"0.6564041",
"0.65490705",
"0.6548267",
"0.6509948",
"0.6496677",
"0.6473647",
"0.64687735",
"0.6376798",
"0.63656455",
"0.62762237",
"0.62697375",
"0.62667465",
"0.626... | 0.70496976 | 2 |
Say hi to everybody | def say_hi
if @names.nil?
puts "..."
elsif @names.respond_to?("each")
# @names is a list of some kind, iterate!
@names.each do |name|
puts "Hello #{name}!"
end
else
puts "Hello #{@names}!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sayHi\n\t\tputs(greet)\n\tend",
"def say_hi\n\t\tputs 'saying hi'\n\tend",
"def say_hi\n\t\tputs \"Hello!\"\n\tend",
"def greet\n self.say \"Hello, I am #{@config[:nick]}. I am the resident uber-bot. To learn more, type '.about'.\"\n end",
"def say_hi\n \tputs \"hello user\" #you must ca... | [
"0.79006225",
"0.7774688",
"0.7542135",
"0.75231713",
"0.748248",
"0.7468877",
"0.7465552",
"0.7261262",
"0.7231959",
"0.7197657",
"0.7163477",
"0.71475774",
"0.71447915",
"0.7140804",
"0.7111786",
"0.7107247",
"0.70781755",
"0.70705646",
"0.7037797",
"0.70323473",
"0.6983622... | 0.0 | -1 |
validates :birthday def store_must_have_one_type if self.birthday 3.year errors.add(:mens_apparel, "You gotta at least sell to human being.") end end | def cant_be_assigned_to_retired_teacher
if teacher && teacher.retirement_date
errors.add(:teacher_id,"Students cannot be assigned to retiring teachers.")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_toddlers\n if age < 5\n errors.add(:birthday, \"You are too young!\")\n end\nend",
"def validate_birthdate\n errors.add(:birthdate, \"Birthdate can't be in the future\") if birthdate && birthdate > Date.today\n end",
"def is_a_valid_date\n errors.add(:birthdate, \"is not a valid date.\") if ... | [
"0.6931307",
"0.6841097",
"0.6815115",
"0.6809048",
"0.678345",
"0.67729396",
"0.67338496",
"0.65327084",
"0.652503",
"0.6487754",
"0.64664954",
"0.64569163",
"0.6455203",
"0.64073336",
"0.6393144",
"0.6294951",
"0.62262434",
"0.6208154",
"0.60725653",
"0.6069934",
"0.6001855... | 0.0 | -1 |
Implementing topological sort using both Khan's and Tarian's algorithms | def topological_sort(vertices)
sorted = []
top_nodes_queue = []
vertices.each do |vertix|
top_nodes_queue.push(vertix) if vertix.in_edges.length == 0
end
until top_nodes_queue.empty?
unpopped = top_nodes_queue.shift
sorted << unpopped
(unpopped.out_edges.length - 1).downto(0).each do |index... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topological_sort(vertices)\n # kahn_sort(vertices)\n tarjan_sort(vertices)\nend",
"def topological_sort(vertices)\n # Khan's algorithm\n sorted_arr = []\n queue = Queue.new\n # in_edges = {}\n vertices.each do |vertex|\n if vertex.in_edges.empty?\n queue.enq(vertex)\n end\n end\n\n # ... | [
"0.8047923",
"0.794595",
"0.7768589",
"0.77582926",
"0.76280963",
"0.7583783",
"0.74990153",
"0.7447668",
"0.7444663",
"0.74279577",
"0.7419171",
"0.7347367",
"0.734007",
"0.73287576",
"0.72477597",
"0.72456425",
"0.72105026",
"0.71851456",
"0.7158905",
"0.715503",
"0.7134244... | 0.68459576 | 49 |
resizes and crops to fill bounds | def crop_to_fit(width, height)
@image = @image.crop_to_fit(width, height)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize_to_fill(new_width, new_height)\n manipulate! do |image|\n\n image = resize_image image, new_width, new_height, :max\n\n if image.x_size > new_width\n top = 0\n left = (image.x_size - new_width) / 2\n elsif image.y_size > new_height\n left = 0\n ... | [
"0.72412753",
"0.692393",
"0.6850467",
"0.6827166",
"0.6661293",
"0.6626258",
"0.65350074",
"0.6439557",
"0.6343486",
"0.633028",
"0.62643874",
"0.62386906",
"0.6217405",
"0.6210476",
"0.6203316",
"0.6172368",
"0.61524016",
"0.61052376",
"0.6102787",
"0.6079778",
"0.6069112",... | 0.61798376 | 15 |
resizes to the bounds of width and height, but keeps the same aspect ratio | def scale_to_fit(width, height)
@image = @image.scale_to_fit(width, height)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize_to(width, height); end",
"def resize(width, height); end",
"def resize_to_fit width, height\n process :resize_to_fit => [width, height]\n end",
"def scale_aspect_to_fill_size(aSize)\n if aSize.width/aSize.height > size.width/size.height\n croppedImg = image_by_cropping_to_cente... | [
"0.75882274",
"0.7288163",
"0.71653855",
"0.7148464",
"0.7142385",
"0.7126189",
"0.70853925",
"0.69939685",
"0.69614774",
"0.6956541",
"0.69433844",
"0.6923398",
"0.6923398",
"0.6905799",
"0.6889475",
"0.6848033",
"0.6847698",
"0.6845387",
"0.67822665",
"0.67800665",
"0.67585... | 0.698523 | 8 |
Will be missing for completely uncolonized (like australia) | def local_value
@attrs["local_value"] || 0.0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regionalized?; end",
"def test_gem_handles_weird_chars_without_exceptions\r\n assert_nothing_raised do\r\n assert_equal \"DE\", Autometal::Geoip.new('78.46.60.181').country\r\n assert_equal \"SE\", Autometal::Geoip.new('81.237.231.174').country\r\n end\r\n end",
"def in_european_union?; en... | [
"0.6158971",
"0.60341114",
"0.59327173",
"0.58671063",
"0.5813254",
"0.5813254",
"0.5811934",
"0.5792343",
"0.57318485",
"0.572678",
"0.5601774",
"0.5601774",
"0.5566513",
"0.5553263",
"0.5515581",
"0.54908204",
"0.54671293",
"0.54573596",
"0.54063797",
"0.5404842",
"0.540484... | 0.0 | -1 |
value_added_outgoing is always same in saves I checked This is preadd | def outgoing_value
@attrs["outgoing"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_create\n @added = true\n super\n end",
"def before_save(sender); end",
"def save_changed\n save changed: true\n end",
"def after_update_save(record); end",
"def attribute_before_last_save(attr_name)\n mutations_before_last_save.original_value(attr_name.to_s)\n end",
... | [
"0.6498567",
"0.63346267",
"0.6294908",
"0.6217262",
"0.61920816",
"0.61499715",
"0.61409026",
"0.60916966",
"0.5984599",
"0.59838605",
"0.5920454",
"0.5911078",
"0.58760524",
"0.587546",
"0.5853949",
"0.5845805",
"0.5823907",
"0.5799626",
"0.5792957",
"0.5785792",
"0.5784069... | 0.0 | -1 |
This will be only approximate | def estimated_truce_time
unless @estimated_truce_time
@estimated_truce_time = {}
@node["active_relations"].to_a.select{|x| x.val["truce"]}.each do |ar|
start = ar.val["last_war"]
warscore = ar.val["last_warscore"] || 0
len = 5 + warscore * 0.1
expires = start + (365.25 * ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate\n # (native code) \n end",
"def approximate?\n !exact?\n end",
"def calculated; end",
"def estimate()\n # (native code)\n end",
"def estimate()\n # (native code)\n end",
"def estimate()\n # (native code)\n end",
"def fractional; end",
"... | [
"0.6819426",
"0.66602266",
"0.66298735",
"0.6459178",
"0.6459178",
"0.6459178",
"0.6447951",
"0.64379686",
"0.6392732",
"0.6392732",
"0.6392732",
"0.6384683",
"0.6359002",
"0.6328664",
"0.6298212",
"0.6293295",
"0.628213",
"0.6272914",
"0.62503207",
"0.6222404",
"0.61224705",... | 0.0 | -1 |
What is being constructed is awkwardly indicated by ID not names | def construction_in_progress?
!!@node["building_construction"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id2name() end",
"def id2name() end",
"def __id__() end",
"def id() end",
"def id=(_arg0); end",
"def id=(_arg0); end",
"def id=(_arg0); end",
"def make_id_to_name\n build_hash('id', 'name')\n end",
"def generate\n parts = objs.map { |obj| identifier_name_for obj }\n co... | [
"0.67795014",
"0.67795014",
"0.6777938",
"0.6744091",
"0.6635275",
"0.6635275",
"0.6635275",
"0.64612526",
"0.6449254",
"0.6422476",
"0.6416365",
"0.62492365",
"0.62331414",
"0.6227718",
"0.6227718",
"0.619519",
"0.61751884",
"0.6166561",
"0.61542326",
"0.61542326",
"0.607265... | 0.0 | -1 |
This should be only of current owner, others are not saved | def territorial_core?
@node["territorial_core"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner\n @owner\n end",
"def owner; end",
"def owner; end",
"def owner\n user\n end",
"def owner\n user\n end",
"def owner\n return self.user\n end",
"def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous... | [
"0.6984789",
"0.69280225",
"0.69280225",
"0.68674433",
"0.68674433",
"0.6866842",
"0.68666524",
"0.68616295",
"0.685321",
"0.67869353",
"0.6759658",
"0.67567897",
"0.6725486",
"0.67247003",
"0.6692853",
"0.6669187",
"0.6669187",
"0.6669187",
"0.6669187",
"0.6669187",
"0.66586... | 0.0 | -1 |
This is no longer in the saves :/ | def min_autonomy
@min_autonomy ||= begin
if trade_company?
0.0
elsif territorial_core?
75.0
elsif estate == "tribes"
50.0
elsif estate
25.0
else
@node["min_autonomy"] || 0
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def schubert; end",
"def probers; end",
"def lastsave; end",
"def lastsave; end",
"def dirty; end",
"def restore; end",
"def refu... | [
"0.73344356",
"0.65323395",
"0.65323395",
"0.65323395",
"0.65323395",
"0.65323395",
"0.65323395",
"0.65323395",
"0.65323395",
"0.6497122",
"0.64954704",
"0.63717395",
"0.63717395",
"0.63016105",
"0.62474775",
"0.62020135",
"0.61341566",
"0.60646814",
"0.60611737",
"0.6054116",
... | 0.0 | -1 |
Old and new saves use different format | def cores
@cores ||= (@node["cores"] || []) + @node.find_all("core")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autosave; end",
"def new_version_additional_behaviour_after_save(old, new, params)\n\t\t# change report/block/delete\n\t\tchange_rbc old, new, 0\n\t\tcopy_mixed_fields old, new\n\t\tmixed_fields_update_series_references old, new\n\tend",
"def save; end",
"def save; end",
"def save; end",
"def save; e... | [
"0.61908853",
"0.6189419",
"0.60357493",
"0.60357493",
"0.60357493",
"0.60357493",
"0.60357493",
"0.60357493",
"0.60357493",
"0.60357493",
"0.60290027",
"0.5747795",
"0.5747795",
"0.5666222",
"0.56541485",
"0.5649764",
"0.5613667",
"0.5540645",
"0.55366373",
"0.5527069",
"0.5... | 0.0 | -1 |
GET school/:id/participants/new ==== Loads form for registering a new participant. Should check if the user already has a participant for this school | def new
unless current_user.participants.exists?(:school_id => params[:school_id])
@participant = @school.participants.new
end
respond_to do |format|
if @participant
format.js
else
format.js {render "exists"}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n if params[:participant][:accepted] == \"1\" and params[:participant][:prereq] == \"1\"\n unless current_user.participants.exists?(:school_id => params[:school_id])\n @participant = @school.participants.new(params[:participant])\n @participant.user_id = current_user.id\n @p... | [
"0.7209591",
"0.7116832",
"0.6843252",
"0.6843252",
"0.6843252",
"0.6833878",
"0.6833878",
"0.6829826",
"0.66633296",
"0.66633296",
"0.6660412",
"0.6660412",
"0.6660412",
"0.65406847",
"0.6512649",
"0.64213747",
"0.64203584",
"0.6413295",
"0.63700235",
"0.63700235",
"0.637002... | 0.7957591 | 0 |
GET school/:id/participants/:id/edit ==== SCHOOL ADMINS ONLY participant.role < 3 This will be called for acceptance/Rejection by leader/assistant | def edit
if current_user.is_school_admin?(params[:school_id])
@participant = @school.participants.find(params[:id])
@teams = @school.coreteams
end
respond_to do |format|
if @participant
format.js
else
format.js {render "shared/save_failed"}
end
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n params[:participant] = convert_school_name_to_id params[:participant]\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n format.html { redirect_to @participant, notice: 'Participant was successfully... | [
"0.7119144",
"0.7096906",
"0.6685714",
"0.659681",
"0.6596112",
"0.6575188",
"0.6570607",
"0.6558248",
"0.65494335",
"0.6515097",
"0.64634687",
"0.6456829",
"0.64391947",
"0.64173937",
"0.6397671",
"0.63764197",
"0.63614106",
"0.6319527",
"0.62553495",
"0.6241997",
"0.6209596... | 0.67803204 | 2 |
POST school/:id/participants ==== Creates a new registration unless one already exists. | def create
if params[:participant][:accepted] == "1" and params[:participant][:prereq] == "1"
unless current_user.participants.exists?(:school_id => params[:school_id])
@participant = @school.participants.new(params[:participant])
@participant.user_id = current_user.id
@participant.acc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n params[:participant] = convert_school_name_to_id params[:participant]\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to @participant, notice: 'Participant was successfully created.' }\n forma... | [
"0.72628886",
"0.671659",
"0.66841674",
"0.6621659",
"0.6609105",
"0.6510878",
"0.6479089",
"0.63899994",
"0.6358618",
"0.63203096",
"0.63203096",
"0.62764883",
"0.62653697",
"0.6236676",
"0.6236676",
"0.6233683",
"0.6233683",
"0.6211835",
"0.6174717",
"0.6171811",
"0.6171343... | 0.7519617 | 0 |
PUT school/:id/participants/:id ==== School Admins Only participant.role < 3 Updates accept/reject | def update
@participant = @school.participants.find(params[:id])
respond_to do |format|
if @participant.update_attributes(params[:participant])
@team = Team.find(params[:coreteam])
@team.add_member(@participant.user)
format.js
if @participant.accepted == 2
Notifi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n params[:participant] = convert_school_name_to_id params[:participant]\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n if @participant.update_attributes(params[:participant])\n format.html { redirect_to @participant, notice: 'Participant was successfully... | [
"0.7176091",
"0.68460083",
"0.6574305",
"0.6514058",
"0.6512882",
"0.64996177",
"0.64268494",
"0.6411152",
"0.63974744",
"0.63806486",
"0.63780326",
"0.63536185",
"0.62724817",
"0.627243",
"0.6241423",
"0.6216721",
"0.619676",
"0.61381996",
"0.6102511",
"0.60841954",
"0.60807... | 0.7040105 | 1 |
DELETE school/:id/participants/:id ==== School Admins Only participant.role < 3 | def destroy
@participant = @school.participants.find(params[:id])
@participant.remove_school_teams(current_user.id, @school)
@participant.destroy
respond_to do |format|
Notifier.participant_deleted(@participant,@school).deliver
format.html { redirect_to admin_tools_personnel_url }
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n if current_user.admin?\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: \"Participant was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end \n end",
"def destroy\n @participants = Parti... | [
"0.7353032",
"0.73073745",
"0.7181343",
"0.71424055",
"0.7134956",
"0.7134956",
"0.7131883",
"0.70895815",
"0.7025327",
"0.7022009",
"0.7022009",
"0.69810236",
"0.69741875",
"0.69583666",
"0.69583666",
"0.6955004",
"0.69547474",
"0.69462043",
"0.68695974",
"0.68695974",
"0.68... | 0.79315776 | 0 |
==== Loads the current school url params | def get_school
@school = School.find_by_id(params[:school_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def school_params\n params[:school]\n end",
"def show_school\n\t\tschool = params[:id]\n\tend",
"def set_school\n @school = School.where(:id => params[:id]).includes(:tournament,:wrestlers,:deductedPoints,:delegates).first\n end",
"def show\n @school = School.find_by(id: params[:id])\n en... | [
"0.749004",
"0.712468",
"0.6266889",
"0.62444746",
"0.62333715",
"0.61626685",
"0.6124578",
"0.60629416",
"0.60629416",
"0.60186934",
"0.60166246",
"0.59858185",
"0.5983147",
"0.59482175",
"0.5906866",
"0.59054774",
"0.5900028",
"0.5896416",
"0.5884043",
"0.5836246",
"0.58208... | 0.64476573 | 2 |
compare to another tx | def ==(other)
@hash == other.hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_transaction?\n # This works because each SELECT is run either inside an existing transaction\n # or inside a temporary, for this statement only, transaction which gets\n # deleted after the statement - and which results in different txids.\n txid1 = ask \"select txid_current()\"\n txid2 = ask... | [
"0.7018276",
"0.6152824",
"0.6099608",
"0.59537435",
"0.5829644",
"0.57423204",
"0.5699315",
"0.56874275",
"0.5625092",
"0.5625092",
"0.5609962",
"0.56060106",
"0.56036055",
"0.55689377",
"0.5568043",
"0.5540309",
"0.5531353",
"0.5519901",
"0.55138105",
"0.55068916",
"0.54713... | 0.0 | -1 |
return the tx hash in binary format | def binary_hash
[@hash].pack("H*").reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend",
"def hexhash\n hash.to_s(16)\n end",
"def hash\n bytes.hash\n end",
"def to_sha256\n Tapyrus.sha256(to_payload).bth\n end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.ind... | [
"0.7652287",
"0.7468693",
"0.736453",
"0.69539064",
"0.6815014",
"0.68016964",
"0.6703301",
"0.6654596",
"0.6654596",
"0.6654596",
"0.6621322",
"0.65889114",
"0.6541473",
"0.6538791",
"0.6536996",
"0.6505416",
"0.6475525",
"0.64339554",
"0.64339554",
"0.6425645",
"0.64189154"... | 0.7347653 | 3 |
create tx from raw binary +data+ | def initialize(data=nil)
@ver, @lock_time, @in, @out = 1, 0, [], []
parse_data(data) if data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_raw_tx\n connection.request self.class.to_create_request, to_params\n end",
"def register_tx(data)\n transaction(:raw_register, data)\n end",
"def parse_data(data)\n @ver = data.unpack(\"I\")[0]\n idx = 4\n in_size, tmp = Protocol.unpack_var_int(data[idx..-1])\n ... | [
"0.62436855",
"0.619169",
"0.6063521",
"0.5990499",
"0.5686448",
"0.5631002",
"0.5527115",
"0.5481374",
"0.5462534",
"0.54612494",
"0.5458939",
"0.54516774",
"0.54431844",
"0.5435735",
"0.5429829",
"0.54220164",
"0.54198927",
"0.54084766",
"0.53961897",
"0.5368058",
"0.53449"... | 0.0 | -1 |
generate the tx hash for given +payload+ in hex format | def hash_from_payload(payload)
Digest::SHA256.digest(Digest::SHA256.digest( payload )).reverse.unpack("H*")[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend",
"def generate_checksum_bytes(payload)\n sum = payload.reduce :+\n sum_hex = ('%04x' % sum).upcase\n\n string_to_ascii_bytes sum_hex\n end",
"def calculate_payload_hash\n\t\treturn Digest::SHA2.hexdigest( self.payloa... | [
"0.7401191",
"0.7343297",
"0.6942218",
"0.6931923",
"0.6712367",
"0.6561753",
"0.65257734",
"0.6393277",
"0.63735694",
"0.6353044",
"0.629668",
"0.6212569",
"0.6200799",
"0.6194972",
"0.6159617",
"0.61583835",
"0.61212486",
"0.6084444",
"0.6071468",
"0.605369",
"0.6048242",
... | 0.77842546 | 0 |
parse raw binary data | def parse_data(data)
@ver = data.unpack("I")[0]
idx = 4
in_size, tmp = Protocol.unpack_var_int(data[idx..-1])
idx += data[idx..-1].bytesize-tmp.bytesize
# raise "unkown transaction version: #{@ver}" unless @ver == 1
@in = (0...in_size).map{
txin = TxIn.new
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(rawdata)\n end",
"def parse(bytes)\n # tack new bytes on to partial packet\n @packet.concat(bytes.force_encoding('BINARY'))\n # find START_BYTE\n until (startPos = @packet.index(START_BYTE)).nil?\n after = @packet.slice(startPos+1 .. -1)\n nread = case after[0]\n when ID... | [
"0.7806379",
"0.72851104",
"0.7048626",
"0.6905259",
"0.68541336",
"0.6801933",
"0.6789201",
"0.6758122",
"0.672537",
"0.66748405",
"0.66212285",
"0.6606549",
"0.65769225",
"0.65636075",
"0.65524095",
"0.65395623",
"0.64208716",
"0.64171964",
"0.6356134",
"0.6350867",
"0.6312... | 0.6553882 | 14 |
output transaction in raw binary format | def to_payload
pin = @in.map{|i|
buf = [ i.prev_out, i.prev_out_index ].pack("a32I")
buf << Protocol.pack_var_int(i.script_sig_length)
buf << i.script_sig if i.script_sig_length > 0
buf << (i.sequence || "\xff\xff\xff\xff")
}.join
pout = @out.map{|o|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_raw_tx\n connection.request self.class.to_create_request, to_params\n end",
"def output_binary(binary)\n message = \"\\r\\n\"\n message << \"Identifier: #{binary[:uniqueid]}\\r\\n\"\n message << \"Length: #{binary[:size]}\\r\\n\"\n message << \"\\r\\n\"\n message << \"#{binary[:dat... | [
"0.6802773",
"0.64583164",
"0.6341689",
"0.6178424",
"0.6140861",
"0.6015499",
"0.6013185",
"0.6002947",
"0.59810567",
"0.59779865",
"0.5934681",
"0.5904318",
"0.58812815",
"0.58051187",
"0.57937866",
"0.5792948",
"0.57894427",
"0.5756632",
"0.575367",
"0.5734458",
"0.5734421... | 0.5417002 | 56 |
generate a signature hash for input +input_idx+. either pass the +outpoint_tx+ or the +script_pubkey+ directly. | def signature_hash_for_input(input_idx, outpoint_tx, script_pubkey=nil, hash_type=nil, drop_sigs=nil, script=nil)
# https://github.com/bitcoin/bitcoin/blob/e071a3f6c06f41068ad17134189a4ac3073ef76b/script.cpp#L834
# http://code.google.com/p/bitcoinj/source/browse/trunk/src/com/google/bitcoin/core/Script.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature_hash(input_index: nil, output_script: nil, hash_type: BTC::SIGHASH_ALL, version: 0, amount: 0)\n\n raise ArgumentError, \"Should specify input_index in Transaction#signature_hash.\" if !input_index\n raise ArgumentError, \"Should specify output_script in Transaction#signature_hash.\" if !ou... | [
"0.71159554",
"0.7098548",
"0.61935973",
"0.61563265",
"0.5604291",
"0.55982417",
"0.55605227",
"0.5498868",
"0.54980636",
"0.5487319",
"0.5447698",
"0.5422071",
"0.541799",
"0.53418",
"0.53293985",
"0.53218347",
"0.5252485",
"0.52320415",
"0.52162194",
"0.51872027",
"0.51592... | 0.8670025 | 0 |
verify input signature +in_idx+ against the corresponding output in +outpoint_tx+ | def verify_input_signature(in_idx, outpoint_tx)
outpoint_idx = @in[in_idx].prev_out_index
script_sig = @in[in_idx].script_sig
script_pubkey = outpoint_tx.out[outpoint_idx].pk_script
script = script_sig + script_pubkey
Bitcoin::Script.new(script).run do |pubkey,sig,has... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature_hash_for_input(input_idx, outpoint_tx, script_pubkey=nil, hash_type=nil, drop_sigs=nil, script=nil)\n # https://github.com/bitcoin/bitcoin/blob/e071a3f6c06f41068ad17134189a4ac3073ef76b/script.cpp#L834\n # http://code.google.com/p/bitcoinj/source/browse/trunk/src/com/google/bitcoin/core/... | [
"0.6513897",
"0.6335994",
"0.60714674",
"0.57039344",
"0.57037854",
"0.5669173",
"0.56485426",
"0.55944854",
"0.552819",
"0.5396789",
"0.53646225",
"0.53428596",
"0.5322215",
"0.53080237",
"0.52621484",
"0.5260059",
"0.5225923",
"0.5213781",
"0.5113426",
"0.5093321",
"0.50838... | 0.8468082 | 0 |
convert to ruby hash (see also from_hash) | def to_hash
@hash ||= hash_from_payload(to_payload)
{
'hash' => @hash, 'ver' => @ver,
'vin_sz' => @in.size, 'vout_sz' => @out.size,
'lock_time' => @lock_time, 'size' => (@payload ||= to_payload).bytesize,
'in' => @in.map.with_index{|i,idx|
t = { 'prev_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash() end",
"def to_hash\n to_a.hash\n end",
"def hash\n to_s.hash\n end",
"def hash\n to_s.hash\n end",
"def to_hash\n data.to_hash\n end",
... | [
"0.7838392",
"0.7838392",
"0.7838392",
"0.7838392",
"0.7838392",
"0.7838392",
"0.7649354",
"0.74899256",
"0.74019456",
"0.74019456",
"0.73841053",
"0.73841053",
"0.7374205",
"0.7371524",
"0.7348139",
"0.7345313",
"0.7325047",
"0.7272278",
"0.72138363",
"0.72138363",
"0.719815... | 0.6332433 | 87 |
generates rawblock json as seen in the block explorer. | def to_json(options = {:space => ''}, *a)
JSON.pretty_generate( to_hash, options )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: @block\n end",
"def api_block_type_list\n arr = BlockType.where(\"parent_id is null and share = ?\", true).reorder(:name).all.collect do |bt|\n { 'name' => bt.name, 'description' => bt.description }\n end \n render :json => arr \n end",
"def blocks... | [
"0.65197116",
"0.632908",
"0.61982065",
"0.6138633",
"0.60923564",
"0.6073825",
"0.6071779",
"0.6028059",
"0.60232776",
"0.5962066",
"0.58684856",
"0.5842438",
"0.58193845",
"0.57816434",
"0.5764506",
"0.57435375",
"0.5742935",
"0.5714596",
"0.5691288",
"0.5681035",
"0.568072... | 0.0 | -1 |
write json representation to a file (see also to_json) | def to_json_file(path)
File.open(path, 'wb'){|f| f.print to_json; }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_json_file(json, filepath)\n File.open(filepath,\"w\") do |f|\n f.write(json.to_json)\n end\nend",
"def write_json(file)\n open(file, \"w\") do |io|\n \tio.write(JSON.pretty_generate(@data))\n end\n end",
"def save\n File.open(json_file, 'w') {|f| f.write(to_json) }... | [
"0.8327628",
"0.81746763",
"0.81709635",
"0.81709635",
"0.81512994",
"0.8111309",
"0.80429894",
"0.8042172",
"0.7997684",
"0.79227364",
"0.78316456",
"0.78161854",
"0.7722293",
"0.77142453",
"0.77065927",
"0.7703215",
"0.76310486",
"0.7630055",
"0.75291896",
"0.7499856",
"0.7... | 0.7922521 | 10 |
Random jitter between long poll requests. | def jitter
rand*JITTER
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_poll_interval\n now = Time.now.to_f\n\n interval = calculate_process_based_interval(now)\n\n interval = calculate_safe_enqueue_interval(now, interval) + safe_random_interval\n\n logger.info \"CRON JOB: random_poll_interval: (#{interval})\"\n\n interval\n end",
"... | [
"0.644109",
"0.6087944",
"0.59999186",
"0.5973289",
"0.58348477",
"0.58093774",
"0.57398504",
"0.57088244",
"0.56652695",
"0.56455195",
"0.55655074",
"0.55300426",
"0.55300426",
"0.5502258",
"0.5497074",
"0.54620314",
"0.54416674",
"0.54002",
"0.53909695",
"0.53908324",
"0.53... | 0.6642392 | 1 |
Creates a new object reference | def object_ref
@objects += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_object\n @object = scope.new params[object_name.to_sym]\n set_instance\n end",
"def clone_object(ref)\n load_object(ref, true)\n end",
"def ref(reference)\n Ref.new(reference)\n end",
"def create_reference\n self.reference or Reference.new\n end",
"def construct_new_object(db... | [
"0.72632873",
"0.7082805",
"0.69757175",
"0.68968564",
"0.67637855",
"0.6758277",
"0.6743076",
"0.6741932",
"0.67096585",
"0.66732407",
"0.66732407",
"0.66216594",
"0.6594277",
"0.65914494",
"0.6563902",
"0.6552358",
"0.6545975",
"0.6516671",
"0.6497789",
"0.6497398",
"0.6455... | 0.0 | -1 |
Creates the structure for the remaining stream. | def parse
token = @tokens.next
return token if [:nil, :true, :false].include? token
obj = [token]
rest =
case token
when :array then parse_array
when :bignum then parse_bignum
when :class, :module then parse_class
w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_stream\n\t\t\t\t# Form input field name for the file path must be set to file.\n\t\t\t\t# Any other field name will not be picked up by the upload server.\n\t\t\t\tname = 'file'\n\t\t\t\tcontent_length = File.size(@data_path)\n\t\t\t\tcontent_type = mime_type_for(@data_path)\n\n\t\t\t\t@stream = Tempfile... | [
"0.59858155",
"0.5970838",
"0.5915965",
"0.57989305",
"0.577757",
"0.57097924",
"0.56099916",
"0.55064523",
"0.5495453",
"0.54452544",
"0.54452544",
"0.54452544",
"0.54452544",
"0.5444863",
"0.54247415",
"0.5423903",
"0.54188174",
"0.53817296",
"0.5352676",
"0.5348783",
"0.53... | 0.0 | -1 |
Creates the body of an +:array+ object | def parse_array
obj = [object_ref]
items = @tokens.next
obj << items
items.times do
obj << parse
end
obj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_array(*body)\n @last_sexp =\n super(*body).tap do |sexp|\n next unless SPECIAL_LITERALS.include?(body.dig(0, :type))\n\n comments = sexp.dig(:body, 0).delete(:comments)\n sexp.merge!(comments: comments) if comments\n end\n end",
"def build_array\n arr ... | [
"0.6301328",
"0.62705773",
"0.6241211",
"0.6240491",
"0.6212359",
"0.6115663",
"0.60888296",
"0.60834384",
"0.6077491",
"0.60448354",
"0.60146403",
"0.5981087",
"0.5937267",
"0.59314644",
"0.59182674",
"0.5844408",
"0.5815484",
"0.5815464",
"0.5813599",
"0.58120114",
"0.57979... | 0.59523815 | 12 |
Creates the body of a +:bignum+ object | def parse_bignum
result = @tokens.next
[object_ref, result]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_bignum(*n); end",
"def read_bignum; end",
"def test_with_bignum; show([[10**40]]) end",
"def to_bin\n [\n \"data\",\n [body.size].pack(\"V\"),\n body\n ].join\n end",
"def binary\n [swap_byte(checksum), swap_byte(l_value), q_ratio] + body\n en... | [
"0.6697732",
"0.6564371",
"0.6065688",
"0.5792957",
"0.5676753",
"0.55556023",
"0.55158806",
"0.5399634",
"0.5374585",
"0.53427756",
"0.5328117",
"0.5285091",
"0.52535516",
"0.5252015",
"0.5232079",
"0.523201",
"0.52107805",
"0.51918286",
"0.51910895",
"0.51899004",
"0.518990... | 0.5840348 | 3 |
Creates the body of a +:class+ object | def parse_class
[object_ref, @tokens.next]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_definition(cls, bld, fun)\n bld.add(\"///\")\n bld.add(\"/// Constructor\")\n bld.add(\"///\")\n\n standardClassName = XCTECSharp::Utils.instance.getStyledClassName(cls.getUName())\n\n bld.startClass(standardClassName + \"()\")\n\n get_body(cls, bld, fun)\n\n bld.endClass\n end",
"d... | [
"0.6982485",
"0.65681595",
"0.65519464",
"0.6403238",
"0.63813263",
"0.631823",
"0.62680066",
"0.62454206",
"0.62225944",
"0.62057453",
"0.6201211",
"0.61923194",
"0.6182852",
"0.6133803",
"0.60786355",
"0.6075239",
"0.6075239",
"0.6075239",
"0.6075239",
"0.6075239",
"0.60752... | 0.0 | -1 |
Creates the body of a wrapped C pointer object | def parse_data
[object_ref, get_symbol, parse]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap_with_function_pointer(func_pointer)\n Logger.info \"Building callback wrapper for #{self.code.qualified_name}\"\n\n base_name = self.code.qualified_name.as_variable\n return_type = func_pointer.return_type.to_cpp\n proxy_method_name = \"do_yield_on_#{base_name}\"\n\n cal... | [
"0.6050222",
"0.5875167",
"0.5875167",
"0.5875167",
"0.5875167",
"0.5875167",
"0.5726514",
"0.57108057",
"0.5662256",
"0.56609386",
"0.56595886",
"0.5640168",
"0.5566577",
"0.5566577",
"0.5566577",
"0.55653214",
"0.55487347",
"0.548077",
"0.54763323",
"0.5423237",
"0.5412635"... | 0.0 | -1 |
Creates the body of an extended object | def parse_extended
[get_symbol, parse]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def body(body)\n append(Body.new(body))\n end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def body; end",
"def b... | [
"0.64135575",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6361357",
"0.6263385",
"0.619296",
"0.6177097",
"0.6166562",
"... | 0.0 | -1 |
Creates the body of a +:float+ object | def parse_float
float = @tokens.next
[object_ref, float]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n\n\n type = TYPE_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 211:13: 'float'\n... | [
"0.6337781",
"0.61649674",
"0.610129",
"0.6069335",
"0.59663993",
"0.5882754",
"0.58752",
"0.584168",
"0.5684724",
"0.56577164",
"0.5646205",
"0.5625748",
"0.5625748",
"0.5500128",
"0.54983515",
"0.5487164",
"0.5433331",
"0.54298836",
"0.53837013",
"0.5366885",
"0.5355918",
... | 0.5883156 | 5 |
Creates the body of a +:hash+ object | def parse_hash
obj = [object_ref]
pairs = @tokens.next
obj << pairs
pairs.times do
obj << parse
obj << parse
end
obj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_hash\n end",
"def to_body\n to_ha... | [
"0.6560059",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"0.6507266",
"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.