query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /badges/1 GET /badges/1.json
def show @badge = Badge.find_by_key(params[:id]) respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badges\n get(\"user/#{user_id}/badges.json\")\n end", "def badges(id)\n get(\"users/#{id}/badges\")\n end", "def full_badges\n client.user_badges(id)\n end", "def badges(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/badges.json\")\n ...
[ "0.82816005", "0.7840446", "0.7380956", "0.7360627", "0.7244829", "0.71667504", "0.7026382", "0.6960049", "0.6957535", "0.6946959", "0.6925517", "0.68794656", "0.6792295", "0.66721576", "0.6649838", "0.6576033", "0.6542274", "0.6541617", "0.6541617", "0.6541617", "0.6520932",...
0.6895976
11
GET /badges/new GET /badges/new.json
def new @badge = Badge.new respond_to do |format| format.html # new.html.erb format.json { render :json => @badge } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @badge = Badge.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @badge }\n end\n end", "def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @badge }\n end...
[ "0.81727326", "0.76246285", "0.7512228", "0.7369779", "0.70479316", "0.6955548", "0.6943522", "0.69004935", "0.68820465", "0.6828595", "0.6789535", "0.6776546", "0.6776546", "0.6743277", "0.6743267", "0.67414254", "0.6724051", "0.66959083", "0.6686734", "0.66722065", "0.66702...
0.8216712
0
POST /badges POST /badges.json
def create @badge = Badge.new(params[:badge]) respond_to do |format| if @badge.save format.html { redirect_to @badge, :notice => 'Badge was successfully created.' } format.json { render :json => @badge, :status => :created, :location => @badge } else format.html { render :action => "new" } format.json { render :json => @badge.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @badge = Badge.new(params[:badge])\n \n\n respond_to do |format|\n if @badge.save\n format.html { redirect_to @badge, notice: 'Badge was successfully created.' }\n format.json { render json: @badge, status: :created, location: @badge }\n else\n format.html { ren...
[ "0.7457712", "0.6846014", "0.6806162", "0.67646587", "0.6714363", "0.6706622", "0.66743445", "0.6616647", "0.64745873", "0.63554764", "0.63486", "0.6334261", "0.6324032", "0.62979513", "0.62812895", "0.6273197", "0.62320244", "0.6105499", "0.6099493", "0.609918", "0.6073953",...
0.7510865
0
PUT /badges/1 PUT /badges/1.json
def update @badge = Badge.find_by_key(params['id']) @badge.approved_at = Time.now unless session[:admin] respond_to do |format| if @badge.update_attributes(params[:badge]) format.html { redirect_to @badge, :notice => 'Badge was successfully updated.' } else format.html { render :action => "edit" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit...
[ "0.7433612", "0.7292388", "0.7160003", "0.67772365", "0.6748671", "0.65781724", "0.6536563", "0.6536563", "0.6536563", "0.64023155", "0.62654424", "0.62097263", "0.61501694", "0.6138595", "0.6097217", "0.60823286", "0.6052821", "0.60479176", "0.5934693", "0.5902172", "0.58571...
0.63369906
10
Increase the default delay by five seconds since some kernelmode payloads may not run immediately.
def wfs_delay super + 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delay\n @delay ||= 600\n end", "def default_delay\n 0.seconds\n end", "def delay\n sleep(2)\n end", "def default_delay\n @@default_delay ||= 0\n end", "def set_delay(delay)\n @delay = delay\n end", "def default_delay=(v)\n @@default_delay = v\n end", "def delay_1...
[ "0.738869", "0.70848966", "0.6960668", "0.692924", "0.6891885", "0.6881094", "0.68787515", "0.6872018", "0.6872018", "0.6872018", "0.684173", "0.684173", "0.68239194", "0.67521393", "0.67432237", "0.6718678", "0.6693301", "0.6691764", "0.6691764", "0.66433674", "0.6562137", ...
0.6942297
3
GET /circles GET /circles.json
def index search_word = SearchForm.new(circle_params) if search_word.valid? @circles = Circle.search(search_word.serializable_hash) puts "circle is #{@circles}" @circles else render json: search_word.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @circle = current_user.circle\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @circle }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def show\n @circle = Circle.find(params[:id...
[ "0.7484646", "0.73138803", "0.7197082", "0.7190375", "0.7155239", "0.6725961", "0.63376987", "0.63168573", "0.63034815", "0.63034815", "0.62562346", "0.62343293", "0.6225809", "0.6105686", "0.60478145", "0.60374385", "0.60374385", "0.6002041", "0.59485286", "0.593329", "0.591...
0.6273125
10
GET /circles/1 GET /circles/1.json
def show @genres = @circle.genres end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @circle }\n end\n end", "def show\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { r...
[ "0.7646373", "0.7601681", "0.7542692", "0.7041239", "0.6995559", "0.6820596", "0.6820596", "0.65825766", "0.6460563", "0.6421201", "0.63588256", "0.6315388", "0.6315388", "0.6289307", "0.6289307", "0.6170639", "0.61608595", "0.6133126", "0.6112254", "0.6094382", "0.6061157", ...
0.0
-1
POST /circles POST /circles.json
def create @circle = Circle.new(post_params) if @circle.save render :show, status: :created, location: @circle else render json: @circle.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @circle = Circle.new(params[:circle])\n @circle.user = current_user\n \n respond_to do |format|\n if @circle.save\n format.html { redirect_to @circle, :notice => 'Circle was successfully created.' }\n format.json { render :json => @circle, :status => :created, :location ...
[ "0.7368445", "0.7193256", "0.68230915", "0.65687287", "0.65500444", "0.64309543", "0.6428214", "0.6428214", "0.6351642", "0.62205863", "0.6118326", "0.610242", "0.6060388", "0.5932615", "0.5932615", "0.5931351", "0.5915893", "0.590707", "0.588749", "0.5874788", "0.5854617", ...
0.7293516
1
PATCH/PUT /circles/1 PATCH/PUT /circles/1.json
def update if @circle.update(post_params) render :show, status: :ok, location: @circle else render json: @circle.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @circle = Circle.find(params[:id])\n\n respond_to do |format|\n if @circle.update_attributes(params[:circle])\n format.html { redirect_to @circle, :notice => 'Circle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :acti...
[ "0.75676835", "0.7538444", "0.7538444", "0.7405154", "0.7237855", "0.64841455", "0.6473821", "0.61811185", "0.61735976", "0.6159464", "0.60976195", "0.60976195", "0.60677433", "0.6050749", "0.6037844", "0.5989796", "0.5967441", "0.5935556", "0.5923504", "0.58812666", "0.58812...
0.659366
5
DELETE /circles/1 DELETE /circles/1.json
def destroy @circle.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @circle = Circle.find(params[:id])\n @circle.destroy\n\n respond_to do |format|\n format.html { redirect_to circles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @circle = Circle.find(params[:id])\n @circle.destroy\n\n respond_to do |format|\n...
[ "0.7906571", "0.7906571", "0.7596188", "0.7595404", "0.7483723", "0.7348654", "0.7110125", "0.6873949", "0.6805337", "0.6778534", "0.66757864", "0.6646662", "0.6629113", "0.65654445", "0.65654445", "0.65654445", "0.65654445", "0.6547623", "0.6458799", "0.6457974", "0.64198214...
0.7237059
6
Use callbacks to share common setup or constraints between actions.
def set_circle @circle = Circle.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 circle_params params.permit({genre: []}, :fee, :order, :min, :max, :frequency, :days, :location, :freeword) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Part 1 Below code takes an array of integers as an argument and returns the sum of its elements.
def sum(in_array) # YOUR CODE HERE sumr=0 if in_array.length == 0 sumr=0 elsif #Enumerable sumr= in_array.reduce(:+) end return sumr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_array(int_array)\n int_array.reduce(:+)\nend", "def sum_array(array)\n sum = 0\n array.each do |x|\n sum += x\n end\n return sum\nend", "def sum_array(array)\n sum = 0\n\n array.each do |number|\n sum += number\n end\n\n return sum\nend", "def sum_array(array)\n\tarray.inject { |sum, n...
[ "0.86859727", "0.85542965", "0.85490406", "0.85471165", "0.85007906", "0.84865177", "0.8482826", "0.8471103", "0.8458727", "0.84479445", "0.8447448", "0.844739", "0.84460264", "0.8445915", "0.8445287", "0.8444723", "0.84398735", "0.84398735", "0.84395623", "0.84348696", "0.84...
0.0
-1
Below code takes an array of integers as an argument and returns the sum of its two largest elements.
def max_2_sum(int_array) # YOUR CODE HERE heyr=0 if int_array.length == 0 heyr=0 return heyr elsif int_array.length == 1 heyr=int_array[0] return heyr end int_array.sort!.reverse! heyr= int_array[0] + int_array[1] return heyr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_two_largest_numbers(arr)\n arr.max(2).reduce(:+)\nend", "def max_2_sum(array)\n sum(array.sort.last(2))\nend", "def max_2_sum(array)\n sum array.sort.last(2)\nend", "def max_2_sum(int_array)\n sum(int_array.sort {|a,b| b <=> a}[0,2])\nend", "def max_2_sum array\n return 0 if array.empty?\n ...
[ "0.8579375", "0.85732424", "0.85603315", "0.8454468", "0.84254694", "0.83595246", "0.8342365", "0.8296276", "0.825158", "0.82363594", "0.8219529", "0.8212155", "0.8199183", "0.818208", "0.81219846", "0.8103977", "0.80883586", "0.8058619", "0.8050383", "0.80021906", "0.7999794...
0.7865954
30
Belwo code takes an array of integers and an additional integer, n, as arguments and returns true if any two elements in the array of integers sum to n.
def sum_to_n?(int_array,n) # YOUR CODE HERE return false if int_array.length == 0 int_array.each_with_index{ |val, index| return true if int_array.find_index(n - val) && int_array.find_index(n - val ) != index } return false # default return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_to_n?(array, n)\n return false if array.empty? || array.length == 1\n\n array.combination(2).any? { |x, y| x + y == n }\nend", "def array_sum_to_n?(array, n)\r\n array.combination(2).any?{ |x, y| x + y == n } # For any combination of two elements their sum must be equal to n.\r\nend", "def sum_to...
[ "0.8592546", "0.85841346", "0.8521152", "0.8400378", "0.83924204", "0.8335459", "0.8320183", "0.8266337", "0.8250457", "0.8237341", "0.8197147", "0.81915534", "0.81590706", "0.8119986", "0.81177366", "0.8112718", "0.8087066", "0.80859077", "0.8079516", "0.80459446", "0.804352...
0.7873853
35
Part 2 Below code takes a string representing a name and returns the string "Hello, " concatenated with the name.
def hello(name) # YOUR CODE HERE "Hello, #{name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hello(name)\n \"Hello, \".concat(name)\nend", "def hello(name)\n\ts = \"Hello, \" + name\n\treturn s\nend", "def hello(name)\n \n str = \"Hello, #{name}\"\n return str \n \nend", "def hello(name)\n str1 = name\n str2 = \"Hello, \"\n str2.concat(str1)\nend", "def name(name)\n return \...
[ "0.7989296", "0.79874384", "0.78154844", "0.7744972", "0.76759094", "0.75783575", "0.7567679", "0.7525287", "0.7521374", "0.7491182", "0.74480134", "0.7436089", "0.7417998", "0.7399628", "0.7386105", "0.73432976", "0.73335195", "0.73335195", "0.73268956", "0.73268956", "0.732...
0.0
-1
Below code takes a string and returns true if it starts with a consonant and false otherwise.
def starts_with_consonant?(s) # YOUR CODE HERE !!(s[0] =~ /[qzyxwvtsrbcdfghjklmnp]+/i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starts_with_consonant? s\n return false if s == ''\n return false if !s[0].match(/^[[:alpha:]]$/)\n s[0] =~ /[AaEeIiOoUu]/ ? false : true\nend", "def starts_with_consonant? s\n return false if s.empty?\n s.downcase!\n if s[0].match(/\\A[bcdfghjklmnpqrstvwxyz]/)\n return true\n else\n false\n en...
[ "0.8950055", "0.89398736", "0.89318657", "0.8914293", "0.8914293", "0.8906625", "0.8906625", "0.8899526", "0.88632745", "0.882058", "0.879161", "0.87850225", "0.87237024", "0.87055355", "0.86931926", "0.8682036", "0.8658485", "0.8651877", "0.8643868", "0.8622101", "0.8617414"...
0.8744369
12
Below code takes a string and returns true if the string represents a binary number that is a multiple of 4.
def binary_multiple_of_4?(s) # YOUR CODE HERE if s =~ /^[0-1]+$/ return s.to_i(2) % 4 == 0 end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binary_multiple_of_4? str\n\treturn (str =~ /\\b[01]+\\b/) != 0 ? false : str.to_i(2) % 4 == 0 ? true : false\nend", "def binary_multiple_of_4? s\n return false if s =~ /[^0-1]/\n return false if s == ''\n s.to_i(2) % 4 == 0 ? true : false\nend", "def binary_multiple_of_4?(str)\n if str!=''\n str.ea...
[ "0.91391087", "0.90644675", "0.90362066", "0.8990401", "0.8975801", "0.8928835", "0.8916422", "0.88924944", "0.888888", "0.88709724", "0.88660556", "0.88583463", "0.88283455", "0.8823368", "0.88209933", "0.8793129", "0.87742674", "0.8743983", "0.87246525", "0.8681561", "0.868...
0.87391615
18
also change the method key?, include?, member?
def has_key?(key) local?(key) || (!@parent.nil? && @parent.key?(key)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key(method)\n @_key = method\n end", "def key=(key); end", "def include?(key); end", "def include?(key); end", "def key=(_); end", "def key=(_); end", "def rekey_as_needed; end", "def pfadd(key, member); end", "def [](key)\n Extension.mixin_to(self,key,super)\n end", "...
[ "0.66888416", "0.6590128", "0.6431418", "0.6431418", "0.6410342", "0.6410342", "0.6348724", "0.6241407", "0.61003023", "0.60467255", "0.60247505", "0.60032475", "0.60032475", "0.5917361", "0.5880308", "0.58585143", "0.58408993", "0.5834375", "0.5834375", "0.5834375", "0.58235...
0.0
-1
GET /cordinators GET /cordinators.json
def index @cordinators = Cordinator.all.order('name ASC').page(params[:page]).per(3) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cords = Cord.all\n @cords = Cord.user_cords(current_user)\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def index\n @commanders = Commander.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render jso...
[ "0.6471373", "0.6235497", "0.60187787", "0.5987753", "0.5859183", "0.5853303", "0.58433515", "0.5839788", "0.57999206", "0.5787826", "0.57639337", "0.5750131", "0.5735624", "0.5713239", "0.56854445", "0.5667751", "0.56671786", "0.5663496", "0.5654859", "0.5637093", "0.5634163...
0.66650933
0
GET /cordinators/1 GET /cordinators/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cordinators = Cordinator.all.order('name ASC').page(params[:page]).per(3)\n end", "def index\n @cords = Cord.all\n @cords = Cord.user_cords(current_user)\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def show\n @collaborator = Collabor...
[ "0.6468164", "0.6338109", "0.6239724", "0.5967036", "0.5955771", "0.5939155", "0.5887246", "0.5843991", "0.5815789", "0.57620484", "0.5746067", "0.5701565", "0.5701565", "0.56876874", "0.568302", "0.5659988", "0.5654441", "0.56499875", "0.5635845", "0.56357145", "0.5604299", ...
0.0
-1
POST /cordinators POST /cordinators.json
def create @cordinator = Cordinator.new(cordinator_params) respond_to do |format| if @cordinator.save format.html { redirect_to @cordinator, notice: 'El cordinador se ha creado correctamente' } format.json { render :show, status: :created, location: @cordinator } else format.html { render :new } format.json { render json: @cordinator.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # @cord = Cord.new(cord_params)\n @cord = @racquet.cords.new(cord_params)\n @cord.user = current_user\n respond_to do |format|\n if @cord.save\n format.html { redirect_to @cord, notice: t('cords.create.success') }\n format.json { render :show, status: :created, location:...
[ "0.60080016", "0.5506219", "0.54745144", "0.5445114", "0.54281193", "0.5355071", "0.5354252", "0.5341191", "0.5331485", "0.53251165", "0.53107536", "0.53016144", "0.52887005", "0.5285094", "0.52657056", "0.5245813", "0.52454466", "0.5236012", "0.5230248", "0.5229306", "0.5202...
0.56536317
1
PATCH/PUT /cordinators/1 PATCH/PUT /cordinators/1.json
def update respond_to do |format| if @cordinator.update(cordinator_params) format.html { redirect_to @cordinator, notice: 'El cordinador se ha actualizado correctamente' } format.json { render :show, status: :ok, location: @cordinator } else format.html { render :edit } format.json { render json: @cordinator.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def patch!\n request! :patch\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n ...
[ "0.61959916", "0.61746824", "0.6141433", "0.61092645", "0.60911775", "0.6066104", "0.60299885", "0.5993334", "0.5988145", "0.59813017", "0.59496444", "0.59359086", "0.59230864", "0.59155315", "0.59032506", "0.58857113", "0.5864647", "0.57712567", "0.57603264", "0.5755869", "0...
0.59656715
10
DELETE /cordinators/1 DELETE /cordinators/1.json
def destroy @cordinator.destroy respond_to do |format| format.html { redirect_to cordinators_url, notice: 'El cordinador se ha eliminado correctamente' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n orden@client.destroy\n end", "def de...
[ "0.7258742", "0.7114767", "0.693792", "0.6838794", "0.6816151", "0.68074024", "0.67969173", "0.6780562", "0.6769751", "0.673742", "0.67337257", "0.6727356", "0.6705943", "0.6698743", "0.6698743", "0.6691693", "0.66801524", "0.6667553", "0.6667553", "0.6667553", "0.6667553", ...
0.70559186
2
Use callbacks to share common setup or constraints between actions.
def set_cordinator @cordinator = Cordinator.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def cordinator_params params.require(:cordinator).permit(:name, :address, :phone) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def requests_cloning_params params.require(:requests_cloning).permit(:name, :company, :mail, :phone, :shipping_address, :group_leader, :payment_method, :sample_name, :sample_volume, :pcr_product_size, :req_type, :sequencing_type, :inv_name, :inv_rfc, :inv_address, :inv_city, :inv_municipality, :inv_state_id, :inv_mail) 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.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
GET /forum/topics GET /forum/topics.json
def index @forum_topics = Forum::Topic.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forum_get_topics(args={})\n JSON.parse(HelpSpot.api_request('forums.getTopics', 'GET', {:xForumId => args[:forum_id]}.merge(args)))['topic'] rescue []\n end", "def show\n\t\t@forum = Forum.find(params[:id])\n\t\t@topics = @forum.topics.order(\"created_at DESC\")\n\n\t\trespond_to do |format|\n\t\t\tf...
[ "0.80589384", "0.79791427", "0.79392666", "0.7635081", "0.7461913", "0.73416793", "0.72031635", "0.71412176", "0.7139532", "0.7101658", "0.7086375", "0.70813334", "0.70747966", "0.70747966", "0.70747966", "0.7047645", "0.70448375", "0.70448375", "0.7020688", "0.6995761", "0.6...
0.73567235
5
GET /forum/topics/1 GET /forum/topics/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n\t\t@forum = Forum.find(params[:id])\n\t\t@topics = @forum.topics.order(\"created_at DESC\")\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @forum }\n\t\tend\n\tend", "def GetTopicsByForum id,params = {}\n\n params = params.merge(path: \"forums...
[ "0.80613303", "0.7809695", "0.76935434", "0.74766177", "0.74642545", "0.7445874", "0.72653353", "0.7255433", "0.7225459", "0.72048295", "0.71258485", "0.71119815", "0.70608765", "0.70500576", "0.7041242", "0.7029406", "0.7029406", "0.7029406", "0.7015976", "0.69895816", "0.69...
0.0
-1
POST /forum/topics POST /forum/topics.json
def create @forum_topic = Forum::Topic.new(forum_topic_params) respond_to do |format| if @forum_topic.save format.html { redirect_to @forum_topic, notice: 'Topic was successfully created.' } format.json { render action: 'show', status: :created, location: @forum_topic } else format.html { render action: 'new' } format.json { render json: @forum_topic.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n if @forum.topics.create!(params[:topic])\n format.html { redirect_to forum_path(@forum), notice: 'Topic was successfully created.' }\n format.json { render json: @topic, status: :created, location: @topic }\n else\n format.html { render action...
[ "0.7544425", "0.73355794", "0.72056794", "0.7142488", "0.70683473", "0.69810206", "0.6958741", "0.6956227", "0.6907363", "0.68847775", "0.6875981", "0.68741125", "0.6870669", "0.6831642", "0.6827633", "0.68154293", "0.6778422", "0.6762545", "0.67495096", "0.6734686", "0.67234...
0.70196164
5
PATCH/PUT /forum/topics/1 PATCH/PUT /forum/topics/1.json
def update respond_to do |format| if @forum_topic.update(forum_topic_params) format.html { redirect_to @forum_topic, notice: 'Topic was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @forum_topic.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateForum id,params = {}\n \n APICall(path: \"forums/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end", "def update\n @topic = Topic.find(params[:id])\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to f...
[ "0.7393139", "0.7090509", "0.7087829", "0.7048357", "0.6968193", "0.68985105", "0.6887631", "0.6876073", "0.68731165", "0.6817543", "0.6807804", "0.6806315", "0.6772678", "0.6745174", "0.6718342", "0.6717167", "0.6713969", "0.67085344", "0.670782", "0.670782", "0.670782", "...
0.7075809
3
DELETE /forum/topics/1 DELETE /forum/topics/1.json
def destroy @forum_topic.destroy respond_to do |format| format.html { redirect_to forum_topics_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteForum id\n \n APICall(path: \"forums/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @forum = Forum.find(params[:forum_id])\n @topic.destroy\n\n respond_to do |format|\n format.html { redirect_to forum_url(@forum) }\n format.json { head :no_content ...
[ "0.79541385", "0.7953616", "0.7926266", "0.7818605", "0.7737781", "0.7694223", "0.7600998", "0.75670964", "0.7549272", "0.7543759", "0.7537674", "0.7520923", "0.751746", "0.751746", "0.751746", "0.751746", "0.751746", "0.75159913", "0.75077087", "0.74912995", "0.74714893", ...
0.8012485
0
Use callbacks to share common setup or constraints between actions.
def set_forum_topic @forum_topic = Forum::Topic.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def forum_topic_params params.require(:forum_topic).permit(:category_id, :title) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_sensor if current_user @sensor = current_user.sensors.find(params[:id]) else # Determine if this user has set this sensor as public public_sensor = Sensor.find(params[:id]).public @sensor = Sensor.find(params[:id]) if public_sensor 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.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 sensor_params params[:sensor][:unit] = params[:sensor][:unit].to_i params[:sensor][:kind] = params[:sensor][:kind].to_i params[:sensor][:type_of_graph] = params[:sensor][:type_of_graph].to_i params[:sensor][:notification] = params[:sensor][:notification].to_i params[:sensor][:notification_value] = params[:sensor][:notification_value].to_i if params[:sensor][:public] == "on" params[:sensor][:public] = true else params[:sensor][:public] = false end params.require(:sensor).permit(:name, :unit, :kind, :type_of_graph, :public, :notification, :notification_value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
dynamic programming bottom up
def is_match(s, p) dp = Array.new(s.length+1) { Array.new(p.length+1, false) } m, n = s.length, p.length dp[m][n] = true m.downto(0) do |i| (n-1).downto(0) do |j| first = i < m && (s[i] == p[j] || p[j] == '.') if p[j+1] == '*' dp[i][j] = dp[i][j+2] || (first && dp[i+1][j]) else dp[i][j] = first && dp[i+1][j+1] end end end dp[0][0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive_solution\n\n end", "def build_subsolutions\n @success_probability = Array.new(@size)\n @success_probability[@size-1] = 1.0/@size\n (@size-1).downto(1).each { |k|\n @success_probability[k-1] = 1.0/@size + @success_probability[k]*(k-1)/k\n }\n end", "def solve\n dp = H.times.map...
[ "0.6271544", "0.61861247", "0.61526287", "0.6137266", "0.60934085", "0.6063052", "0.6055467", "0.60319865", "0.60048896", "0.5980103", "0.5975958", "0.59746754", "0.5965973", "0.5965729", "0.5914004", "0.5860188", "0.5858055", "0.5839102", "0.5814709", "0.5807538", "0.5798958...
0.0
-1
Renders holding page if it exists, if member is NOT logged in, and the root request path is used. /loggedout should render the homepage, but not the holding page
def render_holding_page_if_exists if view_exists?(HOLDING_VIEW) && !@logged_in_member && request.path == '/' render(:template => HOLDING_VIEW, :layout => false) and return end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if current_user\n render_home_page\n else\n render_welcome_page\n end\n end", "def signed_user_unnecessary_pages\n if signed_in?\n redirect_to(root_path)\n end\n end", "def verify_logged_in\n redirect_to root_path unless logged_in?\n end", "def pr...
[ "0.64634496", "0.6334306", "0.6315294", "0.6296778", "0.62539876", "0.6199986", "0.6176579", "0.61680365", "0.6154387", "0.61512864", "0.6147536", "0.61446613", "0.6105697", "0.60962707", "0.60889", "0.60882086", "0.608639", "0.60824186", "0.6082179", "0.6053566", "0.60375595...
0.8022832
0
G:T, R:E, F:S, J:W, H:U, V:I, L:Y, Z:M}
def block_word?(word) down = word.downcase indexArray = [] letter1 = ["b", "x", "d", "c", "n", "g", "r", "f", "j", "h", "v", "l", "z"] letter2 = ["o", "k", "q", "p", "a", "t", "e", "s", "w", "u", "i", "y", "m"] letter1.each_with_index do |element, index| if down.include?(element) indexArray[index] = 1 else indexArray[index] = 0 end end letter2.each_with_index do |element, index| if down.include?(element) indexArray[index] += 1 end end !indexArray.any? {|x| x > 1} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getgm() end", "def human_representation(options = {}, g = { x: x, y: y })\n g.map do |k, v|\n deg = v.to_i.abs\n min = (60 * (v.abs - deg)).to_i\n labs = (v * 1_000_000).abs / 1_000_000\n sec = ((((labs - labs.to_i) * 60) -\n ((labs - labs.to_i) * 60).t...
[ "0.5961361", "0.5650462", "0.564609", "0.5439773", "0.5438751", "0.53969264", "0.5392047", "0.5287255", "0.52759415", "0.526136", "0.526136", "0.52569556", "0.5253616", "0.52456146", "0.51385486", "0.5133525", "0.5129573", "0.5119237", "0.5099938", "0.50962394", "0.50892293",...
0.0
-1
GET /ad/1 GET /ad/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad }\n end\n end", "def show\n @ad = Ad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad }\n ...
[ "0.7653487", "0.7653487", "0.7653487", "0.7245162", "0.7229485", "0.7094977", "0.7065143", "0.70625454", "0.70625454", "0.70081294", "0.6920105", "0.6905401", "0.68924284", "0.6842743", "0.6810194", "0.680532", "0.6676285", "0.66659755", "0.66574806", "0.66574806", "0.6642968...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_ad @ad = Ad.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Currently there is no way of knowing when error output has finished, so now we capture errors from start of receiving first line is 1 second ago or we started capturing error output is 4 seconds ago. Hope this will be enough.
def capture_error_output puts "Capturing error output..." @stderr.flush error_catching_thread = Thread.new { @out = "" thread = Thread.start do @stderr.each_line do |line| @out << line end end } @stderr.sync = false line = "" while c = @stdout.read(1) line += c if line =~ /\(fcsh\)/ puts "Done...." return @out end next if c != "/n" puts "(out) " + line.inspect if $DEBUG if line =~ /Nothing has changed/ puts "Nothing has changed" if $DEBUG return @out end if line =~ /Files changed:/ puts "Filed changed:" if $DEBUG return @out end if line =~ /Error: (.*)/ raise CompileError.new(line) end if line =~ /.+\.swf/ puts "" if $DEBUG return @out end line = "" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capture_error\n begin\n yield\n @error = all_output unless last_exit_status == 0\n rescue => @error\n end\n end", "def recoverable_error e, msg = \"Error\", bt = []\n puts \"#{msg} at time #{clock}\"\n puts \"From \" + bt[0..2].join(\"\\n \") unless bt.empty\n put...
[ "0.6697931", "0.62562585", "0.6221313", "0.6126352", "0.6086054", "0.58403146", "0.5776747", "0.5739993", "0.5723699", "0.5719512", "0.5719336", "0.57189155", "0.57005", "0.56867373", "0.56538385", "0.5606686", "0.5600694", "0.5589313", "0.5583187", "0.55641943", "0.5559698",...
0.70106184
0
Wait on stdout for pattern
def wait_for_on_stdout(pattern) out = '' # read everything in out and stop when pattern is matched {} while !((out << @stdout.read(1)) =~ pattern) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for(pattern)\n $_api_exec_state = :wait_for\n if pattern.is_a?(Array)\n pattern = Regexp.new(pattern.join('|'))\n end\n\n (0..1000000).each do\n line = API::sync_read\n if line and line.match(pattern)\n $_api_exec_state = :none\n return\n end\n sleep 0.01\n end\nend", "...
[ "0.7417049", "0.7047585", "0.6606024", "0.6486684", "0.6402355", "0.63500684", "0.6254041", "0.6245654", "0.61042506", "0.6070601", "0.6046916", "0.601509", "0.5966015", "0.5950698", "0.58704716", "0.58571386", "0.5849312", "0.581083", "0.58056253", "0.57866293", "0.57653826"...
0.8712005
0
This is horrid, should be moved to something like map.resolve_room(name, relative_to = nil)
def find_room(room_name) if room_name[0..0] == '.' @map[room_name[1..-1]] else p = @path.dup p.pop p += room_name.split('.') r = @map[p.join('.')] r || @map[room_name] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_room_lookup_table(parsed_rooms)\n room_lookup = {} \n parsed_rooms.each do |room|\n room_lookup[room[1]] = room.first\n end \n room_lookup\nend", "def find_room(room_or_identifier)\n case room_or_identifier\n when Room\n room_or_identifier\n else\n Room.fuzzy_find(ro...
[ "0.65332305", "0.6158236", "0.60059655", "0.5988852", "0.5506339", "0.5477326", "0.54548943", "0.5454551", "0.54327685", "0.5415896", "0.53470814", "0.5337693", "0.5325693", "0.5290417", "0.52707285", "0.52569366", "0.5214262", "0.52050155", "0.51989424", "0.5194192", "0.5159...
0.6862318
0
a simple versio of above code
def multiply(x, y) return x * y if x.is_a?(Numeric) && y.is_a?(Numeric) fail ArgumentError, 'Arguments must be a number' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def suivre; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def schubert; end", "def terpene; end", "def verdi; end", "def anchored; end", "def same; end", "def probers=(_arg0); end", "def formation; end", "def b...
[ "0.6328854", "0.61629325", "0.60624635", "0.60624635", "0.60624635", "0.60624635", "0.5967665", "0.59564024", "0.5887669", "0.57578367", "0.57401544", "0.5660327", "0.5645947", "0.5640901", "0.5633973", "0.5625773", "0.5602865", "0.5602865", "0.55473095", "0.55178684", "0.550...
0.0
-1
Custom label methods def property_label_method if self.property_category.nil? self.property_name else self.property_category.category_name + ": " + self.property_name end end
def property_label_method self.property_category ? self.property_category.category_name + ": " + self.property_name : self.property_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_label\n \"#{self.name}\"\n end", "def custom_label\n \"#{self.name}\"\n end", "def property_label_text(property)\n case property.to_sym\n when :image_default then t(:image_url)\n when :web_default then t(:website_url)\n when :web_blog then t(:blog_url)\n else t(propert...
[ "0.75380534", "0.7479646", "0.71289426", "0.70067066", "0.6887744", "0.6871248", "0.6810501", "0.67141193", "0.6654435", "0.65932643", "0.6588898", "0.6527019", "0.64864457", "0.6482465", "0.6436876", "0.642014", "0.64193153", "0.6410453", "0.6404373", "0.6390871", "0.6384548...
0.9473136
0
In my own words: Create a method that takes a string argument. It returns a new string, that contains the original string value. Except all the consecutive duplicate characters are collapsed into a single character. input: a string object output: is a new string object steps: => make a copy of the string with dup => examine each character of the string => store the current character inside of a variable outside of the each method => => if the current character is equal to the last character, remove it => after we have iterated through all the characters, return the new string.
def remove_consec_dup(string) new_string_array = string.dup.chars current_character = [] new_string_array.each do |char| if current_character.last == char next else current_character << char end end current_character.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_adjacent_duplicates(input)\n result = \"\"\n last = \"\"\n input.chars.each do |letter|\n if letter != last\n result += letter\n last = letter\n end\n end\n return result\nend", "def no_dupes(string)\n string_arr = string.split('')\n if string_arr.l...
[ "0.80858", "0.7859303", "0.7795108", "0.7722764", "0.7551813", "0.7535296", "0.7511013", "0.7506296", "0.74835664", "0.7459274", "0.74411875", "0.73930335", "0.73283374", "0.7305244", "0.73006004", "0.723436", "0.7223878", "0.7211926", "0.7194081", "0.71889544", "0.71437615",...
0.8259019
0
logs out the current user.
def signout session.delete(:user_id) @current_user = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_out\n\t\t# current_user.delete_auth_token # won't work with curl, but html is good\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend", "def log_out\n session.delete(:user_id)\n @current_user = nil\n end", "def log_out\n session.delete(:user_id)\n @current_user...
[ "0.8546083", "0.85344946", "0.85344946", "0.85344946", "0.85344946", "0.85344946", "0.852604", "0.8525856", "0.8525856", "0.8525856", "0.8525856", "0.8483694", "0.8480767", "0.8480241", "0.84791666", "0.84397125", "0.84262", "0.84262", "0.84262", "0.84262", "0.84262", "0.84...
0.0
-1
Generates asymmetric key pair that is comprised of both public and private keys by specified type.
def generate_keys(keys_type: @default_key_type, key_material: nil) key_material = Validation.check_filled_array_argument!(key_material) if key_material begin native_type = KeyPairType.convert_to_native(keys_type) native_key_pair = nil native_key_pair = if key_material Core::VirgilKeyPair.generate_from_key_material( native_type, key_material ) else Core::VirgilKeyPair.generate(native_type) end key_pair_id = compute_public_key_hash(native_key_pair.public_key) private_key = VirgilPrivateKey.new( key_pair_id, wrap_bytes( Core::VirgilKeyPair.private_key_to_der(native_key_pair.private_key) ) ) public_key = VirgilPublicKey.new( key_pair_id, wrap_bytes( Core::VirgilKeyPair.public_key_to_der(native_key_pair.public_key) ) ) return KeyPair.new(private_key, public_key) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asymmetric_key(name, ssl_class, privkey_abi_type, pubkey_abi_type,\n hooks = {})\n object_wrapper \"private_#{name}\", Tem::Keys::Asymmetric,\n [privkey_abi_type, nil],\n :read => hooks[:read_private] || hooks[:read] ||\n lam...
[ "0.729749", "0.66765815", "0.66422683", "0.63273656", "0.625815", "0.6220553", "0.61587065", "0.61463636", "0.61270756", "0.61120385", "0.6096021", "0.6094618", "0.6069927", "0.60410285", "0.6017853", "0.5986215", "0.5859098", "0.5844397", "0.5822082", "0.5821618", "0.579483"...
0.7097795
1
Imports the Private key from material representation.
def import_private_key(key_bytes, password = nil) key_bytes = Validation.check_filled_array_argument!(key_bytes) begin decrypted_private_key = if !password Core::VirgilKeyPair.private_key_to_der(key_bytes) else Core::VirgilKeyPair.decrypt_private_key( key_bytes, Bytes.from_string(password) ) end public_key_bytes = Core::VirgilKeyPair.extract_public_key( decrypted_private_key, [] ) key_pair_id = compute_public_key_hash(public_key_bytes) private_key_bytes = Core::VirgilKeyPair.private_key_to_der( decrypted_private_key ) return VirgilPrivateKey.new(key_pair_id, wrap_bytes(private_key_bytes)) rescue => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def priv_key\n key = master_ext_key.derive(PURPOSE_TYPE, true).derive(Tapyrus.chain_params.bip44_coin_type, true)\n\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(key) { |key, p| key.derive(p) }\n end", "def private_key\n @private_key ||= load_key(@private_...
[ "0.6410091", "0.628885", "0.62853765", "0.61700916", "0.6164279", "0.6070474", "0.6064182", "0.59653336", "0.59652615", "0.59352744", "0.59266746", "0.5918565", "0.5909634", "0.5906501", "0.59021956", "0.58240163", "0.58090043", "0.5782825", "0.5745873", "0.57402426", "0.5655...
0.67856556
0
Imports the Public key from material representation.
def import_public_key(key_bytes) key_bytes = Validation.check_filled_array_argument!(key_bytes) begin key_pair_id = compute_public_key_hash(key_bytes) public_key_bytes = Core::VirgilKeyPair.public_key_to_der(key_bytes) VirgilPublicKey.new(key_pair_id, wrap_bytes(public_key_bytes)) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_public_key key_name, pubkey, fprint=nil\n params = { \n 'KeyName' => key_name,\n 'PublicKey' => pubkey\n }\n params.merge!( 'Fingerprint' => fprint ) unless fprint.nil?\n\n response = @client.action \"ImportPublicKey\", params\n\n Response::Credential...
[ "0.71169686", "0.69393384", "0.65846115", "0.65846115", "0.6482507", "0.6423467", "0.6289779", "0.6258966", "0.6258966", "0.6255277", "0.6232235", "0.6186848", "0.61603004", "0.6153982", "0.6153051", "0.6130288", "0.6117486", "0.61031467", "0.6101312", "0.60989517", "0.605399...
0.67922914
2
Exports the Private key into material representation.
def export_private_key(private_key, password = nil) private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key) begin unless password return Core::VirgilKeyPair.private_key_to_der( private_key.raw_key ) end password_bytes = Bytes.from_string(password) private_key_bytes = Core::VirgilKeyPair.encrypt_private_key( private_key.raw_key, password_bytes ) wrap_bytes( Core::VirgilKeyPair.private_key_to_der( private_key_bytes, password_bytes ) ) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_public_key\n public_key = context.crypto.extract_public_key(private_key)\n VirgilBuffer.from_bytes(context.crypto.export_public_key(public_key))\n end", "def private_key\n @private_key.to_der\n end", "def output_key(key)\n STDOUT.write \"# Private key (d, n): #{'%X'...
[ "0.6920574", "0.67797095", "0.6773375", "0.649842", "0.6434023", "0.63304627", "0.63133013", "0.62821907", "0.6170287", "0.6142262", "0.6142262", "0.6125581", "0.61235327", "0.60936517", "0.6080612", "0.60539454", "0.60521984", "0.5998864", "0.5927688", "0.58925164", "0.58519...
0.73202413
0
Exports the Public key into material representation.
def export_public_key(public_key) public_key = Validation.check_type_argument!(VirgilPublicKey, public_key) begin wrap_bytes( Core::VirgilKeyPair.public_key_to_der(public_key.raw_key) ) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_public_key\n public_key = context.crypto.extract_public_key(private_key)\n VirgilBuffer.from_bytes(context.crypto.export_public_key(public_key))\n end", "def public_key\n @public_key.to_der\n end", "def public_key_data\n @public_key\n end", "def public_key;...
[ "0.7781859", "0.66773355", "0.6368939", "0.6321901", "0.6321901", "0.6321901", "0.63197047", "0.6272041", "0.6263479", "0.62478334", "0.6205551", "0.62020594", "0.61686707", "0.6161021", "0.6156813", "0.61464834", "0.61463153", "0.61401", "0.61248195", "0.61248195", "0.605717...
0.7246649
1
Extracts the Public key from Private key.
def extract_public_key(private_key) private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key) begin public_key_bytes = Core::VirgilKeyPair.extract_public_key( private_key.raw_key, [] ) VirgilPublicKey.new( private_key.id, wrap_bytes( Core::VirgilKeyPair.public_key_to_der(public_key_bytes) ) ) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_public_key(private_key)\n PointG1.from_private_key(private_key)\n end", "def extract_public_key(options)\n extract_key(options[:public_key] || options[:key_pair] || ENV['PUBLIC_KEY'])\n end", "def public_key\n OpenSSL::PKey.read(public_to_der)\n end", "def public_key\n OpenSS...
[ "0.78158396", "0.7225965", "0.72168237", "0.72168237", "0.69963855", "0.69673043", "0.6884596", "0.6699677", "0.6683896", "0.66786957", "0.66164", "0.65782636", "0.6566694", "0.6541878", "0.6507677", "0.65064543", "0.64971787", "0.64472294", "0.64472294", "0.6425457", "0.6398...
0.7918782
0
Encrypts the specified data using the specified recipients Public keys.
def encrypt(bytes, *public_keys) bytes = Validation.check_filled_array_argument!(bytes) begin encrypt_for_recipients(bytes, Core::VirgilCipher.new, public_keys) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(data)\n raise NoPublicKeyError, \"Public key file: #{@public_key_file}\" unless public?\n \n encrypted_data = public_rsa.public_encrypt(data)\n Base64.encode64(encrypted_data)\n end", "def encrypt(data)\n\t\t# The limit of the encryption scheme is 235 bytes, so if the...
[ "0.7157979", "0.685075", "0.66326123", "0.65123576", "0.64897233", "0.6386013", "0.62958753", "0.6275172", "0.62656736", "0.62612504", "0.62299573", "0.6107599", "0.6107599", "0.60174876", "0.5987157", "0.5954661", "0.5951951", "0.58724535", "0.5861233", "0.5855871", "0.58490...
0.69187206
1
Decrypts the specified bytes using Private key.
def decrypt(cipher_bytes, private_key) cipher_bytes = Validation.check_filled_array_argument!(cipher_bytes) private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key) begin cipher = Core::VirgilCipher.new decrypted_bytes = cipher.decrypt_with_key( cipher_bytes, private_key.id, private_key.raw_key ) wrap_bytes(decrypted_bytes) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private_decrypt(ciphertext)\n @private_key.private_decrypt(ciphertext)\n end", "def decrypt(data)\n raise NoPrivateKeyError, \"Private key file: #{@private_key_file}\" unless private?\n \n decrypted_data = Base64.decode64(data)\n private_rsa.private_decrypt(decrypted_data)...
[ "0.7711891", "0.73947483", "0.7364903", "0.72615296", "0.72615296", "0.7042651", "0.7042651", "0.70365864", "0.7018639", "0.7018639", "0.69881797", "0.69086564", "0.6836868", "0.6815539", "0.68030435", "0.658077", "0.6578454", "0.65765536", "0.65653026", "0.65250695", "0.6521...
0.7909941
0
Signs and encrypts the data.
def sign_then_encrypt(bytes, private_key, *public_keys) bytes = Validation.check_filled_array_argument!(bytes) private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key) begin cipher = Core::VirgilCipher.new custom_bytes = cipher.custom_params custom_bytes.set_data( CUSTOM_PARAM_KEY_SIGNATURE, generate_signature(bytes, private_key) ) public_key = extract_public_key(private_key) custom_bytes.set_data( CUSTOM_PARAM_KEY_SIGNER_ID, wrap_bytes(public_key.id) ) encrypt_for_recipients(bytes, cipher, public_keys) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(data)\n @key.sign(@algo.new, data)\n end", "def sign data\n return unless @key\n\n @key.sign @digest_algorithm.new, data\n end", "def encode(data)\n @encryptor.encrypt_and_sign(data)\n end", "def sign\n validate!\n\n @voter.update(\n data: @data,\n signatur...
[ "0.76435906", "0.7394445", "0.7299908", "0.7150961", "0.70019794", "0.6999661", "0.68502325", "0.6750051", "0.6711967", "0.662519", "0.65527093", "0.6552388", "0.6443249", "0.6415161", "0.6407446", "0.63529307", "0.6345217", "0.63389593", "0.63039935", "0.6285561", "0.6257333...
0.64224654
13
Decrypts and verifies the data.
def decrypt_then_verify(bytes, private_key, *public_keys) bytes = Validation.check_filled_array_argument!(bytes) private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key) begin cipher = Core::VirgilCipher.new decrypted_bytes = cipher.decrypt_with_key( bytes, private_key.id, private_key.raw_key ) signature = cipher.custom_params.get_data(CUSTOM_PARAM_KEY_SIGNATURE) signer_public_key = public_keys.first if public_keys.count > 1 signer_id = cipher.custom_params.get_data(CUSTOM_PARAM_KEY_SIGNER_ID) signer_public_key = public_keys.find {|public_key| public_key.id == signer_id} end is_valid = verify_signature(signature, decrypted_bytes, signer_public_key) raise VirgilCryptoException, 'Signature is not valid' unless is_valid wrap_bytes(decrypted_bytes) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(data)\n\t\tbegin\n\t\t\tkey = OpenSSL::PKey::RSA.new File.read '../keys/victim.pem'\n\t\t\treturn key.private_decrypt(data)\n\t\trescue\n\t\t\treturn false\n\t\tend\n\tend", "def decrypt\n unless @encrypted_data.blank?\n plaintext_data\n end\n end", "def decrypt(data)\n cip...
[ "0.77103", "0.7624082", "0.74206156", "0.71239746", "0.71051866", "0.70907927", "0.70387435", "0.70204955", "0.7012142", "0.6976619", "0.69380146", "0.6928157", "0.68955165", "0.6889988", "0.6867216", "0.6863906", "0.68593055", "0.6845139", "0.6824685", "0.6809739", "0.680085...
0.6274647
47
Signs the specified data using Private key.
def generate_signature(bytes, private_key) bytes = Validation.check_filled_array_argument!(bytes) private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key) begin native_algorithm = HashAlgorithm.convert_to_native(HashAlgorithm::SHA512) signer = Core::VirgilSigner.new(native_algorithm) wrap_bytes(signer.sign(bytes, private_key.raw_key)) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(data)\n @key.sign(@algo.new, data)\n end", "def sign data\n return unless @key\n\n @key.sign @digest_algorithm.new, data\n end", "def sign(data)\n if rsa?\n @priv.sign(OpenSSL::Digest::SHA1.new,data)\n elsif dsa?\n # DSS1 was dropped from OpenSSL in version 1...
[ "0.7947322", "0.786024", "0.7407691", "0.7184251", "0.71586293", "0.7139596", "0.7115777", "0.708158", "0.69725597", "0.6740559", "0.6612138", "0.6592608", "0.63898736", "0.6369639", "0.6331517", "0.6224096", "0.62032676", "0.6201918", "0.6174239", "0.6172403", "0.6150139", ...
0.5454354
41
Verifies the specified signature using original data and signer's public key.
def verify_signature(signature, bytes, signer_public_key) signature = Validation.check_filled_array_argument!(signature) bytes = Validation.check_filled_array_argument!(bytes) signer_public_key = Validation.check_type_argument!(VirgilPublicKey, signer_public_key) begin native_algorithm = HashAlgorithm.convert_to_native(HashAlgorithm::SHA512) signer = Core::VirgilSigner.new(native_algorithm) signer.verify(bytes, signature, signer_public_key.raw_key) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify(signed_data, signature)\n sig_algo, raw_sig, _ = Encoding.decode_signature(signature)\n digest = ALGO_DIGESTS[sig_algo]\n\n if digest.nil?\n raise DecodeError, \"bad signature algorithm: #{sig_algo.inspect}\"\n end\n\n # OpenSSH compatibility: if a the number ...
[ "0.75810474", "0.731252", "0.7081596", "0.70555514", "0.7023932", "0.6910729", "0.6750778", "0.6750778", "0.67338645", "0.6727219", "0.6724313", "0.67084795", "0.6613674", "0.6583732", "0.6560663", "0.6543195", "0.653375", "0.6525398", "0.6461024", "0.6444515", "0.64012206", ...
0.70169884
5
Encrypts the specified stream using public_keys Public keys.
def encrypt_stream(input_stream, cipher_stream, *public_keys) begin cipher = Core::VirgilChunkCipher.new public_keys.each do |public_key| public_key = Validation.check_type_argument!(VirgilPublicKey, public_key) cipher.add_key_recipient(public_key.id, public_key.raw_key) end source = VirgilStreamDataSource.new(input_stream) sink = VirgilStreamDataSink.new(cipher_stream) cipher.encrypt(source, sink) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rsa_encrypt_with_public(plain_string)\n raise \"No public key set\" unless @public_key\n\n @public_key.public_encrypt(plain_string)\n end", "def rsa_encrypt_with_public(plain_string)\n raise \"No public key set\" unless @public_key\n\n @public_key.public_encrypt(plain_string)\n end"...
[ "0.6866947", "0.6866947", "0.68546635", "0.68318695", "0.66694975", "0.65578586", "0.65578586", "0.64710706", "0.64654475", "0.6457335", "0.6340315", "0.6297364", "0.62039274", "0.59877986", "0.59877986", "0.5960488", "0.58886224", "0.587759", "0.5829395", "0.5815585", "0.578...
0.85049194
0
Decrypts the specified stream using Private key.
def decrypt_stream(cipher_stream, output_stream, private_key) private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key) begin cipher = Core::VirgilChunkCipher.new source = VirgilStreamDataSource.new(cipher_stream) sink = VirgilStreamDataSink.new(output_stream) cipher.decrypt_with_key(source, sink, private_key.id, private_key.raw_key) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(keystream)\n\t\tdecrypted_stream = String.new\n\t\t@length.times do |i|\n\t\t\ta = if keystream[i] % 26 == 0\n\t\t\t\t26\n\t\t\telse\n\t\t\t\tkeystream[i] % 26\n\t\t\tend\n\t\t\tb = string[i].ord - 64\n\t\t\tdecrypted_stream << if b - a <= 0\n\t\t\t\t((b - a + 26) + 64).chr\n\t\t\telse\n\t\t\t\t((b - a...
[ "0.69801337", "0.68589413", "0.66194046", "0.6616936", "0.64834505", "0.6472006", "0.6472006", "0.6417519", "0.63320905", "0.631232", "0.631232", "0.6243049", "0.6159586", "0.6159586", "0.6146012", "0.60956144", "0.60793203", "0.606548", "0.60199994", "0.59886336", "0.597278"...
0.81989044
0
Signs the specified stream using Private key.
def generate_stream_signature(input_stream, private_key) private_key = Validation.check_type_argument!(VirgilPrivateKey, private_key) begin native_algorithm = HashAlgorithm.convert_to_native(HashAlgorithm::SHA512) signer = Core::VirgilStreamSigner.new(native_algorithm) source = VirgilStreamDataSource.new(input_stream) wrap_bytes(signer.sign(source, private_key.raw_key)) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign(private_key)\n # Our multiline hash for authorization will be encoded in multiple header\n # lines - X-Ops-Authorization-1, ... (starts at 1, not 0!)\n header_hash = {\n \"X-Ops-Sign\" => SIGNING_DESCRIPTION,\n \"X-Ops-Userid\" => user_id,\n \"X-Ops-Timestam...
[ "0.61230457", "0.61045754", "0.60865486", "0.6081972", "0.59344697", "0.58916974", "0.5887304", "0.5880879", "0.58089775", "0.5762871", "0.57435554", "0.57255197", "0.56761134", "0.5669075", "0.5647609", "0.5610663", "0.5542152", "0.5532891", "0.5517412", "0.5514751", "0.5490...
0.7210573
0
Verifies the specified signature using original stream and signer's Public key.
def verify_stream_signature(signature, input_stream, signer_public_key) signature = Validation.check_filled_array_argument!(signature) signer_public_key = Validation.check_type_argument!(VirgilPublicKey, signer_public_key) begin native_algorithm = HashAlgorithm.convert_to_native(HashAlgorithm::SHA512) signer = Core::VirgilStreamSigner.new(native_algorithm) source = VirgilStreamDataSource.new(input_stream) signer.verify(source, signature, signer_public_key.raw_key) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_signature\n @spki.verify(public_key)\n end", "def verify_signature\n @req.verify(public_key)\n end", "def verify_signature(public_key, payload, signature, timestamp)\n verify_engine\n timestamped_playload = \"#{timestamp}#{payload}\"\n payload_digest = Digest...
[ "0.72716933", "0.722627", "0.71475154", "0.70844406", "0.703887", "0.68283224", "0.68283224", "0.66831076", "0.6665898", "0.6576083", "0.6566004", "0.6550251", "0.6531383", "0.64342684", "0.64220667", "0.64215004", "0.6335991", "0.63291556", "0.62223065", "0.6200806", "0.6177...
0.759501
0
Computes the hash of specified data and the specified [HashAlgorithm]
def generate_hash(bytes, algorithm = nil) bytes = Validation.check_filled_array_argument!(bytes) alg = algorithm alg ||= use_SHA256_fingerprints ? HashAlgorithm::SHA256 : HashAlgorithm::SHA512 begin native_algorithm = HashAlgorithm.convert_to_native(alg) native_hasher = Core::VirgilHash.new(native_algorithm) wrap_bytes(native_hasher.hash(bytes)) rescue StandardError => error raise VirgilCryptoException, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createSHAHash(data)\n\t\treturn Digest::SHA1.digest(data)\n\tend", "def digest(data)\n OpenSSL::HMAC.digest(digest_class.new, key, data)[0,mac_length]\n end", "def build_hash data\n digest = OpenSSL::Digest::Digest.new('md5')\n OpenSSL::HMAC.hexdigest(digest, @project_secret, data)\n e...
[ "0.6684769", "0.65408105", "0.65167636", "0.65106875", "0.64701897", "0.6467093", "0.64469534", "0.64468247", "0.6390521", "0.62007564", "0.62007564", "0.62007564", "0.62007564", "0.62007564", "0.62007564", "0.62007564", "0.6139959", "0.61081904", "0.61081904", "0.60989916", ...
0.6242279
9
Computes the hash of specified public key using SHA256 algorithm.
def compute_public_key_hash(public_key) public_key_der = Core::VirgilKeyPair.public_key_to_der(public_key) if use_SHA256_fingerprints return generate_hash(public_key_der, HashAlgorithm::SHA256) end generate_hash(public_key_der, HashAlgorithm::SHA512)[0..7] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sha256_fingerprint\n Base64.encode64(Digest::SHA256.digest(ssh_public_key_conversion)).gsub(\"\\n\", \"\")\n end", "def hash_sha256(input)\n Digest::SHA2.new(256).digest(input)\n end", "def sha256; end", "def public_key_hash(hex)\n\t\trmd160(sha256(hex))\n\tend", "def sha256_fingerprint...
[ "0.7054746", "0.70079035", "0.69625574", "0.68718785", "0.680094", "0.6739665", "0.6704688", "0.6531241", "0.6473964", "0.64384395", "0.64201456", "0.6352545", "0.63488555", "0.6336968", "0.63226444", "0.62910837", "0.62347096", "0.6221486", "0.62204427", "0.6139459", "0.6115...
0.7633406
0
GET /attachments/1 GET /attachments/1.json
def show @attachment = Attachment.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @attachment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attachment(id)\n response = conn.get 'api/files/attachments/' + id\n\n unless response.status == 200\n error_model = JSON.load(response.body)\n mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \\'' + response.status.to_s + '\\'', error_model...
[ "0.7399391", "0.72964424", "0.72533566", "0.7209824", "0.7198998", "0.7198998", "0.7146045", "0.7035432", "0.7027209", "0.7027209", "0.7027209", "0.7027209", "0.7027209", "0.69881076", "0.698674", "0.6962234", "0.6919316", "0.68941605", "0.68771505", "0.68515855", "0.6847571"...
0.7392096
3
GET /attachments/new GET /attachments/new.json
def new @attachment = Attachment.new respond_to do |format| format.html # new.html.erb format.json { render json: @attachment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @message_attachment = MessageAttachment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_attachment }\n end\n end", "def new\n @attachment_datum = AttachmentDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\...
[ "0.7850828", "0.76186186", "0.75798947", "0.75798947", "0.7561675", "0.75612336", "0.7499064", "0.7499064", "0.7325541", "0.7198492", "0.7149169", "0.6943176", "0.69420123", "0.69367063", "0.69170254", "0.6755561", "0.6755561", "0.67437774", "0.67054135", "0.6672305", "0.6665...
0.81698227
2
POST /attachments POST /attachments.json
def create @attachment = Attachment.new(params[:attachment]) @attachment.save flash[:notice] = 'El archivo ha sido subido correctamente.' return redirect_to :action => :index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html {...
[ "0.67856145", "0.67284447", "0.6717782", "0.6717782", "0.6710522", "0.66664606", "0.6630575", "0.65930396", "0.65218943", "0.6507676", "0.6459344", "0.6454859", "0.6453828", "0.6449482", "0.6444526", "0.64219415", "0.640342", "0.6388061", "0.63603103", "0.6320983", "0.6305493...
0.5768439
88
PUT /attachments/1 PUT /attachments/1.json
def update @attachment = Attachment.find(params[:id]) respond_to do |format| if @attachment.update_attributes(params[:attachment]) format.html { redirect_to attachments_path, notice: 'El archivo ha sido cambiado de categoria correctamente' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @attachment.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @document.update(document_params)\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html { redirect_to @document, notice...
[ "0.70723903", "0.6969434", "0.69647133", "0.69444317", "0.6940061", "0.6824948", "0.6824948", "0.6770707", "0.67692095", "0.6754012", "0.67488635", "0.6722136", "0.6639801", "0.6639801", "0.66233605", "0.6618303", "0.6527931", "0.65129924", "0.65124446", "0.6488836", "0.63972...
0.6439156
20
DELETE /attachments/1 DELETE /attachments/1.json
def destroy @attachment = Attachment.find(params[:id]) @attachment.destroy respond_to do |format| format.html { redirect_to attachments_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @attachment = Attachment.find_by_name(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :ok }\n end\n end", "def destroy\n @attachments = Attachment.find_by_id(params[:id])\n if @attachments....
[ "0.7916613", "0.79112893", "0.780301", "0.780301", "0.780301", "0.7648198", "0.75550735", "0.75268084", "0.75268084", "0.7502376", "0.7484949", "0.74717665", "0.743859", "0.73886263", "0.7363452", "0.73258376", "0.73152924", "0.7278792", "0.72650313", "0.72303075", "0.7230118...
0.7848189
2
GET /level_containers/1 GET /level_containers/1.json
def show @level_container = LevelContainer.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @level_container } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @level_container = LevelContainer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level_container }\n end\n end", "def index\n user_session[:current_container]=nil\n if params[:label].blank?\n @containers = Container.list(params[:...
[ "0.66490954", "0.6480713", "0.64376557", "0.6209083", "0.6160761", "0.6030286", "0.6016257", "0.59843445", "0.58678746", "0.58255917", "0.5691087", "0.56846285", "0.5670138", "0.56534827", "0.5628714", "0.5626149", "0.5616102", "0.5604705", "0.55708253", "0.555228", "0.553554...
0.7470914
0
GET /level_containers/new GET /level_containers/new.json
def new @level_container = LevelContainer.new respond_to do |format| format.html # new.html.erb format.json { render json: @level_container } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @level_container = LevelContainer.new(params[:level_container])\n\n respond_to do |format|\n if @level_container.save\n format.html { redirect_to @level_container, notice: 'Level container was successfully created.' }\n format.json { render json: @level_container, status: :cre...
[ "0.7540073", "0.6921353", "0.6890227", "0.68889314", "0.6888748", "0.6850067", "0.68158525", "0.6496244", "0.6387826", "0.6346345", "0.63002974", "0.6281766", "0.6270102", "0.6269996", "0.62044543", "0.6190622", "0.6184238", "0.6122632", "0.61143756", "0.6113332", "0.6098171"...
0.80521065
0
POST /level_containers POST /level_containers.json
def create @level_container = LevelContainer.new(params[:level_container]) respond_to do |format| if @level_container.save format.html { redirect_to @level_container, notice: 'Level container was successfully created.' } format.json { render json: @level_container, status: :created, location: @level_container } else format.html { render action: "new" } format.json { render json: @level_container.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end", "def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies...
[ "0.6953396", "0.68528384", "0.6707599", "0.61446357", "0.60053307", "0.5751163", "0.5740514", "0.5722212", "0.56487346", "0.5613509", "0.5599725", "0.55909336", "0.556263", "0.55002916", "0.54819936", "0.5418743", "0.5352435", "0.5347443", "0.53390723", "0.53294116", "0.53094...
0.7345584
0
PUT /level_containers/1 PUT /level_containers/1.json
def update @level_container = LevelContainer.find(params[:id]) respond_to do |format| if @level_container.update_attributes(params[:level_container]) format.html { redirect_to @level_container, notice: 'Level container was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @level_container.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @level_container = LevelContainer.new(params[:level_container])\n\n respond_to do |format|\n if @level_container.save\n format.html { redirect_to @level_container, notice: 'Level container was successfully created.' }\n format.json { render json: @level_container, status: :cre...
[ "0.64348024", "0.6189901", "0.61400276", "0.60906875", "0.6009078", "0.5988657", "0.589103", "0.5844507", "0.5731526", "0.57260954", "0.5683184", "0.5628287", "0.5628287", "0.55352783", "0.5526222", "0.54877126", "0.54833376", "0.5463547", "0.54536074", "0.54386973", "0.54207...
0.69577956
0
DELETE /level_containers/1 DELETE /level_containers/1.json
def destroy @level_container = LevelContainer.find(params[:id]) @level_container.destroy respond_to do |format| format.html { redirect_to level_containers_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n if @options[:recurse]\n contents = containervie...
[ "0.7366254", "0.6975811", "0.68506867", "0.6807022", "0.67010915", "0.6654879", "0.66404635", "0.66291106", "0.65641856", "0.64803624", "0.6452543", "0.6412548", "0.63961846", "0.6387078", "0.6377407", "0.6320939", "0.63036215", "0.63035065", "0.6289525", "0.62680393", "0.625...
0.7960961
0
we're assuming this is used in a IO.select for reading
def to_s "iostream(input=#{@input.to_s},output=#{@output.to_s})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select\n ::IO.select([ self.fd ], nil, [ self.fd ], 0.10)\n end", "def select; end", "def select; end", "def select(&blk); end", "def select(&block); end", "def select!(&block); end", "def select(*) end", "def depatch_io\n IO.class_exec do\n class << self\n alias_method :select, :sel...
[ "0.7025364", "0.6552576", "0.6552576", "0.64534914", "0.63984203", "0.6094436", "0.6084067", "0.6067785", "0.593327", "0.5744053", "0.5673677", "0.5673677", "0.5673677", "0.5673677", "0.5673677", "0.5673677", "0.5673677", "0.56581086", "0.55706966", "0.55486184", "0.5508078",...
0.0
-1
Should work for future stock, need to program in future predictor method.
def stock_picker(prices) buy_date = 0 sell_date = 0 max_profit = 0 (0...prices.size).each do |buy| ((buy + 1)...prices.size).each do |sell| profit = prices[sell] - prices[buy] if max_profit < profit max_profit = profit buy_date = buy sell_date = sell end end end [buy_date, sell_date] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_market; end", "def stock_picker(history)\n best_sell_array = [0]\n history.each_with_index do |eo, io|\n best_sell_array[io] = get_best_sell(io, eo, history)\n end\n result_day_pairs = get_result_day_pairs(best_sell_array)\n profit = history[result_day_pairs[0]-1] - history[result_day_pairs[1]-...
[ "0.67755294", "0.63820624", "0.6118608", "0.6052072", "0.6012018", "0.5974223", "0.59681636", "0.5949421", "0.59275514", "0.5904586", "0.58935654", "0.5853072", "0.5835974", "0.5811444", "0.5807802", "0.5776646", "0.57609785", "0.57280576", "0.5714926", "0.5696709", "0.568670...
0.0
-1
=begin Questionnaire responses: a1walk_overall a21walk_pct_unaided a22walk_pct_unilateral a23walk_pct_bilateral a24walk_pct_wheelchair b1visual_double b2swallowing b3vertigo b4hearing balbalance c1mood f1metavar_strength f1astrength_right_arm f1bstrength_left_arm f1cstrength_right_leg f1dstrength_left_leg f1flface_left f1frface_right f2metavar_coord f2acoord_right_arm f2bcoord_left_arm f2ccoord_right_leg f2dcoord_left_leg f2sspeaking f4metavar_sense f4asense_right_arm f4bsense_left_arm f4csense_right_leg f4dsense_left_leg f4flsense_face_left f4frsense_face_right f5tmetavar_bowelbladder f5tabowel f5tbbladder f6avisual_right f6bvisual_left f6tmetavar_visual f7tcog_overall f8metavar_spasm f8aspasm_right_arm f8bspasm_left_arm f8cspasm_right_leg f8dspasm_left_leg FSfuncional_overall Algorithm: sfs f1f < f1fl, f1fr f1u = f1a + f1b f1l = f1c + f1d f2u = f2a + f2b f2l = f2c + f2d f1h = (f1a + f1c f1b f1d ) / 2 f2h = (f2a + f2c f2b f2d ) / 2 f4f < f14r, f4fr, f4fl f14r DOES NOT EXIST!!!!!!!!!!!!!!!!!!!!!! f4u = f4a + f4d f4l = f4c + f4d f4h = (f4a + f4c f4b f4d ) / 2 =end
def initialize(redcap_data) # Everything is pretty self-explainatory. You're essentially creating the 'data' hash to prepare for a data download of all individuals @data_set = [] redcap_data.each do |participant| sfs = calculate_sfs(participant) edss = calculate_edss(participant, sfs) aI = calculate_AI(participant) nrs = calculate_nrs(participant, sfs) mds = calculate_mds(edss, nrs, aI, participant["fs"].to_i, sfs) data = { record_id: participant["record_id"].to_i, first_name: participant["first_name"], last_name: participant["last_name"], sfs: sfs[:sfs], edss: edss, aI: aI, nrs: nrs, mds: mds, f1: sfs[:f1], f2: sfs[:f2], f3: sfs[:f3], f4:sfs[:f4], f5: sfs[:f5], f6: sfs[:f6], f7: sfs[:f7], f8: sfs[:f8], a1: participant["a1"], a21: participant["a21"], a22: participant["a22"], a23: participant["a23"], a24: participant["a24"], f2a: participant["f2a"], f2b: participant["f2b"], f2c: participant["f2c"], f2d: participant["f2d"], bal: participant["bal"], b3: participant["b3"], f1fr: participant["f1fr"], f1fl: participant["f1fl"], f4fr: participant["f4fr"], frfl: participant["frfl"], b1: participant["b1"], f2s: participant["f2s"], b2: participant["b2"], b4: participant["b4"], f4a: participant["f4a"], f4b: participant["f4b"], f4c: participant["f4c"], f4d: participant["f4d"], f5ta: participant["f5ta"], f6a: participant["f6a"], f6b: participant["f6b"], f7t: participant["f7t"], c1: participant["c1"], f1a: participant["f1a"], f1b: participant["f1b"], f1c: participant["f1c"], f1d: participant["f1d"], f8a: participant["f8a"], f8b: participant["f8b"], f8c: participant["f8c"], f8d: participant["f8d"] } @data_set<< data end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_metareview_metrics(review, submission, rubricqns_array)\n preprocess = TextPreprocessing.new\n feature_values = Hash.new #contains the values for each of the metareview features calculated\n preprocess = TextPreprocessing.new\n\n #fetch the review data as an array \n @review_array = re...
[ "0.6192346", "0.6157222", "0.58506584", "0.58418137", "0.5756591", "0.57231456", "0.5683203", "0.5663828", "0.56184596", "0.5471711", "0.5414442", "0.5408823", "0.53773904", "0.5366379", "0.53661245", "0.53519434", "0.5348606", "0.5348154", "0.5348067", "0.5347627", "0.533691...
0.0
-1
the artist class needs an instance method, the add_song that takes in an argument of a song and adds the song to the artist collection of songs. The add_song method should also tell the song that belongs to the artist.
def add_song(song) @songs << song song.artist = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song(song) #=> we found out by looking at the test that the argument is a song instance\n # the following code tells the current artist calling the method what new song it has:\n self.songs << song\n # but the test is asking us for the inverse of this - instead of telling artist \n ...
[ "0.8756985", "0.8594919", "0.85546535", "0.84989583", "0.83455676", "0.83399445", "0.83282304", "0.83179665", "0.82847553", "0.828099", "0.8276707", "0.8276707", "0.8276707", "0.8276707", "0.8276707", "0.8276707", "0.8270203", "0.8270203", "0.826477", "0.826477", "0.826477", ...
0.83697146
4
returns the songs array
def songs @songs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n # @@songs.select { |song| song.name == @name }\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n @songs\n end", "def songs\n ...
[ "0.8498246", "0.8498246", "0.83441764", "0.830164", "0.830164", "0.830164", "0.830164", "0.830164", "0.830164", "0.830164", "0.830164", "0.830164", "0.830164", "0.8173747", "0.8162238", "0.8016703", "0.8003093", "0.7837545", "0.7820602", "0.76459885", "0.74929166", "0.74676...
0.7618532
20
iterates over that artist's songs and collects the genre of each song
def genres self.songs.collect {|song| song.genre} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genres \n songs.collect{ |s| s.genre }.uniq #returns collection of genres for all of the artist's songs/ does not return duplicate genres/ collects genres\n end", "def genres\n self.songs.collect do |song| #call the artist class on the songs method and collect the song\n song.genre #then c...
[ "0.8228723", "0.8051361", "0.80295527", "0.792299", "0.7882845", "0.7811391", "0.7784677", "0.77668774", "0.7731068", "0.76861495", "0.76861495", "0.76861495", "0.76861495", "0.76861495", "0.76860166", "0.7677061", "0.7591977", "0.75689876", "0.75387913", "0.7531827", "0.7529...
0.7145418
34
GET /agencies GET /agencies.json
def index id = params[:id].to_i if id != 0 @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find_all_by_id(id) if @agencies.any? @agency_name = @agencies.first.name end else @agencies = @agencies.paginate(page: params[:page], per_page: 10).order(:name).find(:all) end @records_returned = @agencies.count respond_to do |format| format.html # index.html.erb format.json { render json: @agencies } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n ...
[ "0.72728944", "0.72049415", "0.7114258", "0.7005254", "0.6730379", "0.6693094", "0.6380399", "0.6327348", "0.6307817", "0.62743366", "0.6254967", "0.61001647", "0.6029806", "0.6023754", "0.5979423", "0.5936777", "0.592993", "0.58421415", "0.5778642", "0.5707717", "0.57029617"...
0.65971005
6
GET /agencies/1 GET /agencies/1.json
def show respond_to do |format| format.html # show.html.erb format.json { render json: @agency } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n ...
[ "0.7371774", "0.72503483", "0.6988436", "0.6682137", "0.65387195", "0.6531356", "0.64928675", "0.6466925", "0.6358089", "0.62040913", "0.61793184", "0.6165519", "0.59969693", "0.58776855", "0.58126813", "0.5778851", "0.5777207", "0.5745176", "0.5732595", "0.5725502", "0.57141...
0.5718633
20
GET /agencies/new GET /agencies/new.json
def new respond_to do |format| format.html # new.html.erb format.json { render json: @agency } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @agency_type = AgencyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agency_type }\n end\n end", "def new\n @admin_agency = Admin::Agency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render...
[ "0.69824153", "0.69289935", "0.68514985", "0.6794757", "0.6707335", "0.66374063", "0.6602983", "0.649957", "0.64305085", "0.64138395", "0.64083123", "0.64058983", "0.639911", "0.6366326", "0.6362599", "0.6361379", "0.63423496", "0.6337548", "0.6321848", "0.6320664", "0.629352...
0.71231866
0
POST /agencies POST /agencies.json
def create respond_to do |format| if @agency.save format.html { redirect_to @agency, notice: 'Agency was successfully created.' } format.json { render json: @agency, status: :created, location: @agency } else format.html { render action: "new" } format.json { render json: @agency.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @agency = Agency.new(agency_params)\n\n if @agency.save\n render json: @agency, status: :created, location: @agency\n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def create\n @agency = Agency.new(agency_params)\n\n if @agency....
[ "0.65139616", "0.64378023", "0.60881615", "0.5974332", "0.59158754", "0.57886", "0.5777596", "0.56630564", "0.5619346", "0.56172913", "0.56045616", "0.55700403", "0.55567896", "0.5548369", "0.55454", "0.5529902", "0.5528993", "0.55177605", "0.5492899", "0.5431118", "0.5429397...
0.5401406
21
PUT /agencies/1 PUT /agencies/1.json
def update respond_to do |format| if @agency.update_attributes(params[:agency]) format.html { redirect_to @agency, notice: 'Agency was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @agency.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\...
[ "0.6383923", "0.6370227", "0.59582865", "0.5884642", "0.5827623", "0.57707024", "0.5707225", "0.5662867", "0.5662867", "0.5662867", "0.5662867", "0.5662867", "0.5662867", "0.56472933", "0.55932724", "0.5577771", "0.55759895", "0.555988", "0.5556898", "0.5520727", "0.55169487"...
0.5761342
6
DELETE /agencies/1 DELETE /agencies/1.json
def destroy @agency.destroy if session[:customer_type] == @agency.class.name and session[:customer_id] == params[:id].to_i session[:customer_type] = nil session[:customer_id] = nil end respond_to do |format| format.html { redirect_to :back, alert: @agency.errors[:base][0] } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @admin_agency = Admin::Agency.find(params[:id])\n @admin_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_agencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @agency.update_attribute(:status, 'N')\n respond_to do |fo...
[ "0.71593577", "0.7031232", "0.7006339", "0.6925245", "0.6912497", "0.6776775", "0.66877604", "0.66677976", "0.6647072", "0.65896744", "0.6581337", "0.64700097", "0.6455344", "0.64393365", "0.64218456", "0.6416901", "0.6416874", "0.6395021", "0.6336782", "0.63129896", "0.62708...
0.59860694
85
GET /teams GET /teams.json
def index @teams = Team.joins('LEFT OUTER JOIN clubs on teams.club_id = clubs.id').select('teams.*, clubs.name as club_name') render json: @teams end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "def teams\n render json: @team_query\n end", "def index\n @teams = Team.all\n render json: @teams\n end", "def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n en...
[ "0.81233996", "0.8093715", "0.78999794", "0.78722113", "0.78547835", "0.78078264", "0.7747201", "0.77240586", "0.77240586", "0.76768875", "0.76768875", "0.7509183", "0.748406", "0.74762034", "0.7434379", "0.7405707", "0.738585", "0.73797023", "0.73748475", "0.73599476", "0.73...
0.0
-1
GET /teams/1 GET /teams/1.json
def show @team = Team.find(params[:id]) render json: @team end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team(id)\n get \"/teams/#{id}\"\n end", "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "def show\n\t\t@team = Team.find(params[:id])\n\t\trender '/teams/show.json.jbuilder'\n\tend", "def index\n @teams = Team.all\n render json: @teams\n...
[ "0.7996014", "0.7838169", "0.7667755", "0.7657437", "0.76113945", "0.7591232", "0.758825", "0.7579617", "0.75722426", "0.7572136", "0.7572136", "0.75414246", "0.7532713", "0.7532713", "0.75120324", "0.75120324", "0.75120324", "0.75120324", "0.7472558", "0.74704117", "0.747019...
0.7753974
2
POST /teams POST /teams.json
def create @team = Team.new(params[:team]) if @team.save render json: @team, status: :created, location: @team else render json: @team.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @response = HTTParty.get('http://laxapi.herokuapp.com/api/teams')\n CreateTeamService.new.create_team_objects(@response)\n render :json => {\n :message => \" #{Team.count} teams have been created\",\n status: 200\n }\n end", "def create\n @team = Team.new(team_params)\n ...
[ "0.7407396", "0.7206485", "0.718551", "0.7072946", "0.70231295", "0.70231295", "0.70231295", "0.69917685", "0.6968914", "0.6961326", "0.6925406", "0.6924325", "0.69208974", "0.6915442", "0.6915442", "0.6915442", "0.6915442", "0.6915442", "0.6915442", "0.6915442", "0.6915442",...
0.73516417
1
PUT /teams/1 PUT /teams/1.json
def update @team = Team.find(params[:id]) if @team.update_attributes(params[:team]) head :no_content else render json: @team.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t\tteam_id = params[:id]\n\t\t@team = Team.find(team_id)\n\t\tif @team.update(team_params)\n\t\t\trender json: @team\n\t\telse\n\t\t\trender json: {\n\t\t\t\terror: {\n\t\t\t\t\tmessage: @team.errors.full_messages.to_sentence\n\t\t\t\t}\n\t\t\t}\n\t\tend\n\tend", "def update\n @team = Team.find(p...
[ "0.7076347", "0.6961297", "0.6920335", "0.6880125", "0.6868699", "0.6859074", "0.6833043", "0.6833043", "0.6833043", "0.6833043", "0.6833043", "0.6833043", "0.68301904", "0.68301904", "0.68177104", "0.67880267", "0.667999", "0.6662356", "0.6653315", "0.6644515", "0.66386056",...
0.72277266
0
DELETE /teams/1 DELETE /teams/1.json
def destroy @team = Team.find(params[:id]) @team.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n ...
[ "0.7868205", "0.7819776", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.77657557", "0.77657557", "0.77657557", "0.77657557", "0.77476865", "0.7617056", "0.7555221"...
0.75655633
20
todo : fix ImageRecognition::ImageLoader saving image place it into ram
def initialize(document) @document = document image_uri = ImageRecognition::ImageUriParser.parse(document) ImageRecognition::ImageLoader.save_image(image_uri) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_image_enhenced\n file_name = \"#{Rails.root}/tmp/temp-#{self.id}.jpg\"\n\n open(file_name, 'wb') do |file|\n file << open(self.image_uncompressed.url).read\n end\n\n image = OpenCV::Cv::Mat.new\n image = OpenCV::Cv::imread file_name\n\n image.convertTo(image, -1, 1.4, 30)\n\n ...
[ "0.6438749", "0.6343522", "0.62958634", "0.62391263", "0.62025964", "0.6188804", "0.6168109", "0.6159204", "0.61430806", "0.60338736", "0.6013589", "0.60089177", "0.59942913", "0.5987419", "0.59719896", "0.5964547", "0.5948647", "0.59469134", "0.59218293", "0.5909293", "0.590...
0.63088256
2
GET /units GET /units.json
def index @units = Unit.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foods_units\n get('/foods/units.json')\n end", "def index\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units\", :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n @units = JSON.parse(response.body)\n return @units\n end", "def units\n @units = Item.select...
[ "0.8416218", "0.7555869", "0.7451005", "0.6968702", "0.69407237", "0.68924576", "0.68458724", "0.6776829", "0.67726886", "0.67339927", "0.6626998", "0.6626976", "0.66150105", "0.6614453", "0.6612779", "0.6612779", "0.6612779", "0.65958196", "0.6577777", "0.65643185", "0.65463...
0.6867695
11
GET /units/1 GET /units/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foods_units\n get('/foods/units.json')\n end", "def units\n @units = Item.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units += Detail.select(\"DISTINCT unit\").where(\"unit like ?\", \"%#{params[:q]}%\").limit(20).map(&:unit)\n @units = @uni...
[ "0.8020733", "0.73784614", "0.72970515", "0.727637", "0.7244588", "0.7244588", "0.7244588", "0.7179953", "0.6931644", "0.68736583", "0.683191", "0.6751607", "0.6751607", "0.6751607", "0.6751607", "0.6751607", "0.6751607", "0.66951364", "0.66746956", "0.66559684", "0.66320664"...
0.0
-1
POST /units POST /units.json
def create go=true @unit = Unit.new(unit_params) unless params[:has_exam_date] @unit.exam_date=DateTime.new(1900,1,1) end @temp_1=@unit_time=UnitTime.new(:start_time => parse_time(params[:start_time]) , :end_time =>parse_time( params[:end_time]), :day => params[:day].to_i) if not @unit_time.save @temp_1=UnitTime.where(:start_time => parse_time(params[:start_time]) , :end_time =>parse_time( params[:end_time]), :day => params[:day].to_i)[0] if @temp_1.nil? puts "11111111111111111111111111111111" go=false respond_to do |format| format.html { render :new } format.json { render json: @unit_time.errors, status: :unprocessable_entity } end return end end if params[:has_time_2] && go @temp_2=@unit_time_2=UnitTime.new(:start_time => parse_time(params[:start_time_2]) , :end_time =>parse_time( params[:end_time_2]), :day => params[:day_2].to_i) if not @unit_time_2.save @temp_2=UnitTime.where(:start_time => parse_time(params[:start_time_2]) , :end_time =>parse_time( params[:end_time_2]), :day => params[:day_2].to_i)[0] if @temp_2.nil? puts "22222222222222222222222222222" go=false respond_to do |format| format.html { render :new } format.json { render json: @unit_time_2.errors, status: :unprocessable_entity } end return end end end respond_to do |format| if go @unit.unit_times << @temp_1 if params[:has_time_2] @unit.unit_times << @temp_2 end if @unit.save format.html { redirect_to @unit, notice: 'Unit was successfully created.' } format.json { render :show, status: :created, location: @unit } else format.html { render :new } format.json { render json: @unit.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @unit = Unit.new(params[:unit])\n\n respond_to do |format|\n if @unit.save\n format.html { redirect_to @unit, notice: 'Unit was successfully created.' }\n format.json { render json: @unit, status: :created, location: @unit }\n else\n format.html { render action: \"...
[ "0.67017543", "0.67017543", "0.665163", "0.66260743", "0.65848905", "0.6571388", "0.6559905", "0.6513941", "0.64358485", "0.643058", "0.64260685", "0.64147675", "0.6377638", "0.6371824", "0.63462377", "0.6335834", "0.6332594", "0.6331857", "0.6330569", "0.631212", "0.6300642"...
0.0
-1
PATCH/PUT /units/1 PATCH/PUT /units/1.json
def update go=true #@unit = Unit.new(unit_params) @temp_1=@unit_time=UnitTime.new(:start_time => parse_time(params[:start_time]) , :end_time =>parse_time( params[:end_time]), :day => params[:day].to_i) if not @unit_time.save @temp_1=UnitTime.where(:start_time => parse_time(params[:start_time]) , :end_time =>parse_time( params[:end_time]), :day => params[:day].to_i)[0] if @temp_1.nil? go=false end end if params[:has_time_2] && go @temp_2=@unit_time_2=UnitTime.new(:start_time => parse_time(params[:start_time_2]) , :end_time =>parse_time( params[:end_time_2]), :day => params[:day_2].to_i) if not @unit_time_2.save @temp_2=UnitTime.where(:start_time => parse_time(params[:start_time_2]) , :end_time =>parse_time( params[:end_time_2]), :day => params[:day_2].to_i)[0] if @temp_2.nil? go=false end end end respond_to do |format| if go @unit.unit_times.clear @unit.unit_times << @temp_1 if params[:has_time_2] @unit.unit_times << @temp_2 end if @unit.update(unit_params) unless params[:has_exam_date] @unit.update(:exam_date => DateTime.new(1900,1,1)) end format.html { redirect_to @unit, notice: 'Unit was successfully updated.' } format.json { render :show, status: :ok, location: @unit } else format.html { render :edit } format.json { render json: @unit.errors, status: :unprocessable_entity } format.json { render json: @unit_time.errors, status: :unprocessable_entity } format.json { render json: @unit_time_2.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query...
[ "0.78405803", "0.71017027", "0.69240105", "0.6828834", "0.67859524", "0.67807686", "0.6654957", "0.6617484", "0.659022", "0.6557099", "0.6543901", "0.6528244", "0.6519733", "0.6517602", "0.6511026", "0.6488906", "0.64756215", "0.6440191", "0.6405442", "0.63572663", "0.6347458...
0.0
-1
DELETE /units/1 DELETE /units/1.json
def destroy @unit.destroy respond_to do |format| format.html { redirect_to units_url, notice: 'Unit was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end", "def destroy\n @unit.destroy\n respond_to do |form...
[ "0.77861017", "0.7669319", "0.7640737", "0.7640737", "0.7640737", "0.7640737", "0.76394826", "0.75945437", "0.7526941", "0.7451348", "0.74230313", "0.7408703", "0.7381337", "0.73444855", "0.73303294", "0.7308322", "0.7215855", "0.7208211", "0.71699786", "0.7147167", "0.714531...
0.7406548
12
Use callbacks to share common setup or constraints between actions.
def set_unit @unit = Unit.find(params[:id]) @unit_time = @unit.unit_times[1] @unit_time_2 = @unit.unit_times[2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1