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 |
|---|---|---|---|---|---|---|
method called to check status of player | def status
"#{@name}: #{@lives}/3 "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status\n return @player_status\n end",
"def game_status\n @player = Player.find(params[:id])\n\n # unless @player.is_boss?\n # redirect_to :root, :notice => \"Sorry, the game is closed right now. Please try again later.\"\n # return false\n # end\n end",
"def check_status(input... | [
"0.75374794",
"0.74312884",
"0.73902035",
"0.7343704",
"0.7092123",
"0.6934004",
"0.6861569",
"0.68457997",
"0.6812909",
"0.6799356",
"0.6706606",
"0.6671716",
"0.66568947",
"0.6641653",
"0.6626551",
"0.658123",
"0.6577484",
"0.65753275",
"0.6571924",
"0.6567055",
"0.6504769"... | 0.0 | -1 |
not working, but it works in pry and with Sinatra! Is this a DB/sql/ruby communication issue? | def test_products()
assert_equal(1, @manufacturer1.products.length())
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(statement, *params) #Use of splat(*) parameter used with methods where you don't know how many arguements it will take \n @logger.info \"#{statement}: #{params}\" #Funtionailty for the ability to see in the local host terminal d-bug output from sinatra showing all of the requests it's accepting; this ... | [
"0.64253706",
"0.6312329",
"0.6312329",
"0.62858933",
"0.62858933",
"0.6123554",
"0.6035761",
"0.6007451",
"0.59899205",
"0.5974514",
"0.59158546",
"0.58964473",
"0.5878072",
"0.58687985",
"0.5855671",
"0.58528715",
"0.58119154",
"0.5757109",
"0.573208",
"0.57237154",
"0.5700... | 0.0 | -1 |
Used to compare replica activity to master. Raises exception if it does not match. | def activity_database_matches_self?(replica_host)
# Save a beaker host_hash[:vmhostname], set it to the supplied host_name param,
# and then set it back to the original at the end of the ensure. The :vmhostname
#overrides the host.hostname, and nothing should win out over it.
original_ho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"] || \"\"\n NOT_MASTER.include?(details[\"code\"]) || err.include?(\"not master\")\n end",
"def replica_db_synced_with_master_db?(replica_host, agents)\n # Save a beaker host_hash[:vmhostna... | [
"0.637921",
"0.6231596",
"0.60743034",
"0.60722005",
"0.5926624",
"0.57992303",
"0.5774051",
"0.56686366",
"0.56229943",
"0.56208205",
"0.5578571",
"0.5549842",
"0.55375403",
"0.547099",
"0.5468999",
"0.5359688",
"0.533668",
"0.53181374",
"0.5313121",
"0.5307349",
"0.52732664... | 0.65993315 | 0 |
token = lastfm.auth.get_token lastfm.session = lastfm.auth.get_session(token: token)['key'] | def index
if !params[:artist_name].empty?
lastfm = Lastfm.new(ENV["LASTFM_KEY"], ENV["LASTFM_SECRET"])
@videos = Yt::Collections::Videos.new
artistspotify = RSpotify::Artist.search(params[:artist_name])
artistlastfm = lastfm.artist.get_info(artist: params[:artist_name], autocorrect: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_session_key(&blk)\n doc = last_fm_web_service(\"method\" => \"auth.gettoken\")\n request_token = doc.value_at(\"//token\")\n\n yield \"http://www.last.fm/api/auth/?api_key=#{api_key}&token=#{request_token}\"\n\n doc = last_fm_web_service(\"method\" => \"auth.getsession\", \"token\" => request... | [
"0.74729156",
"0.6921594",
"0.6785755",
"0.655217",
"0.65108144",
"0.6467079",
"0.6412876",
"0.63401604",
"0.6318973",
"0.62487674",
"0.6244067",
"0.6201228",
"0.616665",
"0.6097841",
"0.6081311",
"0.6079801",
"0.60713",
"0.6063498",
"0.60267687",
"0.60267687",
"0.60267687",
... | 0.0 | -1 |
Always allow trending channel to refresh | def refresh_content force=true
super force do |new_videos|
start = Time.now
# We want 1 mention to have effect over 4 hours.
# 10,000 is default for 1 mention and we refresh 4 times an hour.
# 15% geometric decay will be close to having a half life of 1 hour.
percent = 15
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh; schedule_update end",
"def refresh!; end",
"def periodic_flush\n true\n end",
"def refresh; end",
"def low_frequency\n log \"Updating event status\"\n M2mhub::Event.open_or_recently_closed.each(&:update_status!)\n log \"Finished\"\n true\n end",
"def require_recollect_status... | [
"0.6121281",
"0.59162754",
"0.5913696",
"0.56633615",
"0.56480896",
"0.5600766",
"0.55975145",
"0.55218667",
"0.55218667",
"0.55012625",
"0.5488418",
"0.5471041",
"0.54547906",
"0.54547906",
"0.5453676",
"0.5449121",
"0.5435895",
"0.5417045",
"0.54007417",
"0.5399756",
"0.539... | 0.0 | -1 |
calculate fitting DP, Equipment DP, Control Valve DP, Orifice DP | def calculate_and_save_delta_ps
fittings = PipeSizing.fitting1
orifice_id = nil
fittings.each {|item| orifice_id = item[:id] if item[:value] == 'Orifice' }
orifice_dp = self.discharge_circuit_piping.sum(:delta_p, :conditions => ['fitting = ? ', orifice_id])
#calculate flow elements sum
flow_elem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcWeightAndValue(possible_solution)\r\n \r\n @sum_weight=0\r\n @sum_value=0\r\n \r\n (0...@optionSize).each do |idx|\r\n if possible_solution.m_Data[idx] \r\n\r\n @sum_weight += @itemWeight[idx].to_f\r\n @sum_value += @itemValue[idx].to_f\r\n\r\n end \r\n end\r\n \r\n ... | [
"0.6230001",
"0.61995167",
"0.5800942",
"0.5762919",
"0.57119083",
"0.56351215",
"0.55822134",
"0.5579863",
"0.55704415",
"0.5487304",
"0.5486189",
"0.5436457",
"0.54208046",
"0.53925985",
"0.5377868",
"0.5361897",
"0.53607035",
"0.5360508",
"0.53583485",
"0.53476506",
"0.534... | 0.6855408 | 0 |
the hash representing this model that is returned by the api | def api_attributes
{
:id => id.to_s,
:type => self.class.name.underscore.downcase,
:user => user.api_attributes,
:member_type => member_type.api_attributes,
:first_name => first_name,
:last_name => last_name,
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n attributes.hash\n end",
"def hash\n model.hash + key.hash\n end",
"def hash\n data.hash\n end",
"def serialize\n self.to_hash.to_json\n end",
"def hash\n self.cl... | [
"0.77144927",
"0.77144927",
"0.77144927",
"0.75544244",
"0.7312346",
"0.7219866",
"0.72182775",
"0.7175903",
"0.7175808",
"0.7063066",
"0.7049345",
"0.7045115",
"0.70366234",
"0.7022752",
"0.7008443",
"0.699794",
"0.6971193",
"0.69692934",
"0.693788",
"0.6925338",
"0.6890506"... | 0.0 | -1 |
Detail of each constraint | def detail_each_macro(f)
f.printf("\n## Detail of each attribute\n")
# @attribute_all.each{|key,value|
@attribute_all.sort_by{|key,value|
value[3].No.to_i
}.each{|key,value|
next if value[3].No == nil
if value[0] != "NONNEED" && ( value[3].ConstNumber + value[3].RemoveNumber ) != 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constraints; end",
"def constraints; end",
"def constraints; end",
"def descriptions\n\t\treturn self.constraints.each_with_object({}) do |(field,constraint), hash|\n\t\t\thash[ field ] = constraint.description\n\t\tend\n\tend",
"def dump_constraints\n cs = constraints.map do |c|\n c = ... | [
"0.75605035",
"0.75605035",
"0.75605035",
"0.7034625",
"0.686391",
"0.6854615",
"0.67769563",
"0.6501502",
"0.6387589",
"0.6329856",
"0.62363505",
"0.62265503",
"0.6191895",
"0.61092937",
"0.6092772",
"0.6085378",
"0.60591394",
"0.6038744",
"0.59831953",
"0.5978661",
"0.59758... | 0.5013464 | 88 |
generate remomve_constraint list file | def remove_const
file_name = @dir + "remove_const_list.txt"
printf("@I:generate %s\n",file_name)
f = open("#{file_name}","w")
comment = "Removed constraint list"
Common.print_file_header(f,"#{comment}",$TOOL,$VERSION,"##")
i = 0
@attribute_all.each{|attribute_name,data|
data[1].ea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_requirements\n @parser.requirements.each do |name, value|\n editor = ModelEditor.new(name.snake_case)\n editor.insert(AFTER_RELATIONSHIPS, value.collect{|v| \" # #{v}\"}.join(\"\\n\"))\n end\n end",
"def dump_constraints\n cs = constraints.map do |c|\n c = c.dup\n ... | [
"0.5845414",
"0.572446",
"0.5661486",
"0.54556733",
"0.53793186",
"0.53486353",
"0.53235114",
"0.51774156",
"0.51609385",
"0.51609385",
"0.51609385",
"0.514641",
"0.5146019",
"0.51038307",
"0.50942767",
"0.5069242",
"0.5067571",
"0.50009906",
"0.4977893",
"0.49757668",
"0.492... | 0.6364003 | 0 |
Synplify Rpt error report | def rpt_error(error_list)
file_name = @dir + "rpt_error_list.txt"
printf("@I:generate %s\n",file_name)
f = open("#{file_name}","w")
comment = "Error attribute list refferd from Synplify Rpt file"
Common.print_file_header(f,"#{comment}",$TOOL,$VERSION,"##")
print_synplify_rpt(f,error_list)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def srr_error(error_list)\n file_name = @dir + \"srr_error_list.csv\"\n printf(\"@I:generate %s\\n\",file_name)\n f = open(\"#{file_name}\",\"w\")\n comment = \"Error attribute list refferd from Synplify Srr file\" \n Common.print_file_header(f,\"#{comment}\",$TOOL,$VERSION,\"##\") \n print_sy... | [
"0.63619655",
"0.5953014",
"0.5689427",
"0.5662776",
"0.5651415",
"0.5646512",
"0.5638289",
"0.5628051",
"0.56272256",
"0.56272256",
"0.56272256",
"0.56272256",
"0.56233835",
"0.56233835",
"0.56233835",
"0.56233835",
"0.56233835",
"0.56233835",
"0.56233835",
"0.56233835",
"0.... | 0.7367216 | 0 |
Synplify Srr error report | def srr_error(error_list)
file_name = @dir + "srr_error_list.csv"
printf("@I:generate %s\n",file_name)
f = open("#{file_name}","w")
comment = "Error attribute list refferd from Synplify Srr file"
Common.print_file_header(f,"#{comment}",$TOOL,$VERSION,"##")
print_synplify_srr(f,error_list)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(ex) [:error, ex]; end",
"def errors=(_); end",
"def rpt_error(error_list)\n file_name = @dir + \"rpt_error_list.txt\"\n printf(\"@I:generate %s\\n\",file_name)\n f = open(\"#{file_name}\",\"w\")\n comment = \"Error attribute list refferd from Synplify Rpt file\" \n Common.print_file_he... | [
"0.6310264",
"0.60133964",
"0.60034883",
"0.5933804",
"0.5933804",
"0.5933804",
"0.5933804",
"0.59056324",
"0.59056324",
"0.5888008",
"0.58869565",
"0.5801906",
"0.57841396",
"0.57841396",
"0.57841396",
"0.57841396",
"0.57841396",
"0.57841396",
"0.57841396",
"0.57695836",
"0.... | 0.65069985 | 0 |
isbn.delete(" ") is an alternative to gsub | def valid_isbn_ten_check_sum?(isbn)
ten_digit_array = isbn.chars.map!(&:to_i) #takes isbn and turns the string into an array
#splits string into array of individual characters as integers and is shorthand for something longer
sum = 0
ten_digit_array.each_with_index do |value, index|
break if index == 9
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup_isbn(isbn)\n return isbn.downcase.gsub(\"-\", \"\").gsub(\" \", \"\") #return statement is optional\n end",
"def removing_spaces(isbn)\r\n\tisbn.gsub(\" \", \"\") #this strips the space and redefines isbn using the !\r\nend",
"def cleanup(isbn_)\n isbn_.gsub(/[^0-9xX]/,'').gsub(/x/,'X') unle... | [
"0.84184057",
"0.81563795",
"0.73968065",
"0.73047024",
"0.70291066",
"0.6746039",
"0.6635022",
"0.6426283",
"0.63386244",
"0.62967104",
"0.62847567",
"0.6219736",
"0.61990154",
"0.617697",
"0.613311",
"0.6106145",
"0.6092984",
"0.6091522",
"0.6083517",
"0.6068975",
"0.606171... | 0.0 | -1 |
if ten_digit_array.last == 7 true else false end def valid_isbn_ten_check_sum?(isbn) isbn[9] == "7" end | def removing_spaces(isbn)
isbn.gsub(" ", "") #this strips the space and redefines isbn using the !
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_isbn_ten_check_sum?(isbn)\t\r\n\tten_digit_array = isbn.chars.map!(&:to_i) #takes isbn and turns the string into an array\r\n\t#splits string into array of individual characters as integers and is shorthand for something longer\r\n\tsum = 0\r\n\tten_digit_array.each_with_index do |value, index|\r\n\t\tbr... | [
"0.8293311",
"0.79967767",
"0.7733259",
"0.75393105",
"0.74211574",
"0.7354295",
"0.7336746",
"0.7296459",
"0.7242581",
"0.7225771",
"0.7179003",
"0.7141772",
"0.70375544",
"0.6898894",
"0.67114204",
"0.6699024",
"0.66809154",
"0.66441184",
"0.6612212",
"0.66092455",
"0.65909... | 0.0 | -1 |
GET /api/v1/quizzes/:id/questions Return [Array] The questions belongs to Quiz | def get_questions
result = QuizQuestion.includes(:quiz_answers).where(quiz_id: params[:id])
@questions = result.map { |question| QuestionPresenter.new(question) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:quiz_id]\n @quiz = Quizzes::Quiz.find(params[:quiz_id])\n @quizzes_questions = @quiz.questions\n else\n @quizzes_questions = Quizzes::Question.all\n end\n end",
"def quiz_questions\n @questions = set_quiz.questions\n end",
"def index\n @quizzes_answers = Q... | [
"0.7757481",
"0.7436122",
"0.7322714",
"0.73040736",
"0.727182",
"0.727182",
"0.727182",
"0.727182",
"0.727182",
"0.7259046",
"0.7115922",
"0.6775137",
"0.67719156",
"0.67458314",
"0.67427397",
"0.6740824",
"0.67110014",
"0.67105454",
"0.67031777",
"0.6679166",
"0.66615987",
... | 0.7655804 | 1 |
Write a method named include? that takes an Array and a search value as arguments. This method should return true if the search value is in the array, false if it is not. You may not use the Arrayinclude? method in your solution. | def include?(list, search)
return false if list.empty? && search == nil
list.find { |elem| elem == search } == search ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include?(array, search)\n array.each do |value|\n return true if value == search\n end\n false\nend",
"def include?(arr, search)\n arr.any? { |i| i == search }\nend",
"def include?(array, search_value)\n array.any? { |element| element == search_value }\nend",
"def include?(arr, search)\n arr.any... | [
"0.87326545",
"0.85657823",
"0.8560463",
"0.85333633",
"0.8532482",
"0.8438709",
"0.83998626",
"0.83944684",
"0.83707404",
"0.8356435",
"0.83171815",
"0.83064926",
"0.82936645",
"0.8166435",
"0.81390876",
"0.8131782",
"0.81212556",
"0.8113741",
"0.8108487",
"0.80804485",
"0.8... | 0.7954991 | 27 |
probably easier if I just Enumerableeach'ed my through this one and compared each element to the search value, and having to adjust for the edge case isn't cute cooler version from solution that uses double bang to get to the bottom of things, by calling it on the return value of find_index | def include?(list, search)
!!list.find_index(search)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(value)\n result = -1\n @inner.each_with_index do |item, index|\n if value == item\n result = index\n break\n end\n end\n return result\n end",
"def search(nums, target)\n nums.each_with_index do |num, index|\n return index if num == target\n end\n -1\nend",
"... | [
"0.7767514",
"0.77580535",
"0.7680273",
"0.7615405",
"0.75249195",
"0.75098276",
"0.7503532",
"0.7438811",
"0.74349356",
"0.74307853",
"0.74213344",
"0.7361467",
"0.7347601",
"0.7345435",
"0.73011935",
"0.7298717",
"0.7280243",
"0.7278073",
"0.7259315",
"0.7242459",
"0.724107... | 0.0 | -1 |
def index if params[:user_id] | def show
@registration = Registration.find(params[:id])
@user= User.find(params[:user_id])
@race= @registration.race
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\n\t\t@user = User.find( params[:id] )\n\t\tindex\n\t\trender :action => 'index'\n\tend",
"def index\n @user = User.find(params[:user_id])\n @conditions = @user.conditions\n\n if current_user.id == @user.id\n\t\t\trender action: :index\n\t\telse\n\t\t\trender file: 'public/denied'\n\t\tend\n en... | [
"0.75978035",
"0.7482628",
"0.7442924",
"0.74306595",
"0.7401056",
"0.73101413",
"0.7307269",
"0.72584224",
"0.72563046",
"0.7237396",
"0.7237396",
"0.7153785",
"0.71447855",
"0.7084278",
"0.7080435",
"0.70189434",
"0.70189434",
"0.700952",
"0.70002294",
"0.6966601",
"0.69540... | 0.0 | -1 |
has_many :posts, serializer: PostSerializer | def editable
if scope && scope[:user_id] && object.user_id == scope[:user_id]
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def posts\n ActiveModelSerializers::SerializableResource.new(object.posts, each_serializer: CreatorSerializer)\n end",
"def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"def related_posts; end",
"def show\n render json: @post, serializer: Api:... | [
"0.7620991",
"0.70178753",
"0.65289134",
"0.65227085",
"0.6278223",
"0.625466",
"0.6243741",
"0.6243741",
"0.62053734",
"0.6204112",
"0.6153588",
"0.61269164",
"0.60828656",
"0.60828656",
"0.6031481",
"0.60287416",
"0.6025184",
"0.58823955",
"0.5874721",
"0.58741826",
"0.5874... | 0.0 | -1 |
GET /ae_module/documents/:id/edit def edit end POST /ae_module/documents | def create
@document = @adverse_event.ae_documents.where(project: @project, user: current_user).new(ae_document_params)
if @document.save
@document.uploaded!(current_user)
redirect_to ae_module_documents_path(@project, @adverse_event), notice: "Document was successfully created."
else
ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @document = @semester.documents.find(params[:id])\n end",
"def edit\n\t\t@post = @document.post\n\tend",
"def edit\n\n end",
"def update\n\t\traise RuntimeError, \"Not authorized\" unless current_user && current_user.root? == true\n\n\t\tparams = doc_params\n\t\tparams[:body].gsub!(/\\r... | [
"0.7399207",
"0.72780263",
"0.7088958",
"0.70618266",
"0.7024553",
"0.69883776",
"0.6979485",
"0.6956986",
"0.6956194",
"0.69554293",
"0.6951092",
"0.6946643",
"0.69430095",
"0.6929394",
"0.69225574",
"0.6915349",
"0.6915349",
"0.6915349",
"0.69081837",
"0.68868357",
"0.68723... | 0.0 | -1 |
state if they are happy and/or clean The clean? and happy? methods are pretty similiar: they should return true if the happiness or hygiene points exceed seven. Otherwise they should return false. | def happy?
if @happiness > 7
return true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def happy?\n if @happiness > 7\n true\n else\n false\n end\n end",
"def happy?\n return @happiness > 7\n end",
"def happy?\nif @happiness >7\n\ttrue\nelse\n\tfalse\nend\nend",
"def happy?\n @happiness > 7\n end",
"def happy?\n happiness >... | [
"0.78021455",
"0.7768874",
"0.7592377",
"0.7516469",
"0.75142574",
"0.74299246",
"0.7240974",
"0.7196637",
"0.714345",
"0.71143466",
"0.71054274",
"0.70250523",
"0.70250523",
"0.69822145",
"0.696354",
"0.696354",
"0.69614494",
"0.6859047",
"0.6859047",
"0.6859047",
"0.679125"... | 0.78360677 | 0 |
above you can edit what you would like to see or NOT see if a person is signed in or not GET /funnies GET /funnies.json | def index
@funnies = Funny.all.order("created_at DESC").paginate(:page => params[:page], :per_page => 10) # .all gives you all of them in which they were created
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n authorize! :update, Hospital\n end",
"def show\n\n @user = User.find(params[:id])\n @is_an_interest = !Visible.where(hidden_user: params[:id], user_of_interest: @user).nil?\n\n if @user.event_id.present?\n @event = Location.find(Event.find(@user.event_id).location_id).name\n end\n... | [
"0.5877358",
"0.5861438",
"0.58594483",
"0.5846753",
"0.58058006",
"0.57317764",
"0.5727807",
"0.57269454",
"0.5710414",
"0.56930983",
"0.56788486",
"0.56748664",
"0.5671344",
"0.5669234",
"0.5656159",
"0.5643506",
"0.56393534",
"0.56380767",
"0.5626876",
"0.5622915",
"0.5613... | 0.0 | -1 |
GET /funnies/1 GET /funnies/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @funs = Fun.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @funs }\n end\n end",
"def show\n @fun = Fun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fun }\... | [
"0.6833884",
"0.6757539",
"0.6754047",
"0.63274974",
"0.6277143",
"0.623873",
"0.6117645",
"0.60839146",
"0.60511",
"0.6041016",
"0.6033747",
"0.60193616",
"0.6010289",
"0.599859",
"0.5971216",
"0.5966373",
"0.59568983",
"0.5955549",
"0.5950943",
"0.5935102",
"0.59294015",
... | 0.0 | -1 |
this is another way to create a funny GET /funnies/1/edit | def edit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; e... | [
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"0.7261025",
"... | 0.0 | -1 |
POST /funnies POST /funnies.json | def create
@funny = current_user.funnies.build(funny_params)
respond_to do |format|
if @funny.save
format.html { redirect_to @funny, notice: 'Funny was successfully created.' }
format.json { render :show, status: :created, location: @funny }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @fun = Fun.new(params[:fun])\n\n respond_to do |format|\n if @fun.save\n format.html { redirect_to @fun, :notice => 'Fun was successfully created.' }\n format.json { render :json => @fun, :status => :created, :location => @fun }\n else\n format.html { render :actio... | [
"0.6275808",
"0.61566633",
"0.6028478",
"0.57831514",
"0.5708085",
"0.57016337",
"0.56870306",
"0.55942893",
"0.55641055",
"0.5561123",
"0.54838157",
"0.5480628",
"0.54772526",
"0.5429574",
"0.54159695",
"0.5387716",
"0.5385237",
"0.536442",
"0.53614694",
"0.53539854",
"0.535... | 0.6223318 | 1 |
PATCH/PUT /funnies/1 PATCH/PUT /funnies/1.json | def update
respond_to do |format|
if @funny.update(funny_params)
format.html { redirect_to @funny, notice: 'Funny was successfully updated.' }
format.json { render :show, status: :ok, location: @funny }
else
format.html { render :edit }
format.json { render json: @funny.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @fun = Fun.find(params[:id])\n\n respond_to do |format|\n if @fun.update_attributes(params[:fun])\n format.html { redirect_to @fun, :notice => 'Fun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n... | [
"0.66290295",
"0.6426267",
"0.6380119",
"0.6367494",
"0.6341238",
"0.62505865",
"0.6122758",
"0.6095275",
"0.60798484",
"0.5973719",
"0.59690446",
"0.59422326",
"0.5892451",
"0.585856",
"0.5838349",
"0.58320355",
"0.5830294",
"0.5825941",
"0.5823993",
"0.5811594",
"0.5811594"... | 0.5853577 | 14 |
DELETE /funnies/1 DELETE /funnies/1.json | def destroy
@funny.destroy
respond_to do |format|
format.html { redirect_to funnies_url, notice: 'Funny was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @fun = Fun.find(params[:id])\n @fun.destroy\n\n respond_to do |format|\n format.html { redirect_to funs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @funeral.destroy\n\n respond_to do |format|\n format.html { redirect_to funerals_url }\n ... | [
"0.72142625",
"0.6956077",
"0.6936629",
"0.68845505",
"0.68328375",
"0.67646545",
"0.67322576",
"0.673043",
"0.667363",
"0.663177",
"0.6595612",
"0.6592341",
"0.65568477",
"0.65063137",
"0.64838994",
"0.64807993",
"0.64731306",
"0.64731306",
"0.6472837",
"0.64495236",
"0.6438... | 0.66738725 | 8 |
Use callbacks to share common setup or constraints between actions. | def set_funny
@funny = Funny.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.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def funny_params
params.require(:funny).permit(:description, :image)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
The path used after sign up. | def after_inactive_sign_up_path_for(resource)
# super(resource)
session[THANKS_KEY] = { email: resource[:email] }
if resource.individual_use == true
users_thanks_personal_path
else
users_thanks_company_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n root? ? boot_path : user_path\n end",
"def path\n root? ? boot_path : user_path\n end",
"def client_signed_up_path\n path_from_cookie(:after_account_signed_up_path) || path_from_cookie(:after_client_signed_up_path) || edit_user_client_path(current_user)\n end",
"def after_sign_... | [
"0.7448747",
"0.7448747",
"0.7349289",
"0.7244328",
"0.7199158",
"0.7193028",
"0.7124032",
"0.7124032",
"0.71154577",
"0.7111005",
"0.71064454",
"0.7090105",
"0.7076994",
"0.70722765",
"0.7040787",
"0.69848716",
"0.69848716",
"0.69848716",
"0.69848716",
"0.6969613",
"0.696961... | 0.0 | -1 |
GET /tweets GET /tweets.json | def index
if params[:q].present?
@tweets = Tweet.where("title like ? or content like ?", "%#{params[:q]}%", "%#{params[:q]}%")
else
@tweets = Tweet.all
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end",
"def index\n @tweets = @user.tweets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def show_user_tweets\n @user_twee... | [
"0.8115964",
"0.7980523",
"0.7861113",
"0.771004",
"0.7660004",
"0.7516426",
"0.74351203",
"0.7412307",
"0.74091923",
"0.7362535",
"0.73597056",
"0.73010373",
"0.72418493",
"0.7181573",
"0.7124663",
"0.7105023",
"0.70958436",
"0.7094535",
"0.70827615",
"0.70827615",
"0.708276... | 0.0 | -1 |
GET /tweets/1 GET /tweets/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end",
"def index\n @tweets = @user.tweets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def show_user_tweets\n @user_twee... | [
"0.7778678",
"0.7740012",
"0.75967914",
"0.74835896",
"0.74633676",
"0.745958",
"0.74332577",
"0.72234505",
"0.7121512",
"0.70782954",
"0.7053294",
"0.7042362",
"0.7041192",
"0.7039477",
"0.70392036",
"0.69741166",
"0.69741166",
"0.69669175",
"0.6952462",
"0.6949952",
"0.6949... | 0.0 | -1 |
POST /tweets POST /tweets.json | def create
@tweet = Tweet.new(tweet_params)
respond_to do |format|
if @tweet.save
format.html { redirect_to tweets_path, notice: 'Tweet was successfully created.' }
format.json { render :show, status: :created, location: @tweet }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n user = user_from_token\n @tweet = user.tweets.new()\n @tweet.tweet = params[:tweet]\n if @tweet.save\n render :json => @tweet, :status => :created\n else\n render :json => @tweet.errors, :status => :unprocessable_entity\n end\n end",
"def create\n @tweet = current_use... | [
"0.7703068",
"0.7255311",
"0.7185691",
"0.7129174",
"0.7054185",
"0.70179075",
"0.6994355",
"0.69895697",
"0.6970502",
"0.6970502",
"0.69063586",
"0.689271",
"0.68818635",
"0.6881171",
"0.6818261",
"0.6795118",
"0.67859566",
"0.675641",
"0.67340267",
"0.6720174",
"0.6718126",... | 0.70035416 | 6 |
PATCH/PUT /tweets/1 PATCH/PUT /tweets/1.json | def update
check_tweet_for_user
respond_to do |format|
if @tweet.update(tweet_params)
format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }
format.json { render :show, status: :ok, location: @tweet }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @tweet = Tweet.find(params[:id])\n\n respond_to do |format|\n if @tweet.update_attributes(params[:tweet])\n format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.71968454",
"0.71968454",
"0.71968454",
"0.7190497",
"0.71040577",
"0.7085678",
"0.70805085",
"0.7031692",
"0.6947847",
"0.6947847",
"0.6947847",
"0.6947847",
"0.6947256",
"0.6911447",
"0.6911447",
"0.6911447",
"0.6891512",
"0.68812567",
"0.68453866",
"0.6830381",
"0.679388... | 0.6797469 | 20 |
DELETE /tweets/1 DELETE /tweets/1.json | def destroy
check_tweet_for_user
@tweet.destroy
respond_to do |format|
format.html { redirect_to tweets_url, notice: 'Tweet was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n user = user_from_token\n user.tweets.destroy(params[:id])\n head :no_content\n end",
"def destroy\n @tweet = Tweet.find(params[:id])\n @tweet.destroy\n\n respond_to do |format|\n format.html { redirect_to tweets_url }\n format.json { head :no_content }\n end\n end",... | [
"0.7619645",
"0.7450257",
"0.7450257",
"0.7446904",
"0.74289066",
"0.7329418",
"0.7302051",
"0.72898597",
"0.7261742",
"0.7237958",
"0.72130984",
"0.72130984",
"0.72130984",
"0.72130984",
"0.72130984",
"0.72130984",
"0.72105914",
"0.7209531",
"0.7209531",
"0.7209531",
"0.7209... | 0.7120458 | 28 |
Use callbacks to share common setup or constraints between actions. | def check_tweet_for_user
if @tweet.user_id != current_user.id
flash[:notice] = "Not allowed!"
redirect_to tweets_url
return
end
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.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def tweet_params
defaults = { user_id: current_user.id }
params.require(:tweet).permit(:title, :content, :status, :user_id).reverse_merge(defaults)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.6950644",
"0.68134046",
"0.68034387",
"0.6796522",
"0.674668",
"0.6742105",
"0.6527854",
"0.65214247",
"0.6491907",
"0.64294493",
"0.64294493",
"0.64294493",
"0.64004904",
"0.6356768",
"0.63556653",
"0.6348119",
"0.6344521",
"0.63386923",
"0.632588",
"0.632588",
"0.632588"... | 0.0 | -1 |
info name : zhangruochi | def digitize_1(n)
list = []
puts n.to_s
n.to_s.each_char do |char|
list << char.to_i
end
return list.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name() ; info[:name] ; end",
"def info; end",
"def info; end",
"def info\n\tend",
"def funktionsname\n\tanweisung\nend",
"def my_name # Definisi dalam membuat kunci my_name\n puts \"Bagus Wachyu Nuralam\" # Isi dari kunci definisi\nend",
"def get_info\n end",
"def ... | [
"0.7002598",
"0.684158",
"0.684158",
"0.6827845",
"0.66325873",
"0.65484405",
"0.64676243",
"0.64676243",
"0.64676243",
"0.6444237",
"0.6428224",
"0.64033854",
"0.63778996",
"0.63432896",
"0.63378745",
"0.6309526",
"0.6305985",
"0.6298201",
"0.6208081",
"0.6185376",
"0.617114... | 0.0 | -1 |
tries to merge hashes deeply, in case of conflicts yields block if given | def deep_merge(other, &bloc)
other.keys.inject(dup) do |result, key|
begin
case result[key]
when Hash
if other[key].is_a?(Hash)
result[key] = result[key].deep_merge(other[key], &bloc)
result
else
raise MergeConflict
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deep_merge!(other_hash, &block); end",
"def deep_merge!(*other_hashes, &blk); end",
"def deep_merge(*other_hashes, &blk); end",
"def merge(*other_hashes, &blk); end",
"def merge!(*other_hashes, &blk); end",
"def deep_merge!(other_hash, &block)\n merge!(other_hash) do |key, this_val, other_val|... | [
"0.72178644",
"0.7215559",
"0.72031415",
"0.6917968",
"0.6860864",
"0.6852079",
"0.67715013",
"0.67715013",
"0.67244184",
"0.65938514",
"0.65420556",
"0.65356046",
"0.6521196",
"0.64795935",
"0.64694196",
"0.63873065",
"0.63873065",
"0.63873065",
"0.6367961",
"0.6367961",
"0.... | 0.6474893 | 14 |
Tests the URLs and spit out the status code and full url. | def url_tester(method,schema,base_domain,page,query,expected_code,timeout,headers,https_verify,logger)
uri = URI.join("#{schema}://#{base_domain}",page)
http = Net::HTTP.new(uri.host, uri.port)
if schema == "https"
http.use_ssl = true
http.verify_mode = https_verify ? OpenSSL::SSL::VERIFY_PEER : OpenSSL:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_url_status(url)\n begin\n conn = Faraday.new(:url => url)\n response = conn.get\n rescue Faraday::ConnectionFailed => e\n return \"Unknown. Requires attention.\"\n else\n statusNum = response.status\n puts case statusNum\n when 200\n return \"200: Online\"\n ... | [
"0.71084005",
"0.6822823",
"0.68014157",
"0.66713387",
"0.6598682",
"0.6575824",
"0.6518866",
"0.64866006",
"0.6363941",
"0.63506013",
"0.6334306",
"0.63021463",
"0.628362",
"0.62756395",
"0.6264257",
"0.6248308",
"0.62389785",
"0.6217727",
"0.6204517",
"0.6161844",
"0.615803... | 0.6060752 | 25 |
Check the HTTP status codes against our expected response. | def code_parser(returned_code,expected_code,logger)
code_status = false
expected_code.each { |code|
if returned_code == code.to_i
code_status = true
end
}
if code_status
exitcode = OK_STATE
logger.debug_message "Set exit code to #{OK_STATE}. It is #{exitcode}"
else
exitcode = CRITI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_codes_ok?\n response_codes.all? { |code| code == 200 || code == 201 || code == 302 || code == 304 || code == 401 }\n end",
"def validate_http_response! resp\n\t\tif resp['content-length']\n\t\t\tassert_equal resp['content-length'].to_i, resp.body.to_s.bytesize,\n\t\t\t\t\"Content-length mis-... | [
"0.7854537",
"0.7652043",
"0.76219314",
"0.75741506",
"0.7384416",
"0.73838574",
"0.7331008",
"0.7314179",
"0.72755736",
"0.72719103",
"0.7269969",
"0.7254484",
"0.71844304",
"0.7161341",
"0.7112177",
"0.7111456",
"0.70621824",
"0.7034207",
"0.70059776",
"0.6999724",
"0.69922... | 0.0 | -1 |
Get the disc instance in position(row, col) | def [](row, col)
get_disc(row, col)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_disc(row, col)\n @board[row * @size + col]\n end",
"def [](pos)\n r, c = pos[0],pos[1]\n grid[r][c]\n end",
"def [](pos)\n row = pos.first\n col = pos.last\n @grid[row][col]\n end",
"def [](pos)\n row, col = pos\n @grid[row][col]\n end",
"def [](pos)\n row, co... | [
"0.70619375",
"0.6965679",
"0.6926584",
"0.68950576",
"0.6889515",
"0.68684554",
"0.68684554",
"0.6858923",
"0.68194985",
"0.6804466",
"0.6769818",
"0.6761684",
"0.6739183",
"0.6731367",
"0.6721815",
"0.67058915",
"0.670064",
"0.6699289",
"0.6691922",
"0.6639484",
"0.6622448"... | 0.7262484 | 0 |
Set the disc instance in position(row, col) | def []=(row, col, value)
set_disc(row, col, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos=(val)\n #setter method for position \n row, col = val\n @pos = val\n\n end",
"def []=(pos, figure)\n x, y = pos\n @rows[x][y] = figure\n end",
"def[]=(pos, value)\n row = pos.first\n col = pos.last\n @grid[row][col] = value\n end",
"def []=(pos, value)\n ro... | [
"0.75606453",
"0.7232064",
"0.71014535",
"0.70237267",
"0.6960305",
"0.6956343",
"0.6929996",
"0.6780668",
"0.67545116",
"0.66527414",
"0.6480153",
"0.64744556",
"0.6452199",
"0.64505136",
"0.644631",
"0.6394885",
"0.6383808",
"0.6364148",
"0.634124",
"0.6289129",
"0.62633765... | 0.6941481 | 6 |
Query: included within the range | def include?(row, col)
@range.include?(row) && @range.include?(col)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_range(left, right)\n \n end",
"def query_range(left, right)\n \n end",
"def range(from, to)\n from_query(raw_range(from, to))\n end",
"def include_with_range?(value)\n if value.is_a?(::Range)\n operator = exclude_end? ? :< : :<=\n end_value = val... | [
"0.7748745",
"0.7748745",
"0.6924079",
"0.68567187",
"0.6838201",
"0.674843",
"0.6735583",
"0.6683455",
"0.6647927",
"0.64229685",
"0.63962704",
"0.6390943",
"0.6386426",
"0.6376821",
"0.6372114",
"0.6352061",
"0.63504916",
"0.62886226",
"0.62849957",
"0.6265111",
"0.6258598"... | 0.0 | -1 |
Get the disc instance in position(row, col) | def get_disc(row, col)
@board[row * @size + col]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](row, col)\n get_disc(row, col)\n end",
"def [](pos)\n r, c = pos[0],pos[1]\n grid[r][c]\n end",
"def [](pos)\n row = pos.first\n col = pos.last\n @grid[row][col]\n end",
"def [](pos)\n row, col = pos\n @grid[row][col]\n end",
"def [](pos)\n row, col = pos\n ... | [
"0.7263686",
"0.6966345",
"0.6926935",
"0.68957794",
"0.6890079",
"0.686928",
"0.686928",
"0.68595946",
"0.68191636",
"0.68051213",
"0.67705697",
"0.6762313",
"0.67393315",
"0.67319036",
"0.6722269",
"0.67065525",
"0.6701733",
"0.6700588",
"0.6692407",
"0.6640609",
"0.6623691... | 0.70616835 | 1 |
Set the disc instance in position(row, col) | def set_disc(row, col, value)
@board[row * @size + col] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos=(val)\n #setter method for position \n row, col = val\n @pos = val\n\n end",
"def []=(pos, figure)\n x, y = pos\n @rows[x][y] = figure\n end",
"def[]=(pos, value)\n row = pos.first\n col = pos.last\n @grid[row][col] = value\n end",
"def []=(pos, value)\n ro... | [
"0.756131",
"0.72321534",
"0.7100983",
"0.7023203",
"0.69598544",
"0.6941207",
"0.6929363",
"0.6781135",
"0.67546564",
"0.6652895",
"0.6480657",
"0.64755076",
"0.64522153",
"0.64508736",
"0.64460886",
"0.639615",
"0.6384484",
"0.6365008",
"0.6341694",
"0.62891644",
"0.6264573... | 0.695487 | 5 |
Initial setup and also call for I (image) command | def reset(cols, rows)
@cols = cols.to_i.abs
@rows = rows.to_i.abs
@created = true
x = 0
until x > @rows
y = 0
until y > @cols
set_pixel("#{y}-#{x}", COLOR_WHITE)
y = y+1
end
x = x+1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n size 200, 200\n @a = load_image 'construct.jpg'\n @b = load_image 'wash.jpg'\n @offset = 0.0\nend",
"def main\n ImageManip::inspect_image(@image_path)\n dimensions = ImageManip::get_dimensions(@image_path)\n sharp_pixels = get_accidental_pixels(@sharp_path)\n flat_pixels = get_acciden... | [
"0.66980416",
"0.66541225",
"0.66386026",
"0.65120137",
"0.6428638",
"0.6415962",
"0.6391787",
"0.638194",
"0.6353051",
"0.6194233",
"0.6141833",
"0.6137312",
"0.6073018",
"0.6072684",
"0.6066322",
"0.6047808",
"0.6010831",
"0.5994172",
"0.5994167",
"0.5963911",
"0.5941236",
... | 0.0 | -1 |
This function takes 2 vectors and "paints" every pixel between them (inclusive) | def line(points, colour)
points.each do |point|
paint(point[0], point[1], colour)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross(v1, v2)\n dx, dy = v2[0] - v1[0], v2[1] - v1[1]\n cr = [] # array containing intersections\n\n if dx == 0 and dy ==0 then\n\tnc = 0\n elsif dx == 0 then\n\tt = ( 0.0 - v1[1] ) / dy # y = 0\n\tx , y = v1[0] + t * dx, v1[1] + t * dy\n cr.push( [x, y] ) if ... | [
"0.6242299",
"0.60575324",
"0.5595832",
"0.55128103",
"0.548063",
"0.5458222",
"0.54564303",
"0.5446314",
"0.54368556",
"0.5416506",
"0.5412839",
"0.5411509",
"0.53905493",
"0.53699833",
"0.536043",
"0.5350199",
"0.5320419",
"0.53073734",
"0.5307308",
"0.5306688",
"0.5287498"... | 0.0 | -1 |
Class Methods Instance Methods Only call avalara if state is one we charge sales tax for. | def avalara_eligible?
if ship_address.present? and ship_address.state.present?
SpreeAvalara.sales_tax_states.keys.include? ship_address.state.abbr
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_tax_rate(state_id, tax_time = Time.now)\n product.tax_rate(state_id, tax_time)\n end",
"def ship_address_tax_update\n if ship_address and (ship_address_id_changed? or ship_address.changed?)\n create_avalara_tax_adjustment\n end\n end",
"def set_tax(status, base_total, tax_rate)\n ... | [
"0.65991974",
"0.6318884",
"0.6248422",
"0.62025714",
"0.61641496",
"0.61322385",
"0.6122227",
"0.6116445",
"0.60540307",
"0.6035877",
"0.60206085",
"0.6011953",
"0.5988416",
"0.5973932",
"0.5973182",
"0.5957698",
"0.59538865",
"0.59538865",
"0.5929751",
"0.5883417",
"0.58767... | 0.61689794 | 4 |
Commits tax transaction to avalara when order is finalized. | def finalize_with_avalara_tax!
finalize_without_avalara_tax!
avalara_tax_transaction.commit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finalize_transaction(type='purchase')\n self.save\n self.user.make_paid! if (!user.nil? && user.persisted?)\n self.transactions.create(action:type, amount: self.price_in_cents, response: self.purchase_response)\n end",
"def mark_complete\n ActiveRecord::Base.transaction do\n fin... | [
"0.61791027",
"0.6157421",
"0.6023995",
"0.6003465",
"0.59023446",
"0.58656466",
"0.5856951",
"0.5822869",
"0.5792908",
"0.5744815",
"0.5727476",
"0.56764853",
"0.5671182",
"0.5617736",
"0.5608444",
"0.55829424",
"0.55667126",
"0.55453205",
"0.55273044",
"0.5522495",
"0.55022... | 0.7559819 | 0 |
If the shipping address changes we want to update tax. | def ship_address_tax_update
if ship_address and (ship_address_id_changed? or ship_address.changed?)
create_avalara_tax_adjustment
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def address_change\n @update_cart_invoice = zip_code_changed?\n true\n end",
"def use_another_address_for_shipping=(val)\n value = val.is_a?(String) ? (val.to_i > 0) : val\n @use_another_address_for_shipping = value\n end",
"def tax_address\n self.ship_address || self.bill_address\... | [
"0.6919147",
"0.65936106",
"0.65795505",
"0.64272183",
"0.6398525",
"0.6393481",
"0.6317139",
"0.6261219",
"0.6159925",
"0.6157222",
"0.6129962",
"0.6129627",
"0.61246884",
"0.61001277",
"0.60340726",
"0.59933084",
"0.59733164",
"0.5900336",
"0.5892932",
"0.5871426",
"0.58469... | 0.85914356 | 0 |
using the comment_params which we get from a form to create a new comment, switching its profile_id to the user who is currently signed in (and posting the comment). after that, if the comment is valid, it saves and we are redirected to the home page if not, we get redirected to profiles index | def create
@comment = Comment.new(comment_params)
if user_signed_in?
@comment.profile_id = Profile.find_by(user_id: current_user.id).id
end
if @comment.save
redirect_to '/', :notice => "Comment posted."
else
flash[:alert] ="Problem occured while commenting."
redirect_to '/pro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # If user signed in, link comment to user\n if user_signed_in? \n params[:comment][:user_id] = current_user.id\n else\n if @conf.anonymous_comment == false\n redirect_to request.referer, notice: t('You must be logged in to comment')\n return \n end\n # Add ht... | [
"0.7056843",
"0.70320493",
"0.6987045",
"0.69802314",
"0.69726986",
"0.69261897",
"0.688951",
"0.68045354",
"0.6754199",
"0.67532927",
"0.6703895",
"0.6703242",
"0.6681955",
"0.6675734",
"0.6674799",
"0.6669308",
"0.6643197",
"0.6632061",
"0.6626885",
"0.66264033",
"0.6600273... | 0.8279139 | 0 |
Generator for breadthfirst search | def bfs(tree)
Enumerator.new do |yielder|
queue = [tree]
while !queue.empty?
node = queue.shift
children = node[1..-1]
yielder << node.first
children.each do |child|
queue << child
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def breadth_first\n return do_breadth_first( [Node.new(@start)], Set.new, @dest)\n end",
"def use_breadth_first(item, graph, logic_function = ->(x){graph[x].empty?} , returned = \"steps\" )\r\n search_queue = []\r\n steps = {}\r\n search_queue = search_queue.concat(graph[item])\r\n searched = []\... | [
"0.73685944",
"0.7213712",
"0.6871641",
"0.6850813",
"0.6840119",
"0.6772789",
"0.67365724",
"0.6633638",
"0.6624322",
"0.66139513",
"0.6600324",
"0.65862674",
"0.65719485",
"0.6544904",
"0.65368605",
"0.653499",
"0.65133023",
"0.6468518",
"0.644392",
"0.6428082",
"0.6416052"... | 0.6588527 | 11 |
GET /subscribers/1 GET /subscribers/1.json | def show
@subscriber = Subscriber.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @subscriber }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscriber(id_or_email)\n make_json_api_request :get, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}\"\n end",
"def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end",
"def show\n\n @subscriber = Subscriber.find(params[:id])\n\n respond_to d... | [
"0.77388203",
"0.7634598",
"0.74280024",
"0.73774445",
"0.7345014",
"0.7330656",
"0.71469235",
"0.71259916",
"0.7072152",
"0.6970554",
"0.6936619",
"0.6935477",
"0.6912732",
"0.6750059",
"0.65972066",
"0.6581586",
"0.6581586",
"0.6581586",
"0.65361416",
"0.6490314",
"0.648337... | 0.73992676 | 4 |
GET /subscribers/new GET /subscribers/new.json | def new
@subscriber = Subscriber.new
@subscriber.account = @account
respond_to do |format|
format.html # new.html.erb
format.json { render json: @subscriber }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @breadcrumb = 'create'\n @subscriber = Subscriber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscriber }\n end\n end",
"def new\n @subscriber = Subscriber.new\n\n respond_to do |format|\n format.html # new.h... | [
"0.80595684",
"0.80341417",
"0.80341417",
"0.80341417",
"0.72021174",
"0.7013239",
"0.69594014",
"0.6924623",
"0.68993986",
"0.68993986",
"0.68993986",
"0.68993986",
"0.68993986",
"0.6880789",
"0.6876071",
"0.68549526",
"0.6847666",
"0.68472934",
"0.68107957",
"0.68092275",
"... | 0.7491268 | 4 |
POST /subscribers POST /subscribers.json | def create
@subscriber = Subscriber.new(params[:subscriber])
@subscriber.account = @account
respond_to do |format|
if @subscriber.save
format.html { redirect_to account_subscriber_path(@account, @subscriber), notice: 'Subscriber was successfully created.' }
format.json { render json:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @subscriber = Subscriber.new(subscriber_params)\n\n respond_to do |format|\n if @subscriber.save\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully created.' }\n format.json { render :show, status: :created, location: @subscriber }\n else\n ... | [
"0.7317428",
"0.731076",
"0.73096126",
"0.70741594",
"0.707315",
"0.69829106",
"0.69536996",
"0.6886174",
"0.68259984",
"0.6772293",
"0.67319465",
"0.6642967",
"0.6582124",
"0.65672916",
"0.6563927",
"0.6546686",
"0.6516176",
"0.64925486",
"0.6472395",
"0.6459243",
"0.6459243... | 0.6963176 | 6 |
PUT /subscribers/1 PUT /subscribers/1.json | def update
@subscriber = Subscriber.find(params[:id])
respond_to do |format|
if @subscriber.update_attributes(params[:subscriber])
format.html { redirect_to account_subscriber_path(@account, @subscriber), notice: 'Subscriber was successfully updated.' }
format.json { head :no_content }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { head :ok }\n else\n format.html {... | [
"0.7039112",
"0.7039112",
"0.69885147",
"0.67915416",
"0.6668616",
"0.6667096",
"0.6635083",
"0.6604206",
"0.6509201",
"0.6508301",
"0.64354146",
"0.639294",
"0.639294",
"0.639294",
"0.639294",
"0.639294",
"0.639294",
"0.6363125",
"0.6310509",
"0.6278845",
"0.6265447",
"0.6... | 0.68489516 | 3 |
DELETE /subscribers/1 DELETE /subscribers/1.json | def destroy
@subscriber = Subscriber.find(params[:id])
@subscriber.destroy
respond_to do |format|
format.html { redirect_to account_subscribers_url(@account) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n re... | [
"0.794178",
"0.7923782",
"0.7879767",
"0.77783054",
"0.77302533",
"0.7588091",
"0.74162745",
"0.7325512",
"0.72669154",
"0.726173",
"0.7258234",
"0.7192651",
"0.7192651",
"0.70819443",
"0.70665675",
"0.70633245",
"0.7053913",
"0.70507365",
"0.7002493",
"0.69816566",
"0.698165... | 0.7802754 | 3 |
require all new entries to have these four fields, at a minimum, INCLUDING notes | def transfer_rate_check
params.require(:transferrate).permit(:transferringprogram,
:transfereeprogram,
:transferratio,
:transfernotes)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_required_fields\n user = new_record? ? author : current_journal.try(:user)\n\n required_attribute_names(user).each do |attribute|\n if /^\\d+$/.match?(attribute)\n attribute = attribute.to_i\n v = custom_field_values.detect {|v| v.custom_field_id == attribute}\n if v &&... | [
"0.60935783",
"0.5979805",
"0.5979805",
"0.595164",
"0.59476155",
"0.591604",
"0.58861095",
"0.58468163",
"0.5815933",
"0.58048534",
"0.56630355",
"0.5608843",
"0.5603012",
"0.55806434",
"0.5550667",
"0.5543277",
"0.5538007",
"0.54928875",
"0.5491562",
"0.5478523",
"0.5477958... | 0.0 | -1 |
GET /boiler_plates GET /boiler_plates.xml | def index
@boiler_plates = BoilerPlate.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @boiler_plates }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @boiler_plate = BoilerPlate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boiler_plate }\n end\n end",
"def new\n @boiler_plate = BoilerPlate.new\n\n respond_to do |format|\n format.html # new.html.erb\n f... | [
"0.7679445",
"0.70896095",
"0.6299235",
"0.62055016",
"0.5826645",
"0.58242387",
"0.58198214",
"0.5772513",
"0.5732204",
"0.56720245",
"0.5666418",
"0.5616622",
"0.55807227",
"0.55464065",
"0.5542549",
"0.5541495",
"0.55352503",
"0.5532193",
"0.55219936",
"0.55168563",
"0.549... | 0.7634052 | 1 |
GET /boiler_plates/1 GET /boiler_plates/1.xml | def show
@boiler_plate = BoilerPlate.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @boiler_plate }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @boiler_plates = BoilerPlate.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boiler_plates }\n end\n end",
"def new\n @boiler_plate = BoilerPlate.new\n\n respond_to do |format|\n format.html # new.html.erb\n form... | [
"0.75293154",
"0.7227407",
"0.63179666",
"0.6090636",
"0.6012867",
"0.5965269",
"0.5950447",
"0.5898424",
"0.58704686",
"0.58555347",
"0.58547264",
"0.58199924",
"0.58033395",
"0.57714134",
"0.5769595",
"0.5752118",
"0.5736966",
"0.5726771",
"0.5710339",
"0.5703261",
"0.57015... | 0.78385013 | 0 |
GET /boiler_plates/new GET /boiler_plates/new.xml | def new
@boiler_plate = BoilerPlate.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @boiler_plate }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @boiler_plate = BoilerPlate.new(params[:boiler_plate])\n\n respond_to do |format|\n if @boiler_plate.save\n flash[:notice] = 'BoilerPlate was successfully created.'\n format.html { redirect_to(@boiler_plate) }\n format.xml { render :xml => @boiler_plate, :status => :cr... | [
"0.7549295",
"0.6980377",
"0.6933126",
"0.6893171",
"0.6878288",
"0.6837467",
"0.6826287",
"0.68224114",
"0.67840856",
"0.67826396",
"0.67453086",
"0.6728796",
"0.6728796",
"0.6703554",
"0.66956544",
"0.66840553",
"0.66712296",
"0.6655946",
"0.66502386",
"0.6635484",
"0.66316... | 0.8192281 | 0 |
POST /boiler_plates POST /boiler_plates.xml | def create
@boiler_plate = BoilerPlate.new(params[:boiler_plate])
respond_to do |format|
if @boiler_plate.save
flash[:notice] = 'BoilerPlate was successfully created.'
format.html { redirect_to(@boiler_plate) }
format.xml { render :xml => @boiler_plate, :status => :created, :loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @boiler_plate = BoilerPlate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boiler_plate }\n end\n end",
"def show\n @boiler_plate = BoilerPlate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n f... | [
"0.68130213",
"0.6199865",
"0.61425203",
"0.59709096",
"0.58339614",
"0.555243",
"0.5530822",
"0.5512827",
"0.5426326",
"0.53119636",
"0.52858543",
"0.5266966",
"0.5241144",
"0.51894337",
"0.5128822",
"0.512236",
"0.51134455",
"0.51017845",
"0.5061034",
"0.49503043",
"0.49452... | 0.73388 | 0 |
PUT /boiler_plates/1 PUT /boiler_plates/1.xml | def update
@boiler_plate = BoilerPlate.find(params[:id])
respond_to do |format|
if @boiler_plate.update_attributes(params[:boiler_plate])
flash[:notice] = 'BoilerPlate was successfully updated.'
format.html { redirect_to(@boiler_plate) }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @boiler_plate = BoilerPlate.new(params[:boiler_plate])\n\n respond_to do |format|\n if @boiler_plate.save\n flash[:notice] = 'BoilerPlate was successfully created.'\n format.html { redirect_to(@boiler_plate) }\n format.xml { render :xml => @boiler_plate, :status => :cr... | [
"0.6405011",
"0.62619215",
"0.618644",
"0.5988051",
"0.5816975",
"0.5814854",
"0.57469857",
"0.57454455",
"0.55547154",
"0.5413983",
"0.54120153",
"0.54026854",
"0.5334137",
"0.5302639",
"0.5293511",
"0.5291221",
"0.52754587",
"0.526398",
"0.52542925",
"0.52375644",
"0.520338... | 0.728412 | 0 |
DELETE /boiler_plates/1 DELETE /boiler_plates/1.xml | def destroy
@boiler_plate = BoilerPlate.find(params[:id])
@boiler_plate.destroy
respond_to do |format|
format.html { redirect_to(boiler_plates_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @spoiler.destroy\n\n head :no_content\n end",
"def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to(bowls_url) }\n ... | [
"0.6494167",
"0.6294656",
"0.6269033",
"0.6254381",
"0.62457126",
"0.624426",
"0.623076",
"0.6161564",
"0.6151422",
"0.611897",
"0.6116099",
"0.6107611",
"0.6079868",
"0.60794616",
"0.6057895",
"0.6050264",
"0.6045996",
"0.6031383",
"0.6025258",
"0.60144037",
"0.6009132",
"... | 0.7487383 | 0 |
ABCDEFGH and PAPORODPPEEGH is ADEGH Solution ================================================ 1Recursive approach if last char of a == last char of b lcs = 1 + lcs(a[0..size1], b[0..size1]) else lcs = max ( | def lcs(a,b)
return "" if a.size==0 || b.size==0
if (a.size == 1 || b.size == 1)
return (a[a.size-1] == b[b.size-1]) ? "#{a[a.size-1]}" : ""
end
#LCS with one char less and add 1 for the last char
return "#{a[a.size-1]}" + lcs(a[0..a.size-2], b[0..b.size-2]) if a[a.size-1] == b[b.size-1]
lcs_1 = lcs(a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lcs(a, b)\n lengths = Array.new(a.size+1) { Array.new(b.size+1) { 0 } }\n # row 0 and column 0 are initialized to 0 already\n a.split('').each_with_index { |x, i|\n b.split('').each_with_index { |y, j|\n if x == y\n lengths[i+1][j+1] = lengths[i][j] + 1\n ... | [
"0.73298836",
"0.73298836",
"0.72706413",
"0.7040644",
"0.6852042",
"0.68033206",
"0.6777911",
"0.67129594",
"0.6665895",
"0.66632783",
"0.66332537",
"0.66050786",
"0.6581674",
"0.658141",
"0.65569496",
"0.6547629",
"0.65475243",
"0.6523413",
"0.6521319",
"0.6491021",
"0.6479... | 0.8238897 | 0 |
Excon is failing on SSL when a 302 (and possibly others) is received. We should be able to verify the SSL cert even though it's not a 200. HTTPie and Curl are able to. See | def fix_for_excon_bug(error_message)
return error_message unless buggy_message?(error_message)
'Unable to verify the certificate because a redirect was detected'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_ssl_certificate\n response = request('api.twilio.com', '8443', 'GET', 'https://api.twilio.com:8443/.json')\n return unless response.status_code < 200 || response.status_code >= 300\n\n raise RestError.new 'Unexpected response from certificate endpoint', response\n end",
"de... | [
"0.70427465",
"0.6911361",
"0.6720607",
"0.64269376",
"0.6405589",
"0.6397705",
"0.6375897",
"0.6333768",
"0.6333768",
"0.631129",
"0.6285625",
"0.6214334",
"0.6177259",
"0.6176862",
"0.6159507",
"0.61592126",
"0.61207646",
"0.61117667",
"0.605801",
"0.6042158",
"0.6001947",
... | 0.57786006 | 43 |
ran after all classes are initialized and before executing the MainActivity on_create method | def after_bootstrap
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_initialization_finished()\n end",
"def post_init\n end",
"def on_init; end",
"def on_init; end",
"def after_initialize\n end",
"def post_init\n end",
"def post_initialize\n end",
"def after_initialize\n end",
"def after_initialize\n end",
"def after_initialized\n... | [
"0.71364284",
"0.7110153",
"0.69864684",
"0.69864684",
"0.6965421",
"0.694114",
"0.6837567",
"0.6821732",
"0.6821732",
"0.6802689",
"0.6773016",
"0.6773016",
"0.6773016",
"0.6773016",
"0.676161",
"0.67485994",
"0.67084163",
"0.67084163",
"0.6677862",
"0.6654237",
"0.66417056"... | 0.0 | -1 |
after a partial is rendered | def after_partial_setup(view)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_rendering( state=nil )\n\t\t# Nothing to do\n\t\treturn nil\n\tend",
"def after_render(&block)\n @after_render_block = block\n end",
"def partial; end",
"def partial; end",
"def partial; end",
"def partial; end",
"def render_partial(context, options, &block); end",
"def partial?; end",
... | [
"0.68446136",
"0.66859376",
"0.65869766",
"0.65869766",
"0.65869766",
"0.65869766",
"0.6554021",
"0.65426004",
"0.62966716",
"0.61510235",
"0.608673",
"0.60829055",
"0.59994024",
"0.5900637",
"0.58905524",
"0.58427787",
"0.5780428",
"0.5770357",
"0.5754155",
"0.5725832",
"0.5... | 0.80597365 | 0 |
after a complete view is rendered | def after_view_setup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_rendering( state=nil )\n\t\t# Nothing to do\n\t\treturn nil\n\tend",
"def after_partial_setup(view)\n end",
"def after_render(&block)\n @after_render_block = block\n end",
"def show\n # uncomplete\n # render\n # complete\n end",
"def render_finish\n raise NotImplementedErr... | [
"0.72956413",
"0.7111487",
"0.65203184",
"0.6511049",
"0.648622",
"0.64552593",
"0.6332515",
"0.63005406",
"0.6289774",
"0.6281777",
"0.62655336",
"0.62467146",
"0.62324584",
"0.61842304",
"0.6110087",
"0.60960907",
"0.6074636",
"0.6068122",
"0.6002001",
"0.59804386",
"0.5956... | 0.74737513 | 0 |
=============================================================================== Create another method! =============================================================================== Instruction =============================================================================== 1. Define a greeter method that takes a singl... | def greeter(name)
return "Hello #{name}!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def old_code\n #Ask for a number\n `say \"Hi Welcome to PICK A NUMBER program\"`\n print \"Pick a number: \"\n #Get a number from the user\n number = gets.chomp\n # i = integer\n # if number = 0 then even else odd\n if number.to_i.even?\n puts \"\\n#{number} is even \"\n else \n puts \"\\n#{number} ... | [
"0.70199126",
"0.68618804",
"0.6817572",
"0.6813085",
"0.6773564",
"0.67693174",
"0.6763535",
"0.67574143",
"0.6750691",
"0.67252517",
"0.6687813",
"0.6677469",
"0.6669537",
"0.6668575",
"0.6646062",
"0.66349167",
"0.66302556",
"0.6624549",
"0.6611444",
"0.66094327",
"0.65668... | 0.0 | -1 |
Write the response out to the wire | def render(socket)
socket << render_header
socket << @body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write bytes\n r = response_object\n r.body \"\" if r.body_io.nil?\n r.body_io.write bytes\n end",
"def out(value)\n $response.write(value)\n end",
"def respond(response)\n unless response.committed?\n write_status(response)\n write_headers(response)\n write_b... | [
"0.7273734",
"0.72602004",
"0.71629184",
"0.71343946",
"0.6963384",
"0.68216676",
"0.67345",
"0.66266376",
"0.6577914",
"0.6507258",
"0.63973355",
"0.63912153",
"0.6308058",
"0.6304816",
"0.62613386",
"0.6260106",
"0.62414736",
"0.6194507",
"0.6194507",
"0.61926407",
"0.61884... | 0.0 | -1 |
Convert headers into a string FIXME: this should probably be factored elsewhere, SRP and all | def render_header
response_header = "#{@version} #{@status} #{@reason}#{CRLF}"
unless @headers.empty?
response_header << @headers.map do |header, value|
"#{header}: #{value}"
end.join(CRLF) << CRLF
end
response_header << CRLF
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringify_headers(headers); end",
"def stringify_headers headers\n headers.inject({}) do |result, (key, value)|\n if key.is_a? Symbol\n key = key.to_s.split(/_/).map { |w| w.capitalize }.join('-')\n end\n if 'CONTENT-TYPE' == key.upcase\n target_value = value.to_s\... | [
"0.85444975",
"0.7660079",
"0.76421934",
"0.7539346",
"0.7505561",
"0.74667025",
"0.74308854",
"0.7423649",
"0.73159903",
"0.72934484",
"0.7233862",
"0.7148906",
"0.7126543",
"0.70036364",
"0.69802624",
"0.6952876",
"0.6917398",
"0.6867751",
"0.6867751",
"0.6828791",
"0.67782... | 0.0 | -1 |
Before initializing sync service (callbacks: after create/update/destroy) | def ps_skip_callback?(_action)
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_initialize(&block); end",
"def after_initialize\n # noop\n end",
"def after_initialize\n end",
"def after_sync\n end",
"def pre_initialize\n end",
"def after_initialize\n end",
"def after_initialize\n end",
"def after_initialize(options={}) ; end",
"def a... | [
"0.69607884",
"0.679049",
"0.67565125",
"0.6701954",
"0.6700452",
"0.6663479",
"0.6663479",
"0.6660324",
"0.65727",
"0.65727",
"0.65727",
"0.65727",
"0.6531911",
"0.6528615",
"0.6515215",
"0.639311",
"0.638016",
"0.6366226",
"0.62960047",
"0.6292852",
"0.6274388",
"0.626415... | 0.0 | -1 |
TODO: make it using respond_to?(:ps_skip_sync?) before preparing data to sync | def ps_skip_sync?(_action)
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def old_sync; end",
"def remote_sync_if_necessary(options={})\n false\n end",
"def pre_sync\n #move\n end",
"def sync() end",
"def sync() end",
"def sync() end",
"def sync=(p0) end",
"def sync=(p0) end",
"def sync=(p0) end",
"def sync; end",
"def salesforce_skip_sync?\n r... | [
"0.6869574",
"0.66138977",
"0.6436241",
"0.6415769",
"0.6415769",
"0.6415769",
"0.63906",
"0.63906",
"0.63906",
"0.6324541",
"0.62325245",
"0.62175846",
"0.61879003",
"0.6169755",
"0.60701674",
"0.60518783",
"0.60243464",
"0.60243464",
"0.6001251",
"0.5987388",
"0.5975431",
... | 0.7129618 | 0 |
To perform sync on demand | def ps_perform_sync(action = :create, attrs: nil, as_klass: nil,
publisher: nil)
publisher ||= self.class.ps_publisher(action).dup
publisher.attrs = attrs if attrs
publisher.as_klass = as_klass if as_klass
PubSubModelSync::MessagePublisher.publish_model(self, action, publ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync() end",
"def sync() end",
"def sync() end",
"def sync; end",
"def sync\n end",
"def sync\n end",
"def sync()\n #This is a stub, used for indexing\n end",
"def sync=\n end",
"def old_sync; end",
"def fsync()\n #This is a stub, used for indexing\n end",
"def fsync(... | [
"0.89839303",
"0.89839303",
"0.89839303",
"0.8678089",
"0.8322461",
"0.8322461",
"0.8192628",
"0.7757698",
"0.75857097",
"0.7546206",
"0.7403152",
"0.7403152",
"0.74025863",
"0.73522997",
"0.73522997",
"0.7275698",
"0.7203388",
"0.7170838",
"0.71582156",
"0.71572995",
"0.7156... | 0.0 | -1 |
On demand class level publisher | def ps_class_publish(data, action:, as_klass: nil)
as_klass = (as_klass || name).to_s
klass = PubSubModelSync::MessagePublisher
klass.publish_data(as_klass, data, action.to_sym)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publisher; end",
"def publisher; end",
"def publisher\n end",
"def publisher\n @publisher ||= Publisher.new(self)\n end",
"def publish!\n raise 'Not implemented!'\n end",
"def publisher_class\n Publisher\n end",
"def publisher\n ::Qup::Publisher.new( self )\n end",
... | [
"0.8374123",
"0.8374123",
"0.7874853",
"0.73245704",
"0.7168141",
"0.7129674",
"0.70871407",
"0.7028196",
"0.6889339",
"0.67406195",
"0.67037183",
"0.66966134",
"0.66966134",
"0.66966134",
"0.66387224",
"0.65757227",
"0.65592766",
"0.6516819",
"0.6455554",
"0.6452666",
"0.635... | 0.598081 | 50 |
Publisher info for specific action | def ps_publisher(action = :create)
PubSubModelSync::Config.publishers.find do |publisher|
publisher.klass == name && publisher.actions.include?(action)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info(action=nil)\n my.info(action)\n end",
"def actions() ; info[:actions] ; end",
"def actions() ; info[:actions] ; end",
"def publish\n end",
"def publish\n end",
"def publish\n end",
"def action_summary controller, action\n case control... | [
"0.7010281",
"0.6616382",
"0.6616382",
"0.62338585",
"0.62338585",
"0.62338585",
"0.6179556",
"0.6145353",
"0.6141307",
"0.6123732",
"0.61056006",
"0.60994124",
"0.603987",
"0.60278887",
"0.6022182",
"0.59998786",
"0.5967149",
"0.5962458",
"0.59445137",
"0.59263015",
"0.59066... | 0.60451406 | 12 |
Tests loading all valid png files in the suite that are supported for saving as bmp, saving them as bmp, loading the resaved images and comparing them pixelwise. | def test_load_save_load_valid_png_files_as_bmp
each_file_with_updated_info do
|file_path|
#Valid color image with bit depth less than 16 and no transparency
if @test_feature != "x" && @bit_depth != 16 && @test_feature != "t" &&
(@color_type_desc == "c" || @color_type_desc == "p")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_load_valid_png_files\n\n each_file_with_updated_info do\n |file_path|\n\n if @test_feature != \"x\"\n\n #Reading valid png files should not raise any exception\n assert_nothing_raised do\n Imgrb::Image.new(file_path)\n end\n\n img = Imgrb::Image.new(file_p... | [
"0.73193747",
"0.6955987",
"0.66284484",
"0.6409592",
"0.59918725",
"0.5970282",
"0.5762497",
"0.5744084",
"0.5724377",
"0.5681421",
"0.5678085",
"0.5663587",
"0.5620685",
"0.56187487",
"0.56187487",
"0.55800754",
"0.5483672",
"0.5435688",
"0.54189456",
"0.5413791",
"0.540398... | 0.818477 | 0 |
output team name and his bts list | def get_team_live_bts
team_hash=Hash.new
LabBts.where("bts_pass > ?" ,0).each do |bts|
team_hash[bts.team] ||=[]
team_hash[bts.team] << bts.ip
end
puts team_hash.size
team_hash.each do |team, site_list|
puts "#{team}=#{site_list.size}"
end
return team_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_teams\n puts(@teams.to_s);\n end",
"def printTeams(teamArray)\n\t\tprintWords = \"\"\n\t\tteamArray.each do |team|\n\t\t\tprintWords << \"Team Name: #{team.name} Email: #{team.email} Lottery Balls: #{team.balls}\\n\"\n\t\tend\n\t\treturn printWords\n\tend",
"def teams_data\n ... | [
"0.70792097",
"0.69395834",
"0.6868166",
"0.6859509",
"0.6665982",
"0.6562466",
"0.65578514",
"0.65049744",
"0.64877427",
"0.6486538",
"0.63691485",
"0.6353313",
"0.6316965",
"0.62585866",
"0.6243105",
"0.6213832",
"0.6213207",
"0.6206885",
"0.61551917",
"0.61548257",
"0.6138... | 0.0 | -1 |
Presumably "/" is a good separator because it won't appear in repo_name | def to_s
"#{@timestamp}/#{@repo_name}/#{@sha}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def github_repo\n # GitHub allows underscores, hyphens and dots in repo names\n # but only hyphens in user/organisation names (as well as alphanumeric).\n repository_url.scan(/:([A-Za-z0-9-]+\\/[\\w.-]+)\\.git$/).join\n end",
"def repo_name_without_whitespace(repo_name)\n repo_name.strip\n ... | [
"0.72766703",
"0.71895236",
"0.71285236",
"0.70995516",
"0.69596994",
"0.6947789",
"0.6907278",
"0.68249136",
"0.68167496",
"0.6812683",
"0.67542887",
"0.6718875",
"0.6699286",
"0.6692748",
"0.668867",
"0.66668564",
"0.66602504",
"0.6644463",
"0.66418576",
"0.66314745",
"0.66... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.password_reset.subject | def password_reset(user)
@user = user
@hostname = "http://creuroja.net"
@reset_password_link = "#{@hostname}#{edit_password_reset_path(@user.resettoken)}"
mail(to: @user.email, subject: 'Recuperació de contrasenya de Creu Roja a Catalunya')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset(user)\n @user = user\n mail :to => user.email, :subject => I18n.t(\"reset_password\")\n end",
"def forgot_password(user)\n setup_email(user)\n subject \"Password Reset\"\n end",
"def reset_password(user)\n @recipients = user.email\n @from = \"#{Site.current.email}\"\n ... | [
"0.68480784",
"0.6811366",
"0.6742922",
"0.67029166",
"0.6681673",
"0.66372716",
"0.6591902",
"0.6572679",
"0.6554142",
"0.6505293",
"0.64807165",
"0.6469704",
"0.64564425",
"0.6449847",
"0.64418167",
"0.6410761",
"0.640746",
"0.6402613",
"0.639758",
"0.63880056",
"0.6385681"... | 0.0 | -1 |
Returns the timetable for the course an instance was initialised with. Returns: A timetable for a course. | def get_timetable
@timetable_parser.get_timetable_for_course(@courseCode, @year)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timetable_for_class( school_class )\n Timetable.select{|t| t.school_class == school_class }.to_a\n end",
"def core_timetable(course_code)\n Tableau::TimetableParser.new(course_code).parse\n end",
"def set_course_timetable\n @course_timetable = CourseTimetable.find(params[:id])\n end... | [
"0.65548986",
"0.6277774",
"0.6094841",
"0.6056275",
"0.581053",
"0.5701646",
"0.56833386",
"0.5645975",
"0.55489486",
"0.54279226",
"0.5413758",
"0.5383867",
"0.5332239",
"0.53093964",
"0.5268675",
"0.523927",
"0.52320534",
"0.51977926",
"0.51910937",
"0.5145128",
"0.5144087... | 0.74087924 | 0 |
Match any request that is a response to the receiver (or an array message starting with such) | def ===(message)
request, = message
match = request.is_a?(Request) && self == request.response_to
debug(:receive) { "Request #{request.inspect} does not match #{self}" } unless match
match
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond(message)\n RESPONSES.sample\n end",
"def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n ... | [
"0.62965846",
"0.6284331",
"0.6258988",
"0.6075293",
"0.6052468",
"0.596216",
"0.5877029",
"0.58550566",
"0.5814423",
"0.57773316",
"0.576909",
"0.5731234",
"0.57124954",
"0.56696343",
"0.5659375",
"0.56576115",
"0.56576115",
"0.56365013",
"0.56344426",
"0.56317705",
"0.56203... | 0.58366126 | 8 |
Might be better to use Nokogiri to create the XML body ? | def request_body(method, params = [])
p_body = ''
params.each { |p| p_body << "<param><value><string>#{p}</string></value></param>" }
body = '<?xml version="1.0"?><methodCall>'
body << "<methodName>#{method}</methodName>"
body << "<params>#{p_body}</params>" unless p_body.length == 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml\n Nokogiri::XML(body)\n end",
"def xml\n @xml ||= Nokogiri::XML(body)\n end",
"def generate_body\n xmlbody = %Q(<?xml version=\"1.0\" encoding=\"UTF-8\"?>\\n<!DOCTYPE project PUBLIC \"-//DTO Labs Inc.//DTD Resources Document 1.0//EN\" \"project.dtd\">\\n<project>\\n)\n \n ... | [
"0.7577536",
"0.72700983",
"0.7076771",
"0.70478404",
"0.6774259",
"0.6694498",
"0.66032964",
"0.65713775",
"0.65649927",
"0.6558122",
"0.6552569",
"0.64834",
"0.6414801",
"0.63960665",
"0.6363492",
"0.63587856",
"0.63413316",
"0.63320446",
"0.6329427",
"0.6321921",
"0.631992... | 0.0 | -1 |
User account actions. The ! methods are 'just get the job done'. It's true, they do some testing of their own thus unDRY'ing tests that do and should live in the user account stories but the repetition is ultimately important so that a faulty test setup fails early. | def log_out
get '/sessions/destroy'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_actions(user)\n can_act_as_logged_in_user(user) unless Revs::Application.config.restricted_beta # also have logged in privileges if we are not in beta\n end",
"def testNoAction\n executeTest('DummyUser', {})\n end",
"def my_actions(options)\n @setup = false\n get_template_par... | [
"0.6611575",
"0.6552464",
"0.6284329",
"0.61965716",
"0.6117945",
"0.60594153",
"0.6047718",
"0.6032079",
"0.5991756",
"0.597739",
"0.5941529",
"0.5934871",
"0.5902212",
"0.58818895",
"0.58818895",
"0.5875354",
"0.58518434",
"0.5850806",
"0.58456933",
"0.58375955",
"0.5815251... | 0.0 | -1 |
navbar search may be duplicate | def index
@products = if params[:term]
Product.where('name LIKE ?', "%#{params[:term]}%")
else
Product.all
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_search_bar_options\n zone = controller.class.name.downcase\n zone =~ /homepage/ || zone =~ /records/\n end",
"def override_search(form_ui)\n \"active_scaffold_search_#{form_ui}\"\n end",
"def override_search(form_ui)\n \"active_scaffold_search_#{form_ui}\"\n end",
"def... | [
"0.6148396",
"0.60942334",
"0.60942334",
"0.5907236",
"0.5768075",
"0.5714722",
"0.5714722",
"0.5714722",
"0.5714722",
"0.5714722",
"0.5714722",
"0.5714722",
"0.5714722",
"0.5714722",
"0.5714722",
"0.570752",
"0.5676818",
"0.5674417",
"0.5667047",
"0.56553185",
"0.5621489",
... | 0.0 | -1 |
a regular expression to get the latitude and longitude from the string. Grouping is used for the digits so that the values can be retrieved from the match data object afterwards using array [] notation. | def get_lat_long(doc)
script1 = doc.css('body #container #content script')[1]
lat_lon = /"latitude":"(\d+\.\d+)","longitude":"(-\d+\.\d+)"/.match(script1.to_s)
# puts "lat is #{lat_lon[1]} long is #{lat_lon[2]} "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_lat_long(raw)\n m = raw.match(/(\\d+)\\s+(\\d+\\.?\\d*)\\s*([NS])\\s+(\\d+)\\s+(\\d+\\.?\\d*)\\s*([WE])/i)\n if m.nil? || m.size != 5\n return nil\n else\n # Parse out degrees and minutes\n latitude = m[1].to_f + (m[2].to_f / 60.0)\n longitude = m[4].to_f + (m[5... | [
"0.66487074",
"0.6483513",
"0.62437844",
"0.61660385",
"0.58826673",
"0.5733307",
"0.56616336",
"0.55365735",
"0.5468651",
"0.54571986",
"0.54549825",
"0.5420016",
"0.5384517",
"0.5367001",
"0.5304433",
"0.52994746",
"0.52371174",
"0.52371174",
"0.51830757",
"0.5177384",
"0.5... | 0.5856795 | 5 |
Wait until all inputs to the edge have been traversed. Returns false if failed? | def wait
if @count > 0
Fiber.yield
end
succeeded?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def traverse_graph\n for i in 0..@number_of_vertices-1 do\n if @adjacent_list[i].length > 0 && @adjacent_list[i].length > @indegree[i]\n break\n end\n end\n\n return true if (i == @number_of_vertices)\n\n dfs_traversal(i);\n\n for i in 0..@number_of_vertices-1\n if (@visited[i]... | [
"0.6043979",
"0.59695923",
"0.5726637",
"0.5726637",
"0.5576758",
"0.5561684",
"0.5545832",
"0.5531082",
"0.55035144",
"0.5494036",
"0.5463426",
"0.5455608",
"0.5451108",
"0.5416143",
"0.54082006",
"0.53887427",
"0.53663784",
"0.53484756",
"0.5334836",
"0.5333606",
"0.5308429... | 0.5338792 | 18 |
Traverse the edge, mark the edge as failed if the source was also failed. | def traverse(task)
@count -= 1
# The entire edge fails if any individual task fails.
if task.failed?
@failed << task
end
if @count == 0
@fiber.resume
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_if_failed(node)\n id, *children = *node\n if tester.literal_flags\n node.updated(nil, [id] + process_all(children))\n else\n node.updated(nil, [clean(id)] + process_all(children))\n end\n end",
"def failed_nodes\n select do |node|\n node.faile... | [
"0.54766357",
"0.5452155",
"0.54381156",
"0.5358952",
"0.526431",
"0.526325",
"0.52255386",
"0.51945347",
"0.51694727",
"0.5162564",
"0.51403785",
"0.51384544",
"0.51327854",
"0.512375",
"0.5119912",
"0.5108373",
"0.5108373",
"0.5098483",
"0.5061323",
"0.50189555",
"0.5006400... | 0.5381702 | 3 |
This is called in the case that a parent fails to complete because a child task has failed. | def skip!(task)
@vertices += 1
if task.failed?
@failed << task
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fail_to_parent(error)\n @__context__.executor << FlowFiber.new { @parent.fail(self, error) }\n end",
"def pending_dependency_failed(parent, child, reason)\n parent.failed_to_start!(reason)\n true\n end",
"def complete\n if ! failure.nil?\n ra... | [
"0.6555173",
"0.6406762",
"0.61527956",
"0.59827924",
"0.5831281",
"0.5731657",
"0.57284087",
"0.56945235",
"0.56620055",
"0.5652018",
"0.56311",
"0.5629305",
"0.56047505",
"0.5578715",
"0.55406797",
"0.55137587",
"0.5457666",
"0.54547346",
"0.5446237",
"0.5420633",
"0.540389... | 0.0 | -1 |
Increase the number of traversals we are waiting for. | def increment!
@vertices += 1
@count += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_waiting\n synchronize do\n @num_waiting\n end\n end",
"def num_waiting\n synchronize do\n @num_waiting\n end\n end",
"def num_waiting\n end",
"def num_waiting\n end",
"def increment_transaction_count!\n @transaction_coun... | [
"0.62475383",
"0.62475383",
"0.59825826",
"0.59825826",
"0.5921921",
"0.5807507",
"0.57886523",
"0.57346004",
"0.5715678",
"0.56279963",
"0.56279963",
"0.5610727",
"0.55820596",
"0.5531117",
"0.5531117",
"0.55107296",
"0.54766834",
"0.54606277",
"0.5445559",
"0.5444935",
"0.5... | 0.49944553 | 69 |
GET /producto_platillos GET /producto_platillos.json | def index
#@producto_platillos = ProductoPlatillo.all
@producto_platillos = ProductoPlatillo.paginate(:per_page => 5, :page => params[:page])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @plato = Plato.find(params[:id])\n\n if !@plato.comentario.first.nil?\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n else\n render json: @plato.as_json(only: [:id, :nombre, :prec... | [
"0.6772314",
"0.66174287",
"0.6607248",
"0.6486347",
"0.64763993",
"0.64665955",
"0.642262",
"0.64082706",
"0.6385137",
"0.6378181",
"0.63468605",
"0.6335697",
"0.63112074",
"0.6236767",
"0.62340736",
"0.62129515",
"0.61946577",
"0.61703753",
"0.61660355",
"0.6121208",
"0.609... | 0.6293081 | 13 |
GET /producto_platillos/1 GET /producto_platillos/1.json | def show
combo_producto
combo_platillo
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @plato = Plato.find(params[:id])\n\n if !@plato.comentario.first.nil?\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n else\n render json: @plato.as_json(only: [:id, :nombre, :prec... | [
"0.6909057",
"0.6686624",
"0.66710925",
"0.6600284",
"0.6581346",
"0.6579126",
"0.653145",
"0.64576155",
"0.6404416",
"0.6383554",
"0.6383079",
"0.6382015",
"0.63767076",
"0.63358223",
"0.6325091",
"0.63201064",
"0.6275003",
"0.62538236",
"0.6247262",
"0.6241285",
"0.6232454"... | 0.0 | -1 |
POST /producto_platillos POST /producto_platillos.json | def create
combo_producto
combo_platillo
@producto_platillo = ProductoPlatillo.new(producto_platillo_params)
respond_to do |format|
if @producto_platillo.save
format.html { redirect_to @producto_platillo, notice: 'El Detalle del Platillo Fue Creado Exitosamente.' }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def producto_platillo_params\n params.require(:producto_platillo).permit(:id_pro_pla, :producto, :platillo, :cantidad, :unidad_medida)\n end",
"def create\n if params[:get]\n @plato = Plato.where(\"soda_id = ?\", params[:soda_id])\n\n #if !@plato.comentario.first.nil?\n # render json: @pla... | [
"0.7018897",
"0.6923182",
"0.6849851",
"0.6807288",
"0.66978735",
"0.6647443",
"0.6609142",
"0.6576189",
"0.655807",
"0.65398675",
"0.64680856",
"0.64614064",
"0.6455028",
"0.64339703",
"0.64044243",
"0.6363091",
"0.6330418",
"0.63189685",
"0.6309633",
"0.63084376",
"0.630843... | 0.72657496 | 0 |
PATCH/PUT /producto_platillos/1 PATCH/PUT /producto_platillos/1.json | def update
respond_to do |format|
if @producto_platillo.update(producto_platillo_params)
format.html { redirect_to @producto_platillo, notice: 'El Detalle del Platillo Fue Actualizado Exitosamente.' }
format.json { render :show, status: :ok, location: @producto_platillo }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redi... | [
"0.7268854",
"0.6940245",
"0.6734913",
"0.6690352",
"0.66876256",
"0.66721344",
"0.6628423",
"0.661195",
"0.6591396",
"0.65824676",
"0.65641254",
"0.6555627",
"0.65471905",
"0.6531612",
"0.65307873",
"0.653039",
"0.6519643",
"0.6516555",
"0.6499899",
"0.648792",
"0.6485296",
... | 0.70068634 | 1 |
DELETE /producto_platillos/1 DELETE /producto_platillos/1.json | def destroy
combo_producto
combo_platillo
@producto_platillo.destroy
respond_to do |format|
format.html { redirect_to producto_platillos_url, notice: 'El Detalle del Platillo Fue Eliminado Exitosamente.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @producto_ofertado.destroy\n respond_to do |format|\n format.html { redirect_to producto_ofertados_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @producto.destroy\n respond_to do |format|\n format.html { redirect_to productos_url }\n forma... | [
"0.7328511",
"0.73202974",
"0.72491026",
"0.72444123",
"0.721747",
"0.721747",
"0.721747",
"0.72146946",
"0.721325",
"0.7207015",
"0.7201146",
"0.71920335",
"0.7173406",
"0.7171786",
"0.7151508",
"0.71489567",
"0.7116819",
"0.71141243",
"0.71057177",
"0.71028197",
"0.71019363... | 0.74845874 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_producto_platillo
@producto_platillo = ProductoPlatillo.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 producto_platillo_params
params.require(:producto_platillo).permit(:id_pro_pla, :producto, :platillo, :cantidad, :unidad_medida)
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.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894"... | 0.0 | -1 |
whether the sum of each row matches the sum of corresponding column i.e. sum of numbers in row i is the same as the sum of numbers in column i for i = 0 to row.length1 If this is the case, return true. Otherwise, return false. | def matrix_check_sum(matrix)
dim = matrix.length
dim.times do |i|
row_sum = matrix[i].sum
col_sum = sum_column(matrix, i)
return false if row_sum != col_sum
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix_check_sum(matrix)\n rows = matrix.length\n columns = matrix[0].length\n \n sum_rows = []\n matrix.each do |row|\n sum_rows.push(row.sum)\n end\n\n sum_columns = []\n columns.times do |i|\n sum = 0\n rows.times do |j|\n sum = sum + matrix[j][i]\n end\n sum_columns.push(sum)\n ... | [
"0.80996144",
"0.8073452",
"0.8023219",
"0.78848034",
"0.77612644",
"0.77600557",
"0.7740447",
"0.7733405",
"0.7680314",
"0.7673039",
"0.76665896",
"0.7614307",
"0.75983787",
"0.74744433",
"0.74436533",
"0.73713684",
"0.7268347",
"0.67911965",
"0.6694505",
"0.6657823",
"0.662... | 0.79283804 | 3 |
GET /fixtures/1 GET /fixtures/1.json | def show
@fixtures = Fixture.all
@fixture = Fixture.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @fixture }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @fixture }\n end\n end",
"def index\n @fixtures = Fixture.all\n\n respond_to do |format|\n format.json { render json: @fixtures }\n end\n end",
"def show\n @fixture = Fixture... | [
"0.7448775",
"0.73799914",
"0.7178113",
"0.6998394",
"0.68740314",
"0.687179",
"0.68463093",
"0.6756987",
"0.67401975",
"0.67236924",
"0.672074",
"0.6715093",
"0.66443664",
"0.66278625",
"0.64838415",
"0.647972",
"0.6468191",
"0.6451382",
"0.63159263",
"0.6300804",
"0.6287719... | 0.7429521 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.