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
DELETE /registro_videoconferencia/1 DELETE /registro_videoconferencia/1.json
def destroy @registro_videoconferencium.destroy respond_to do |format| format.html { redirect_to registro_videoconferencia_url, notice: 'Registro videoconferencium was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @videoconferencium.destroy\n respond_to do |format|\n format.html { redirect_to videoconferencia_url, notice: 'Videoconferencium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @demanda_videomonitoramento.destroy\n respond_to ...
[ "0.74522597", "0.73999476", "0.73672694", "0.7292133", "0.7283046", "0.7253298", "0.72135305", "0.7207643", "0.71855456", "0.7164202", "0.71505815", "0.71499646", "0.71347374", "0.7123997", "0.7123974", "0.7123974", "0.7082267", "0.7080422", "0.7071454", "0.70684385", "0.7066...
0.7736406
0
Use callbacks to share common setup or constraints between actions.
def set_registro_videoconferencium @registro_videoconferencium = RegistroVideoconferencium.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 registro_videoconferencium_params params.require(:registro_videoconferencium).permit(:estado, :fecha, :hora, :descripcion, :videoconferencia) 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
Create a named behavior for a role using the standard library SimpleDelegator.
def wrap(name, &block) require 'delegate' wrapper_name = RoleBuilders.mod_name(name) klass = private_const_set(wrapper_name, Class.new(SimpleDelegator, &block)) klass.send(:include, Surrounded) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_role(role_name)\n role_mapping = self.roles[role_name]\n role_module, obj = role_mapping.role_module, role_mapping.data_object\n obj.extend(role_module)\n obj.instance_variable_set(:@__brassbound_context, self)\n class << obj\n def context\n @__brassbound_context\n end\n ...
[ "0.6011108", "0.5729127", "0.5701763", "0.5509641", "0.54447526", "0.5380843", "0.5378879", "0.5348573", "0.53369236", "0.53357744", "0.53312635", "0.53207797", "0.5276843", "0.5262182", "0.52580714", "0.5249163", "0.5228657", "0.5204873", "0.517466", "0.5136834", "0.51265836...
0.57081705
2
Create a named behavior for a role using the standard library DelegateClass. This ties the implementation of the role to a specific class or module API.
def delegate_class(name, class_name, &block) require 'delegate' wrapper_name = RoleBuilders.mod_name(name) klass = private_const_set(wrapper_name, DelegateClass(Object.const_get(class_name.to_s))) klass.class_eval(&block) klass.send(:include, Surrounded) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_role(klass)\n role = self\n klass.class_eval do\n role_accessor_name = \"#{role.name}_role\"\n unless respond_to?(role_accessor_name)\n singleton_class.send(:define_method, role_accessor_name) do\n role\n end\n # else we can'...
[ "0.6080697", "0.6006857", "0.57758373", "0.5636941", "0.5468796", "0.5420977", "0.5360667", "0.52933496", "0.5225137", "0.512194", "0.5072748", "0.5064455", "0.4983604", "0.49808812", "0.4973817", "0.49591684", "0.4944239", "0.49412456", "0.4900895", "0.48820943", "0.48644528...
0.64988995
0
Create an object which will bind methods to the role player
def interface(name, &block) interface_name = RoleBuilders.mod_name(name) + 'Interface' behavior = private_const_set(interface_name, Module.new(&block)) require 'surrounded/context/negotiator' undef_method(name) define_method(name) do instance_variable_set("@#{name}", Negotiator.new(role_map.assigned_player(name), behavior)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role(*args)\n case args.size\n when 2\n role_module = args[0]\n obj = args[1]\n role_name = Util.underscore(role_module.name).to_sym\n when 3\n role_name = args[0]\n role_module = args[1]\n obj = args[2]\n else\n raise ArgumentError\n end\n\n self.roles[role...
[ "0.63176924", "0.63159937", "0.6247642", "0.6199636", "0.6174743", "0.6153263", "0.61007714", "0.60529304", "0.60100245", "0.60069424", "0.5943684", "0.5939294", "0.5937096", "0.5937096", "0.5937096", "0.5937096", "0.5937096", "0.5937096", "0.5937096", "0.5908761", "0.5825937...
0.5999383
10
Query Google for the coordinates of the given address. Returns array [lat,lon] if found, nil if not found or if network error.
def coordinates(address) return nil if address.blank? return nil unless doc = search(address, false) # blindly use first result (assume it is most accurate) place = doc['results'].first['geometry']['location'] ['lat', 'lng'].map{ |i| place[i] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geo_coordinates_for address\n @log ||= Rails.logger\n return KNOWN_PLACES[address] if KNOWN_PLACES[address]\n \n google_data = get_geo_json address, :retries => 2\n location = google_data['results'].first['geometry']['location'] rescue {}\n \n log_empty(address, google_data['s...
[ "0.80880225", "0.70398694", "0.69687486", "0.69668967", "0.6962731", "0.6960704", "0.68821484", "0.68506145", "0.6822225", "0.6731522", "0.67175484", "0.6698383", "0.66558284", "0.6587856", "0.65832466", "0.6563839", "0.64569175", "0.6405859", "0.6269609", "0.6244365", "0.621...
0.7832044
1
Query Google for the address of the given coordinates. Returns string if found, nil if not found or if network error.
def address(latitude, longitude) return nil if latitude.blank? || longitude.blank? return nil unless doc = search("#{latitude},#{longitude}", true) # blindly use first result (assume it is most accurate) doc['results'].first['formatted_address'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_google_coordinate(address)\n url = 'http://maps.googleapis.com/maps/api/geocode/json?sensor=false&language=zh-CN&address=' + URI::encode(address)\n decoded = call_api(url)\n\n if decoded['status'] == 'OK' then\n ret = decoded['results'][0]['geometry']['location']\n else\n ret = {}\n end\n\n ret...
[ "0.6729448", "0.6680642", "0.6546521", "0.6525455", "0.64835143", "0.63535297", "0.6295257", "0.62468207", "0.6161132", "0.6121456", "0.6099901", "0.60981727", "0.6058294", "0.59705615", "0.59515345", "0.59493357", "0.5939193", "0.5904536", "0.5904536", "0.5836619", "0.581482...
0.67221576
1
Query Google for geographic information about the given phrase. Returns a hash representing a valid geocoder response. Returns nil if non200 HTTP response, timeout, or other error.
def search(query, reverse = false) doc = fetch_parsed_response(query, reverse) doc && doc['status'] == "OK" ? doc : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind_of?(Hash)\n #near_query = \"ll=#{near[:latitude]},#{near[:longitude]}&spn=#{near[:span_latitude]},#{near[:span_longitude]}&gl=#{near[:country]}\" \n ...
[ "0.67880553", "0.62291324", "0.61813664", "0.61546785", "0.61384463", "0.60846806", "0.60348177", "0.5982754", "0.5905531", "0.5866242", "0.5860795", "0.5851679", "0.5843129", "0.5811106", "0.57623464", "0.5759035", "0.5704793", "0.56904614", "0.56820655", "0.56671697", "0.56...
0.0
-1
Returns a parsed Google geocoder search result (hash). This method is not intended for general use (prefer Geocoder.search).
def fetch_parsed_response(query, reverse = false) if doc = fetch_raw_response(query, reverse) ActiveSupport::JSON.decode(doc) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(q:, raw: false)\n return unless String(q).length > 10\n\n result = Geocoder.search(q)\n raw ? result&.data : format_result(result)\n end", "def where_geocoder(query, near = nil)\n url = URI.parse GOOGLE_GEOCODER_URI\n near_query = nil\n if near && near.kind...
[ "0.64095515", "0.62508875", "0.62498516", "0.61635286", "0.5937185", "0.58503747", "0.58041644", "0.5785488", "0.57651937", "0.5725596", "0.56638944", "0.56345713", "0.5628236", "0.5591629", "0.5556601", "0.55394506", "0.5532531", "0.55156344", "0.551281", "0.5501", "0.548510...
0.0
-1
Returns a raw Google geocoder search result (JSON). This method is not intended for general use (prefer Geocoder.search).
def fetch_raw_response(query, reverse = false) return nil if query.blank? # name parameter based on forward/reverse geocoding param = reverse ? :latlng : :address # build URL params = { param => query, :sensor => "false" } url = "http://maps.google.com/maps/api/geocode/json?" + params.to_query # query geocoder and make sure it responds quickly begin resp = nil timeout(3) do Net::HTTP.get_response(URI.parse(url)).body end rescue SocketError, TimeoutError return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(q:, raw: false)\n return unless String(q).length > 10\n\n result = Geocoder.search(q)\n raw ? result&.data : format_result(result)\n end", "def\tsearch\n\t\tresult = query_google_places\n\t\trender :json => result\n\tend", "def optimistic_geo_wrapper(query)\n geocoded = nil\...
[ "0.7515012", "0.7311621", "0.6537428", "0.6524741", "0.64524645", "0.63665897", "0.636332", "0.63476115", "0.6286834", "0.6285323", "0.62476194", "0.6237739", "0.62277484", "0.61654186", "0.6151388", "0.614263", "0.6138089", "0.61275446", "0.6120009", "0.6112965", "0.5974651"...
0.6535571
3
Set the current location of driver
def set_location(lon, lat) factory = Driver.rgeo_factory_for_column(:location) # update(location: factory.point(lon,lat)) self.location = factory.point(lon,lat) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_location\n LocationHelper.browse_location(params['select_location'], current_user)\n end", "def change_curr_location(new_location)\n @curr_location = new_location\n end", "def get_current_loc\r\n\t\treturn driver.location\r\n\tend", "def setLocation(location)\r\n\t\t\t\t\t@location = location...
[ "0.64280885", "0.6394768", "0.613227", "0.6085285", "0.5959727", "0.59058756", "0.5859009", "0.58474165", "0.57946837", "0.5766176", "0.57469374", "0.5715642", "0.5698983", "0.5697716", "0.56884336", "0.56584215", "0.5620568", "0.5620568", "0.55974656", "0.55875325", "0.55760...
0.54345006
27
def staffs staffs = [] self.subdepartments.each do |sub| sub.staffs.each do |staff| staffs << staff end end return staffs end
def staff_names staff_names = [] self.subdepartments.each do |sub| sub.staffs.each do |staff| staff_names << staff.full_names end end return staff_names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def staff\n group.staff + group.group_type.courses.map(&:convenor)\n end", "def fs_and_sc_list\n field_staffs + staffing_companies.collect{|sc| sc.staffs }.flatten\n end", "def staff_ids\n return @staff_ids\n end", "def all_departments\n @@all_...
[ "0.7230124", "0.70683724", "0.67663026", "0.6514076", "0.64435756", "0.6402106", "0.6320232", "0.6286299", "0.6241766", "0.6237957", "0.618811", "0.61763144", "0.61289096", "0.60877115", "0.6072385", "0.604601", "0.6008521", "0.5999491", "0.59976923", "0.59917957", "0.5976500...
0.7851917
0
Toggle state of desktop icons.
def toggle toggle_icon_display restart_finder icons_showing? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def desktop?\n false # FIXME\n end", "def toggle\n if visible?\n hide\n\n else\n show\n\n end\n end", "def toggle\n if on?\n off\n else\n on\n end\n end", "def openToggle()\n @openToggle_duration = @w_openToggle.animationSpeed\n if (@...
[ "0.5737684", "0.57260805", "0.5722228", "0.5668005", "0.562962", "0.55806327", "0.55647373", "0.54940456", "0.5484741", "0.54819816", "0.5476582", "0.54455376", "0.54334587", "0.542164", "0.5417264", "0.5410405", "0.5383721", "0.53760374", "0.53467005", "0.5332184", "0.531090...
0.7112464
0
Uploads the file and sets public_url attribute to the url of the remote S3 object === Parameters [file_path (String)] full path of the file to upload
def store!(file) file_path = file.is_a?(String) ? file : file.path basename = file.is_a?(String) ? File.basename(file) : file.original_filename # Upload the file o = s3_bucket.objects["#{asset_path}#{basename}"] o.write(Pathname.new(file_path), { acl: :public_read, content_type: MIME::Types.type_for(file_path).first.to_s }) # Set the public_url attribute remote_url = o.public_url.to_s self.set(public_url: remote_url) self.this.update(public_url: remote_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end", "def store!\n # Upload the file\n prefix = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\"\n fname = prefix+(@file.respond_t...
[ "0.8397492", "0.7654236", "0.7621614", "0.70696557", "0.7064327", "0.7064021", "0.7059148", "0.68869674", "0.6814998", "0.6814421", "0.6767916", "0.6710564", "0.6661792", "0.66418314", "0.66396815", "0.6596707", "0.65942234", "0.65939456", "0.6585862", "0.65602803", "0.647875...
0.7955411
1
Removes the remote file
def remove! basename = File.basename(public_url) o = s3_bucket.objects["#{asset_path}#{basename}"] o.delete end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end", "def files_remote_remove...
[ "0.8950435", "0.8494948", "0.80176824", "0.7825574", "0.76300585", "0.7509187", "0.7505245", "0.7477317", "0.7477317", "0.7431123", "0.73337185", "0.7191782", "0.70872396", "0.7061084", "0.70378965", "0.6989666", "0.6987884", "0.6973254", "0.6924938", "0.69206935", "0.6912956...
0.0
-1
Path to the file, relative to the storage system
def asset_path "user/#{self.user_id}/assets/" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_path\n storage.file_path(self.class, @id)\n end", "def filepath\n base = storage_root_path\n if base\n File.join(base, storage_key)\n else\n raise StandardError.new(\"no filesystem path found for datafile: #{self.web_id}\")\n end\n end", "def stored_file_path\n File.j...
[ "0.8099268", "0.8076895", "0.7978352", "0.7954434", "0.7916503", "0.785955", "0.7818022", "0.77858806", "0.77848655", "0.7749855", "0.7729863", "0.77112925", "0.7707139", "0.7631517", "0.76220983", "0.7617068", "0.76135236", "0.7602822", "0.75878394", "0.75737506", "0.7573750...
0.0
-1
Runs the following callbacks: before_destroy destroy after_destroy only if destroy is successful
def destroy_with_callbacks run_callbacks(:before_destroy) result = destroy_without_callbacks run_callbacks(:after_destroy) if result result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n return false if callback(:before_destroy) == false\n result = destroy_without_callbacks\n callback(:after_destroy)\n result\n end", "def destroy\n return false if callback(:before_destroy) == false\n result = destroy_without_callbacks\n ...
[ "0.7942425", "0.7942425", "0.788467", "0.7734169", "0.7663466", "0.7532305", "0.7409953", "0.73851407", "0.73702747", "0.73263586", "0.71145856", "0.71145856", "0.71145856", "0.7083888", "0.6881957", "0.6815957", "0.6807547", "0.6807547", "0.6790049", "0.67671937", "0.6700443...
0.8050903
0
Runs the following callbacks: before_find find_record after_find if a record was found
def find_record_with_callbacks run_callbacks(:before_find) result = find_record_without_callbacks run_callbacks(:after_find) if result result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(*args)\n records = super\n @after.call(records) if @after\n records\n end", "def after_find\n end", "def after_find\n check_if_status_is_up_to_date\n end", "def find_record\n if record\n self.new_session = false\n return record\n end\n \n...
[ "0.75302047", "0.74342936", "0.65217125", "0.639116", "0.63230455", "0.6300618", "0.6030712", "0.60287315", "0.5903821", "0.58804", "0.58588004", "0.58588004", "0.56920636", "0.5677259", "0.5664264", "0.5651076", "0.5640873", "0.5627926", "0.5600982", "0.5595867", "0.554882",...
0.84691346
0
Runs the following callbacks: before_save before_create only if new_session? == true before_update only if new_session? == false save the following are only run is save is successful after_save before_update only if new_session? == false before_create only if new_session? == true
def save_with_callbacks(&block) run_callbacks(:before_save) if new_session? run_callbacks(:before_create) else run_callbacks(:before_update) end result = save_without_callbacks(&block) if result run_callbacks(:after_save) if new_session? run_callbacks(:after_create) else run_callbacks(:after_update) end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n result = nil\n if valid?\n self.record = attempted_record\n\n run_callbacks :before_save\n run_callbacks(new_session? ? :before_create : :before_update)\n run_callbacks(new_session? ? :after_create : :after_update)\n run_callbacks ...
[ "0.7341021", "0.71566254", "0.669895", "0.6453453", "0.63910234", "0.6389693", "0.6246433", "0.6239173", "0.6165097", "0.6134382", "0.61131334", "0.6101822", "0.6101306", "0.6059083", "0.6044832", "0.60376674", "0.60354257", "0.6035111", "0.60089576", "0.59456617", "0.5902756...
0.78939766
0
Runs the following callbacks: before_validation validate after_validation only if errors.empty?
def validate_with_callbacks run_callbacks(:before_validation) validate_without_callbacks run_callbacks(:after_validation) if errors.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_validations!\n run_callbacks(:validation) do\n super\n end\n end", "def validate\n # add errors if not validate\n end", "def run_validations\n run_callbacks :validation do\n failed_validators.clear\n validation_chain.run(self)\n ...
[ "0.7638646", "0.7369778", "0.7315629", "0.7263786", "0.7202742", "0.7178205", "0.7132834", "0.7132462", "0.7098271", "0.7094484", "0.70940614", "0.70020056", "0.67042446", "0.66954356", "0.65865505", "0.6568375", "0.65666157", "0.6556527", "0.65494287", "0.65422493", "0.65239...
0.8428882
0
> foo > foo
def extract_type1 if url = query_info.urls.first if url = URI::Parser.new.extract(url).first uri = URI(url) if uri.path if md = uri.path.match(%r{/users/history/(.*)|/users/(.*)}) s = md.captures.compact.first ERB::Util.html_escape(s) end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def >(object, fd = 1)\n redirect!(object, fd, 'w')\n end", "def dup; end", "def dup; end", "def dup; end", "def dup; end", "def >>(object, fd = 1)\n redirect!(object, fd, 'a')\n end", "def dup() end", "def write(output_to); end", "def dup! ; self ; end", "def test_can_pipe_...
[ "0.56730825", "0.5659433", "0.5659433", "0.5659433", "0.5659433", "0.54764163", "0.5461758", "0.545702", "0.5423509", "0.5367031", "0.5334635", "0.52974695", "0.52974695", "0.52933174", "0.52933174", "0.52933174", "0.529284", "0.52759063", "0.5242513", "0.51937556", "0.519138...
0.0
-1
What parameters are missing for a CreateStack call, where UsePreviousValue has no meaning.
def missing_for_create # If we haven't set a value, and there is no default, we can't # create the stack. @hash.values.select { |v| !v.set? && !v.default? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack(*args); end", "def stack(new_scope = T.unsafe(nil)); end", "def stack; end", "def stack; end", "def stack\n @values.fetch('stack') { \n @values['stack'] = nil\n }\n end", "def create_stack(stack_name, options = {})\n params = {\n 'StackNam...
[ "0.6286725", "0.6212097", "0.61968577", "0.61968577", "0.60174483", "0.59197414", "0.58819324", "0.5743494", "0.5728175", "0.57154083", "0.57132256", "0.5667861", "0.5610962", "0.55951726", "0.55892414", "0.5559694", "0.5559694", "0.5559694", "0.5552926", "0.5518303", "0.5485...
0.54478467
21
Set the user settings for a user that has REPLICATION SLAVE privilidgess def replication_user=(replication_user_settings)
def replication_user # TODO: only bail on getting a user if it is acutally used #raise "You need to specify a replication user!" if @repl_user.nil? @repl_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postgresql_replication_user\n replication_username = configuration[:postgresql][:replication_username] || \"#{database_environment[:username]}_replication\"\n raise \"Missing configuration[:postgresql][:replication_password], please add and try again\" unless configuration[:postgresql][:replication_p...
[ "0.63998413", "0.62272996", "0.6082902", "0.60521394", "0.58521193", "0.5829461", "0.5779877", "0.5747542", "0.56285447", "0.55564", "0.55329454", "0.54941034", "0.54841346", "0.5476899", "0.5464212", "0.54454464", "0.54448277", "0.54380196", "0.5424635", "0.5409752", "0.5406...
0.6789249
0
Set the user settings for a user that has SELECT privilidgess def ro_user=(ro_user_settings)
def ro_user #raise "You need to specify a SELECT user!" if @ro_user.nil? @ro_user || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_readonly_user(opts)\n opts = check_params(opts,[:ro_user_info])\n super(opts)\n end", "def set_user_settings\n @settings = Setting.includes(:features).find_or_create_by(provider: @user_domain)\n end", "def settings\n\t\tcheck_if_myself\n\t\t@user = current_user\n\tend", "def set_user...
[ "0.6854271", "0.6615801", "0.66062444", "0.63687074", "0.62820935", "0.614782", "0.6093599", "0.60480756", "0.6022576", "0.6014716", "0.5938661", "0.59343344", "0.5923405", "0.58870554", "0.58782417", "0.58370805", "0.5817791", "0.58002967", "0.57972735", "0.5767697", "0.5740...
0.6824782
1
Set the user settings for a user that has reads/writes heartbeats def heartbeat_user=(heartbeat_user_settings)
def heartbeat_user #raise "You need to specify a heartbeat user!" if @heartbeat_user.nil? @heartbeat_user || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user=(value)\n conf['dashboard']['user'] = value\n end", "def set_user_setting\n @current_user.create_default_user_setting unless @current_user.user_setting\n @user_setting = @current_user.user_setting\n end", "def set(user_obj)\n # example code to set it\n # You could also set i...
[ "0.649751", "0.61443394", "0.6020464", "0.6010618", "0.588153", "0.5778598", "0.5764999", "0.5747253", "0.5739527", "0.5663453", "0.5557444", "0.5520484", "0.55058897", "0.54613143", "0.5453085", "0.5413977", "0.5413977", "0.54072905", "0.5382513", "0.5376694", "0.5375021", ...
0.68399316
0
def self.subdomain2id(subdomain) MACHINELIFE_IDS[subdomain] end
def machinelife_images temp = JSON.parse(imgs.presence || "[]").to_a temp.unshift top_img if top_img.present? temp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_ensembl_subdomain\n @ensembl_subdomain = EnsemblSubdomain.find(params[:id])\n end", "def generate_subdomain\n slug = self.name.gsub(/\\W/, \"-\").gsub(/\\-{2,}/, \"-\").sub(/^\\-/, \"\").sub(/\\-$/, \"\").downcase\n count = self.class.where(domain: slug).count\n\n while count > 0\n ...
[ "0.6928194", "0.667414", "0.66403085", "0.66198283", "0.6580453", "0.65290606", "0.63811827", "0.6373786", "0.6304466", "0.62270546", "0.6219581", "0.6215681", "0.6215681", "0.6206988", "0.62008536", "0.6195254", "0.61649126", "0.6159363", "0.6141327", "0.6053258", "0.6053163...
0.0
-1
finds and opens view
def get_view(filename) full_file = File.join(options.views, filename) if File.exists?(full_file) view_file = full_file else view_directory = File.join(File.dirname(__FILE__),'views') view_file = File.join(view_directory,filename) end open(view_file,'r') { |file| file.read } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_to_view\n unless ( name = path_matcher.controller_name )\n return\n end\n # figure out what the name of def we are in is\n action = find_function_under_cursor\n view = File.join(project_root, \"/app/views/#{name}/#{action}\")\n\n # open the according ...
[ "0.7309089", "0.69221425", "0.6723794", "0.66920435", "0.6585333", "0.65265733", "0.6468835", "0.6405922", "0.63665605", "0.63620305", "0.63103384", "0.6292088", "0.62773335", "0.62608874", "0.62604916", "0.6218306", "0.62137234", "0.6173676", "0.61674136", "0.6145497", "0.61...
0.5947697
27
Create a method that takes two integers as arguments. The first argument s a count, and the second is the first number of a sequence that your method will create. The method should return an Array that contains the same number of elements as the count argument, while the values of each element will be multiples of the starting number. You may assume that the count argument will always have a value of 0 or greater, while the starting number can be any integer value. If the count is 0, an empty list should be returned. input count integer number output: a new Array rules: outputs count number of numbers starting from this integer first integer 1, first integer 2, first integer3,etc algo: 1. get a count, and an integer 2. initialize an empty Array 3. initialize variable times as a factor count 4. iterate thru by times 5. in each iteration, put the integer times into the new array 6. in each iteration, increment times by 1 7. return the new array
def sequence(count, integer) new_arr = [] times = 1 count.times do new_arr << integer * times times += 1 end p new_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence(count, starting_num)\n result_arr = []\n 1.upto(count) { |num| result_arr << starting_num * num }\n result_arr\nend", "def sequence(count, start_number)\n array = []\n count.times { |i| array << (start_number * (i + 1)) }\n array\nend", "def sequence(count, number)\n sequence_arr = []\n 1....
[ "0.81486416", "0.8035389", "0.7976485", "0.7910869", "0.78672826", "0.7774187", "0.76455706", "0.76172286", "0.7576997", "0.7573405", "0.755418", "0.75534344", "0.75427073", "0.75026715", "0.74828", "0.73792785", "0.73405284", "0.72876716", "0.7257774", "0.72237325", "0.72118...
0.75081325
13
gives access to all helpers defined within `application_helper`. Deliver an invitation email
def sharing_invitation_instructions(record, raw_token, opts={}) @notification_token = opts[:notification_token] if opts[:notification_token] @recipient = record @sender = record.invited_by # opts[:from] = "Ignatz from RecipePower <ignatz@recipepower.com>" # optional arguments introduced in Devise 2.2.0, remove check once support for < 2.2.0 is dropped. @invitation_event = InvitationSentEvent.post @sender, @recipient, @recipient.shared # Add an attachment for the shared entity's image, if available if (imgdata = @recipient.shared && @recipient.shared.imgdata).present? attachments['collectible_image'] = Base64.decode64(imgdata.sub(/^data:image\/[^;]*;base64,/,'')) end if Gem::Version.new(Devise::VERSION.dup) < Gem::Version.new('2.2.0') devise_mail(record, :sharing_invitation_instructions) else devise_mail(record, :sharing_invitation_instructions, opts) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invitation\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def invitation\n InvitationMailer.send_invitation(self).deliver\n end", "def all_application_helpers; end", "def helpers\n ActionController::Base.helpers\n end", "def helpers\n ApplicationController.helpers\n...
[ "0.6264212", "0.6202036", "0.6163642", "0.61503625", "0.6131173", "0.6131173", "0.6110015", "0.6110015", "0.60819566", "0.60819566", "0.60819566", "0.60718036", "0.60718036", "0.6069679", "0.600578", "0.59995174", "0.59971124", "0.5994744", "0.5983484", "0.59687537", "0.59417...
0.5496474
59
GET /rec_event_follows GET /rec_event_follows.json
def index @rec_event_follows = RecEventFollow.all authorize! :index, RecEventFollow.new, :message => 'Not authorized as an administrator.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_rec_event_follow\n @rec_event_follow = RecEventFollow.find(params[:id])\n end", "def followed_events\n @followed = Follower.all.where(:customer_id => params[:customer_id])\n @followed_events=Array.new\n @eventos_nous=Array.new\n @followed.each do |f|\n @followed_events = Evento.a...
[ "0.68207645", "0.6772752", "0.6617579", "0.6541694", "0.6511154", "0.6477968", "0.6472577", "0.6430263", "0.6392835", "0.63390857", "0.6335644", "0.6265119", "0.62443507", "0.62344414", "0.6231666", "0.61889374", "0.6163822", "0.61520886", "0.6128537", "0.6125582", "0.6119675...
0.61339056
18
GET /rec_event_follows/1 GET /rec_event_follows/1.json
def show authorize! :show, @rec_event_follow, :message => 'Not authorized as an administrator.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_rec_event_follow\n @rec_event_follow = RecEventFollow.find(params[:id])\n end", "def show_follows\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.follows\n end", "def followed_events\n @followed = Follower.all.where(:customer_id => params[:customer_id])\n @followed_even...
[ "0.7048061", "0.6680448", "0.6662466", "0.6628479", "0.6618326", "0.6577661", "0.6555493", "0.6496516", "0.6384339", "0.63671744", "0.6363592", "0.6332563", "0.62791", "0.6253611", "0.62394613", "0.61823446", "0.61449075", "0.6138084", "0.61049414", "0.61037695", "0.6099935",...
0.59743893
36
POST /rec_event_follows POST /rec_event_follows.json
def create @rec_event_follow = RecEventFollow.new(rec_event_follow_params) authorize! :create, @rec_event_follow, :message => 'Not authorized as an administrator.' respond_to do |format| if @rec_event_follow.save format.html { redirect_to @rec_event_follow, notice: 'Rec event follow was successfully created.' } format.json { render action: 'show', status: :created, location: @rec_event_follow } else format.html { render action: 'new' } format.json { render json: @rec_event_follow.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if(@check)\n @follower.update(event_params.except(:token))\n if follower.save\n render json: @follower, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end", "def follow\r\n @relationship...
[ "0.7034674", "0.6816628", "0.68094337", "0.67214954", "0.6706344", "0.6692911", "0.6665344", "0.6626101", "0.6598047", "0.6595729", "0.6555569", "0.65327495", "0.65180385", "0.64423", "0.6429685", "0.64273745", "0.6421967", "0.64184344", "0.6400108", "0.63597816", "0.6357918"...
0.6566461
10
PATCH/PUT /rec_event_follows/1 PATCH/PUT /rec_event_follows/1.json
def update respond_to do |format| authorize! :update, @rec_event_follow, :message => 'Not authorized as an administrator.' if @rec_event_follow.update(rec_event_follow_params) format.html { redirect_to @rec_event_follow, notice: 'Rec event follow was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @rec_event_follow.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if(@check)\n @follower.update(event_params.except(:token))\n if follower.save\n render json: @follower, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end", "def set_rec_event_follow\n ...
[ "0.7493949", "0.6801311", "0.6654434", "0.6632716", "0.66159564", "0.66159564", "0.65949607", "0.65949607", "0.6561313", "0.652599", "0.6499532", "0.6421165", "0.64151657", "0.6351396", "0.6244038", "0.6212301", "0.61789477", "0.6178631", "0.6168319", "0.61624527", "0.6127741...
0.7499513
0
DELETE /rec_event_follows/1 DELETE /rec_event_follows/1.json
def destroy authorize! :destroy, @rec_event_follow, :message => 'Not authorized as an administrator.' @rec_event_follow.destroy respond_to do |format| format.html { redirect_to rec_event_follows_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows.delete(@followed)\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end", "def test_stop_following_a_user\r\n # delete \"/follows/destroy.json\", :api_key =...
[ "0.6938171", "0.69183445", "0.6876606", "0.68600255", "0.6775278", "0.67212653", "0.67173415", "0.67129", "0.66898817", "0.66898817", "0.6636427", "0.6579135", "0.6571831", "0.6550049", "0.6535593", "0.65300465", "0.6524555", "0.6487886", "0.6483768", "0.6482289", "0.647621",...
0.75690764
0
Use callbacks to share common setup or constraints between actions.
def set_rec_event_follow @rec_event_follow = RecEventFollow.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def rec_event_follow_params params.require(:rec_event_follow).permit(:recurring_event_id, :user_id, :send_email, :send_sms) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
How long since a host said it was alive
def initialize(my_name, shared_path) @my_name = my_name @shared_path = shared_path FileUtils.mkdir_p(@shared_path) unless File.directory?(@shared_path) @my_file = "#{@shared_path}/#{@my_name}.txt" @nominated_hosts = [] @active_hosts = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keep_alive_time; end", "def alive?\n expires_on > Time.now\n end", "def idle_time\n return 0 unless alive?\n return Time.now - ts\n end", "def uptime\n Time.now - live_since\n end", "def keep_alive_time=(_arg0); end", "def getAge(host, refTime = nil)\n if refTime == nil th...
[ "0.74838763", "0.69762605", "0.6906107", "0.69060796", "0.6855067", "0.65225625", "0.6509905", "0.64930403", "0.64682066", "0.6387569", "0.62504506", "0.62404644", "0.6237468", "0.61483544", "0.6145397", "0.6136309", "0.6107158", "0.6095115", "0.60814804", "0.6032994", "0.602...
0.0
-1
GET /contact_requests/1 GET /contact_requests/1.json
def show @contact_request = ContactRequest.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @contact_request } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contact = current_user.contacts.find(params[:contact_id])\n @requests = @contact.requests\n\n respond_with @requests\n end", "def show\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @requests\n end", ...
[ "0.74935263", "0.7283026", "0.686412", "0.67566", "0.6415807", "0.63845825", "0.62854654", "0.6244459", "0.6193241", "0.6193241", "0.6193241", "0.6145869", "0.6145869", "0.61389667", "0.6122961", "0.60988915", "0.6089211", "0.60832804", "0.6076538", "0.60753036", "0.6069796",...
0.7409002
1
GET /contact_requests/new GET /contact_requests/new.json
def new @contact_request = ContactRequest.new respond_to do |format| format.html # new.html.erb format.json { render json: @contact_request } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @contact = current_user.contacts.find(params[:contact_id])\n @request = Request.new(params[:request])\n @request.contact = @contact\n @request.user = current_user\n\n respond_with @request do |format|\n if @request.save\n @requests = @contact.requests.last_requests\n ...
[ "0.73663086", "0.73390824", "0.73390824", "0.73390824", "0.7323062", "0.7275984", "0.7275984", "0.7275984", "0.7275984", "0.7275984", "0.7254225", "0.7246353", "0.7231858", "0.7171804", "0.7116707", "0.7081889", "0.70368844", "0.69848824", "0.6976765", "0.69732654", "0.693357...
0.8205658
0
POST /contact_requests POST /contact_requests.json
def create @contact_request = ContactRequest.new(params[:contact_request]) respond_to do |format| if @contact_request.save ContactRequestMailer.contact_request_submitted(@contact_request).deliver format.html { redirect_to new_contact_request_path, notice: 'Contact request was successfully submitted.' } format.json { render json: @contact_request, status: :created, location: @contact_request } else format.html { render action: "new" } format.json { render json: @contact_request.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @contact = current_user.contacts.find(params[:contact_id])\n @request = Request.new(params[:request])\n @request.contact = @contact\n @request.user = current_user\n\n respond_with @request do |format|\n if @request.save\n @requests = @contact.requests.last_requests\n ...
[ "0.70818156", "0.6308896", "0.6275255", "0.62182724", "0.61216146", "0.6053918", "0.5998568", "0.59393895", "0.5923282", "0.5918005", "0.5900771", "0.5885958", "0.5875787", "0.5867483", "0.5828618", "0.5823433", "0.5808172", "0.58075505", "0.5793487", "0.5791441", "0.5790665"...
0.705282
1
PUT /contact_requests/1 PUT /contact_requests/1.json
def update @contact_request = ContactRequest.find(params[:id]) respond_to do |format| if @contact_request.update_attributes(params[:contact_request]) format.html { redirect_to @contact_request, notice: 'Contact request was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @contact_request.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @request do |format|\n if @request.update_attributes(params[:request])\n @requests = @contact.requests.last_requests\n format.html { redirect_to(cont...
[ "0.7133398", "0.65594596", "0.64663845", "0.6374402", "0.6358661", "0.63550556", "0.63187456", "0.61847866", "0.6103021", "0.609151", "0.60833126", "0.60771185", "0.60715234", "0.60702467", "0.60547704", "0.6020336", "0.5993733", "0.59850705", "0.59779274", "0.59770083", "0.5...
0.7111245
1
DELETE /contact_requests/1 DELETE /contact_requests/1.json
def destroy @contact_request = ContactRequest.find(params[:id]) @contact_request.destroy respond_to do |format| format.html { redirect_to contact_requests_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n @request.destroy\n @requests = @contact.requests.last_requests\n\n respond_with @request do |format|\n format.html { redirect_to(contact_requests_path) }\n end\n end",...
[ "0.7712041", "0.7394408", "0.71834093", "0.7075735", "0.70171463", "0.7016067", "0.70110947", "0.7008154", "0.7008154", "0.7008154", "0.70038825", "0.7000669", "0.69926757", "0.69926757", "0.69926757", "0.69824016", "0.6978951", "0.6978951", "0.6978951", "0.6978951", "0.69789...
0.7967918
0
Deliver the email using ActionMailer.
def deliver if valid? run_callbacks :before_delivery Mailer.deliver_active_email(self) run_callbacks :after_delivery true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deliver\n Mailer.deliver_message(options)\n end", "def deliver_mail\n @invitation.deliver_mail\n track 'Invitation Deliver Mail', @invitation\n redirect_to account_invitations_path, notice: 'Invitation email has been sent.'\n end", "def do_email\n @delivery = Delivery.find(params[:id])...
[ "0.809183", "0.76478827", "0.74085903", "0.71882033", "0.71494883", "0.7104018", "0.70324254", "0.7023609", "0.69787526", "0.6946056", "0.6931979", "0.69247293", "0.69140005", "0.69102436", "0.69079274", "0.6897841", "0.6883508", "0.68639386", "0.68612206", "0.68485165", "0.6...
0.6301469
83
Try to returns the best directory path to dump the database.
def best_dumps_path if database.via_ssh? return main_storage.path if same_ssh_as_database?(main_storage) else return main_storage.path if main_storage.local? end Dir.tmpdir end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_directory\n File.join(@relative_to_base, DUMP_DIRECTORY_NAME)\n end", "def dump_path\n dump = {:postgresql => 'pg_dump',:mysql => 'mysqldump'}\n # Note: the 'mysqldump_path' config option is DEPRECATED but keeping this in for legacy config file support\n @fu_conf[:mysqldump_path] || @fu...
[ "0.698278", "0.6739662", "0.6721679", "0.6646991", "0.6597641", "0.6452779", "0.63014305", "0.6282399", "0.6281804", "0.6267054", "0.62249774", "0.61648196", "0.60731304", "0.6046728", "0.60163337", "0.59997964", "0.58897877", "0.58729047", "0.5867233", "0.58663917", "0.58663...
0.718354
0
Try to returns the best local directory path.
def best_local_dumps_path spare_storage && spare_storage.local? ? spare_storage.path : Dir.tmpdir end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_local_dir\n return @resource[:local_dir]\n end", "def localstate_default_directory\n default_dir = File.join( Config::CONFIG['localstatedir'], basedir )\n return default_dir if is_tyrant_root?( default_dir )\n return nil\n end", "def ensure_local_drive_path(path, temp_dir_...
[ "0.67836654", "0.66678035", "0.6454074", "0.6454074", "0.6405758", "0.6293029", "0.62139404", "0.6188333", "0.6188333", "0.6118948", "0.6109734", "0.61065394", "0.6035522", "0.6017777", "0.60168386", "0.600736", "0.59877187", "0.59733516", "0.5968184", "0.5904714", "0.5886782...
0.5497518
61
GET /sold_tickets GET /sold_tickets.json
def index @sold_tickets = SoldTicket.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_tickets_sold()\n end", "def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end", "def set_sold_ticket\n @sold_ticket = SoldTicket.find(params[:id])\n end", "def index\n respond_with(@tickets)\n end", "def index_all\n ...
[ "0.70010173", "0.68604535", "0.6770478", "0.67574805", "0.6751021", "0.6730914", "0.6714098", "0.66498023", "0.66498023", "0.66498023", "0.66498023", "0.66498023", "0.66498023", "0.66498023", "0.66498023", "0.66498023", "0.66498023", "0.66498023", "0.66498023", "0.6648962", "...
0.77643716
0
GET /sold_tickets/1 GET /sold_tickets/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sold_tickets = SoldTicket.all\n end", "def set_sold_ticket\n @sold_ticket = SoldTicket.find(params[:id])\n end", "def index\n respond_with(@tickets)\n end", "def index\n @tickets = current_user.tickets.last(15).reverse\n\n respond_to do |format|\n format.html # index.h...
[ "0.7540422", "0.6842509", "0.67488575", "0.67123353", "0.6712204", "0.6707451", "0.6676983", "0.66667277", "0.6665841", "0.6620928", "0.66156316", "0.6598288", "0.6586901", "0.6586901", "0.6586901", "0.6586901", "0.6586901", "0.6586901", "0.6586901", "0.6586901", "0.6586901",...
0.0
-1
POST /sold_tickets POST /sold_tickets.json
def create @sold_ticket = SoldTicket.new(sold_ticket_params) respond_to do |format| if SoldTicket.multi_save format.html { redirect_to user(current_user.id), notice: 'Sold ticket was successfully created.' } format.json { render :show, status: :created, location: @sold_ticket } else format.html { render :new } format.json { render json: @sold_ticket.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_sold_ticket\n @sold_ticket = SoldTicket.find(params[:id])\n end", "def index\n @sold_tickets = SoldTicket.all\n end", "def create\n @tickets = []\n params[:quantity].to_i.times do\n @ticket = Ticket.new(params[:ticket])\n @ticket.viber = current_viber\n @tickets << @tic...
[ "0.6670911", "0.6605518", "0.64356005", "0.6306255", "0.6129994", "0.61258847", "0.6096558", "0.6085693", "0.6073113", "0.6071858", "0.60685337", "0.5918079", "0.5890387", "0.58712465", "0.585073", "0.58352304", "0.58280134", "0.5800623", "0.5788963", "0.577629", "0.5756438",...
0.7122735
0
PATCH/PUT /sold_tickets/1 PATCH/PUT /sold_tickets/1.json
def update respond_to do |format| if @sold_ticket.update(sold_ticket_params) format.html { redirect_to @sold_ticket, notice: 'Sold ticket was successfully updated.' } format.json { render :show, status: :ok, location: @sold_ticket } else format.html { render :edit } format.json { render json: @sold_ticket.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @ticketold = Ticket.find(@ticket.id)\n respond_to do |format|\n if @ticket.update(ticket_params)\n Account::Tickets::TicketLogs.update(@ticket...
[ "0.72060317", "0.66595817", "0.6629772", "0.6594802", "0.65591234", "0.65586305", "0.65586305", "0.65586305", "0.6522384", "0.6516499", "0.65097594", "0.6502603", "0.64985853", "0.6497071", "0.6497071", "0.64895433", "0.6489519", "0.6489519", "0.6489519", "0.6489519", "0.6489...
0.72800624
0
DELETE /sold_tickets/1 DELETE /sold_tickets/1.json
def destroy @sold_ticket.destroy respond_to do |format| format.html { redirect_to sold_tickets_url, notice: 'Sold ticket was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end", "def delete id\n\t\t@tickets.delete ['id', id]\n\tend", "def destroy\n @ticket.destroy\n respond_to do |format|\n format.html { redirect_to tickets_url }\n format.json { head :no...
[ "0.7492526", "0.7138666", "0.7116207", "0.7116207", "0.7116207", "0.7116207", "0.7116207", "0.7116178", "0.7059499", "0.7029115", "0.7022613", "0.70065564", "0.699963", "0.6973767", "0.6973767", "0.6973767", "0.6973767", "0.6973767", "0.6973767", "0.69548655", "0.6901134", ...
0.76165533
0
Use callbacks to share common setup or constraints between actions.
def set_sold_ticket @sold_ticket = SoldTicket.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def sold_ticket_params params.fetch(:sold_ticket, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
def valid_move?(x, y) ((self.position_x self.position_y) == (x y) || (self.position_x + self.position_y) == (x + y)) is_obstructed? to be added end
def valid_move?(x, y) return false if is_obstructed?(x, y) diagonal_move_left?(x, y) || diagonal_move_right?(x,y) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_move?(new_x, new_y)\n true\n end", "def legal_move?(x_destination, y_destination)\n x_movement_difference = (x_destination - self.x_pos).abs\n y_movement_difference = (y_destination - self.y_pos).abs\n\n x_movement_difference.between?(0, 1) && y_movement_difference.between?(0, 1)\n end", ...
[ "0.8775423", "0.83912027", "0.8263296", "0.82556367", "0.82047415", "0.8173667", "0.8152844", "0.81271267", "0.81271267", "0.81244326", "0.8100789", "0.8078021", "0.7983049", "0.7937657", "0.7935846", "0.7927927", "0.79033", "0.7890252", "0.7879887", "0.7878882", "0.7872121",...
0.8724223
1
def supplier Supplier.find_by(id: supplier_id) end
def is_discounted? price.to_f <= 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supplier\n Supplier.find_by(:id => supplier_id)\n end", "def supplier\n # Look in the supplier's table for a supplier with an id that matches supplier_id\n Supplier.find_by(id: supplier_id)\n end", "def get_supplier()\n supplier = Supplier.find(supplier_id)\n return supplier\n end", "de...
[ "0.9492767", "0.9341116", "0.84718066", "0.84026754", "0.8299823", "0.8206647", "0.8200205", "0.8115367", "0.8115367", "0.8115367", "0.8115367", "0.8115367", "0.8115367", "0.8115367", "0.8115367", "0.8092614", "0.8084593", "0.7982103", "0.7699587", "0.7550884", "0.7434136", ...
0.0
-1
There is a bus moving in the city, and it takes and drop some people in each bus stop. You are provided with a list (or array) of integer arrays (or tuples). Each integer array has two items which represent number of people get into bus (The first item) and number of people get off the bus (The second item) in a bus stop. Your task is to return number of people who are still in the bus after the last bus station (after the last array). Even though it is the last bus stop, the bus is not empty, and some people are still in the bus, and they are probably sleeping there :D Take a look on the test cases. Please keep in mind that the test cases ensure that the number of people in the bus is always >= 0. So the return integer can't be negative. The second value in the first integer array is 0, since the bus is empty in the first bus stop. Example: Test.assert_equals number([[10, 0], [3, 5], [5, 8]]), 5 Test.assert_equals number([[3, 0], [9, 1], [4, 10], [12, 2], [6, 1], [7, 10]]), 17 Test.assert_equals number([[3, 0], [9, 1], [4, 8], [12, 2], [6, 1], [7, 8]]), 21 My answer:
def number(bus_stops) item_1 = bus_stops.sum(&:first) #return the sum of first elements in arrays (i.e. people get on the bus) item_2 = bus_stops.sum(&:last) #return the sum of last elements in arrays (i.e. people get off the bus) p passengers = item_1 - item_2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number(bus_stops)\n entries = []\n exits = []\n bus_stops.each { |x| entries << x[0] }\n bus_stops.each { |x| exits << x[1] }\n p entries.inject(&:+) - exits.inject(&:+)\nend", "def number(bus_stop)\n people_left = 0\n bus_stop.each do |stop|\n people_left += (stop[0] - stop[1])\n end\n people_le...
[ "0.6508321", "0.63578063", "0.62414706", "0.6083835", "0.60192657", "0.5990421", "0.59454006", "0.58915025", "0.58369255", "0.5759814", "0.55555826", "0.5551596", "0.55281836", "0.5488759", "0.54686403", "0.544321", "0.54423666", "0.54155886", "0.54070127", "0.5358391", "0.53...
0.6365046
1
Get basic information about your organizations
def org @org_resource ||= Org.new(@client) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = or...
[ "0.7904826", "0.7794674", "0.77018255", "0.76004016", "0.74847585", "0.73995316", "0.73995316", "0.7376753", "0.73588496", "0.73469377", "0.7300385", "0.72276556", "0.7159024", "0.71496993", "0.71327084", "0.70964104", "0.7095218", "0.70886546", "0.70810956", "0.7018822", "0....
0.0
-1
All aspects of team management
def team @team_resource ||= Team.new(@client) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def team\n\t\t\trobot.team\n\t\tend", "def team_information_list\n @teams = Team.find_teams_by_user(current_user.id)\n \n end", "def team\n @response = CompanyApi::Request::Setting.new(\n...
[ "0.7861066", "0.7861066", "0.7861066", "0.7861066", "0.7861066", "0.7861066", "0.6998447", "0.68245584", "0.6808107", "0.6781058", "0.66769695", "0.6652922", "0.66062784", "0.65926784", "0.6575723", "0.65342087", "0.64932925", "0.6445005", "0.6440177", "0.64328855", "0.640182...
0.6090877
54
Info for existing organization.
def info(org_username) @client.org.info(org_username) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend", "def organization\n _get(\"/account/organization\") { |json| json }\n end", "def get_org_information(name)\n begin\n github_api_setup.orgs.get(nam...
[ "0.7640379", "0.73596096", "0.7218846", "0.7016799", "0.69409794", "0.69409794", "0.68925655", "0.6807708", "0.6807708", "0.6807708", "0.6740632", "0.66974705", "0.6667614", "0.6667614", "0.66660506", "0.6580457", "0.6579217", "0.65516776", "0.65418136", "0.65341735", "0.6463...
0.6814674
7
Create a new team.
def create(org_username, body = {}) @client.team.create(org_username, body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_team(opts)\n HelloSign::Resource::Team.new post('/team/create', body: opts)\n end", "def create(_team)\n # stub\n end", "def create_team(opts)\n HelloSign::Resource::Team.new post('/team/create', :body => opts)\n end", "def create\n\t\tTeam.create(params[:te...
[ "0.84293497", "0.841435", "0.8381285", "0.83776397", "0.83551127", "0.81242603", "0.80644804", "0.80554205", "0.7988987", "0.7985404", "0.79497695", "0.7943586", "0.7941304", "0.7941304", "0.7941304", "0.7941304", "0.7941304", "0.7941304", "0.7941304", "0.7941304", "0.7940966...
0.7556647
55
Delete an existing team.
def delete(team_id) @client.team.delete(team_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_team\n post('/team/destroy')\n end", "def destroy_team\n post('/team/destroy')\n end", "def delete()\n\n Team.destroy(self.id)\n end", "def delete(_team)\n # stub\n end", "def delete_team(id)\n boolean_request :delete, \"/teams/#{id}\"\n e...
[ "0.85925484", "0.85925484", "0.8524446", "0.83301955", "0.82421327", "0.81770736", "0.81506354", "0.81456274", "0.80228627", "0.7953203", "0.79343647", "0.7822298", "0.78090906", "0.7755417", "0.7747579", "0.7747579", "0.7747579", "0.7747579", "0.7747579", "0.7747579", "0.774...
0.83295196
4
Info for existing team.
def info(team_id) @client.team.info(team_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team_info(options={})\n post(\"team.info\", options)\n end", "def team_info(options = {})\n post('team.info', options)\n end", "def team_info(team_id)\n team_info_hash(team_id)\n end", "def team_info(params = {})\n response = @session.do_post \"#{SCOPE}.info\", ...
[ "0.805207", "0.80386984", "0.77354944", "0.7542862", "0.7370155", "0.7337309", "0.7157007", "0.70823365", "0.7058903", "0.7033669", "0.70252305", "0.69720864", "0.6861856", "0.681197", "0.6785128", "0.6752807", "0.67475164", "0.674183", "0.674183", "0.674183", "0.674183", "...
0.73896635
4
List existing teams for an org.
def list(org_username) @client.team.list(org_username) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def org_teams(org)\n Hardmode.get(\"/orgs/#{org}/teams\", :headers => @auth)\n end", "def teams(org)\n get \"/orgs/#{org}/teams\"\n end", "def get_teams( org )\n teams = Homework.get(\"/orgs/#{org}/teams\", :headers => @auth)\n teams.each do |team|\n puts team['id']\n ...
[ "0.8562008", "0.84797186", "0.8197575", "0.7982986", "0.78823084", "0.7258482", "0.70737994", "0.7054997", "0.6937374", "0.68350524", "0.6727801", "0.6639845", "0.6586247", "0.65180814", "0.64882165", "0.64792675", "0.6466502", "0.644493", "0.64319986", "0.63792485", "0.63769...
0.7684691
5
Update an existing team.
def update(team_id, body = {}) @client.team.update(team_id, body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_team\n @team.update(team_params)\n end", "def update\n\t\tteam = Team.find(params[:id])\n\t\tteam.update_attributes(params[:team])\n\n\t\tredirect_to teams_path\n\tend", "def update\n @team = Team.find(params[:id])\n if @team.update_attributes(team_params)\n flash[:notice] = \"Team su...
[ "0.8587275", "0.81969345", "0.80520034", "0.7996723", "0.78804016", "0.7848154", "0.78084606", "0.78082496", "0.77981377", "0.77981377", "0.77981377", "0.77981377", "0.77981377", "0.77981377", "0.7783417", "0.7783417", "0.7724654", "0.7688975", "0.76819724", "0.76708156", "0....
0.81074655
2
Return the list of expressions as array of expression objects
def expressions return @expressions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expression_bodies\n expression_bodies_arr = Array.new\n @expressions.each do |expression|\n expression_bodies_arr << expression.body\n end\n return expression_bodies_arr\n end", "def expressions\n @expressions = operands.\n select {|op| op.is_a?(RDF::Reso...
[ "0.7358127", "0.7051174", "0.6998701", "0.6899185", "0.6677532", "0.6608422", "0.656691", "0.6476871", "0.64444166", "0.64106655", "0.64010644", "0.6257234", "0.62564933", "0.6255756", "0.6255756", "0.6206655", "0.61680716", "0.6130374", "0.60817456", "0.6081187", "0.6003012"...
0.78951705
0
Return the expression bodies as an array of strings.
def expression_bodies expression_bodies_arr = Array.new @expressions.each do |expression| expression_bodies_arr << expression.body end return expression_bodies_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expressions\n return @expressions\n end", "def raw_expression_children\n\n @raw_representation[2].select { |c| c.is_a?(Array) }\n end", "def expressions; end", "def evaluate\n arr = []\n laststr = nil\n # Evaluate all the Nodes, turning each one into a String, SeparateS...
[ "0.6973946", "0.633136", "0.61444956", "0.6134569", "0.58708936", "0.5770213", "0.5657598", "0.5523451", "0.55130506", "0.54943144", "0.5490918", "0.54681057", "0.546782", "0.54629123", "0.54245627", "0.5313971", "0.52920985", "0.52837706", "0.52603006", "0.52591854", "0.5251...
0.8749801
0
Return entities used with there id as an array of strings.
def entities_used entities_arr = Array.new @entities.each do |entity| entities_arr << entity.id unless entities_arr.include?(entity.id) end return entities_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entities viewerid=nil\n tagging_query(viewerid).to_a.map(&:entity)\n end", "def entities\n _entities\n end", "def entities\n _entities\n end", "def entities\n @entities\n end", "def find_entities\n []\n end", "def entities\n @entities ||= [...
[ "0.7133439", "0.6685168", "0.6685168", "0.6660047", "0.66519576", "0.6588606", "0.6507486", "0.6457407", "0.6401334", "0.63695776", "0.6362609", "0.63518363", "0.634869", "0.62718517", "0.61698353", "0.615606", "0.61500823", "0.6141816", "0.61253065", "0.61253065", "0.6105137...
0.7079936
1
Overide that assists in calling the proper index in the array of intent results.
def [](num) @intents[num] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [](idx)\n process_results unless @processed\n @results[idx]\n end", "def next_result()\n #This is a stub, used for indexing\n end", "def [](index)\n execute\n return @result[index]\n end", "def results=(_arg0); end", "def results=(...
[ "0.62582564", "0.5883612", "0.57228786", "0.57067853", "0.57067853", "0.5573621", "0.55102", "0.5475681", "0.54631186", "0.54112345", "0.5398668", "0.53559667", "0.5341848", "0.53290284", "0.5311468", "0.5307291", "0.52837557", "0.522945", "0.5228645", "0.5222701", "0.5216538...
0.50121397
46
Assists in going through each intent in the instance variable.
def each @intents.each do |intent| lambda{intent} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_many_intents\n intents = []\n @switches.each do |sw|\n rest = @switches - [sw]\n intents = _create_intent sw, rest, intents\nputs intents.size\n post_slice intents\n end\n post_slice intents, true\n end", "def intent xA\n result = @attributes.clone\n for g in xA do\n ...
[ "0.61879927", "0.6010818", "0.5610221", "0.5534706", "0.54216284", "0.53657794", "0.5201076", "0.5201076", "0.5165043", "0.51494354", "0.5130485", "0.507602", "0.5018144", "0.5009547", "0.50058293", "0.49816284", "0.49804", "0.49364328", "0.493144", "0.4920903", "0.49194878",...
0.66019195
0
verica que el objeto de guarde en la base de datos correctamente (se usa a mano en casos de objetos que se generan automaticamente sin intervencion del usuario)
def secure_save(variable) begin if variable.save return true end rescue ActiveRecord::RecordNotFound # handle not found error logger.error "no se encontro el registro que se solicito" return false rescue ActiveRecord::ActiveRecordError # handle other ActiveRecord errors logger.error ("hubo un error en el ActiveRecord" + logger.debug) rescue # StandardError # handle most other errors rescue Exception # handle everything else end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auditoria_antes(accion, tabla, objeto)\n auditoria = Auditoria.new\n auditoria.usuario = current_usuario.login\n auditoria.ip = request.remote_ip\n auditoria.accion = accion\n auditoria.tabla = tabla\n auditoria.pista_antes = objeto.to_json\n auditoria.sistema = \"RUE\"\n auditoria.save...
[ "0.6005672", "0.57852143", "0.57479227", "0.57031995", "0.5674326", "0.56485367", "0.55354387", "0.55126214", "0.55069363", "0.5505872", "0.55039835", "0.55016184", "0.54981256", "0.54905915", "0.5433577", "0.5423064", "0.5406326", "0.53848165", "0.5382944", "0.5381717", "0.5...
0.0
-1
metodo que verifica la existencia de la variable (se usa a mano en donde se ocupe)
def var_verify(variable) begin if variable return true end rescue ActiveRecord::RecordNotFound # handle not found error logger.error "no se encontro el registro que se solicito" puts "-------------------------------------------------------------" puts "no se encontro el Record" puts variable.inspect puts "-------------------------------------------------------------" return false rescue ActiveRecord::ActiveRecordError # handle other ActiveRecord errors logger.error ("hubo un error en el ActiveRecord" + logger.debug) rescue # StandardError # handle most other errors rescue Exception # handle everything else puts "-------------------------------------------------------------". puts "ocurrio una excepcion" puts variable.inspect puts "-------------------------------------------------------------" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variable_exists?(id) #method\n @variables.key?(id)\n end", "def invariable?\n false\n end", "def variable?\n !@variable_id.nil?\n end", "def instance_variable_defined?(p0) end", "def variable_exists(name)\n assert_type name, :String, :name\n bool(environment.caller...
[ "0.72650063", "0.7253521", "0.7211516", "0.7176143", "0.71503454", "0.7125426", "0.70509857", "0.6996074", "0.696279", "0.6949997", "0.6882179", "0.6824669", "0.680964", "0.67310625", "0.6692534", "0.65885967", "0.65885967", "0.65701616", "0.65647644", "0.6556827", "0.6549507...
0.65192956
22
funcion que administra los errores de servidor
def server_error(exception) # Whatever code that handles the exception ExceptionNotifier.notify_exception(exception, :env => request.env, :data => {:message => "was doing something wrong"}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_error\n\n end", "def server_errors; end", "def server_error?; end", "def error(x, status:200, type:\"request\", title:\"An error occurred\", message:\"\", args: [])\n x.res.status = status\n if App[:app_error][type.to_sym]\n App[:app_error][type.to_sym][:get][x, title, message, *args]\...
[ "0.7281446", "0.6988511", "0.6832737", "0.6781073", "0.67684156", "0.65982616", "0.6594593", "0.65492034", "0.6532545", "0.6487213", "0.64863896", "0.6448598", "0.64338565", "0.64249736", "0.6399204", "0.6397197", "0.6384347", "0.63229156", "0.63082665", "0.6266615", "0.62615...
0.6070348
44
funcion que activa las traducciones
def set_locale I18n.locale = :es || I18n.default_locale end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _activate\n\t\t\tend", "def activate; end", "def transact; end", "def pro_activate\n set_activate\n end", "def activate()\n end", "def activate\n @r.activate\n end", "def activar\n # flash[:notice] = \"klkkkk\"\n \n session[:cliente_id] = \"desktop\" # SETEADO MANUAL ADMINISTRATIVA...
[ "0.6603873", "0.65292674", "0.65143627", "0.64128673", "0.63732445", "0.617129", "0.61607", "0.61297745", "0.60468346", "0.603206", "0.5944918", "0.59187263", "0.5914407", "0.5877657", "0.5815545", "0.5788684", "0.57590157", "0.5727486", "0.5706203", "0.5695396", "0.56945753"...
0.0
-1
string Commadelimited list of user IDs who are group administrators (separated by commas)
def admin_ids @attributes[:admin_ids] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discover_users_string\n discover_users.join(', ')\n end", "def admin_ids\n group_user_ids(admins_join_table)\n end", "def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end", "def discover_groups_string\n discover_groups.join(', ')\n end", "def admin_g...
[ "0.6773825", "0.6649143", "0.6350244", "0.63407445", "0.62768835", "0.6272521", "0.6247548", "0.61904824", "0.61843437", "0.6176734", "0.6174171", "0.6142453", "0.6131808", "0.6130034", "0.6060415", "0.6031385", "0.5992851", "0.5992424", "0.59850425", "0.5963289", "0.59444857...
0.5748722
33
string Notes about this group
def notes @attributes[:notes] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n [@group.description,@description].join(' ')\n end", "def liner_note\n info = \"(authorized accounts: #{@groups.keys.join(', ')})\" \n info = '' if @groups.empty?\n \"%s %s\" % [@name.bright, info]\n end", "def to_s\n string = super.to_s + \"\\tgrupo alimentici...
[ "0.7585577", "0.6932081", "0.66503984", "0.6527764", "0.6483832", "0.6466546", "0.6459814", "0.64060223", "0.6402603", "0.6401579", "0.63809556", "0.63594997", "0.6345348", "0.6340556", "0.6338869", "0.6338869", "0.6338869", "0.6338869", "0.6338869", "0.6338869", "0.6338869",...
0.0
-1
string Commadelimited list of user IDs who belong to this group (separated by commas)
def user_ids @attributes[:user_ids] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_users\n\t\tshared_users.map(&:id).join(\", \")\n\tend", "def discover_users_string\n discover_users.join(', ')\n end", "def read_users_string\n read_users.join(', ')\n end", "def get_following_ids_string\n following_ids = self.followed_users.pluck(:id) << self.id\n follo...
[ "0.70399874", "0.6944412", "0.68309927", "0.679464", "0.6781506", "0.6645395", "0.6578697", "0.6536222", "0.6525982", "0.6491802", "0.64493734", "0.6448474", "0.64100623", "0.6395395", "0.63564736", "0.6340574", "0.6333712", "0.62917244", "0.62711585", "0.6207097", "0.6173816...
0.64967775
9
string Commadelimited list of usernames who belong to this group (separated by commas)
def usernames @attributes[:usernames] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discover_users_string\n discover_users.join(', ')\n end", "def reply_users_names\n reply_users&.split(/[, ]+/)&.map do |reply_user_id|\n User.find(reply_user_id).real_name\n end&.join(', ')\n end", "def read_users_string\n read_users.join(', ')\n end", "def complete_na...
[ "0.72588146", "0.7121007", "0.70382947", "0.6846178", "0.6837458", "0.66396487", "0.66323876", "0.65394366", "0.6497406", "0.6465287", "0.6452495", "0.64344865", "0.6402158", "0.6398522", "0.63426787", "0.62771237", "0.6203201", "0.61898583", "0.6170373", "0.6145119", "0.6093...
0.64081985
13
Parameters: name string Group name. notes string Group notes. user_ids string A list of user ids. If sent as a string, should be commadelimited. admin_ids string A list of group admin user ids. If sent as a string, should be commadelimited.
def update(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String) raise InvalidParameterError.new("Bad parameter: notes must be an String") if params[:notes] and !params[:notes].is_a?(String) raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params[:user_ids] and !params[:user_ids].is_a?(String) raise InvalidParameterError.new("Bad parameter: admin_ids must be an String") if params[:admin_ids] and !params[:admin_ids].is_a?(String) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/groups/#{@attributes[:id]}", :patch, params, @options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_group\n ids = params[:ids]\n group = Group.find(params[:group_id])\n if ids.present?\n users = User.where(id: ids)\n users.each do |u|\n GroupUser.create(user: u, group: group, created_by: current_user)\n if current_user != u\n u.notify(\n \"#{current...
[ "0.6211643", "0.597901", "0.5842245", "0.58307934", "0.58105415", "0.5749629", "0.5683097", "0.5631074", "0.55885214", "0.5519266", "0.5519266", "0.5482365", "0.54697216", "0.5469077", "0.5463548", "0.5412069", "0.53925276", "0.5386765", "0.53752464", "0.5362075", "0.5334245"...
0.519643
31
GET /api/tests/testable?resource= Get the details of a given test plan : test cases resources covered by test cases Since v.3.5 ==== Examples get the test plan defined by the file com/mycompany/FooTest.c of my_project : GET /api/tests/plan?resource=my_project:com/mycompany/FooTest.c
def testable require_parameters :resource resource=Project.by_key(params[:resource]) not_found("Not found: #{params[:resource]}") unless resource access_denied unless has_role?(:user, resource) testable = java_facade.testable(resource.key) json = {} if testable resource = testable.component json[:key] = resource.key json[:name] = resource.name if resource.name json[:longName] = resource.longName if resource.longName json[:coveredLines] = testable.testedLines json[:coverages] = testable.coverageBlocks.map do |coverage| test_case = coverage.testCase coverage_json = {} coverage_json[:lines] = coverage.lines coverage_json[:name] = test_case.name coverage_json[:status] = test_case.status.to_s if test_case.status coverage_json[:durationInMs] = test_case.durationInMs coverage_json[:testPlan] = test_case.testPlan.component.key coverage_json.delete_if { |k, v| v.nil? } coverage_json end end json.delete_if { |k, v| v.nil? } respond_to do |format| format.json { render :json => jsonp(json) } format.xml { render :xml => xml_not_supported } format.text { render :text => text_not_supported } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_plan }\n end\n end", "def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_plans/#{id}\"...
[ "0.6353359", "0.62036073", "0.60681015", "0.6039246", "0.6034119", "0.59960186", "0.58718604", "0.584755", "0.5809333", "0.5755498", "0.57186514", "0.5650956", "0.5615706", "0.5615158", "0.5608367", "0.5582736", "0.55267173", "0.55170166", "0.5514333", "0.5508896", "0.5499957...
0.6823678
0
Creates a wrapped function spec based on the provided spec. The hash must have the following keys: name:: the name of the wrapped function params:: a list of parameters to supply when calling Each member of the params list must be a hash, with a mandatory key of 'value' holding the value to be supplied as the parameter. If only a 'name' key is provided, this will be used as the value. A 'type' may be supplied as well, and is necessary if an equivalent struct or pointer is to be supplied as the value so that casting can be performed correctly. The following key is optional: includes:: a list of includes needed for this function
def initialize(spec) @spec = self.class.normalize_spec_hash(spec) check = @spec['error-check'] @error_rules = check['rules'].map do |rule_spec| RuleSpec.new(rule_spec) end action = check['error-action'] @error_action = ActionSpec.new(action) unless @error_rules.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_from(function_spec)\n resolved_params = []\n\n @spec['params'].each do |param|\n resolved_params << function_spec.resolve_wrapped_param(param)\n end\n\n \"#{@spec['name']}( #{resolved_params.join(', ')} )\"\n end", "def json_spec(name, &block)\n # Parse the input token...
[ "0.52312267", "0.52049226", "0.50881684", "0.5011314", "0.49133167", "0.48622757", "0.4739138", "0.47299454", "0.47129807", "0.46225414", "0.46154743", "0.4555072", "0.45069322", "0.446761", "0.44175696", "0.44130325", "0.44049078", "0.43754166", "0.4368848", "0.4346952", "0....
0.0
-1
Generates a function call from a provided FunctionSpec. Paremeters and types are resolved using this function's context.
def call_from(function_spec) resolved_params = [] @spec['params'].each do |param| resolved_params << function_spec.resolve_wrapped_param(param) end "#{@spec['name']}( #{resolved_params.join(', ')} )" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_call_for_function(function_name, param_hash, function_params)\n output = \"\"\n payload_variable_name = 'parsed_payload'\n function_params.each do |param| \n output += \"#{param} = #{payload_variable_name}['#{param}']\\n\"\n end\n\n joined_param_string = function_params.join(', ')\n output +=...
[ "0.61701816", "0.53646755", "0.5325305", "0.5321283", "0.5281186", "0.5237938", "0.52055365", "0.5160128", "0.51426977", "0.5130135", "0.5103285", "0.50887305", "0.5080676", "0.5080396", "0.5074464", "0.507376", "0.5069834", "0.50623256", "0.50463223", "0.5031352", "0.5022494...
0.7800188
0
Yields each line of the error check and any actions taken for this wrapped function. If this function does not have any error check defined, then this function returns without yielding anything. +return_val+ is used as the replacement for a return value signified by the use of RETURN_VALUE_KEYWORD in the spec. If not specified it defaults to +'return_val'+. This parameter was added in release 0.4.2.
def error_check(return_val: 'return_val') return if @error_rules.empty? checks = @error_rules.map { |rule| rule.check(return_val: return_val) } yield "if( #{checks.join(' && ')} ){" yield " #{@error_action.take};" yield '}' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_check\n @@return_check ||= Proc.new { |ptr| Error.check_and_raise( ptr ) }\n end", "def each_error(&blk)\n yield value\n self\n end", "def with_checking(description)\n puts \"Checking #{description}\"\n result = yield\n if result\n puts \"OK\"\n else\n puts \"FAILED\"\n ...
[ "0.5953187", "0.580142", "0.5736961", "0.5692616", "0.5527312", "0.54786634", "0.5445796", "0.5445641", "0.54100806", "0.54085886", "0.53746337", "0.53572744", "0.53572744", "0.53572744", "0.53377837", "0.531385", "0.5305816", "0.5300508", "0.52881557", "0.5242474", "0.523416...
0.7073704
0
True if the wrapped function has an error check associated with it.
def error_check? !@error_rules.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_on_error?\n defined? @on_error\n end", "def raise_on_error?\n !!@raise_on_error\n end", "def error?\n !!@error\n end", "def error?\n !!@error\n end", "def error?\n not @error.nil?\n end", "def error?()\n #This is a stub, used for indexing\n en...
[ "0.7195475", "0.7030983", "0.7009783", "0.7009783", "0.6987915", "0.6957566", "0.6941116", "0.693001", "0.6914877", "0.6914877", "0.6909985", "0.6841991", "0.6827234", "0.6826043", "0.68109643", "0.6802435", "0.6802012", "0.6774842", "0.6768849", "0.6734169", "0.6725946", "...
0.71104485
1
A list of includes required for this function call.
def includes includes = @spec['includes'].dup includes.concat(@error_action.includes) if error_check? includes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_includes\n []\n end", "def includes() return @includes end", "def allowed_includes\n []\n end", "def includes\n @includes ||= params[:include].to_s.split(',')\n end", "def includes\n []\n end", "def includes\n end", "def includes\n end", "def included_i...
[ "0.8081024", "0.80346656", "0.791811", "0.7884439", "0.7582941", "0.75183076", "0.75183076", "0.7514233", "0.7455574", "0.73687845", "0.7367305", "0.73432255", "0.73165125", "0.719227", "0.7162343", "0.7124008", "0.70960987", "0.7028111", "0.6995484", "0.699491", "0.69945925"...
0.73677224
10
A TypeSpec describing the type of the return value. Changed in release 0.4.2 to return a TypeSpec instead of a String.
def return_val_type TypeSpec.new(@spec['return']['type']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_type\n as_java_type(@ast.return_type)\n end", "def spec_type(desc, *additional); end", "def expected_type\n 'string'\n end", "def spec_type desc, *additional\n TYPES.find { |matcher, _klass|\n if matcher.respond_to? :call then\n matcher.call desc, *addition...
[ "0.6271245", "0.61185175", "0.5996158", "0.58966744", "0.5846511", "0.5816263", "0.5807003", "0.5798122", "0.57817715", "0.57322943", "0.5635026", "0.56271523", "0.55972743", "0.55916053", "0.55712104", "0.5548467", "0.5525777", "0.54927045", "0.54885375", "0.54859537", "0.54...
0.81955373
0
True if calling this wrapped function needs to save/use the return value for error checking. This is equivalent to checking all error rules for the use of RETURN_VALUE_KEYWORD. This method was added in release 0.4.2.
def use_return? @error_rules.any?(&:use_return?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keep_retval?\n @keep_retval\n end", "def has_return_value?\n @return_value.type != VoidType\n end", "def supports_returning?\n false\n end", "def returns_something?; @return_type || !@returned_arguments.empty? end", "def return_check\n @@retu...
[ "0.71043986", "0.66771823", "0.65141886", "0.6433797", "0.6295656", "0.5985675", "0.5794631", "0.5765681", "0.5738969", "0.5715086", "0.5699672", "0.5696634", "0.56964314", "0.56748056", "0.56563294", "0.5634929", "0.5634213", "0.5633445", "0.5629417", "0.56275827", "0.562493...
0.69108576
1
Utilities executes +block+ once. Inside +block+ one may use +break+, +next+ and +redo+.
def once(&block) while true yield break end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_blocker\n blocker do\n # next\n # break\n # return\n \"HA!\"\n # next\n # break\n # return\n end\n puts \"DONE!\"\nend", "def callBlock\n yield # Invokes block\n yield # Invokes block again\nend", "def run_block\n if @block\n _block = @block\n @block = nil\n...
[ "0.69492686", "0.6783201", "0.6722293", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", "0.6556273", ...
0.6661393
3
method takes the location of the card as index and returns the rank of that card
def rank_of_cards_at(index) return cards[index].rank end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rank_of_card_at(index)\n cards[index].rank\n end", "def get_rank(player, index)\n player.deck.rank_of_card_at(index)\n end", "def rank_of_card_at(index_number)\n #this if statment assumes that if a deck runs out of cars,\n #then the rank of a non-existant card will be 0.\n #there are other...
[ "0.884389", "0.8548879", "0.8367248", "0.78868616", "0.78296036", "0.75964", "0.7415967", "0.7248068", "0.7248068", "0.72296023", "0.7200215", "0.7164571", "0.70517623", "0.6994914", "0.69148576", "0.6909316", "0.68993384", "0.68619055", "0.68509597", "0.6834928", "0.6818249"...
0.8682236
1
method that returns an array of cards in the deck that have a rank of 11 or above
def high_ranking_cards array_high_cards = [] cards.each do |card| if card.rank >= 11 array_high_cards << card end end array_high_cards end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def high_ranking_cards\n\n cards.select do |card|\n card.rank >= 11\n end\n\n end", "def high_ranking_cards\n\n cards.find_all do |card|\n card.rank >= 11\n end\n end", "def high_ranking_cards\n high_cards = []\n @cards.each do|card|\n if card.rank >= 11\n hig...
[ "0.8250881", "0.81045336", "0.7728543", "0.77278906", "0.7680578", "0.7147253", "0.6939794", "0.6838715", "0.6696209", "0.66387737", "0.6634485", "0.64832735", "0.64506555", "0.64208394", "0.6374412", "0.63446575", "0.6340148", "0.6287293", "0.62323934", "0.61858", "0.6177990...
0.8188311
1
method that returns the percentage of cards that are high ranking
def percent_high_ranking count_high = 0 cards.each do |card| if card.rank >= 11 count_high += 1 end end count_high_f = count_high.to_f count_total = cards.length count_total_f = count_total.to_f (100 * (count_high_f/count_total_f)).round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_high_ranking\n percent = high_ranking_cards.length / cards.length.to_f\n end", "def percent_high_ranking\n ((high_ranking_cards.count.to_f / @cards.count.to_f) * 100).round(2)\n end", "def percent_high_ranking\n (high_ranking_cards.count.fdiv(@cards.count) * 100).round(2)\n end", "def...
[ "0.91720563", "0.9121698", "0.91184473", "0.8980694", "0.8806858", "0.74805653", "0.71984434", "0.71831447", "0.7152803", "0.7034786", "0.69695306", "0.69002855", "0.69002855", "0.6896839", "0.6883806", "0.6872848", "0.68479615", "0.684721", "0.6840927", "0.6837351", "0.68361...
0.92016345
0
method that removes the top card from the deck
def remove_card @cards.shift end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_card_top\n @cardList.pop\n end", "def remove_card\n @cards.shift\n end", "def remove_card\n @cards.delete_at(0)\n end", "def remove_card\n self.cards.delete_at(0)\n end", "def test_discard_top_card\n top_card = @manager.draw_pile.cards[0]\n assert_not_equal(top_card, @ma...
[ "0.83992624", "0.7904575", "0.7892877", "0.7848877", "0.76699847", "0.76046175", "0.7569525", "0.7489352", "0.73779875", "0.73430866", "0.73252714", "0.7307331", "0.72515976", "0.7188678", "0.7121172", "0.7077429", "0.69806933", "0.69581836", "0.6956428", "0.6951054", "0.6938...
0.78837436
3
method that adds one card to the bottom (end) of the deck
def add_card(card) @cards << card end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_bottom (card)\n @cards.unshift(card);\n end", "def add_card_to_bottom(card)\n unless self.id.nil? or (card.deck_id == self.id and card.card_order == 1)\n # Decrese the orders for the cards above in the old deck\n if card.deck_id\n card.deck.cards.where(\"card_order > ?\", card...
[ "0.8549377", "0.82762897", "0.7870316", "0.73916227", "0.7202082", "0.7191213", "0.71750593", "0.71626335", "0.70505977", "0.70304286", "0.7019423", "0.70159894", "0.70115626", "0.699303", "0.6983935", "0.6910869", "0.68974435", "0.68651557", "0.6864277", "0.68529093", "0.685...
0.67092746
31
create seo attributes with options + default attributes
def cama_build_seo(options = {}) options[:image] = current_site.get_option("screenshot", current_site.the_logo) unless options[:image].present? options[:title] = current_site.the_title unless options[:title].present? options[:description] = current_site.the_option("seo_description") unless options[:description].present? options[:url] = request.original_url options[:keywords] = current_site.the_option("keywords") unless options[:keywords].present? s = { keywords: options[:keywords], author: current_site.get_option('seo_author'), icon: current_site.the_icon, og: { title: options[:title], description: options[:description], type: 'website', url: options[:url], image: options[:image] }, twitter: { card: 'summary', title: options[:title], description: options[:description], url: options[:url], image: options[:image], site: current_site.get_option('twitter_card'), creator: current_site.get_option('twitter_card'), domain: request.host }, alternate: [ { type: 'application/rss+xml', href: cama_rss_url } ] }.merge(options.except(:object)) l = current_site.get_languages if l.size > 1 l.each do |lang| s[:alternate] << { href: current_site.the_url(locale: lang), hreflang: lang } end end # call all hooks for seo r = { seo_data: s, object: options[:object] } hooks_run('seo', r) r[:seo_data] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attributes_options(options)\n html_options = options.stringify_keys!\n self.default_options = {'data-role' => \"listview\", 'data-inset' => \"true\"}\n\n if html_options.has_key?('data-inset')\n self.default_options = default_options.merge({'data-inset' => html_options['data-...
[ "0.64910275", "0.6320029", "0.6137898", "0.6031069", "0.5932591", "0.58328396", "0.58277667", "0.5821638", "0.581378", "0.58037084", "0.57967025", "0.5790875", "0.5789192", "0.5751775", "0.5727037", "0.5687015", "0.5685451", "0.5669663", "0.56654084", "0.5626645", "0.5611722"...
0.540985
39
Remove any color codes from _text_.
def strip_color(text) text.to_s.gsub(/(\001)?\e\[.*?(\d)+m(\002)?/, '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_color_codes(text); end", "def strip_color_codes(text)\n text.gsub(/\\e\\[(\\d+)(;\\d+)*m/, '')\n end", "def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/ , '')\n end", "def remove_colors\n gsub(/\\e\\[\\d+m/, '')\n end", "def strip_color\n return sel...
[ "0.879744", "0.8459457", "0.83087665", "0.7689787", "0.7493423", "0.733087", "0.7223662", "0.71777344", "0.7055508", "0.7013991", "0.69740856", "0.6934507", "0.6890726", "0.6877144", "0.6877144", "0.68487966", "0.6791423", "0.6777379", "0.6740813", "0.6739731", "0.66795635", ...
0.8455379
2
Returns _text_ as bold text for use on a terminal.
def bold(text) "\e[1m#{text}\e[0m" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bold_print(text)\n text.split(//).each do |ch|\n print ch, BS, ch\n end\n end", "def bold\n surround_with_ansi(ANSI_BOLD)\n end", "def bold(str)\n console_bold=\"\\e[1m\"\n console_reset=\"\\e[0m\"\n \"#{console_bold}#{str}#{console_reset}\"\nend", "def bold(string_to_bold)\n ...
[ "0.7857709", "0.7768464", "0.7630191", "0.7427221", "0.7356232", "0.7208961", "0.7185732", "0.7185732", "0.71615183", "0.70104885", "0.6975165", "0.69276106", "0.6916251", "0.68806916", "0.68738055", "0.6823167", "0.6579228", "0.649576", "0.6494936", "0.64502823", "0.64007753...
0.85225856
0
Returns `text` in the default foreground colour. Use this instead of "black" or "white" when you mean absence of colour.
def default(text) text.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def textColor\n return @text_color\n end", "def output_color(text, color=text.to_i)\r\n # Color matches: 1 - Black; 2 - White; 3 - Red; 4 - Yellow; 5 - Green; 6 - Blue; 7 - Gold\r\n colors = { 1 => 30, 2 => 36, 3 => 31, 4 => 33, 5 => 35, 6 => 34, 7 => 220 }\r\n # \\e[47m Is for the grey foreground \...
[ "0.7381206", "0.7094532", "0.7089703", "0.67523843", "0.66624063", "0.66569746", "0.66373694", "0.66124743", "0.6592725", "0.6588967", "0.6587635", "0.6557048", "0.65375173", "0.651355", "0.65103924", "0.6497696", "0.64966834", "0.6478376", "0.6450603", "0.6427067", "0.641552...
0.6041813
69
GET /part_time_employees GET /part_time_employees.json
def index if isAdmin @part_time_employees = PartTimeEmployee.all elsif isGeneral @part_time_employees = PartTimeEmployee.where('dateofTermination >= ? OR dateofTermination is null', DateTime.now) else redirect_to :controller => 'sessions', :action => 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @clock = @employee.clock_in_out\n render json: @clock\n end", "def index\n @employees = @client.employees\n @events = fetch_events\n end", "def set_part_time_employee\n @part_time_employee = PartTimeEmployee.find(params[:id])\n end", "def hours\n render json: Pings::Selec...
[ "0.6266729", "0.61180156", "0.61168337", "0.60730165", "0.60275364", "0.60162544", "0.60093045", "0.5994406", "0.59692645", "0.5864218", "0.58239114", "0.5779323", "0.57791513", "0.57663125", "0.5761973", "0.57558423", "0.5752165", "0.5749141", "0.57457954", "0.57160527", "0....
0.5528122
37
GET /part_time_employees/1 GET /part_time_employees/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @clock = @employee.clock_in_out\n render json: @clock\n end", "def employee(employee_id)\n get(\"employees/#{employee_id}\")\n end", "def set_part_time_employee\n @part_time_employee = PartTimeEmployee.find(params[:id])\n end", "def index\n @employees = current_owner...
[ "0.6313151", "0.62829584", "0.6179917", "0.61059195", "0.60353774", "0.602566", "0.6008278", "0.5951128", "0.5935665", "0.5908674", "0.5893894", "0.58767277", "0.58426976", "0.583289", "0.58322173", "0.58062303", "0.5798063", "0.5776785", "0.57633984", "0.5755999", "0.5746475...
0.0
-1
POST /part_time_employees POST /part_time_employees.json
def create @employee = Employee.new(employee_params) @employee.editor_id = current_user.id @part_time_employee = PartTimeEmployee.new(part_time_employee_params) if isAdmin @part_time_employee.verified = 1 end respond_to do |format| @part_time_employee.valid? if @employee.valid? && @part_time_employee.valid? if @employee.save @part_time_employee.employee = Employee.find(@employee.id) format.json { render :show, status: :created, location: @employee } if @part_time_employee.save @logs = Log.new @logs.employeeInfo = @employee.to_json @logs.additionalInfo = @part_time_employee.to_json @logs.CRUD = "Create" @logs.table = "Full Time Employee" @logs.who = current_user.name @logs.save format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully created.' } format.json { render :show, status: :created, location: @part_time_employee } end end else format.html { render :new } format.json { render json: @employee.errors, status: :unprocessable_entity } #format.html { render :new } format.json { render json: @part_time_employee.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def part_time_employee_params\n params.require(:part_time_employee).permit(:dateOfHire, :dateOfTermination, :hourlyRate)\n end", "def set_part_time_employee\n @part_time_employee = PartTimeEmployee.find(params[:id])\n end", "def timesheet_params\n params.require(:timesheet).permit(:employe...
[ "0.6718057", "0.62755406", "0.6054807", "0.5887762", "0.58600324", "0.5845948", "0.58075005", "0.5761829", "0.5745959", "0.57172805", "0.5703387", "0.569539", "0.5673725", "0.56725144", "0.565754", "0.5611794", "0.5601707", "0.55941486", "0.5583448", "0.5548034", "0.5534706",...
0.64913464
1
PATCH/PUT /part_time_employees/1 PATCH/PUT /part_time_employees/1.json
def update if isAdmin @part_time_employee = PartTimeEmployee.find(params[:id]) @employee = @part_time_employee.employee @part_time_employee.assign_attributes(part_time_employee_params) @employee.assign_attributes(employee_params) respond_to do |format| @part_time_employee.valid? if @employee.valid? && @part_time_employee.valid? @employee.editor_id = current_user.id if @part_time_employee.part_time_employees_id != nil @realFulltime = PartTimeEmployee.find(@part_time_employee.part_time_employees_id) @realEmployee = Employee.find(@realFulltime.employee_id) @realFulltime.dateOfHire = @part_time_employee.dateOfHire @realFulltime.dateofTermination = @part_time_employee.dateofTermination @realFulltime.hourlyRate = @part_time_employee.hourlyRate @realFulltime.verified = 1 @realEmployee.lastName = @employee.lastName @realEmployee.firstName = @employee.firstName @realEmployee.sin = @employee.sin @realEmployee.dateOfBirth = @employee.dateOfBirth @realEmployee.reasonForLeaving = @employee.reasonForLeaving @realEmployee.company_id = @employee.company_id @realEmployee.editor_id = current_user.id @realEmployee.save @realFulltime.save @part_time_employee.destroy @employee.destroy else @logs = Log.new @logs.employeeInfo = @employee.to_json @logs.additionalInfo = @part_time_employee.to_json @logs.CRUD = "Update" @logs.table = "Full Time Employee" @logs.who = current_user.name @logs.save @employee.save @part_time_employee.save end format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully updated.' } format.json { render :show, status: :ok, location: @part_time_employee } else format.html { render :new } format.json { render json: @employee.errors, status: :unprocessable_entity } #format.html { render :new } format.json { render json: @part_time_employee.errors, status: :unprocessable_entity } end end else @employee = Employee.new(employee_params) @employee.editor_id = current_user.id @part_time_employee = PartTimeEmployee.new(part_time_employee_params) @oldFullTime = PartTimeEmployee.find(params[:id]) @oldFullTimeId = @oldFullTime.part_time_employees_id if @oldFullTimeId == nil @oldFullTimeId = @oldFullTime.id end @part_time_employee.part_time_employees_id = @oldFullTimeId @part_time_employee.hourlyRate = PartTimeEmployee.find(params[:id]).hourlyRate respond_to do |format| @part_time_employee.valid? if @employee.valid? && @part_time_employee.valid? if @employee.save @part_time_employee.employee = Employee.find(@employee.id) format.json { render :show, status: :created, location: @employee } @logs = Log.new @logs.employeeInfo = @employee.to_json @logs.additionalInfo = @part_time_employee.to_json @logs.CRUD = "Update" @logs.table = "Full Time Employee" @logs.who = current_user.name @logs.save if @part_time_employee.save format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully created.' } format.json { render :show, status: :created, location: @part_time_employee } end end else format.html { render :new } format.json { render json: @employee.errors, status: :unprocessable_entity } #format.html { render :new } format.json { render json: @part_time_employee.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @employee = Employee.find_by_id(params[:id])\n @employee.update_attributes({:id => params[:id],\n :name => params[:name],\n :title => params[:title],\n :status => params[:status],\n ...
[ "0.66479033", "0.6305728", "0.6246564", "0.62333786", "0.6165545", "0.6157546", "0.61514604", "0.61179614", "0.6109723", "0.6103555", "0.60938615", "0.60938615", "0.60938615", "0.60937333", "0.60825497", "0.60566914", "0.60566914", "0.60402614", "0.60348994", "0.6001229", "0....
0.6653238
0