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 |
|---|---|---|---|---|---|---|
def self.offer_discounts where(discount_offered: true) end | def review_count
reviews.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_discounts?\n rpg_shop.permit_sales\n end",
"def supplier_discount\n supplier.supplier_discounts\n .select do |sd|\n book.language.nil? || sd.discount.language.nil? || sd.discount.language == book.language\n end\n .select do |sd|\n true\n (sd.discount.start.nil? && sd.discou... | [
"0.6243521",
"0.61532116",
"0.6146533",
"0.61284596",
"0.6084504",
"0.6024712",
"0.6019035",
"0.6008983",
"0.59552985",
"0.59552985",
"0.5918514",
"0.58936316",
"0.585271",
"0.5844365",
"0.58271134",
"0.58091325",
"0.57830846",
"0.57543635",
"0.57532316",
"0.57505363",
"0.569... | 0.0 | -1 |
When the user inputs 10, we expect the program to print The result is 50!, but that's not the output we see. Why not? | def multiply_by_five(n)
n * 5
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def always\n print \"Give me a number: \"\n number = gets.chomp.to_i\n puts ((number+5)*2-4)/2\nend",
"def always_threes\n puts \"Give me a number\"\n number = gets.to_i\n puts \"Always \" + (((number + 5) * 2 - 4) / 2 - number).to_s + \"!\"\nend",
"def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply... | [
"0.70389336",
"0.6874133",
"0.6745367",
"0.65544397",
"0.64549804",
"0.64432377",
"0.64065063",
"0.6398994",
"0.6318504",
"0.6315981",
"0.6312368",
"0.62937516",
"0.62934214",
"0.62860435",
"0.62792474",
"0.62472624",
"0.62448376",
"0.6236136",
"0.6235785",
"0.6221795",
"0.62... | 0.0 | -1 |
Method called to initialize the game | def start_game
puts "Welcome to Hangman! A secret word has been chosen. You have #{turn_count} guesses to get the word correct. Good luck!"
(@secret_word.size).times { @correct_letters += "_ " }
puts @correct_letters
begin_guessing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_setup\n end",
"def initialize_game\n setup_boards\n end",
"def initialize\n @game_settings = GameSettings.new\n super 920, 480\n self.caption = GAME_TITLE\n @settings_hovered = Options::START_SCREEN[0]\n @title_font, @subtitle_font = Gosu::Font.new(50), Gosu::Font.new(20)\n @b... | [
"0.81415135",
"0.81269836",
"0.7600116",
"0.75172186",
"0.7507088",
"0.7384138",
"0.7343816",
"0.73285294",
"0.7294057",
"0.7245336",
"0.7239022",
"0.72247934",
"0.7119456",
"0.71005887",
"0.7065298",
"0.70395905",
"0.6973492",
"0.69592166",
"0.6955616",
"0.695244",
"0.695203... | 0.0 | -1 |
Defines the process for when the user begins guessing letters and words. | def begin_guessing
while @turn_count > 0 do
puts "\nPlease enter 'guess' if you would like to guess the word. Otherwise, please enter a single letter guess."
guess_input = gets.chomp
# Handles the case if the user wants to guess the word
if guess_input.downcase == "guess"
puts "\nPlease e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_game\r\n\t puts \"Welcome to Hangman! A secret word has been chosen. You have #{turn_count} guesses to get the word correct. Good luck!\"\r\n\t (@secret_word.size).times { @correct_letters += \"_ \" }\r\n\t puts @correct_letters\r\n\t begin_guessing\r\n\tend",
"def play_game\r\n\r\n word = selec... | [
"0.65249324",
"0.64361787",
"0.63706017",
"0.6361552",
"0.63336825",
"0.6326985",
"0.6276684",
"0.624462",
"0.62317836",
"0.61829287",
"0.6173103",
"0.6159348",
"0.61266613",
"0.6119347",
"0.6118174",
"0.61142844",
"0.6113047",
"0.61109257",
"0.6101874",
"0.60971683",
"0.6095... | 0.6221736 | 9 |
This method runs when the user enters a letter as a guess | def game_board(guess_letter)
puts ""
result_index_array = (0 ... @secret_word.length).find_all { |i| @secret_word[i,1] == guess_letter }
# Change the output to show a successful guess
if result_index_array.size == 0
@incorrect_letters += guess_letter
@incorrect_letters += ", "
else ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess_letter\n\t\tprint \"Your guess: \"\n\t\tguess = gets.chomp.downcase\n\t\treturn guess if guess == \"save\"\n\t\tif (guess.between?('a','z') && !(@guessed_letters.include? guess)\\\n\t\t\t&& guess.length == 1)\n\t\t\tprocess_guess(guess)\n\t\t\t@guessed_letters << guess\n\t\t\t@turns += 1\n\t\telse\n\t\t\... | [
"0.82956743",
"0.8270882",
"0.8254228",
"0.8243415",
"0.81700116",
"0.81633997",
"0.8082923",
"0.8070065",
"0.79515016",
"0.7941843",
"0.7925727",
"0.7923035",
"0.78987634",
"0.7894939",
"0.7870256",
"0.786534",
"0.785804",
"0.7857856",
"0.78515923",
"0.78269255",
"0.78028864... | 0.0 | -1 |
Picks a random word that is <= 5 <= 12 characters long | def get_word
# Variable initialization
wordArray = []
count = 0
random_int = 0
# Stores each word that is on a new line into an array
f = File.open("5desk.txt", "r")
f.each_line{ |line| wordArray << line }
f.close
# Selects the random word between the desired length of bet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_word\n @word = @lines[rand(0..(@lines.length - 1))].chomp\n choose_word if @word.length < 5 || @word.length > 12\n end",
"def select_word\n words = File.readlines(\"5desk.txt\").select { |word| word.length.between?(5, 12) }\n words[rand(words.length)].strip\n end",
"def word_picker\n ... | [
"0.8451204",
"0.82461154",
"0.8036826",
"0.79618514",
"0.79618514",
"0.79618514",
"0.79618514",
"0.79521096",
"0.7900207",
"0.78963745",
"0.784521",
"0.7718741",
"0.7641229",
"0.7591021",
"0.7558463",
"0.7550519",
"0.74853516",
"0.7455619",
"0.74509305",
"0.73885506",
"0.7283... | 0.7813261 | 11 |
Use the connection from the connection class | def connection
@connection_class.connection
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_using conn\n @connection = conn\n end",
"def connection\n @connection ||= build_connection\n end",
"def connection\n @connection ||= make_connection\n end",
"def connection\n retrieve_connection\n end",
"def connection\n self.class.connection\n end",
... | [
"0.84952605",
"0.779956",
"0.77212566",
"0.7679995",
"0.7643311",
"0.7643311",
"0.7643311",
"0.7643311",
"0.7642692",
"0.7625288",
"0.75897795",
"0.75034446",
"0.74880946",
"0.748513",
"0.74770087",
"0.7449866",
"0.7438127",
"0.7438127",
"0.7438127",
"0.7438127",
"0.7438127",... | 0.759137 | 10 |
POST /perfis POST /perfis.json | def create
@perfil = Perfil.new(perfil_params)
@perfil.usuario = current_usuario
respond_to do |format|
if @perfil.save
format.html { redirect_to perfil_usuario_path, notice: 'Perfil criado com sucesso!' }
format.json { render :show, status: :created, location: @perfil }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def performance\n authenticated_post(\"auth/r/stats/perf:1D/hist\")\n end",
"def create\n @performance = Performance.new(performance_params)\n\n respond_to do |format|\n if @performance.save\n format.html { redirect_to @performance, notice: 'Performance was successfully created.' }\n ... | [
"0.58577776",
"0.58544505",
"0.58141935",
"0.5795466",
"0.57093066",
"0.5352049",
"0.5350076",
"0.5347291",
"0.52529556",
"0.5222911",
"0.5222031",
"0.51993984",
"0.51762176",
"0.5172226",
"0.51379097",
"0.512722",
"0.5107052",
"0.5071513",
"0.50679356",
"0.50514066",
"0.5027... | 0.0 | -1 |
PATCH/PUT /perfis/1 PATCH/PUT /perfis/1.json | def update
respond_to do |format|
if @perfil.update(perfil_params)
format.html { redirect_to perfil_usuario_path, notice: 'Perfil atualizado com sucesso.' }
format.json { render :show, status: :ok, location: @perfil }
else
format.html { render :edit }
format.json { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => ... | [
"0.650458",
"0.6407848",
"0.6160093",
"0.61005205",
"0.6083585",
"0.60575294",
"0.5999917",
"0.5902671",
"0.58812124",
"0.58812124",
"0.58752215",
"0.58752215",
"0.5871593",
"0.5840547",
"0.5790313",
"0.5786082",
"0.578131",
"0.5757046",
"0.5739154",
"0.57378966",
"0.573755",... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def perfil_params
params.require(:perfil).permit( :usuario_id, :imagemPerfil, :descricao, :imagemCapa, :datacap, :datagcb, :corda ) # List here whitelisted params
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 |
override to_json on subclass as necc | def serialize
self.to_hash.to_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json\n return self.class.to_json\n end",
"def to_json *args \n self.to_hash.to_json\n end",
"def to_json *args \n self.to_hash.to_json\n end",
"def to_json\n self.to_hash.to_json\n end",
"def to_json\n self.to_hash.to_json\n end",
"def to_json\n self.to_h.to_json\n... | [
"0.8055617",
"0.7820431",
"0.7820431",
"0.7800274",
"0.7800274",
"0.77742434",
"0.7749946",
"0.77167827",
"0.7715316",
"0.77016395",
"0.7699638",
"0.7699638",
"0.7699638",
"0.76551574",
"0.765182",
"0.7648516",
"0.76371706",
"0.7570027",
"0.7550014",
"0.7506443",
"0.7506443",... | 0.7471419 | 24 |
(Experimental) Embeds a "pure" (nonNetzke) Ext component into the view, e.g.: :panel, :html => "Simple Panel" | def ext(name, config = {}) #:doc:
comp = Netzke::ExtComponent.new(name, config)
content_for :netzke_on_ready, raw("#{comp.js_component_render}")
raw(comp.js_component_html)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_ext_panel(items = [])\n items.each { |item| \n item[:html] = item[:html].gsub(/\"/,'\\\"').gsub(/\\n/,'')\n item[:id] ||= rand(10000)\n }\n render :partial => \"admin/extjs/panel\", :locals => {\n :items => items, :random_id => rand(10000)\n }\n end",
... | [
"0.66991633",
"0.61836034",
"0.6061008",
"0.600821",
"0.59466916",
"0.5939079",
"0.57164204",
"0.5712766",
"0.56834227",
"0.5642665",
"0.5642665",
"0.56311554",
"0.5584416",
"0.55709237",
"0.5569337",
"0.5567374",
"0.5490809",
"0.54840463",
"0.5448873",
"0.54422045",
"0.54362... | 0.6431847 | 2 |
GET /users GET /users.json | def index
if user_signed_in? && current_user.admin?
@users = User.all
@unapproved_users = User.where(:approved => false)
@approved_users = User.where(:approved => true)
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @users }
end
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n para... | [
"0.82109934",
"0.7873764",
"0.7860689",
"0.78108346",
"0.78067017",
"0.7678852",
"0.76586664",
"0.76318866",
"0.7582366",
"0.75291824",
"0.7487637",
"0.74485743",
"0.7439024",
"0.7437192",
"0.7427442",
"0.73978853",
"0.73978853",
"0.73978853",
"0.73978853",
"0.7377353",
"0.73... | 0.0 | -1 |
GET /users/1 GET /users/1.json | def show
@user = User.find(params[:id])
if user_signed_in? && (@user.id == current_user.id)
redirect_to "/users/profile"
else
@message = Message.new
@flag = Flag.new
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @user }
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.722... | 0.0 | -1 |
PUT /users/1 PUT /users/1.json | def update
@user = User.find(params[:id])
if @user.update_attributes(params[:user])
if @user.crops
redirect_to "/users/#{@user.id}/crop"
else
flash[:notice] = 'Your profile was successfully updated.'
redirect_to("/users/profile")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"de... | [
"0.74118364",
"0.7391657",
"0.7303552",
"0.7253468",
"0.720215",
"0.707407",
"0.70519817",
"0.702646",
"0.7005611",
"0.69875664",
"0.69819397",
"0.6941456",
"0.6939727",
"0.69212985",
"0.6907294",
"0.68761027",
"0.68474513",
"0.68327546",
"0.6820883",
"0.679931",
"0.67685133"... | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json | def destroy
if user_signed_in? && current_user.admin?
@user = User.find(params[:id])
@user.destroy
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
else
redirect_to root_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935"... | 0.0 | -1 |
Only double the consonants, not the vowels, and not the spaces | def double_consonants(str)
new_string = []
str.chars.each do |char|
if ('aeiouAEIOU').include?(char) == false
new_string << char*2
else
new_string << char
end
end
new_string.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend",
"def double_consonants(str)\n str.chars.each_with_object('') do |char, new_str|\n if char =~ /[^aeiou]/ && char =~ /[A-... | [
"0.8217358",
"0.82117003",
"0.809547",
"0.80916166",
"0.80724776",
"0.80712235",
"0.80546397",
"0.8008712",
"0.7984824",
"0.797624",
"0.797095",
"0.79629236",
"0.79564434",
"0.7938168",
"0.79236543",
"0.7902705",
"0.7818807",
"0.77948654",
"0.77184683",
"0.7709112",
"0.770613... | 0.7945793 | 13 |
Converts the built Nokogiri Document into standard xml | def to_xml
@builder.to_xml
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end",
"def to_xml\n doc = Nokogiri::XML::Document.new\n element = to_nokogiri(doc)\n element.to_s\n end",
"def to_xml\n to_node.document.to_xml\n end",
"def to_xml\n Ox.to_xml d... | [
"0.7523668",
"0.7523668",
"0.7473059",
"0.7468181",
"0.73293406",
"0.7303755",
"0.72566235",
"0.72153676",
"0.72031695",
"0.7179419",
"0.7097997",
"0.70746946",
"0.70658606",
"0.7056958",
"0.7056958",
"0.6982054",
"0.6968044",
"0.6959157",
"0.69312876",
"0.6896396",
"0.684437... | 0.6845065 | 20 |
Join a branch context table to the current dataset the context will apply to. | def join_context(context_data, options = {})
join_column = options[:join_column] || :branch_id
versioned_table = opts[:last_joined_table] || opts[:from].first
ds = join(context_data, { :branch_id => join_column }, options) do |j, lj|
Sequel.expr(Sequel.qualify(j, :version) =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _join_table_dataset(opts)\n ds = model.db.from(opts.join_table_source)\n opts[:join_table_block] ? opts[:join_table_block].call(ds) : ds\n end",
"def dataset(branch = nil, options = {})\n return super() if @in_dataset or (!Branch::Context.current! and !branch)\n @in... | [
"0.61954814",
"0.5920218",
"0.5471721",
"0.5141958",
"0.51167387",
"0.49394366",
"0.48700264",
"0.48562512",
"0.48376673",
"0.4816288",
"0.4816288",
"0.47974974",
"0.47700936",
"0.4751795",
"0.47412553",
"0.46824995",
"0.46436185",
"0.4643216",
"0.46403047",
"0.46355677",
"0.... | 0.7112102 | 0 |
Pick latest versions and remove deleted records | def finalize(opts = {})
# Can we use opts[:from] instead of first_source_table and override?
model_table_name = opts[:model_table_name] || model.raw_dataset.first_source_table
sel_col = model.columns.map { |c| Sequel.qualify(model_table_name, c) }
return select(*sel_col) if opts[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_old_versions( versions_to_keep )\n find( :all, :conditions => [ 'number <= ?', self.maximum( :number ) - versions_to_keep ] ).each do |version|\n version.destroy\n end\n end",
"def clean_db(prev_versions)\nputs \"CLEAN DB CALLED\"\n if Version.count > prev_version... | [
"0.710951",
"0.6696476",
"0.66800165",
"0.6468061",
"0.64182055",
"0.6365732",
"0.61186194",
"0.6084252",
"0.6068945",
"0.589684",
"0.5861712",
"0.58551747",
"0.5826512",
"0.57847404",
"0.5714406",
"0.57018447",
"0.56541497",
"0.56215674",
"0.561105",
"0.561105",
"0.5585096",... | 0.0 | -1 |
Change equals to handle computed branch_path | def eql?(obj)
super(obj) && (obj.branch_path_context == branch_path_context)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def branch_key(branch_name)\n return @branch_key_override.call(self, branch_name) if (branch_name && @branch_key_override)\n\n # replace any equals and subsequent text with forward slash and chomp any\n # trailing slash. note that chomp! returns nil if character (i.e. slash)\n # is not found at... | [
"0.61939865",
"0.61339927",
"0.6119972",
"0.60702103",
"0.60702103",
"0.5987548",
"0.5942062",
"0.58392215",
"0.5833013",
"0.5796568",
"0.5766336",
"0.5766336",
"0.5725416",
"0.5684812",
"0.5651064",
"0.56400317",
"0.5572504",
"0.5566789",
"0.55095226",
"0.54764324",
"0.54759... | 0.73782134 | 0 |
Doesn't work right if you use your own model initializers | def initialize(values = {})
raise "Can't specify record_id" if values[:record_id]
raise "Can't specify version" if values[:version]
@context = Branch::Context.get(check_context_specifier(values), false)
@branch_path_context = []
values = values.dup
values.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_model\n end",
"def pre_initialize; end",
"def make_and_model; end",
"def pre_initialize\n end",
"def new_model_defaults\n end",
"def pre_initialize_fields\n end",
"def setup_object_attributes; end",
"def initialize_model\n # let's create our new empty model\n ... | [
"0.7502379",
"0.68487334",
"0.6763528",
"0.6657133",
"0.6620386",
"0.6549898",
"0.638752",
"0.6354913",
"0.6349862",
"0.6349862",
"0.6349862",
"0.6349862",
"0.63070226",
"0.63070226",
"0.63053495",
"0.63008356",
"0.6279789",
"0.625864",
"0.6241825",
"0.6241825",
"0.6241825",
... | 0.0 | -1 |
Should preform delete check here instead of DB trigger because the context is needed to do this correctly. | def delete(values = {})
o = new(values.merge(deleted: true))
ds = self.class.dataset(o.context, no_finalize: true)
p = ds.where(ds.last_record_id => record_id,
ds.last_branch_path => o.branch_path)
.order(Sequel.qualify(ds.opts[:last_joined_table], :depth),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_without_checking\n # SEQUEL5: Remove\n if use_prepared_statements_for?(:delete)\n _set_prepared_statement_server(model.send(:prepared_delete)).call(pk_hash)\n else\n super\n end\n end",
"def delete; raise ActiveRecord::ReadOnlyRecord; e... | [
"0.71726227",
"0.6967382",
"0.69373107",
"0.67764455",
"0.6683949",
"0.66564965",
"0.6646057",
"0.6645356",
"0.66022396",
"0.6557078",
"0.65492713",
"0.65405077",
"0.6532371",
"0.6523477",
"0.6512401",
"0.6512401",
"0.6512401",
"0.65059197",
"0.64821714",
"0.6473698",
"0.6426... | 0.0 | -1 |
Redefine add_associated_object from Sequel associations.rb Add option join_class to return added object with many_to_many relations | def add_associated_object(opts, o, *args)
klass = opts.associated_class
if o.is_a?(Hash) && opts[:join_class].nil?
o = klass.new(o)
elsif o.is_a?(Integer) || o.is_a?(String) || o.is_a?(Array)
o = klass.with_pk!(o)
elsif !o.is_a?(klass)
raise(Se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_add_associated_object(opts, o)\n klass = opts.associated_class\n\n case o\n when Hash\n klass.new(o)\n when Integer, String, Array\n klass.with_pk!(o)\n when klass\n o\n else \n raise(Sequel::Error, \"associa... | [
"0.7245174",
"0.72067297",
"0.70119107",
"0.6692926",
"0.66212666",
"0.6436201",
"0.63957715",
"0.62621343",
"0.6188772",
"0.6183271",
"0.61008716",
"0.6090861",
"0.6075536",
"0.6056924",
"0.6046592",
"0.60417",
"0.604143",
"0.6031428",
"0.597421",
"0.59721434",
"0.5923005",
... | 0.7793471 | 0 |
Kludgy: change dataset if in a context but only provide new behavior once as dataset_from_context and methods it calls will call dataset again. There is probably a better way | def dataset(branch = nil, options = {})
return super() if @in_dataset or (!Branch::Context.current! and !branch)
@in_dataset = true
context = Branch::Context.get(branch)
ds = dataset_from_context(context, options)
@in_dataset = nil
ds
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_dataset\n this\n end",
"def _update_dataset\n this\n end",
"def set_dataset\n # TODO\n #@dataset = DatasetService.get_dataset\n end",
"def set_dataset\n @dataset = Dataset.find(params[:id] || params[:dataset_id])\n end",
"def set_dataset\n @dataset =\n ... | [
"0.65355283",
"0.65355283",
"0.6323003",
"0.6118783",
"0.6110146",
"0.6106977",
"0.6075136",
"0.6066373",
"0.600249",
"0.60023135",
"0.592424",
"0.59161806",
"0.5895118",
"0.5886442",
"0.58560735",
"0.58311063",
"0.582913",
"0.582913",
"0.582913",
"0.582913",
"0.58245236",
... | 0.6255034 | 3 |
the block following the method call will be converted into a Proc object and then assigned to the formal parameter | def meth2
put yield(8)
end
square = proc {|i| i*i}
meth2 {|i| i + i}
meth2 &square # the last actual argument in a method invocation is a Proc object, precede it with & to convert it into a block. The method may then use yield to call it
# class
class Cla # class names always begin with a captial letter
inclu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_to_proc(&p)\n\tp.call\nend",
"def call_a_proc(&block)\n block.call\nend",
"def run_block\n p = Proc.new # <1>\n p.call\nend",
"def run_block\n p = Proc.new\n p.call\nend",
"def fred(param)\n proc {}\nend",
"def to_proc() self ; end",
"def be_proc(&block)\n block.call\n put... | [
"0.763516",
"0.75856006",
"0.7507135",
"0.74062246",
"0.72985965",
"0.72053695",
"0.7199881",
"0.71845216",
"0.7169261",
"0.7163115",
"0.71604514",
"0.7097487",
"0.7093522",
"0.7093522",
"0.7071152",
"0.7071152",
"0.70707726",
"0.705533",
"0.7023521",
"0.7006675",
"0.6994148"... | 0.0 | -1 |
Override the getter to return only nonrestricted documents | def external_documents
DocumentFilter.new(documents: @external_documents).filter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restricted_should_authenticate\n authenticate_user! unless @document.public?\n end",
"def document_not_found!\n doc = ::SolrDocument.find(params[:id])\n # Render the document if the current_user == the depositor of the document\n return doc if current_user && current_user.user_key == doc[\... | [
"0.7107771",
"0.6714771",
"0.6343302",
"0.63202703",
"0.62467664",
"0.61841166",
"0.6177336",
"0.617507",
"0.6138872",
"0.61090237",
"0.61090237",
"0.6073866",
"0.59602314",
"0.59503293",
"0.5949227",
"0.59304327",
"0.587515",
"0.5856466",
"0.5829601",
"0.58270043",
"0.580114... | 0.5714037 | 39 |
Define lesson plan component for the check whether the component is defined. | def component
current_component_host[:course_lesson_plan_component]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def component_present\n if component.nil?\n errors.add(:component, 'is not valid.')\n end\n end",
"def component!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 40 )\n\n\n\n type = COMPONENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - -... | [
"0.5552779",
"0.5424927",
"0.53812563",
"0.53667694",
"0.53106624",
"0.5302395",
"0.5299635",
"0.5292341",
"0.5265917",
"0.52548426",
"0.52243185",
"0.52243185",
"0.51806206",
"0.5172114",
"0.5152644",
"0.5107673",
"0.5107673",
"0.5107039",
"0.5086674",
"0.5012775",
"0.497031... | 0.5934433 | 0 |
Gets the total duration of all sessions contained within. | def duration
@sessions.map(&:duration).reduce(&:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_duration\n duration = 0\n trips.each { |trip| duration += trip.duration }\n return duration\n end",
"def total_duration\n self.inject(0) do |accum,trip|\n accum += trip.duration\n accum\n end\n end",
"def total_sessions(options = {})\n req... | [
"0.68285286",
"0.6704258",
"0.661271",
"0.65225285",
"0.65047383",
"0.6477634",
"0.6447814",
"0.64300376",
"0.64001817",
"0.63054454",
"0.6298143",
"0.62773776",
"0.6253047",
"0.62419176",
"0.6230875",
"0.6115186",
"0.6076121",
"0.60557556",
"0.6039918",
"0.6033231",
"0.60240... | 0.84526277 | 0 |
3. Write a simple grep that will print the lines of a file having any occurances of a phrase in that line. You will need to do a simple regular expression match and read lines from a file. | def occurGrep(pattern, filename)
regexp = Regexp.new(pattern)
File.foreach(filename).with_index { |line, line_num|
puts "#{line_num}: #{line}" if regexp =~ line }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grep(filename, phrase)\n File.open(filename) do |lines|\n lines.each do |line|\n puts \"#{lines.lineno}. #{line}\" if line =~ Regexp.new(phrase)\n end\n end\nend",
"def simple_grep(filename, phrase)\n regexp = Regexp.new(phrase)\n File.open(filename, 'r') do |file|\n ... | [
"0.8840223",
"0.87348145",
"0.8708171",
"0.87037766",
"0.84813017",
"0.76942515",
"0.7683765",
"0.7558999",
"0.73928624",
"0.7351168",
"0.7336956",
"0.6809648",
"0.6806974",
"0.6747354",
"0.67368966",
"0.6658524",
"0.6633613",
"0.66121304",
"0.65554583",
"0.6409517",
"0.63865... | 0.6794785 | 13 |
Show all privacy policies | def index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @privacy_policies = PrivacyPolicy.all\n end",
"def index\n @priv_policies = PrivPolicy.all\n end",
"def index\n @permission_policies = PermissionPolicy.all\n end",
"def policies\n @policies = Policy.all\n end",
"def list_policies\n http_get(:uri=>\"/policies\", :fields=... | [
"0.8041882",
"0.7918802",
"0.69752306",
"0.66851735",
"0.6669837",
"0.6616309",
"0.6613419",
"0.66041094",
"0.66041094",
"0.6567964",
"0.64693093",
"0.64608747",
"0.6452844",
"0.64220876",
"0.63800085",
"0.6363705",
"0.63294184",
"0.6316399",
"0.6315937",
"0.621407",
"0.61991... | 0.0 | -1 |
Show the last privacy policy | def last_policy
@last_policy = Privacypolicy.where(:online => true).order(:publication_time).last
if @last_policy.nil?
flash[:danger] = "Le site n'a actuellement aucune politique de confidentalité."
redirect_to root_path
else
redirect_to @last_policy
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n last_policy = Privacypolicy.where(:online => true).order(:publication_time).last\n Privacypolicy.create(:publication_time => DateTime.now, :online => false, :description => \" - À écrire - \", :content => (!last_policy.nil? ? last_policy.content : \" - À écrire - \"))\n redirect_to privacypolici... | [
"0.6994164",
"0.66583407",
"0.6401159",
"0.6401159",
"0.62046856",
"0.6120155",
"0.6044052",
"0.60261226",
"0.60261226",
"0.58869064",
"0.58708656",
"0.5837117",
"0.5816919",
"0.58143795",
"0.5742264",
"0.57387424",
"0.5723976",
"0.57054317",
"0.56900144",
"0.5686266",
"0.567... | 0.7427885 | 0 |
Show one privacy policy | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def privacy\n end",
"def privacy\n end",
"def authorize_show\n user = requested_user(:user_id)\n if request.format.ics?\n unauthorized(\"Invalid privacy token.\") unless params[:pt] == user.privacy_token\n else\n unauthorized unless user == current_user\n end\n true\n end",
"def g... | [
"0.73930407",
"0.73930407",
"0.71042836",
"0.69210166",
"0.69041616",
"0.6899397",
"0.68052423",
"0.6768037",
"0.66448563",
"0.65901583",
"0.65792036",
"0.65677965",
"0.6517508",
"0.64776516",
"0.64658093",
"0.6460942",
"0.64112335",
"0.63748866",
"0.6341075",
"0.63348615",
"... | 0.0 | -1 |
Create a privacy policy (automatic from the last one) | def new
last_policy = Privacypolicy.where(:online => true).order(:publication_time).last
Privacypolicy.create(:publication_time => DateTime.now, :online => false, :description => " - À écrire - ", :content => (!last_policy.nil? ? last_policy.content : " - À écrire - "))
redirect_to privacypolicies_path
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_privacy_policy\n @privacy_policy = PrivacyPolicy.find(params[:id])\n end",
"def create\n @privacy_policy = PrivacyPolicy.new(privacy_policy_params)\n\n respond_to do |format|\n if @privacy_policy.save\n format.html { redirect_to @privacy_policy, notice: 'Privacy policy was successfu... | [
"0.6615621",
"0.6602969",
"0.66003394",
"0.6530028",
"0.652548",
"0.63888276",
"0.6256889",
"0.61253744",
"0.61253744",
"0.6116139",
"0.60835296",
"0.6007256",
"0.5997349",
"0.5934588",
"0.59015006",
"0.5894451",
"0.58895975",
"0.58613783",
"0.58441466",
"0.5828521",
"0.58069... | 0.695762 | 0 |
Update a privacy policy (show the form) | def edit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @privacy_policy.update(privacy_policy_params)\n format.html { redirect_to @privacy_policy, notice: 'Privacy policy was successfully updated.' }\n format.json { render :show, status: :ok, location: @privacy_policy }\n else\n format.html { re... | [
"0.7758746",
"0.7599681",
"0.73252064",
"0.7308839",
"0.7097843",
"0.69584346",
"0.673892",
"0.66912574",
"0.66749096",
"0.66408926",
"0.6556804",
"0.65206045",
"0.65133095",
"0.65133095",
"0.6445831",
"0.6433366",
"0.6431481",
"0.64115554",
"0.637245",
"0.6234101",
"0.621055... | 0.0 | -1 |
Update the description of a privacy policy (show the form) | def edit_description
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @privacypolicy.update_attributes(params.require(:privacypolicy).permit(:description, :content))\n flash[:success] = \"Modification enregistrée.\"\n redirect_to privacypolicies_path\n else\n if params[:privacypolicy][:description].nil?\n render 'edit'\n else\n ... | [
"0.75081825",
"0.68430215",
"0.6640478",
"0.648713",
"0.6470448",
"0.6389047",
"0.6320487",
"0.62897176",
"0.6188254",
"0.60461825",
"0.60461825",
"0.59988326",
"0.59988326",
"0.59713113",
"0.59364116",
"0.58240646",
"0.58217657",
"0.5805477",
"0.5797871",
"0.57639563",
"0.57... | 0.5671262 | 26 |
Update a privacy policy or its description (send the form) | def update
if @privacypolicy.update_attributes(params.require(:privacypolicy).permit(:description, :content))
flash[:success] = "Modification enregistrée."
redirect_to privacypolicies_path
else
if params[:privacypolicy][:description].nil?
render 'edit'
else
render 'edit_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @privacy_policy.update(privacy_policy_params)\n format.html { redirect_to @privacy_policy, notice: 'Privacy policy was successfully updated.' }\n format.json { render :show, status: :ok, location: @privacy_policy }\n else\n format.html { re... | [
"0.7448105",
"0.7305616",
"0.67677593",
"0.6614141",
"0.65755904",
"0.6572025",
"0.6533835",
"0.65262",
"0.64992166",
"0.64992166",
"0.6417055",
"0.6413603",
"0.638637",
"0.63807464",
"0.63807464",
"0.6378693",
"0.6350975",
"0.6350975",
"0.6350975",
"0.6350975",
"0.6350975",
... | 0.7795928 | 0 |
Delete a privacy policy | def destroy
@privacypolicy.destroy
flash[:success] = "Politique de confidentialité supprimée."
redirect_to privacypolicies_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @privacy_policy.destroy\n respond_to do |format|\n format.html { redirect_to privacy_policies_url, notice: 'Privacy policy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @privacy_policy.destroy\n respond_to do |format|\n ... | [
"0.7470783",
"0.7415244",
"0.709066",
"0.69670534",
"0.69669384",
"0.67254215",
"0.6678735",
"0.65856814",
"0.6533491",
"0.6519269",
"0.64885455",
"0.63837993",
"0.6369172",
"0.6369172",
"0.6369172",
"0.6297704",
"0.62552947",
"0.625052",
"0.6247883",
"0.6159466",
"0.6155703"... | 0.76185125 | 0 |
Put a privacy policy online | def put_online
@privacypolicy.online = true
@privacypolicy.publication_time = DateTime.now
@privacypolicy.save
User.all.each do |u|
u.last_policy_read = false
u.save
end
redirect_to @privacypolicy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_privacy_policy\n @privacy_policy = PrivacyPolicy.find(params[:id])\n end",
"def set_privacy_policy\n @privacy_policy = PrivacyPolicy.find(params[:id])\n end",
"def set_pub\n @pub = Pub.find(params[:id])\n authorize @pub\n end",
"def new\n last_policy = Privacypolicy.where(... | [
"0.7157747",
"0.7095812",
"0.6363742",
"0.6321772",
"0.6273294",
"0.6259737",
"0.6259737",
"0.6149866",
"0.6147421",
"0.6104248",
"0.6104248",
"0.6043777",
"0.60310066",
"0.59936756",
"0.59515804",
"0.59077626",
"0.5906398",
"0.58590835",
"0.5797708",
"0.57856417",
"0.5733815... | 0.7472212 | 0 |
GET METHODS Get the privacy policy | def get_policy
@privacypolicy = Privacypolicy.find_by_id(params[:id])
return if check_nil_object(@privacypolicy)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def privacy\n end",
"def privacy\n end",
"def authorization\n get_privacy_setting.privacy_level\n end",
"def privacy\n @api_v1_pages = Api::V1::Page.where('title = \"privacy\"').first\n\n render json: @api_v1_pages\n end",
"def index\n @privacy_policies = PrivacyPolicy.all\n en... | [
"0.7100545",
"0.7100545",
"0.7091396",
"0.70472825",
"0.68853176",
"0.68742007",
"0.6735391",
"0.6674617",
"0.6650984",
"0.6637281",
"0.65251154",
"0.6433442",
"0.63610655",
"0.63610655",
"0.61405253",
"0.6132412",
"0.61197835",
"0.61064273",
"0.6087512",
"0.607578",
"0.60640... | 0.7268539 | 0 |
Get the privacy policy (v2) | def get_policy2
@privacypolicy = Privacypolicy.find_by_id(params[:privacypolicy_id])
return if check_nil_object(@privacypolicy)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy\n @privacypolicy = Privacypolicy.find_by_id(params[:id])\n return if check_nil_object(@privacypolicy)\n end",
"def policy\n self.permissions['policy'].to_sym\n end",
"def get_privacy_notice\n return self.public == true ? \"Public\" : \"Private\"\n end",
"def authorization\n ... | [
"0.6823307",
"0.6432598",
"0.64201367",
"0.6370934",
"0.6296502",
"0.6270096",
"0.62525177",
"0.6164355",
"0.5896158",
"0.58666587",
"0.58167684",
"0.5803951",
"0.5771688",
"0.575697",
"0.575697",
"0.56785256",
"0.5678273",
"0.56782466",
"0.56706744",
"0.56599414",
"0.5656992... | 0.727623 | 0 |
CHECK METHODS Check that the privacy policy is offline | def is_offline
return if check_online_object(@privacypolicy)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_online\n return if check_offline_object(@privacypolicy)\n end",
"def offline?\n !online?\n end",
"def offline?\n status == :offline\n end",
"def offline?\n @is_offline = OFFLINE if @is_offline === nil\n @is_offline\n end",
"def should_be_online?\n !should_be_offline?\n end... | [
"0.7785677",
"0.67558354",
"0.6737155",
"0.64315975",
"0.6398926",
"0.63438624",
"0.6298949",
"0.61789286",
"0.6172731",
"0.6162102",
"0.6139242",
"0.61092424",
"0.6102581",
"0.608358",
"0.59950536",
"0.59850985",
"0.5972484",
"0.5966174",
"0.5945663",
"0.5945663",
"0.5934127... | 0.8237825 | 0 |
Check that the privacy policy is online | def is_online
return if check_offline_object(@privacypolicy)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_offline\n return if check_online_object(@privacypolicy)\n end",
"def is_privacy_policy?\n if !get_option( 'wp_page_for_privacy_policy' ).blank? && is_page?( get_option( 'wp_page_for_privacy_policy' ) )\n true\n else\n false\n end\n end",
"def online?\n status != :offline\n ... | [
"0.81324553",
"0.68043095",
"0.65559226",
"0.6548145",
"0.6495669",
"0.6447887",
"0.6295736",
"0.623608",
"0.62345964",
"0.62175447",
"0.62058216",
"0.6203887",
"0.6203516",
"0.6199409",
"0.6199409",
"0.61924",
"0.61821693",
"0.6175502",
"0.61641884",
"0.6124403",
"0.60646963... | 0.8328452 | 0 |
Sets metrics before returning next host | def next
next_host.tap do |_|
set_metrics!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_metrics\n end",
"def setup_metrics\n end",
"def setup_metrics\n end",
"def set_metrics(metrics, batch)\n _this_ts, label, latency, error, threads, http_code = metrics\n ['ALL', label].each do |key|\n # load test worker threads are recorded at the start of the interval\n bat... | [
"0.61315465",
"0.61315465",
"0.61315465",
"0.6100113",
"0.58682585",
"0.5810053",
"0.5588192",
"0.55189973",
"0.5516393",
"0.55100703",
"0.5503378",
"0.5478309",
"0.54475754",
"0.5429487",
"0.5390609",
"0.5283521",
"0.5281072",
"0.5276756",
"0.52759963",
"0.5268168",
"0.52606... | 0.83352536 | 0 |
Returns the next available host. Returns a Gitlab::Database::LoadBalancing::Host instance, or nil if no hosts were available. | def next_host
@mutex.synchronize do
break if @hosts.empty?
started_at = @index
loop do
host = @hosts[@index]
@index = (@index + 1) % @hosts.length
break host if host.online?
# Return nil once we have cycled through... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_cluster_host\n if @resurrect_at\n time = Time.now.to_i\n resurrect_cluster(time) if @resurrect_at <= time\n end\n host_n = @current_host_n\n loop do\n host = @hosts[host_n]\n if !host\n raise NoAliveHosts if host_n == 0\n ... | [
"0.6576088",
"0.57875293",
"0.5667201",
"0.55571085",
"0.55387145",
"0.5524242",
"0.549183",
"0.5437521",
"0.53636956",
"0.530602",
"0.5203218",
"0.5179631",
"0.51502043",
"0.5041372",
"0.5040545",
"0.5030363",
"0.5030363",
"0.5022613",
"0.49623126",
"0.49610704",
"0.49585938... | 0.7401523 | 0 |
Convenience method. Given one vertex for an edge, get the other vertex. | def get_other_vertex(v_id)
(vertices - [v_id])[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def other_vertex(direction, edge)\n case direction\n when :in; edge.source\n else\n edge.target\n end\n end",
"def get_connection_to(another_vertex)\n @edges.each do |edge|\n if edge.head == another_vertex || edge.tail == another_vertex\... | [
"0.7968537",
"0.7732168",
"0.73569506",
"0.68832445",
"0.6864664",
"0.6864664",
"0.67573583",
"0.66178817",
"0.65621585",
"0.65394014",
"0.65251887",
"0.65117925",
"0.64759797",
"0.64649826",
"0.6416385",
"0.62423086",
"0.61957264",
"0.6185537",
"0.61830664",
"0.61683404",
"0... | 0.7438637 | 2 |
Rewrite the edge as if the center vertex of a circular arc were the origin. | def translate_edge(vertices_hash)
raise 'not circular enough for this call' if !circular
v1 = vertices_hash[vertices[0]]
v2 = vertices_hash[vertices[1]]
translated_v1 = Vertex.new(v1.x - center.x, v1.y - center.y)
translated_v2 = Vertex.new(v2.x - center.x, v2.y - center.y)
[translated_v1, trans... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circle_side_edge(radius, side_number)\n angle = (DEGREES_PER_STEP * side_number).gosu_to_radians\n CP::Vec2.new(radius, 0).rotate(CP::Vec2.for_angle(angle))\n end",
"def arc_around(center, options)\n open_curve(arc_vertices(center, options))\n end",
"def conjugate!\r\n set(@axis.mirror,... | [
"0.58919716",
"0.5494429",
"0.5467309",
"0.545262",
"0.5349873",
"0.52243865",
"0.5179",
"0.5164956",
"0.5051272",
"0.5050115",
"0.5040964",
"0.5019188",
"0.50129926",
"0.49735433",
"0.4965664",
"0.49466124",
"0.49432352",
"0.4912012",
"0.49056762",
"0.489965",
"0.48851615",
... | 0.51606655 | 8 |
Return angle of arc in radians. | def get_angle(vertices_hash)
raise 'not circular enough for this call' if !circular
t_v1, t_v2 = translate_edge(vertices_hash)
dot_product = self.class.get_dot_product(t_v1, t_v2)
origin = Vertex.new(0,0)
magnitude_t_v1 = get_distance(origin, t_v1)
magnitude_t_v2 = get_distance(origin, t_v2)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle\n rad / Math::PI * 180\n end",
"def angle_of_specified_radius\n @angle_of_radius\n end",
"def angle\n ns = norm\n x_ = @x / ns\n y_ = @y / ns\n\n Math.atan2(x_, y_)\n end",
"def radian_angle\n @angle * Math::PI / 180.0\n end",
"def angle_from_arc... | [
"0.76045007",
"0.71740824",
"0.71496785",
"0.6907047",
"0.6855201",
"0.684366",
"0.6814171",
"0.67723906",
"0.6706673",
"0.6673413",
"0.6672546",
"0.666039",
"0.66367483",
"0.6600001",
"0.6582055",
"0.6536902",
"0.6536304",
"0.65184325",
"0.64958984",
"0.640394",
"0.63791436"... | 0.5659545 | 68 |
Get farthest coordinates out from a convex curve. | def find_farthest_points(vertices_hash)
@positive_x = center.x + radius
@positive_y = center.y + radius
# In case the convexity is pointing down the negative direction of the x or y axis.
@negative_x = center.x - radius
@negative_y = center.y - radius
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absolute_points\n points.map do |cv_pt|\n make_absolute(cv_pt.point)\n end\n end",
"def get_bounds\n rMinX = nil\n rMinY = nil\n rMaxX = nil\n rMaxY = nil\n\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n rMinX =... | [
"0.57158387",
"0.5612041",
"0.55890787",
"0.55303377",
"0.5454376",
"0.53604823",
"0.534463",
"0.5326311",
"0.52623594",
"0.5226792",
"0.5225968",
"0.52248096",
"0.5213609",
"0.520127",
"0.5175795",
"0.514802",
"0.511735",
"0.51133156",
"0.5108914",
"0.5089936",
"0.5089301",
... | 0.656804 | 0 |
GET /solicitudes GET /solicitudes.json | def index
if !params[:search].nil?
s = params[:search]
@beneficiarios = Beneficiario.search s
end
@solicitudes=Solicitud.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @solicitantes = Solicitante.all\n end",
"def index\n @solicituds = Solicitud.all\n end",
"def index\n @solicituds = Solicitud.all\n end",
"def index\n @solicitadors = Solicitador.all\n end",
"def index\n @solicitacoes = Solicitacao.all\n end",
"def show\n @solicitante= ... | [
"0.69797987",
"0.68898875",
"0.6889573",
"0.6878036",
"0.6876616",
"0.68586206",
"0.66113937",
"0.6507895",
"0.64169776",
"0.6386859",
"0.61965597",
"0.6103606",
"0.6103606",
"0.6103606",
"0.6103606",
"0.6103606",
"0.6103606",
"0.60500455",
"0.6021548",
"0.60067666",
"0.59914... | 0.5474972 | 49 |
GET /solicitudes/1 GET /solicitudes/1.json | def show
@solicitante=Solicitante.find(params[:solicitante_id])
@beneficiario=Beneficiario.find(params[:beneficiario_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @solicitante= Solicitante.find(params[:solicitante_id])\n @beneficiario= Beneficiario.find(params[:id])\n @solicitudes = Solicitud.where(solicitante_id: @solicitante.id, beneficiario_id: @beneficiario.id).all\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\... | [
"0.67952716",
"0.6737971",
"0.65238494",
"0.6455131",
"0.6454962",
"0.6365642",
"0.6355848",
"0.62918",
"0.62918",
"0.62746376",
"0.62735933",
"0.62735933",
"0.62735933",
"0.62735933",
"0.62735933",
"0.62735933",
"0.6201601",
"0.6193236",
"0.6110813",
"0.6110813",
"0.60532486... | 0.5756662 | 28 |
POST /solicitudes POST /solicitudes.json | def create
authorize! :create, Solicitud
@solicitante=Solicitante.find(params[:solicitante_id])
@beneficiario=Beneficiario.find(params[:beneficiario_id])
@solicitud = Solicitud.create(solicitud_params)
@solicitud.solicitante_id=@solicitante.id
@solicitud.beneficiario_id=@beneficiario.id
res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @solicitante = Solicitante.new(solicitante_params)\n\n respond_to do |format|\n if @solicitante.save\n format.html { redirect_to @solicitante, notice: 'Solicitante was successfully created.' }\n format.json { render :show, status: :created, location: @solicitante }\n else... | [
"0.6964316",
"0.6953736",
"0.6843501",
"0.6811379",
"0.6672929",
"0.6462882",
"0.6462545",
"0.64441544",
"0.6367663",
"0.6301891",
"0.62387013",
"0.6215373",
"0.6060763",
"0.60553545",
"0.6016125",
"0.6008194",
"0.59516686",
"0.59516686",
"0.59516686",
"0.59516686",
"0.595166... | 0.68033445 | 4 |
PATCH/PUT /solicitudes/1 PATCH/PUT /solicitudes/1.json | def update
authorize! :update, Solicitud
respond_to do |format|
if @solicitud.update(solicitud_params)
format.html { redirect_to solicitudes_path, notice: 'Solicitud actualizada exitosamente.' }
format.json { render :show, status: :ok, location: solicitudes_path }
else
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json... | [
"0.69516563",
"0.6882925",
"0.6867186",
"0.68657017",
"0.6822757",
"0.6704037",
"0.66716623",
"0.6644306",
"0.66137904",
"0.6602071",
"0.65783113",
"0.6508704",
"0.6389823",
"0.6376479",
"0.637204",
"0.62030613",
"0.6165539",
"0.6155108",
"0.60764724",
"0.60466397",
"0.603261... | 0.686974 | 2 |
DELETE /solicitudes/1 DELETE /solicitudes/1.json | def destroy
authorize! :destroy, Solicitud
@solicitud.destroy
respond_to do |format|
format.html { redirect_to solicitudes_url, notice: 'Solicitud was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was suc... | [
"0.80276495",
"0.7756985",
"0.7748066",
"0.7625654",
"0.75773644",
"0.7446899",
"0.7432284",
"0.74241287",
"0.7419758",
"0.73481065",
"0.72741175",
"0.723881",
"0.7209831",
"0.71891",
"0.7048063",
"0.6990543",
"0.69714457",
"0.68746495",
"0.682335",
"0.68003666",
"0.67828685"... | 0.76641995 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_solicitud
@solicitud = Solicitud.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def solicitud_params
params.require(:solicitud).permit(:status, :descripcion, :ayuda_id, :beneficiario_id, :solicitante_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 |
incomplete needs to allow for no status or one status (just draft) | def current_order_status
most_recent_order_statuses = order_statuses.order(:updated_at).last(2)
current_order_status = most_recent_order_statuses[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draft?\n self.status == \"Draft\" || self.status == \"draft\" \n end",
"def only_update_status_from_pending\n\t if changed.length > 1\n\t\t errors[:base] << 'You cannot modify this invitation.'\n\t\t return\n\t\t end\n\t\t\told_status = changed_attributes['status']\n\t\t\tif old_status != 'pend... | [
"0.7172971",
"0.6945172",
"0.6800329",
"0.6755435",
"0.6676972",
"0.6660758",
"0.665286",
"0.66369873",
"0.66330314",
"0.6588815",
"0.6588183",
"0.6583893",
"0.6558888",
"0.6553425",
"0.6549284",
"0.6549284",
"0.6549284",
"0.65411395",
"0.6529871",
"0.6514679",
"0.6514454",
... | 0.0 | -1 |
incomplete needs to allow for no status or one status (just draft) | def incoming_order_status
most_recent_order_statuses = order_statuses.order(:updated_at).last(2)
incoming_order_status = most_recent_order_statuses[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draft?\n self.status == \"Draft\" || self.status == \"draft\" \n end",
"def only_update_status_from_pending\n\t if changed.length > 1\n\t\t errors[:base] << 'You cannot modify this invitation.'\n\t\t return\n\t\t end\n\t\t\told_status = changed_attributes['status']\n\t\t\tif old_status != 'pend... | [
"0.71724886",
"0.6946358",
"0.6799775",
"0.6755102",
"0.667768",
"0.6661496",
"0.665357",
"0.6636725",
"0.6632766",
"0.6588249",
"0.6587971",
"0.6585525",
"0.6558821",
"0.6553156",
"0.65500087",
"0.65500087",
"0.65500087",
"0.6541427",
"0.6531213",
"0.6515212",
"0.6515068",
... | 0.0 | -1 |
GET /movement_proof_details GET /movement_proof_details.json | def index
@movement_proof_details = MovementProofDetail.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_movement_proof_detail\n @movement_proof_detail = MovementProofDetail.find(params[:id])\n end",
"def create\n @movement_proof_detail = MovementProofDetail.new(movement_proof_detail_params)\n\n respond_to do |format|\n if @movement_proof_detail.save\n format.html {redirect_to @movemen... | [
"0.7216908",
"0.70416623",
"0.6591604",
"0.6265037",
"0.6237184",
"0.62120605",
"0.61808926",
"0.6042705",
"0.59492534",
"0.5922186",
"0.59214324",
"0.587696",
"0.5861894",
"0.5859045",
"0.58545643",
"0.5788111",
"0.57838553",
"0.5775582",
"0.5769364",
"0.5751442",
"0.5742989... | 0.7400214 | 0 |
GET /movement_proof_details/1 GET /movement_proof_details/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @movement_proof_details = MovementProofDetail.all\n end",
"def set_movement_proof_detail\n @movement_proof_detail = MovementProofDetail.find(params[:id])\n end",
"def create\n @movement_proof_detail = MovementProofDetail.new(movement_proof_detail_params)\n\n respond_to do |format|\n ... | [
"0.73242754",
"0.72380525",
"0.6928916",
"0.6519352",
"0.6402881",
"0.6361215",
"0.6222905",
"0.61233693",
"0.6105836",
"0.60867697",
"0.60727906",
"0.60661775",
"0.60079056",
"0.5944632",
"0.5939844",
"0.59379506",
"0.5915266",
"0.59150004",
"0.59145844",
"0.5877797",
"0.586... | 0.0 | -1 |
POST /movement_proof_details POST /movement_proof_details.json | def create
@movement_proof_detail = MovementProofDetail.new(movement_proof_detail_params)
respond_to do |format|
if @movement_proof_detail.save
format.html {redirect_to @movement_proof_detail, notice: 'Movement proof detail was successfully created.'}
format.json {render :show, status: :c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movement_proof_detail_params\n params.require(:movement_proof_detail).permit(:movement_proof_id, :product_id, :quantity)\n end",
"def set_movement_proof_detail\n @movement_proof_detail = MovementProofDetail.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @movement_proof_... | [
"0.7271008",
"0.7213464",
"0.67039853",
"0.6359789",
"0.6345519",
"0.62441665",
"0.62323576",
"0.6092041",
"0.6055395",
"0.6051176",
"0.6019283",
"0.5986266",
"0.5891799",
"0.58470535",
"0.5827537",
"0.58115476",
"0.57701963",
"0.57682943",
"0.57596505",
"0.5755213",
"0.57413... | 0.8010999 | 0 |
PATCH/PUT /movement_proof_details/1 PATCH/PUT /movement_proof_details/1.json | def update
respond_to do |format|
if @movement_proof_detail.update(movement_proof_detail_params)
format.html {redirect_to @movement_proof_detail, notice: 'Movement proof detail was successfully updated.'}
format.json {render :show, status: :ok, location: @movement_proof_detail}
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @id_proof = IdProof.find(params[:id])\n\n respond_to do |format|\n if @id_proof.update_attributes(params[:id_proof])\n format.html { redirect_to @id_proof, notice: 'Id proof was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { rend... | [
"0.6704792",
"0.6651115",
"0.65805465",
"0.64411324",
"0.6377014",
"0.6221765",
"0.6139319",
"0.60703695",
"0.6065653",
"0.6062862",
"0.6053716",
"0.6038795",
"0.60205805",
"0.6002279",
"0.59922236",
"0.5991205",
"0.59894896",
"0.598473",
"0.5982411",
"0.5981807",
"0.5979784"... | 0.76619667 | 0 |
DELETE /movement_proof_details/1 DELETE /movement_proof_details/1.json | def destroy
@movement_proof_detail.destroy
respond_to do |format|
format.html {redirect_to movement_proof_details_url, notice: 'Movement proof detail was successfully destroyed.'}
format.json {head :no_content}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @id_proof = IdProof.find(params[:id])\n @id_proof.destroy\n\n respond_to do |format|\n format.html { redirect_to id_proofs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_detail.destroy\n respond_to do |format|\n format.html { redirect_t... | [
"0.69991237",
"0.69641936",
"0.68131226",
"0.6795052",
"0.67827886",
"0.67491597",
"0.673984",
"0.6736791",
"0.67188704",
"0.6716913",
"0.6710501",
"0.6683182",
"0.66820204",
"0.6681708",
"0.66755617",
"0.66573155",
"0.66245925",
"0.6623559",
"0.6622907",
"0.6621698",
"0.6595... | 0.77347493 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_movement_proof_detail
@movement_proof_detail = MovementProofDetail.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def movement_proof_detail_params
params.require(:movement_proof_detail).permit(:movement_proof_id, :product_id, :quantity)
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.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
GET /client_users GET /client_users.json | def index
@client_users = ClientUser.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def list_users\n self.class.get('/users')\n end",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of i... | [
"0.7617301",
"0.74131286",
"0.729311",
"0.72875893",
"0.726882",
"0.717274",
"0.7137904",
"0.7066994",
"0.70446455",
"0.6976708",
"0.69644034",
"0.69480526",
"0.69480526",
"0.6940509",
"0.69258386",
"0.68885654",
"0.6883345",
"0.68744",
"0.6867642",
"0.685098",
"0.6847306",
... | 0.70654505 | 8 |
GET /client_users/1 GET /client_users/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.75027657",
"0.7288913",
"0.7198927",
"0.7064856",
"0.70458984",
"0.6999677",
"0.6982538",
"0.6970788",
"0.6857203",
"0.6821059",
"0.68137705",
"0.6805885",
"0.6804764",
"0.6800919",
"0.67464894",
"0.6678686",
"0.66573656",
"0.6641868",
"0.66301274",
"0.66301274",
"0.661241... | 0.0 | -1 |
POST /client_users POST /client_users.json | def create
@client_user = ClientUser.new(client_user_params)
respond_to do |format|
if @client_user.save
format.html { redirect_to @client_user, notice: 'Client user was successfully created.' }
format.json { render :show, status: :created, location: @client_user }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end",
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => u... | [
"0.7117039",
"0.7017146",
"0.6790007",
"0.677926",
"0.6665295",
"0.6564552",
"0.6550971",
"0.64533913",
"0.64053446",
"0.6405259",
"0.63724095",
"0.6371717",
"0.63682085",
"0.6366056",
"0.634916",
"0.6330378",
"0.63199",
"0.62970906",
"0.6294868",
"0.62606055",
"0.62570417",
... | 0.67712533 | 4 |
PATCH/PUT /client_users/1 PATCH/PUT /client_users/1.json | def update
respond_to do |format|
if @client_user.update(client_user_params)
format.html { redirect_to @client_user, notice: 'Client user was successfully updated.' }
format.json { render :show, status: :ok, location: @client_user }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_client\n\t\tif(request.method == \"OPTIONS\")\n\t\t\trespond({status: 0})\n\t\telsif request.method == \"POST\"\n\t\t\trespond(update_user_client(params))\n\t\tend\n\tend",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update... | [
"0.70591766",
"0.67735887",
"0.6723082",
"0.67124397",
"0.66465515",
"0.65861714",
"0.6491402",
"0.64851856",
"0.64851856",
"0.6433331",
"0.64136714",
"0.63999695",
"0.6385155",
"0.6356156",
"0.6346852",
"0.63333374",
"0.6302522",
"0.6301664",
"0.62938726",
"0.6275992",
"0.62... | 0.6509311 | 6 |
DELETE /client_users/1 DELETE /client_users/1.json | def destroy
@client_user.destroy
respond_to do |format|
format.html { redirect_to client_users_url, notice: 'Client user was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def u... | [
"0.7556086",
"0.7354373",
"0.7227271",
"0.71918637",
"0.71851456",
"0.71666163",
"0.71301216",
"0.7124893",
"0.7117217",
"0.7108753",
"0.70650595",
"0.70383406",
"0.7036359",
"0.7010814",
"0.7010814",
"0.6990122",
"0.69858545",
"0.69858545",
"0.69858545",
"0.69858545",
"0.698... | 0.7384595 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_client_user
@client_user = ClientUser.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def client_user_params
params.require(:client_user).permit(:user_id, :client_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 |
this sends an welcome email when user first sign up | def welcome_email
@user = params[:user]
@url = 'https://recipeapp-mysticflower.herokuapp.com'
mail(to: @user.email, subject: 'Welcome to My Awesome Site')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def welcome_email\n # User welcome email sent.\n end",
"def after_confirmation # Send welcome mail after user is successfully registered\n send_user_mail\n end",
"def welcome_signup_email(signup)\n @signup = signup\n mail(\n :subject => \"We will be coming to your school soon!\",\n :f... | [
"0.8036157",
"0.7841922",
"0.7755658",
"0.76700664",
"0.76666147",
"0.7661711",
"0.7656894",
"0.76536155",
"0.7648345",
"0.7624604",
"0.75853646",
"0.7537845",
"0.7510117",
"0.74880826",
"0.741278",
"0.7410402",
"0.740798",
"0.7399603",
"0.7390357",
"0.73361915",
"0.7319386",... | 0.7357037 | 19 |
This error was analyzed in the README file. error | def cartman_hates(thing)
while true
puts "What's there to hate about #{thing}?"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(msg)\n raise ::RDoc::Error, msg\n end",
"def error(msg)\n raise ::RDoc::Error, msg\n end",
"def error(msg)\n raise RDoc::Error, msg\n end",
"def error_description\n end",
"def error(msg)\n raise RDocError.new(msg)\n end",
"def original_error; end",
"def original_e... | [
"0.62770504",
"0.62770504",
"0.61675584",
"0.5914057",
"0.5904174",
"0.5886233",
"0.5886233",
"0.5852805",
"0.5852805",
"0.5852805",
"0.5852805",
"0.5852805",
"0.5852805",
"0.5852805",
"0.583136",
"0.5688505",
"0.56222665",
"0.56164575",
"0.5589611",
"0.55694646",
"0.54936635... | 0.0 | -1 |
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge [by myself, with: ]. David Kerr and Jessica Tatham 1. Pseudocode What is the input? Array of grades What is the output? (i.e. What sh... | def get_grade(Array)
sum = array.inject{|sum,x| sum + x }
average = sum/Array.length
if (average >= 90)
return "A"
elsif (average >=80)
return "B"
elsif (average >=70)
return "C"
elsif (average >=60)
return "D"
else
return "F"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_grade(grades)\n sum = 0 # define sum, so that I can add things to it\n grades.each {|grade| sum += grade} # adding each element of the array together\n mean = sum / grades.length # the average of the grades\n case # the letter grade for each mean\n when mean >= 90\n return \"A\" # good job, student... | [
"0.79285336",
"0.7674992",
"0.74184835",
"0.7412371",
"0.7387684",
"0.737031",
"0.73611736",
"0.73598",
"0.7341642",
"0.7335198",
"0.73188657",
"0.73168087",
"0.7282746",
"0.7215251",
"0.72074264",
"0.7181101",
"0.7171884",
"0.7169598",
"0.7160825",
"0.7145761",
"0.7134486",
... | 0.7386611 | 5 |
TODO: These routes are no lonmger used =begin def section_answers? | def answer?
@plan.readable_by?(@user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_exam_section_question(user_id, course_id, exam_id, section_id,\r\n question_type, question_id)\r\n qtype = QuestionType.parse(question_type)\r\n raise RuntimeError, \"Invalid Question Type\" if qtype.nil?\r\n response = get_current_exam_attempt(user_id, cours... | [
"0.61672807",
"0.61593074",
"0.61593074",
"0.6155022",
"0.610568",
"0.6027545",
"0.59169596",
"0.58691347",
"0.5847259",
"0.58095026",
"0.580803",
"0.5757873",
"0.5757259",
"0.5727717",
"0.5726437",
"0.567342",
"0.56656426",
"0.5613995",
"0.5601739",
"0.55928826",
"0.55885756... | 0.0 | -1 |
GET /dtc_staffs GET /dtc_staffs.json | def index
@dtc_staffs = DtcStaff.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @daw_staffs = DawStaff.all\n end",
"def index\n @staffs = Staff.all\n end",
"def index\n @staffs = Staff.all\n end",
"def index\n @staffs = Staff.all\n end",
"def index\n @lec_staffs = LecStaff.all\n end",
"def show\n @staff = Staff.find(params[:id])\n\n respond_to d... | [
"0.7246473",
"0.71951383",
"0.71951383",
"0.71951383",
"0.6982304",
"0.6964757",
"0.6889087",
"0.68837744",
"0.6800325",
"0.6764878",
"0.6718327",
"0.6715794",
"0.66920257",
"0.6674566",
"0.66474646",
"0.658983",
"0.6514715",
"0.64983857",
"0.64714676",
"0.643377",
"0.6433349... | 0.7728874 | 0 |
GET /dtc_staffs/1 GET /dtc_staffs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dtc_staffs = DtcStaff.all\n end",
"def show\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @staff }\n end\n end",
"def show\n @admin_staff = Admin::Staff.find(params[:id])\n\n respond_to do |for... | [
"0.7469366",
"0.7340806",
"0.7272605",
"0.70631754",
"0.70631754",
"0.70631754",
"0.7058064",
"0.7011308",
"0.6904108",
"0.6822491",
"0.68125457",
"0.6801407",
"0.67938805",
"0.6777941",
"0.67580414",
"0.67231816",
"0.67203575",
"0.6575994",
"0.6505749",
"0.65053463",
"0.6505... | 0.0 | -1 |
POST /dtc_staffs POST /dtc_staffs.json | def create
sub_cluster = params["dtcstaff"]["sub_cluster"]
@dtc_staff = DtcStaff.new(params[:dtc_staff])
@dtc_staff.subcluster(sub_cluster)
respond_to do |format|
if @dtc_staff.save
format.html { redirect_to dtc_staffs_url, notice: 'Route Associated' }
format.json { render action:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @staff = Staff.new(params[:staff])\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to @staff, notice: 'Staff was successfully created.' }\n format.json { render json: @staff, status: :created, location: @staff }\n else\n format.html { render ac... | [
"0.7180572",
"0.7167225",
"0.7167225",
"0.7167225",
"0.7167225",
"0.7167225",
"0.71593094",
"0.71546113",
"0.71092695",
"0.7085513",
"0.7019465",
"0.6991427",
"0.67382425",
"0.67175204",
"0.6698706",
"0.66857964",
"0.66846246",
"0.66069883",
"0.6593835",
"0.6586768",
"0.65484... | 0.70757765 | 10 |
PATCH/PUT /dtc_staffs/1 PATCH/PUT /dtc_staffs/1.json | def update
sub_cluster = params["dtcstaff"]["sub_cluster"]
@dtc_staff.subcluster(sub_cluster)
respond_to do |format|
if @dtc_staff.update(params[:dtc_staff])
format.html { redirect_to dtc_staffs_url, notice: 'Route Updated' }
format.json { head :no_content }
else
format.ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @staff = Staff.find(params[:id])\n\n respond_to do |format|\n if @staff.update_attributes(params[:staff])\n format.html { redirect_to @staff, notice: 'Staff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.7344762",
"0.7245089",
"0.72400045",
"0.7191414",
"0.7191414",
"0.7191414",
"0.7191414",
"0.7156188",
"0.7105237",
"0.709584",
"0.7026948",
"0.6864093",
"0.6851568",
"0.68152946",
"0.67870325",
"0.67720556",
"0.6737811",
"0.6703225",
"0.6620549",
"0.66120434",
"0.6542683",... | 0.71674055 | 7 |
DELETE /dtc_staffs/1 DELETE /dtc_staffs/1.json | def destroy
@dtc_staff.destroy
respond_to do |format|
format.html { redirect_to dtc_staffs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @staff = Staff.find(params[:id])\n @staff.destroy\n\n respond_to do |format|\n format.html { redirect_to staffs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin_staff = Admin::Staff.find(params[:id])\n @admin_staff.destroy\n\n respond_to do |forma... | [
"0.74841154",
"0.748289",
"0.7329928",
"0.7305019",
"0.7272375",
"0.72185034",
"0.7203216",
"0.7203216",
"0.7203216",
"0.7203216",
"0.7203216",
"0.7203216",
"0.71990573",
"0.7156624",
"0.7146346",
"0.7115637",
"0.70900357",
"0.70030767",
"0.6957959",
"0.6946812",
"0.6903832",... | 0.7901139 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_dtc_staff
@dtc_staff = DtcStaff.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Generic remote script commands with custom phrases | def assign(description, script, options={})
@commands << RemoteScriptCommand.new(
"assign", description, script,
"assigning #{description}", "assigned #{description}", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(command, *args, &blk)\n description, script = args[0..1]\n @commands << RemoteScriptCommand.new(command.to_s, description, script)\n end",
"def commands; end",
"def set_commands; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def... | [
"0.6575266",
"0.6549505",
"0.64270407",
"0.63532066",
"0.63532066",
"0.63532066",
"0.63532066",
"0.63532066",
"0.63532066",
"0.6253331",
"0.6244377",
"0.618828",
"0.61777216",
"0.613645",
"0.6062812",
"0.6054011",
"0.6044116",
"0.6041375",
"0.6040072",
"0.6008041",
"0.6006582... | 0.0 | -1 |
Runs a script on target server, and stores the (stripped) STDOUT into settings. Usage: server.capture_value "salted password", script("convert_salted_password", "PASSWORD" => settings.bosh.password), :settings => "bosh.salted_password" Would store the returned STDOUT into settings[:bosh][:salted_password] | def capture_value(description, script, options)
@commands << RemoteScriptCommand.new(
"capture value", description, script,
"captures value of #{description}", "captured value of #{description}", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_script(command, script, options={})\n ssh_username = options[:ssh_username] || default_ssh_username\n run_as_root = options[:run_as_root]\n settings = options[:settings]\n settings_key = options[:save_output_to_settings_key]\n\n remote_path = remote_tmp_script_path(command)\n upload_... | [
"0.6505681",
"0.5538283",
"0.5417339",
"0.5205785",
"0.50985324",
"0.50777173",
"0.5069612",
"0.5065425",
"0.5060069",
"0.49887273",
"0.49013197",
"0.48742962",
"0.48742962",
"0.48404172",
"0.47922704",
"0.4789404",
"0.47847095",
"0.47805285",
"0.47690436",
"0.4763126",
"0.47... | 0.57852 | 1 |
catchall for commands with generic active/past tense phrases | def method_missing(command, *args, &blk)
description, script = args[0..1]
@commands << RemoteScriptCommand.new(command.to_s, description, script)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_commands(command) # rubocop:todo Metrics/CyclomaticComplexity\n case command\n when '/start'\n greet_user\n when '/stop'\n send_message \"Bye, #{message.from.first_name}\"\n when '/help'\n send_message \"Please enter any of the following commands: #{@commands}\"\n when '/ne... | [
"0.6262905",
"0.6152912",
"0.6151328",
"0.61424387",
"0.6098762",
"0.60770845",
"0.60770845",
"0.6023389",
"0.59997034",
"0.5977621",
"0.5969095",
"0.59483224",
"0.59079593",
"0.58225775",
"0.58004797",
"0.5797745",
"0.5797745",
"0.5797745",
"0.5797745",
"0.5797745",
"0.57977... | 0.0 | -1 |
Setup the instance methods, fields, etc. on the association owning class. | def setup!
setup_defaults!
setup_instance_methods!
@owner_class.embedded = true
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_associations; end",
"def setup!\n setup_instance_methods!\n @owner_class.embedded_relations = @owner_class.embedded_relations.merge(name => self)\n @owner_class.aliased_fields[name.to_s] = store_as if store_as\n self\n end",
"def setup_associates(klass, rela... | [
"0.7657987",
"0.7603321",
"0.65178555",
"0.6431459",
"0.6395818",
"0.6360205",
"0.61765134",
"0.61361146",
"0.61005175",
"0.60801756",
"0.5988589",
"0.597291",
"0.5960046",
"0.5908261",
"0.58711827",
"0.5838305",
"0.58278316",
"0.57362074",
"0.57287663",
"0.57267123",
"0.5721... | 0.6479943 | 3 |
Is this association type embedded? | def embedded?; true; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embedded?\n self.class.embedded?\n end",
"def association?(object, associations); end",
"def associated?\n @associated\n end",
"def embedded_many?\n metadata && metadata.macro == :embeds_many\n end",
"def embedded?\n @embedded ||= (cyclic ? _parent.present? : self.class.embedde... | [
"0.7803465",
"0.7442363",
"0.7348209",
"0.7190699",
"0.7169406",
"0.7152623",
"0.7147541",
"0.7135776",
"0.6990384",
"0.6977484",
"0.6940877",
"0.6917507",
"0.6912645",
"0.6881951",
"0.6869063",
"0.685434",
"0.68388087",
"0.6824171",
"0.6821763",
"0.6811377",
"0.6795039",
"... | 0.0 | -1 |
Does this association type store the foreign key? | def stores_foreign_key?; false; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foreign_key?\n true\n end",
"def stores_foreign_key?; true; end",
"def stores_foreign_key?\n false\n end",
"def is_foreign_key?\n association.present?\n end",
"def foreign_key?\n @ref_table ? true : false\n end",
"def foreign_key?\n false\n ... | [
"0.80957913",
"0.79947084",
"0.79917634",
"0.79694086",
"0.77857506",
"0.7761964",
"0.75099933",
"0.75099933",
"0.750269",
"0.74985445",
"0.7303387",
"0.7192919",
"0.71860105",
"0.70742124",
"0.7054133",
"0.7054133",
"0.69969445",
"0.69837224",
"0.69400215",
"0.6842183",
"0.6... | 0.7833693 | 5 |
The default for validating the association object. | def validation_default; false; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validation_default; true; end",
"def validation_default; true; end",
"def validate_single_association(reflection)\n association = association_instance_get(reflection.name)\n record = association && association.reader\n association_valid?(reflection, record) if record && (record.ch... | [
"0.7084825",
"0.7084825",
"0.66095936",
"0.6389959",
"0.622675",
"0.6213225",
"0.6213225",
"0.6213225",
"0.6213225",
"0.61723125",
"0.60954636",
"0.6078461",
"0.5996937",
"0.5916771",
"0.5910694",
"0.58916867",
"0.58906955",
"0.5845207",
"0.5840826",
"0.582982",
"0.5827795",
... | 0.67545927 | 2 |
The key that is used to get the attributes for the associated object. | def key
@key ||= name.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key\n @attributes[:key]\n end",
"def key\n @attributes[:key]\n end",
"def key\n attributes[:key]\n end",
"def key\n attributes['key'] or raise NoKeySpecified\n end",
"def key_value\n @attrs[self.class.key_attribute.to_s]\n end",
"def dynamo_attribute_key\n ... | [
"0.85119003",
"0.85119003",
"0.8497106",
"0.80031556",
"0.753383",
"0.75299054",
"0.7491704",
"0.74671555",
"0.74247295",
"0.73532903",
"0.72925603",
"0.7265418",
"0.72579104",
"0.72579104",
"0.72464097",
"0.72464097",
"0.72042423",
"0.7192115",
"0.7192115",
"0.7167808",
"0.7... | 0.7109196 | 25 |
Get the association proxy class for this association type. | def relation
Proxy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def true_class\n return AssociationProxyWrapper\n end",
"def proxy_class\n @proxy_class ||= if klass.embeddable?\n polymorphic? ? ManyEmbeddedPolymorphicProxy : ManyEmbeddedProxy\n else\n if polymorphic?\n ManyPolymorphicProxy\n elsif as?\n ... | [
"0.71153265",
"0.70509326",
"0.66959715",
"0.6568533",
"0.65084445",
"0.64965916",
"0.6481051",
"0.6477464",
"0.63622963",
"0.61739",
"0.6115749",
"0.6112852",
"0.60545766",
"0.5995179",
"0.5952951",
"0.58629525",
"0.58464855",
"0.58453155",
"0.5840133",
"0.58279663",
"0.5818... | 0.5185765 | 72 |
Is this association polymorphic? | def polymorphic?
!!@options[:polymorphic]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polymorphic?\n @reflection.polymorphic? == true\n end",
"def polymorphic?\n !!@polymorphic_as\n end",
"def polymorphic?\n @polymorphic == true || !@as.nil?\n end",
"def polymorphic?\n return false unless target_class.is_a?(Class)\n return target_class.ann(:self, :polymor... | [
"0.8167815",
"0.8144032",
"0.8049462",
"0.790025",
"0.7871359",
"0.7871359",
"0.7748374",
"0.7569701",
"0.74109477",
"0.7230506",
"0.71659225",
"0.71587175",
"0.71380854",
"0.7068267",
"0.7044219",
"0.69684315",
"0.69449896",
"0.69006777",
"0.68973875",
"0.68878347",
"0.68753... | 0.7550362 | 8 |
The nested builder object. | def nested_builder(attributes, options)
Nested::One.new(self, attributes, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def builder\n @builder ||= Builder.new(self)\n end",
"def nested_builder(metadata, attributes, options)\n Builders::NestedAttributes::One.new(metadata, attributes, options)\n end",
"def builder\n ::JSON::SchemaDsl::Builder.define_builder(self)\n end",
"def build bu... | [
"0.7851233",
"0.76532924",
"0.7537575",
"0.74855673",
"0.7220183",
"0.7220183",
"0.7220183",
"0.71033514",
"0.70678",
"0.7060022",
"0.69834024",
"0.69834024",
"0.6980505",
"0.6980217",
"0.6980217",
"0.6942195",
"0.6940773",
"0.68732524",
"0.6637305",
"0.65924233",
"0.6518731"... | 0.7687178 | 1 |
Set up default values for any options used by this association. | def setup_defaults!
@options[:touch] = true unless @options.key?(:touch)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_options\n end",
"def options\n defaults.merge!(@options)\n end",
"def options\n defaults.merge!(@options)\n end",
"def default_options=(opts); end",
"def default_options\n @default_options ||= {}\n end",
"def default_options\n { }\n e... | [
"0.7796743",
"0.7491083",
"0.7491083",
"0.7329886",
"0.7285314",
"0.72443974",
"0.7239905",
"0.72134626",
"0.72134626",
"0.72134626",
"0.7205164",
"0.7205164",
"0.72014934",
"0.71834224",
"0.7144427",
"0.7144427",
"0.7144427",
"0.71143824",
"0.7109103",
"0.7100497",
"0.710013... | 0.0 | -1 |
validates_uniqueness_of :receiver_id, :scope=>[:type,:finance_fee_category_id],:message=>'Discount already exists for the student category' | def category_name
c =StudentCategory.find(self.receiver_id)
c.name unless c.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniqueness_for_school_and_subject\n school = School.find(school_id)\n school.courses.where(subject_id: subject_id).each do |course|\n if (course.call_number == call_number)\n errors.add(:course, 'course call number already exists')\n return\n elsif (course.friendly_name == friendl... | [
"0.59618723",
"0.5809653",
"0.5747706",
"0.56072927",
"0.55654716",
"0.5534405",
"0.5525214",
"0.5523972",
"0.5493883",
"0.5458232",
"0.5452154",
"0.5440597",
"0.5438545",
"0.5432006",
"0.5404658",
"0.54014343",
"0.5390762",
"0.53791445",
"0.5330267",
"0.53256917",
"0.5313218... | 0.0 | -1 |
def check_is_manage raise() if User.find(session[:user_id]).role_id == 1 end | def index
@applyment_credits = ClientCredit.where(credit_state: 0).page(params[:applyment_credits_page].to_i)
cur_date = Timemachine.get_current_date + 1.day
@opened_credits = ClientCredit.where("credit_state = 1 and begin_date <= '#{cur_date}'").page(params[:opened_credits_page].to_i)
@closed_credits... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_role\n if current_user && current_user.has_role?(:admin)\n return\n else\n flash[:notice]= \"You are not authorised to access the page you sought.\"\n redirect_to root_path\n end\n end",
"def require_user_can_manage( object )\n\t\tunless ( object.user == @current_... | [
"0.7691989",
"0.75436336",
"0.7486617",
"0.74711984",
"0.7373419",
"0.73732656",
"0.7371611",
"0.73527837",
"0.73295325",
"0.7291084",
"0.7291084",
"0.7222057",
"0.7219068",
"0.720519",
"0.7195676",
"0.71938276",
"0.71831274",
"0.7179725",
"0.7175987",
"0.7148262",
"0.7138907... | 0.0 | -1 |
By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed n, find the sum of the evenvalued terms. | def fiboEvenSum(number)
sum = 0
previousDigit = 1
fiboDigit = 0;
while fiboDigit < number
temp = fiboDigit
fiboDigit += previousDigit
previousDigit = temp
if fiboDigit % 2 == 0
sum += fiboDigit
end
end
sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sumOfEvenFibonacciNumbersUnderN(n)\n\n return 0 if n <= 2 \n \n fibonacci = [0,1]\n total = 0\n\n until fibonacci.last >= n\n \tfibonacci << fibonacci.last + fibonacci[-2]\n \ttotal += fibonacci[-1] if fibonacci[-1].even? \n end\n\n total \n\nend",
"def sum_even_fib_terms(max)\n sum = 0\n \n # ini... | [
"0.8281229",
"0.8248102",
"0.8208883",
"0.8060552",
"0.80514735",
"0.80452687",
"0.8003215",
"0.79879856",
"0.79279906",
"0.7867757",
"0.78526413",
"0.78052247",
"0.7774127",
"0.77703285",
"0.7761765",
"0.775875",
"0.7757881",
"0.7745574",
"0.7737954",
"0.77371055",
"0.771703... | 0.7512277 | 28 |
override this so user isn't signed in after resetting password | def update
self.resource = resource_class.reset_password_by_token(resource_params)
if resource.errors.empty?
resource.unlock_access! if unlockable?(resource)
flash_message = resource.active_for_authentication? ? :updated_not_active : :updated
set_flash_message(:notice, flash_message) if is_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleared_required\n if current_user\n if current_user.cleared\n return\n end\n raise 'Du är ännu inte godkänd för att tippa.'\n end\n redirect_to \"/login\", notice: 'Logga in för att tippa.'\n end",
"def reset_password(*args)\n self.legacy_password = false\n super\n end... | [
"0.7001278",
"0.69912344",
"0.69188863",
"0.6915404",
"0.6754631",
"0.6752775",
"0.6738189",
"0.6678064",
"0.6651922",
"0.66471124",
"0.66435194",
"0.66415775",
"0.6613275",
"0.6610481",
"0.66050506",
"0.6598001",
"0.6576015",
"0.65716267",
"0.65628636",
"0.6559661",
"0.65487... | 0.0 | -1 |
Returns all files declaring the object in the form of an Array of Arrays containing the location of their declaration. | def files
return [] unless meta?
filename = meta['path'] + '/' + meta['filename']
[
Inch::Utils::CodeLocation.new('', filename, meta['lineno'])
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_files\n source_files.map { |file| object_path( file ) }\n end",
"def filepaths\n object.object_files.map(&:relative_path)\n end",
"def referenced_files\r\n\t\t(\r\n\t\t\t[file] +\r\n\t\t\t%w[sourcepath importfile].flat_map do |att|\r\n\t\t\t\tfind(att=>/./).flat_map do |asset|\r\n\t\t\t\... | [
"0.678622",
"0.65900815",
"0.6570874",
"0.64412177",
"0.63566965",
"0.6317068",
"0.6174546",
"0.6155858",
"0.6130992",
"0.60925984",
"0.6089602",
"0.60883653",
"0.60883653",
"0.60714364",
"0.6064021",
"0.60207593",
"0.6017876",
"0.6003217",
"0.6002084",
"0.5995504",
"0.599334... | 0.68637747 | 0 |
Returns +true+ if the name starts with an underscore (_). | def private_name?
fullname =~ /(\A|#|\.)_/
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n self.name.match(/^[a-zA-Z0-9_]+$/) ? true : false\n end",
"def miga_name?\n !(self !~ /^[A-Za-z0-9_]+$/)\n end",
"def showTitle?(string)\n return string.start_with?(\"_\") ? false : true\n end",
"def underscore_name(name)\n name.to_s.sub(/.*::/, \"\").\n gsub(/([... | [
"0.72921276",
"0.7234981",
"0.7180647",
"0.6991956",
"0.69722706",
"0.69564676",
"0.69327074",
"0.6773758",
"0.67607206",
"0.6725894",
"0.671959",
"0.67022514",
"0.66285694",
"0.6553683",
"0.65516853",
"0.6516987",
"0.651212",
"0.64603305",
"0.64482814",
"0.6418655",
"0.63907... | 0.6809491 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.