query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Increments the `member` in `key` by `score`
def zincr(key, member, score = 1) mon_synchronize do perform ["zincr", key, member, score], :proc => T_INT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zincr(key, member, score = 1)\n mon_synchronize do\n perform [\"zincr\", key, member, score], proc: T_INT\n end\n end", "def add(member, score)\n conn.zadd key, score, member\n self\n end", "def []=(key, score)\n update_condition = ->(redis) do\n current_score = redis.zscore(@red...
[ "0.77639544", "0.74010384", "0.72462547", "0.7201458", "0.7091968", "0.69084466", "0.68013626", "0.67986935", "0.67986935", "0.67018306", "0.66687614", "0.6572654", "0.65612507", "0.65565073", "0.6539253", "0.6500143", "0.6478672", "0.642778", "0.64001894", "0.6373067", "0.63...
0.7730227
1
Decrements the `member` in `key` by `score`
def zdecr(key, member, score = 1) mon_synchronize do perform ["zdecr", key, member, score], :proc => T_INT end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zdecr(key, member, score = 1)\n mon_synchronize do\n perform [\"zdecr\", key, member, score], proc: T_INT\n end\n end", "def delete_score\n transaction do\n self.player.points = self.player.points - 1\n if self.player.save\n self.player.team.score = self.player.team.score - 1\...
[ "0.7171971", "0.66796994", "0.6355409", "0.63182896", "0.6274033", "0.6274033", "0.6250731", "0.62432873", "0.6227282", "0.6217739", "0.61954737", "0.61954737", "0.61909205", "0.61909205", "0.6168629", "0.6164304", "0.61160076", "0.61141527", "0.6063342", "0.6016244", "0.6000...
0.71095705
1
Checks existence of a zset at `key`.
def zexists(key) mon_synchronize do perform ["zexists", key], :proc => T_BOOL end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zexists(key)\n mon_synchronize do\n perform [\"zexists\", key], proc: T_BOOL\n end\n end", "def exist?(key)\n !@store.select { |i| i[:key] == build_key(key) }.empty?\n end", "def exist(key)\n check_return_code(\n Lib.memcached_exist(@struct, key),\n key\n )\n end", "def e...
[ "0.74694544", "0.69498026", "0.6856277", "0.66631037", "0.6655751", "0.6655751", "0.66374934", "0.66104716", "0.66102195", "0.6593313", "0.6588371", "0.6543319", "0.6539127", "0.6521038", "0.6516892", "0.64862496", "0.64846325", "0.6468201", "0.6453052", "0.6452728", "0.64527...
0.7396976
1
Delete an `member` from a zset `key`.
def zdel(key, member) mon_synchronize do perform ["zdel", key, member], :proc => T_BOOL end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zdel(key, member)\n mon_synchronize do\n perform [\"zdel\", key, member], proc: T_BOOL\n end\n end", "def zrem(key, member); end", "def zrem(key, member); end", "def zrem(key, member)\n node_for(key).zrem(key, member)\n end", "def zrem(key, member)\n call(key, [:zrem, key, me...
[ "0.83847237", "0.814844", "0.814844", "0.81324166", "0.807038", "0.7387503", "0.6894136", "0.6894136", "0.6715972", "0.665433", "0.66479725", "0.66479725", "0.66479725", "0.66479725", "0.66479725", "0.6624721", "0.65294397", "0.65294397", "0.6438684", "0.6384351", "0.632338",...
0.82843137
1
record a file download event
def record_file_download_event( id, user = nil ) puts "==> file download event: file id #{id}" event = find_todays_existing_download_event( id, user ) if event.nil? == false event.downloads += 1 else event = create_new_download_event( id, user ) end save_safely( event ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(event)\n info \"Finished downloading updates\"\n end", "def download\n record_activity(\"downloaded \" + params[:file_name])\n send_file Rails.root.join('public', 'uploads', params[:file_name])\n end", "def handleDownloadFileRequest(req)\n begin\n length = File.size(req.path...
[ "0.7068658", "0.70125014", "0.63595754", "0.63029325", "0.6174101", "0.6172651", "0.6141766", "0.6137337", "0.6131357", "0.611393", "0.6088467", "0.6082635", "0.60814774", "0.6080848", "0.6064295", "0.6060903", "0.60247785", "0.60225695", "0.6020604", "0.5992105", "0.59849256...
0.7996708
0
get an aggregate count of work views
def get_work_view_count( work ) return WorkViewStat.where( 'work_id = ?', work.id ).sum( :work_views ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_views_count\n self.visits.count.to_i\n end", "def visible_work_count\n Work.owned_by(self).visible(skip_ownership = true).count(:distinct => true, :select => 'works.id') \n end", "def count(view = :all, *args, &block)\n if view == :all\n return super({}, *args) ...
[ "0.6948625", "0.6819293", "0.6630215", "0.658277", "0.6579473", "0.6553843", "0.6486918", "0.6482332", "0.6368392", "0.63379544", "0.6327346", "0.6314404", "0.62535584", "0.62523395", "0.6233465", "0.6225921", "0.61944914", "0.6192755", "0.6192755", "0.618442", "0.61436504", ...
0.8454733
0
get an aggregate count of work downloads
def get_work_download_count( work ) return 0 if work.filesets.blank? sum = 0 work.filesets.each { |fs| sum += get_file_download_count( fs.id ) } return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_download_count\n sum(:api_download_count) + sum(:web_download_count)\n end", "def download_count\n web_download_count + api_download_count\n end", "def downloads_count; AddonDownload.sum(:download_count, :addon_id => self.addon_id, :addon_version_id => self.id).to_i rescue 0; end", "def...
[ "0.74356323", "0.72748256", "0.7244997", "0.71940744", "0.71314454", "0.6645008", "0.66007835", "0.6589589", "0.6516627", "0.64892775", "0.6459012", "0.6441779", "0.6420355", "0.6419459", "0.641944", "0.64016813", "0.6388988", "0.63854903", "0.63791233", "0.6341634", "0.63225...
0.8286587
0
get an aggregate size of the work files
def get_work_aggregate_size( work ) return 0 if work.filesets.blank? sum = 0 work.filesets.each { |fs| sum += fs.file_size } return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_upload_mass\n number_to_human_size(self.works.all.sum(:file_size))\n end", "def size_in_bytes\n files.inject(0) do |sum, f|\n path = File.join self.path, f\n sum + File.size(path)\n end\n end", "def total_bytes\n self.files.map {|file| file[:size].to_i}.reduce(:+) # ...
[ "0.76772", "0.7457767", "0.72747403", "0.7252813", "0.72179574", "0.7120239", "0.7052728", "0.70295733", "0.6972544", "0.6950702", "0.6950702", "0.692486", "0.6887583", "0.68838197", "0.6874803", "0.6866598", "0.6850891", "0.6830996", "0.6820592", "0.68160427", "0.67980146", ...
0.8909225
0
get an aggregate count of file downloads
def get_file_download_count( fileset_id ) return FileDownloadStat.where( 'file_id = ?', fileset_id ).sum( :downloads ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_download_count\n sum(:api_download_count) + sum(:web_download_count)\n end", "def download_count\n web_download_count + api_download_count\n end", "def get_work_download_count( work )\n return 0 if work.filesets.blank?\n sum = 0\n work.filesets.each { |fs|\n sum += get_file_...
[ "0.77822095", "0.77077955", "0.73467565", "0.7200584", "0.71080047", "0.7080399", "0.7057292", "0.69814837", "0.6971545", "0.68675935", "0.67329663", "0.67015177", "0.66967535", "0.66870034", "0.6685328", "0.6655517", "0.6549815", "0.6529465", "0.6478196", "0.64778167", "0.63...
0.77161497
1
get a list of download events that are identified by user
def get_all_identified_download_events FileDownloadStat.where( 'user_id is not NULL' ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def events(user)\n get(:standard, {:method => \"user.getEvents\", :user => user})\n end", "def user_events\n @user_events ||= users.map { |u| u.events }.flatten\n end", "...
[ "0.7129182", "0.6950252", "0.6779924", "0.6691374", "0.66705525", "0.66536707", "0.663865", "0.6558381", "0.65138316", "0.6416778", "0.6413463", "0.6338472", "0.6275424", "0.62752295", "0.6199955", "0.6180463", "0.6153745", "0.6120297", "0.6106054", "0.60949737", "0.6090307",...
0.8038649
0
anonymize the supplied view event
def anonymize_work_view_event( view_event ) # find an anomomyzed version event = find_existing_view_event( view_event.date, view_event.work_id, nil ) if event.nil? == false event.work_views += view_event.work_views else event = create_new_view_event( view_event.work_id, nil ) event...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_event(user, event) \n\tend", "def onReturn(view)\n end", "def _view; end", "def method_missing(method, *args, &block)\n view.send(method, *args, &block)\n end", "def add_view(view)\n\n # Enter\n view.signal_connect('motion-notify-event') do |view, event|\n m...
[ "0.71625125", "0.6134325", "0.60869074", "0.60780245", "0.5967921", "0.58964616", "0.58817226", "0.58296645", "0.5809241", "0.5784003", "0.5784003", "0.5784003", "0.57759327", "0.5769606", "0.5730399", "0.57269883", "0.5724026", "0.57028395", "0.56849414", "0.5674232", "0.567...
0.64028484
1
anonymize the supplied download event
def anonymize_file_download_event( download_event ) # find an anomomyzed version event = find_existing_download_event( download_event.date, download_event.file_id, nil ) if event.nil? == false event.downloads += download_event.downloads else event = create_new_download_event( download_eve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(event)\n info \"Finished downloading updates\"\n end", "def method_missing(name, *args, &block)\n case name\n when :download then deprecated_download(*args, &block)\n else\n super\n end\n end", "def record_file_download_event( id, user = nil )\n ...
[ "0.68280655", "0.65856147", "0.64904183", "0.63822967", "0.6174608", "0.6149485", "0.61319745", "0.5962276", "0.59618974", "0.59448737", "0.58606684", "0.5845564", "0.57718134", "0.57702816", "0.57543254", "0.56988585", "0.56076163", "0.5599339", "0.55725455", "0.5563968", "0...
0.7009443
0
Prepares the app for being staged in one or more environments by loading config(s), middleware, and setting the load path.
def prepare(*env_or_envs) return if prepared? # load config for one or more environments load_config(*env_or_envs) # load each block from middleware stack load_middleware # include pwd in load path $:.unshift(Dir.pwd) unless $:.include? Dir.pwd @prepar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_app\n call_stack(:before, :load)\n\n # load src files\n @loader = Loader.new\n @loader.load_from_path(config.app.src_dir)\n\n # load the routes\n load_routes\n\n call_stack(:after, :load)\n end", "def setup(env: nil)\n @env = (env ||= config.env.default).to_sym...
[ "0.6559662", "0.65007675", "0.6291141", "0.6250594", "0.62491477", "0.62198794", "0.6118497", "0.59263813", "0.59051", "0.59029967", "0.58917916", "0.58894557", "0.58766335", "0.5861988", "0.58563775", "0.58345497", "0.58173394", "0.5806987", "0.579876", "0.5796181", "0.57261...
0.7817022
0
Defines a route set.
def routes(set_name = :main, &block) if set_name && block @@routes[set_name] = block else @@routes end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route_sets; end", "def routes(set_name = :main, &block)\n return @routes ||= {} unless block_given?\n routes[set_name] = block\n self\n end", "def routes(set_name = :main, &block)\n self.class.routes(set_name, &block)\n load_routes\n end", "def data_set_routes\n ...
[ "0.7528972", "0.7443987", "0.7332855", "0.7247125", "0.72449374", "0.66445696", "0.6467639", "0.6394465", "0.6382144", "0.6319095", "0.626583", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494", "0.623494"...
0.76046884
0
Accepts block to be added to middleware stack.
def middleware(&block) @@middleware << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rack_app_route_block(block)\n block\n end", "def rack_app_route_block(block)\n block\n end", "def middleware(&block); end", "def add(&block)\n @block_args << block\n end", "def middleware(&block)\n return @middleware ||= [] unless block_given?\n ...
[ "0.68905556", "0.68905556", "0.67735636", "0.67063475", "0.6648033", "0.6500446", "0.6472763", "0.6472763", "0.6472763", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936", "0.6406936",...
0.70431674
0
Fetches a stack (before | after) by name.
def stack(which, name) @@stacks[which][name] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack(name)\n stacks = (Thread.current[:__moped_threaded_stacks__] ||= {})\n stacks[name] ||= []\n end", "def [](name)\n @stack.each do |layer|\n value = layer[name]\n return value unless value.nil?\n end\n nil\n end", "def fetch(name, default = :__raise)\n ...
[ "0.6649528", "0.59085673", "0.57742584", "0.5726988", "0.5689255", "0.5590191", "0.55600953", "0.5544644", "0.5505837", "0.5425863", "0.53779274", "0.53649753", "0.5347133", "0.5319278", "0.5310055", "0.5294281", "0.5221288", "0.52100426", "0.51855713", "0.51512027", "0.51424...
0.62947977
1
Adds a block to the before stack for `stack_name`.
def before(stack_name, &block) @@stacks[:before][stack_name.to_sym] << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before(name, options={}, &block)\n self.add_block_container_to_list(\"before_#{name.to_s}\", options, &block)\n nil\n end", "def before &block\n @before_blocks ||= []\n @before_blocks << block if block\n end", "def before(name, &block)\n before_steps[name] ||= EMPTY_ARRAY.d...
[ "0.7453471", "0.67468995", "0.66664416", "0.66487736", "0.66173166", "0.65138286", "0.64530176", "0.63607913", "0.63262993", "0.6308333", "0.62687606", "0.619812", "0.61878437", "0.61878437", "0.61377215", "0.6104828", "0.6081546", "0.60406375", "0.6037799", "0.60254437", "0....
0.9117473
0
Adds a block to the after stack for `stack_name`.
def after(stack_name, &block) @@stacks[:after][stack_name.to_sym] << block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after(name, options={}, &block)\n self.add_block_container_to_list(\"after_#{name.to_s}\", options, &block)\n nil\n end", "def after(&block)\n @blocks << block\n end", "def before(stack_name, &block)\n @@stacks[:before][stack_name.to_sym] << block\n end", "def after(name,...
[ "0.72503245", "0.6692351", "0.6390935", "0.63804823", "0.6378832", "0.62972414", "0.6200467", "0.61942023", "0.607257", "0.6029528", "0.5977615", "0.5859684", "0.5855761", "0.5827147", "0.5816143", "0.57655495", "0.57655495", "0.57655495", "0.57655495", "0.5713373", "0.570909...
0.88214636
0
Returns true if the application is staged.
def staged? @staged end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def staging?\n self.environment == ENV_STAGE\n end", "def staging?\n status == \"STAGING\"\n end", "def staging?\n @staging_index != nil\n end", "def for_startup?\n self.stage_id > 1\n end", "def app_starting?\n @launching\n end", "def use_staged_file_only\n @use_...
[ "0.7235159", "0.7121673", "0.6456897", "0.6408972", "0.6306472", "0.6295903", "0.61553335", "0.6077606", "0.60681003", "0.60681003", "0.6024236", "0.6012484", "0.5975478", "0.59264153", "0.5916197", "0.5839874", "0.58217937", "0.5767053", "0.5762693", "0.5749853", "0.57411414...
0.8288656
0
Sends data in the response (immediately). Accepts a string of data or a File, mimetype (autodetected; defaults to octetstream), and optional file name. If a File, mime type will be guessed. Otherwise mime type and file name will default to whatever is set in the response.
def send(file_or_data, type = nil, send_as = nil) if file_or_data.class == File data = file_or_data.read # auto set type based on file type type = Rack::Mime.mime_type("." + String.split_at_last_dot(file_or_data.path)[1]) else data = file_or_data end headers = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(file_or_data, type: nil, name: nil)\n if file_or_data.is_a?(IO) || file_or_data.is_a?(StringIO)\n data = file_or_data\n\n if file_or_data.is_a?(File)\n type ||= Rack::Mime.mime_type(File.extname(file_or_data.path))\n end\n\n @connection.set_response_header(Rack::C...
[ "0.7759746", "0.7507452", "0.73989993", "0.6897502", "0.64952874", "0.6389846", "0.6325512", "0.62787044", "0.6261842", "0.6208261", "0.614706", "0.60828394", "0.6068764", "0.6060857", "0.6048625", "0.60485697", "0.60435843", "0.6030396", "0.6025539", "0.6024027", "0.59408844...
0.7656748
1
Stores set cookies at beginning of request cycle for comparison at the end of the cycle
def set_initial_cookies @initial_cookies = {} request.cookies.each {|k,v| @initial_cookies[k] = v } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookies\n call_once\n @cookies\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def cookies; @cookies ||= CookieJar.new; end", "def collect_cookies_from_response; end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie'...
[ "0.747537", "0.7376184", "0.7074061", "0.6962543", "0.6907773", "0.6784072", "0.6784072", "0.6784072", "0.67754376", "0.67403436", "0.67327803", "0.66543406", "0.66543406", "0.66543406", "0.66543406", "0.66543406", "0.66543406", "0.66543406", "0.6635044", "0.66191334", "0.653...
0.75812143
0
Array of Sovren position history job categories.
def categories data['JobCategory'] || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n Category.position_sorted\n end", "def clil_categories_codes\n self.clil_categories.map{|c| c.code}.uniq\n end", "def clil_categories_codes\n self.clil_categories.map { |c| c.code }.uniq\n end", "def activity_log_student_time_categories_array\n activity_log_student_...
[ "0.60339916", "0.5817439", "0.57953984", "0.5772682", "0.57708603", "0.5763281", "0.5700613", "0.56918633", "0.56786466", "0.5661815", "0.5606624", "0.5605586", "0.5565057", "0.5564378", "0.55531037", "0.5551822", "0.5542173", "0.5536872", "0.54887426", "0.5434261", "0.543426...
0.7244381
0
Uses the dockercompose CLI to fetch the associated container IDs
def container_ids @container_ids ||= DockerCompose.new(project).container_ids end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containers_ids\n containers(:response_format => :id_array)\n end", "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "def start_all_containers\n system('docker compose -f docker-compose.yml ...
[ "0.6735033", "0.66175115", "0.6551078", "0.63883233", "0.6343595", "0.6313978", "0.6284457", "0.6213802", "0.6208493", "0.6194415", "0.60851234", "0.6028195", "0.6002083", "0.5957767", "0.59456444", "0.59258276", "0.58273274", "0.58273274", "0.5811719", "0.57776004", "0.57766...
0.79320097
0
gets information about the containers from the Docker API
def containers @containers ||= Docker::Container.all( all: true, # include stopped containers filters: { id: container_ids }.to_json ).map(&:json) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info\n container.info\n end", "def containers\n TestLab::Container.all\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def get_containers\n content = YAML::load(Fil...
[ "0.7212993", "0.6938", "0.6898589", "0.67649084", "0.67344123", "0.6707264", "0.6643655", "0.6469227", "0.6409113", "0.63955414", "0.63950866", "0.6351381", "0.6338871", "0.6327768", "0.6321929", "0.63143736", "0.63027257", "0.62481797", "0.622766", "0.6213659", "0.6140169", ...
0.7293216
0
Returns that the remote host is always vulnerable
def check return Exploit::CheckCode::Vulnerable end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_host(ip)\n print_status(\"Checking #{peer} for DLSw exposure\")\n response = get_response\n\n if !response.blank? && (response =~ /IOS Software|cisco.com/)\n print_good(\"#{peer}: The target Cisco router appears vulnerable: parts of a Cisco IOS banner detected\")\n report_vuln(\n ...
[ "0.68722624", "0.6610267", "0.6548351", "0.6417939", "0.6393129", "0.63112485", "0.6308762", "0.6188193", "0.60714716", "0.60561657", "0.60193527", "0.6011968", "0.5997984", "0.5971886", "0.59324974", "0.59300596", "0.59199405", "0.591743", "0.5915322", "0.59101534", "0.59043...
0.6688242
1
The frame's default execution context.
def execution_context raise "Execution Context is not available in detached frame \"#{frame.url}\" (are you trying to evaluate?)" if @_detached @_context_promise.value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execution_context\n initialize_context!(Object.new)\n end", "def execution_context\n @context\n end", "def run_context\n nil\n end", "def default_view_context\n ActionController::Base.new.view_context\n end", "def default_view_context\n ActionController::Base.new....
[ "0.6777796", "0.6683005", "0.6544475", "0.6507209", "0.6507209", "0.6379279", "0.6375337", "0.635769", "0.634832", "0.63318783", "0.630878", "0.63039845", "0.63039845", "0.6291997", "0.62233007", "0.6200452", "0.61555564", "0.6146917", "0.6146917", "0.61099464", "0.6097495", ...
0.67062175
1
The method evaluates the XPath expression.
def xpath(expression) document.xpath expression end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xpath; end", "def xpath; end", "def xpath(*args); end", "def xpath(*args); end", "def at_xpath(*args); end", "def at_xpath(*args); end", "def xpath(xpath)\n @doc.xpath(xpath)\n end", "def evaluate(context)\n Parser.new(@expr).parse.evaluate(context)\n end", "def xpath(path)\...
[ "0.7276239", "0.7276239", "0.71157575", "0.71157575", "0.6934695", "0.6934695", "0.66685826", "0.6616184", "0.6581248", "0.64662045", "0.6379013", "0.635437", "0.6266348", "0.6164858", "0.61581963", "0.61435694", "0.60825723", "0.60510975", "0.6043136", "0.6040138", "0.598646...
0.7369241
0
The method runs document.querySelectorAll within the frame. If no elements match the selector, the return value resolves to [].
def query_selector_all(selector) document.query_selector_all selector end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end", "def findAll(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end", "def query_selector_all(node_id:, selector:)\n {\n ...
[ "0.74725795", "0.7255658", "0.6986995", "0.64311063", "0.6394186", "0.6207973", "0.618712", "0.6004348", "0.58796173", "0.58427256", "0.58425415", "0.5754153", "0.56960666", "0.5677586", "0.56144214", "0.5559332", "0.55009055", "0.54397327", "0.54327863", "0.5429639", "0.5377...
0.7261152
1
This method fetches an element with selector and focuses it. If there's no element matching selector, the method throws an error.
def focus(selector) handle = query_selector selector "No node found for selector: #{selector}" if handle.nil? handle.focus handle.dispose nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select!\n raise \"Locator at #{locator} is not visible\" unless visible?\n begin\n wd_element.click\n rescue\n raise \"Locator at #{locator} can not be interacted with\" unless visible?\n end\n check_errors\n end", "def select!\n raise \"Locator at...
[ "0.67057604", "0.66400516", "0.6597134", "0.6597134", "0.65383637", "0.63706785", "0.6271941", "0.6228774", "0.6045374", "0.5711961", "0.568006", "0.5662004", "0.5633813", "0.56214005", "0.55724597", "0.55421734", "0.5492148", "0.54739857", "0.54595417", "0.5449888", "0.54310...
0.7462675
0
This method fetches an element with selector, scrolls it into view if needed, and then uses page.touchscreen to tap in the center of the element. If there's no element matching selector, the method throws an error.
def touchscreen_tap(selector) handle = query_selector selector raise "No node found for selector: #{selector}" if handle.nil? handle.tap handle.dispose nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll_and_touch(element, options = {})\n scroll_until_i_see(element, options)\n touch(element)\n end", "def scroll_into_view(selector)\n el = find(selector)\n # only do this if the native element is a selenium element\n el.native.send_keys(:null) if el.native.class.to_s.split(\"::\").first =...
[ "0.6666636", "0.6659074", "0.66046506", "0.6150177", "0.6091912", "0.60176575", "0.60004973", "0.59490055", "0.5900012", "0.5890448", "0.5874212", "0.58716375", "0.5826666", "0.5822378", "0.58208746", "0.5818627", "0.58149624", "0.5800615", "0.57582855", "0.5751799", "0.57219...
0.67288876
0
GET /paquetes GET /paquetes.xml
def index @paquetes = Paquete.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @paquetes } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @paquete = Paquete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paquete }\n end\n end", "def url\n\t\tagencia_paquete_path(self)\n\tend", "def show\n @cavalete = Cavalete.find(params[:id])\n\n respond_to do |form...
[ "0.6419261", "0.5860568", "0.5766065", "0.57640654", "0.57264876", "0.56885284", "0.5685778", "0.56707025", "0.56707025", "0.56422955", "0.56301796", "0.56099606", "0.5608689", "0.5606184", "0.55851626", "0.5571785", "0.55622613", "0.5543774", "0.5540296", "0.5491513", "0.548...
0.64097744
1
GET /paquetes/1 GET /paquetes/1.xml
def show @paquete = Paquete.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @paquete } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @paquetes = Paquete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @paquetes }\n end\n end", "def show\n @clicker = Clicker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { rend...
[ "0.64007175", "0.602023", "0.5929332", "0.58973825", "0.5891376", "0.5845938", "0.58397174", "0.58397174", "0.5831822", "0.58187705", "0.5811458", "0.5808906", "0.5807807", "0.5805684", "0.5805487", "0.5793554", "0.57815385", "0.57570106", "0.5735918", "0.5730853", "0.5730853...
0.6519604
0
POST /paquetes POST /paquetes.xml
def create @paquete = Paquete.new(params[:paquete]) respond_to do |format| if @paquete.save format.html { redirect_to(@paquete, :notice => 'Paquete was successfully created.') } format.xml { render :xml => @paquete, :status => :created, :location => @paquete } else format.ht...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(params)\n\nxml =<<XML\n<entry xmlns=\"http://purl.org/atom/ns#\">\n <title>#{params[:title]}</title>\n <link rel=\"related\" type=\"text/html\" href=\"#{params[:url]}\" />\n <summary type=\"text/plain\">#{params[:comment]}</summary>\n</entry>\nXML\n\n post('/post', xml)\n end", "def create\...
[ "0.55406106", "0.5496011", "0.5437388", "0.53188324", "0.5303812", "0.52505594", "0.52284896", "0.52202505", "0.52098995", "0.5203851", "0.5152939", "0.51358366", "0.5100844", "0.50867236", "0.507924", "0.5078838", "0.50661075", "0.50578696", "0.5049836", "0.5040613", "0.5032...
0.6237619
0
DELETE /paquetes/1 DELETE /paquetes/1.xml
def destroy @paquete = Paquete.find(params[:id]) @paquete.destroy respond_to do |format| format.html { redirect_to(paquetes_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @acre = Acre.find(params[:id])\n @acre.destroy\n\n respond_to do |format|\n format.html { redirect_to(acres_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aisl...
[ "0.7135331", "0.6605438", "0.65665966", "0.6543116", "0.6515017", "0.6478686", "0.64713323", "0.6468143", "0.6434875", "0.6433774", "0.6405007", "0.64002377", "0.639789", "0.6393516", "0.63865846", "0.63790566", "0.6369941", "0.63674", "0.6364069", "0.63581955", "0.6350041", ...
0.70852363
1
GET /notesheets GET /notesheets.json
def index @notesheets = Notesheet.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @notes = Note.all\n render json: @notes\n end", "def list_notes\n notes = if unsafe_params[:editable]\n Note.editable_by(@context).where.not(title: nil).accessible_by_private\n else\n Note.accessible_by(@context).where.not(title: nil)\n end\n\n if unsafe_params[:scopes].p...
[ "0.6620252", "0.65489125", "0.6499742", "0.64531994", "0.64275813", "0.63737583", "0.63737583", "0.6306056", "0.62811774", "0.6244164", "0.6153337", "0.61511666", "0.6116539", "0.6106703", "0.6102543", "0.6089911", "0.604092", "0.60393965", "0.60176885", "0.59905833", "0.5978...
0.75343657
0
POST /notesheets POST /notesheets.json
def create @notesheet = Notesheet.new(notesheet_params) respond_to do |format| if @notesheet.save if !@notesheet.notepic.url path = "#{@notesheet.title}-#{@notesheet.id}.txt" File.open(path, "w+") do |f| f.write(@notesheet.content) @noteshee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notesheet_params\n params.require(:notesheet).permit(:content, :title, :course_id, :user_id, :date_created, :notepic, :notepic_cache)\n end", "def index\n @notesheets = Notesheet.all\n end", "def set_notesheet\n @notesheet = Notesheet.find(params[:id])\n\n end", "def create\n ticsh...
[ "0.666936", "0.62605244", "0.6200012", "0.58830637", "0.5775622", "0.573048", "0.5709784", "0.5694335", "0.5609547", "0.55936563", "0.5590921", "0.55790657", "0.55607307", "0.5548598", "0.5543869", "0.5532662", "0.55211306", "0.5475616", "0.54702806", "0.5456696", "0.54557216...
0.7247544
0
PATCH/PUT /notesheets/1 PATCH/PUT /notesheets/1.json
def update respond_to do |format| if @notesheet.update(notesheet_params) format.html { redirect_to @notesheet, notice: 'Notesheet was successfully updated.' } format.json { render :show, status: :ok, location: @notesheet } else format.html { render :edit } format.json { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def update\n if @note.update(note_params)\n render json: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end", "def update\n note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_wi...
[ "0.6522053", "0.63813996", "0.63578933", "0.6301746", "0.6291684", "0.6266091", "0.62050736", "0.6165987", "0.61568373", "0.61482704", "0.6143157", "0.61344534", "0.6128389", "0.6096458", "0.60702264", "0.604873", "0.60457677", "0.60232913", "0.6021925", "0.6021424", "0.60199...
0.72586566
0
DELETE /notesheets/1 DELETE /notesheets/1.json
def destroy @notesheet.destroy respond_to do |format| format.html { redirect_to notesheets_url, notice: 'Notesheet was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @weekly_note.destroy\n respond_to do |format|\n format.html { redirect_to weekly_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_...
[ "0.7044337", "0.69997126", "0.69957507", "0.6964713", "0.6964713", "0.6964713", "0.6964713", "0.69637614", "0.6954986", "0.6945465", "0.6939364", "0.6925723", "0.69050974", "0.68887085", "0.68848366", "0.6881083", "0.6876354", "0.6876074", "0.6860639", "0.68410367", "0.682477...
0.7807703
0
Take ARD plist and create new computer objects TODO when a computer object import fails, tell the user what went wrong (by print the computer.errors hash)
def create_import begin @computers = ComputerService.import(params[:computer],current_unit) rescue NoMethodError e = "Please select a plist file" rescue => e end unless @computers.nil? @total = @computers.count # Save each computer. If it doesn't save, leave it out of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_import\n begin\n @computers = ComputerService.import(params[:computer],current_unit)\n rescue NoMethodError\n end\n \n unless @computers.nil?\n @total = @computers.count\n # Save each computer. If it doesn't save, leave it out of the array\n @computers = @computers....
[ "0.6408239", "0.5724597", "0.5448583", "0.52582735", "0.5172279", "0.5143568", "0.5139678", "0.5074955", "0.5073008", "0.50712794", "0.505662", "0.49813265", "0.49479967", "0.49197778", "0.4910568", "0.49104005", "0.49060348", "0.49002755", "0.48919582", "0.48673034", "0.4859...
0.6494538
0
Allows a computer to checkin with the server, notifying it of the last successful munki run. May be extended in the future.
def checkin @computer = Computer.find_for_show(nil, params[:id]) if params[:managed_install_report_plist].present? report_hash = ManagedInstallReport.format_report_plist(params[:managed_install_report_plist]).merge({:ip => request.remote_ip}) @computer.managed_install_reports.build(report_hash) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_in!\n ensure_can_check_in!\n self.update(status: :complete)\n end", "def checkin\n end", "def notify_users_and_add_it\n return # disabled for now\n return true if remote?\n User.find_all_by_notify_on_new_torrents(true).each do |user|\n Notifier.send_new(user,self) if user.notifi...
[ "0.5600158", "0.55769444", "0.54527855", "0.5397629", "0.5348797", "0.52700305", "0.5237163", "0.5236375", "0.5225316", "0.51849437", "0.5169335", "0.51355827", "0.5133926", "0.51307064", "0.51232654", "0.51170665", "0.51157415", "0.510627", "0.5102861", "0.50992143", "0.5064...
0.62869346
0
If buffer slots are free, inserts value and returns true.
def try_insert_new(value) return false if used == @size entry = GClockBufferEntry.new(value, 1) @buffer[@pointer] = entry advance_pointer true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_last(value)\n if @queue.size < @size\n @queue.push(value)\n true\n else\n false\n end\n end", "def add(value)\n found = true\n @values.delete(value) { found = false }\n @values[value] = true\n @values.shift if @values.length > @capacity\n found\n en...
[ "0.67836845", "0.6649894", "0.66428876", "0.6640979", "0.6544269", "0.64828765", "0.6445525", "0.63733226", "0.63253295", "0.6085846", "0.6000582", "0.60005736", "0.59499645", "0.59248406", "0.5897573", "0.588062", "0.58699095", "0.5834886", "0.57715684", "0.5754918", "0.5744...
0.7857396
0
Selects the parts of description where query mathches to the items description
def map_description_part(description, query) start_of_find = description.gsub(/_/, " ").downcase.index(query) substring_start = if start_of_find - 17 < 0 then 0 else start_of_find - 17 end substring_end = if start_of_find + 20 > description.size then description.size else start_of_find + 20 end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_with_description(expected_description)\n filter = ObjectFilter.new { |filter| filter.accept(\"items.description\").when_it is(expected_description) }\n items_data = self.service.object_filter(filter).getItems()\n\n items_data.collect do |item_data|\n first_price = item_data['prices'...
[ "0.63168526", "0.61614364", "0.6091587", "0.6067165", "0.597548", "0.5955041", "0.59208214", "0.58952385", "0.58118385", "0.57744914", "0.57262135", "0.5726114", "0.5712092", "0.5658058", "0.56184465", "0.56152254", "0.55138016", "0.54820466", "0.54717505", "0.54685795", "0.5...
0.62491643
1
MIDI data must be encoded in 7bit bytes (most significat bit is used to mark STATUS bytes) Korg Monologue encodes data in 7byte chunks
def midi_encoder(bytes) raise "Invalid data length #{bytes.size}" unless bytes.size % 7 == 0 result = [] (0...bytes.size).step(7).each do |start| chunk = bytes[start, 7] msbits = 0 chunk.each_with_index do |b, i| msbits |= (b & 0x80) >> (7 - i) end result << msbits result += chunk.ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_program_midi_data(data)\n valid = data[0] == 0xF0 &&\n data[1] == 0x42 &&\n (data[2] & 0xF0 == 0x30) &&\n data[3] == 0x00 &&\n data[4] == 0x01 &&\n data[5] == 0x44 &&\n (data[6] == 0x4C || data[6] == 0x40) &&\n data[-1] == 0xF7\n if data[6] == 0x40\n # current program\n program...
[ "0.60295254", "0.5705238", "0.56088686", "0.55482477", "0.5426472", "0.53987956", "0.5362406", "0.53152245", "0.52974725", "0.52758926", "0.527021", "0.52352166", "0.5210215", "0.5181947", "0.5166361", "0.5153549", "0.51393884", "0.51069003", "0.51068693", "0.51049584", "0.50...
0.6903426
0
Extract program data dump from midi message
def get_program_midi_data(data) valid = data[0] == 0xF0 && data[1] == 0x42 && (data[2] & 0xF0 == 0x30) && data[3] == 0x00 && data[4] == 0x01 && data[5] == 0x44 && (data[6] == 0x4C || data[6] == 0x40) && data[-1] == 0xF7 if data[6] == 0x40 # current program program = nil start...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_program(prog)\n prog_bytes = to_bytes(prog)\n data = {}\n raise \"Invalid program\" unless prog[0, 4] == 'PROG'\n name = prog[4...16]\n data[:name] = program_name(prog)\n\n HR_PARAMS.each do |(key, ms_offset, ls_offset, ls_pos, units)|\n # single byte value\n value = prog_bytes[ms_offset]\n ...
[ "0.59759104", "0.5656735", "0.5452958", "0.54080665", "0.5392941", "0.5352338", "0.534459", "0.52830565", "0.5281976", "0.52596194", "0.5255477", "0.5234659", "0.5183154", "0.51806927", "0.5153215", "0.5141619", "0.5120715", "0.5103102", "0.5092581", "0.5081025", "0.5057778",...
0.75217336
0
Extract program data dump from binary file (like the .prog_bin files that are part of .molglib/.molgpreset packs)
def get_program_file_data(program_file) File.open(program_file,'rb'){|f| f.read} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_program(prog)\n prog_bytes = to_bytes(prog)\n data = {}\n raise \"Invalid program\" unless prog[0, 4] == 'PROG'\n name = prog[4...16]\n data[:name] = program_name(prog)\n\n HR_PARAMS.each do |(key, ms_offset, ls_offset, ls_pos, units)|\n # single byte value\n value = prog_bytes[ms_offset]\n ...
[ "0.6155024", "0.61215544", "0.59901685", "0.5961997", "0.5759024", "0.57084185", "0.56159574", "0.5578849", "0.5517678", "0.54004574", "0.5392215", "0.5186379", "0.5178744", "0.5102294", "0.5095169", "0.50811595", "0.50398755", "0.49912056", "0.49874336", "0.49376357", "0.490...
0.6198225
0
Parse program data dump
def parse_program(prog) prog_bytes = to_bytes(prog) data = {} raise "Invalid program" unless prog[0, 4] == 'PROG' name = prog[4...16] data[:name] = program_name(prog) HR_PARAMS.each do |(key, ms_offset, ls_offset, ls_pos, units)| # single byte value value = prog_bytes[ms_offset] data[key] = val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_program_midi_data(data)\n valid = data[0] == 0xF0 &&\n data[1] == 0x42 &&\n (data[2] & 0xF0 == 0x30) &&\n data[3] == 0x00 &&\n data[4] == 0x01 &&\n data[5] == 0x44 &&\n (data[6] == 0x4C || data[6] == 0x40) &&\n data[-1] == 0xF7\n if data[6] == 0x40\n # current program\n program...
[ "0.61019415", "0.581704", "0.58068043", "0.5750443", "0.56978065", "0.5506315", "0.548784", "0.54501534", "0.5434926", "0.5398954", "0.5338516", "0.5315678", "0.52658504", "0.5259087", "0.5259087", "0.5207675", "0.5193938", "0.51726544", "0.51682174", "0.51467574", "0.5143361...
0.6969858
0
home page default ads management
def index @home_page = DefaultAd.find(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home\n error_404 unless (@page = Page.where(:link_url => '/').first).present?\n @banners = Banner.order('position ASC')\n #@banners = defined?(Banner).blank? ? [] : Banner.all\n end", "def index\n @ad_banners = AdBanner.all\n @pages = Page.all\n end", "def index\n \tset_user\n @ads = ...
[ "0.6816975", "0.6763372", "0.6579762", "0.64423555", "0.63973284", "0.630541", "0.62575495", "0.6228657", "0.61972076", "0.61972076", "0.61972076", "0.61972076", "0.61972076", "0.6191948", "0.618928", "0.61436754", "0.610948", "0.60918", "0.6087822", "0.60848874", "0.60753614...
0.7642998
0
stories page default page ads managment
def stories_page @stories_page = DefaultAd.find(2) @stories_page_left_top = DefaultAd.find(3) @stories_page_left_bottom = DefaultAd.find(4) @stories_page_right = DefaultAd.find(5) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @home_page = DefaultAd.find(1) \nend", "def index\n @ad_banners = AdBanner.all\n @pages = Page.all\n end", "def index\n @story_pages = StoryPage.all\n end", "def pages; end", "def index\n @slider_ads = SliderAd.order(id: :desc).page(params[:page]).per(25)\n end", "def pla...
[ "0.66294193", "0.62805545", "0.6124563", "0.60792094", "0.60645753", "0.6016941", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.6002153", "0.5988614", "0.5985813", "0.5944787",...
0.6842739
0
Valida que uns cadena enviado y una clave encriptada sean iguales cuando la cadena se encripta
def clave_valida?(cadena, clave) # la clave recibida debería ser una instancia de bcrypt, por lo tanto # implementa la comparación con == clave == cadena end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate\n encrypt\n end", "def esClaveValida(clave)\n\tcadena_clave = clave.to_s\n\tmedio_clave = (cadena_clave[1]).to_i + (cadena_clave[2].to_i)\n\treturn medio_clave.even?\nend", "def debe_ser_encarcelado\n if is_encarcelado\n return false\n else\n if !tiene_salvoconducto...
[ "0.6590535", "0.6400664", "0.61028624", "0.5937549", "0.59350425", "0.5879187", "0.5879187", "0.57978594", "0.5719973", "0.5634549", "0.56228495", "0.5614995", "0.5584627", "0.5576075", "0.5543845", "0.5482864", "0.547931", "0.5472266", "0.5456521", "0.54185504", "0.5412478",...
0.69328207
0
Public: Delete a document. POST uuid a single uuid to delete Examples delete("7cf917de22464ac3adab791a49454180") => true Returns true if the delete was successful
def delete(uuid) raw_body = api_call(:post, "document/delete", { :uuid => uuid }) raw_body == "true" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(opts = {})\n response = Crocodoc.connection.post 'document/delete', :uuid => @uuid\n response.body.chomp.downcase == 'true'\n end", "def delete\n @client.delete_document(@path)\n end", "def remove_document_by_uuid(uuid)\n @documents.delete(uuid)\n end", "def de...
[ "0.8003158", "0.7327317", "0.7097672", "0.6696224", "0.6694576", "0.6627026", "0.6558195", "0.6547385", "0.65295273", "0.6516332", "0.6512793", "0.6511275", "0.6491366", "0.6468646", "0.6451002", "0.642768", "0.6426247", "0.642034", "0.64196974", "0.6400854", "0.6368546", "...
0.8553729
0
Public: Get the url for the viewer for a session. session The uuid of the session (see session) Examples view("CFAmd3Qjm_2ehBI7HyndnXKsDrQXJ7jHCuzcRv_V4FAgbSmaBkF") => Returns a url string for viewing the session
def view(session_id) "https://crocodoc.com/view/#{session_id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_viewing_url(session)\n \"https://crocodoc.com/view/#{session.key}\"\n end", "def viewer\n authorize @session\n end", "def get_viewer_link(urn,access_token)\n #absolute url = request.base_url\n url = \"/viewer1.html?token=#{access_token}&urn=#{urn}\"\n link = \"<a href=\\\"#{url}\\\...
[ "0.7522495", "0.6145662", "0.59553003", "0.59191215", "0.5768783", "0.5741065", "0.5604294", "0.55353403", "0.54902905", "0.5478923", "0.54365796", "0.5401586", "0.5388175", "0.536817", "0.53624254", "0.530224", "0.529813", "0.5292428", "0.5257301", "0.5239954", "0.5227571", ...
0.7154142
1
Puts tokens in start places Executes automated actions if any enabled Fills out weights for futher usage
def init return if @initialized # Fill start places with tokens to let the process start put_token(start_place) start_place[:enabled] = true # Terminators are used to identify which transitions can be executed @terminators = {} @net.places.select(&:start?).each do |start_plac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_actions; end", "def start\n @actions << :start\n end", "def start\n assign_globals\n register_space\n start_message\n build_actions\n start_threads\n end", "def start_run; end", "def execute start\n # TODO: erase attributes once they're no longer n...
[ "0.58902663", "0.5705497", "0.56762755", "0.55847746", "0.5543325", "0.5517922", "0.5474361", "0.54603976", "0.54177123", "0.5377966", "0.53721416", "0.5320664", "0.5300634", "0.529117", "0.5249527", "0.5214216", "0.5211444", "0.5198405", "0.5194378", "0.5190566", "0.5190566"...
0.5814666
1
Runs all automated transitions which are enabled at the moment
def execute_automated!(source: nil, params: {}, color: {}) @net.transitions.each do |transition| if transition.automated? && source != transition && transition_enabled?(transition, color: color) perform_action!(transition, params: params, color: color) end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_transition\r\n # Execute transition\r\n if $data_system.battle_transition == \"\"\r\n Graphics.transition(20)\r\n else\r\n Graphics.transition(40, \"Graphics/Transitions/\" +\r\n $data_system.battle_transition)\r\n end\r\n # Start pre-battle phase\r\n start_phase1\r\n e...
[ "0.68035895", "0.6741294", "0.6566988", "0.64490163", "0.6074535", "0.60683733", "0.602775", "0.6026691", "0.59877396", "0.59870976", "0.59158295", "0.5884009", "0.58793586", "0.5784965", "0.5781985", "0.5753808", "0.5749438", "0.5726816", "0.5699352", "0.56908995", "0.569089...
0.6785611
1
GET /options/1 GET /options/1.xml
def show @option = Options.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @option } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @options = @question.options.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @options }\n end\n end", "def show\n\t@option = Option.find(params[:id])\n\n\n\trespond_to do |format|\n\t format.html # show.html.erb\n\t format.xml ...
[ "0.6737998", "0.6669854", "0.6557185", "0.6532269", "0.6477579", "0.6331469", "0.6313355", "0.6308954", "0.62945104", "0.62643063", "0.6211199", "0.62021637", "0.6199756", "0.6199756", "0.61866087", "0.61787176", "0.6044787", "0.603775", "0.6035963", "0.60276", "0.6021486", ...
0.68262917
0
GET /options/new GET /options/new.xml
def new @option = Option.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @option } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @opt = Opt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @opt }\n end\n end", "def new\n @option = OptionModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @option }\n end\n...
[ "0.7455853", "0.73404807", "0.7013586", "0.6895405", "0.6882285", "0.6882285", "0.68157756", "0.68148303", "0.67561", "0.674072", "0.67350537", "0.6730547", "0.6524446", "0.6522662", "0.6495112", "0.6409164", "0.6382452", "0.6370532", "0.6348015", "0.63223034", "0.63173157", ...
0.7571324
1
DELETE /options/1 DELETE /options/1.xml
def destroy @option = Option.find(params[:id]) @option.destroy respond_to do |format| format.html { redirect_to(options_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @opt = Opt.find(params[:id])\n @opt.destroy\n\n respond_to do |format|\n format.html { redirect_to(opts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @auto_option = AutoOption.find...
[ "0.6976978", "0.6933382", "0.682899", "0.66711384", "0.658292", "0.6561163", "0.6500211", "0.6459917", "0.6442409", "0.6403972", "0.6403972", "0.6399349", "0.6351671", "0.6323481", "0.6323413", "0.6307222", "0.6307222", "0.63068646", "0.62822574", "0.62731606", "0.62616515", ...
0.70544225
0
GET /generator_infos/1 GET /generator_infos/1.json
def show @generator_info = GeneratorInfo.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @generator_info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @generator }\n end\n end", "def new\n @generator_info = GeneratorInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format....
[ "0.7734949", "0.76324904", "0.7155637", "0.7088739", "0.692677", "0.6912711", "0.6613922", "0.65839964", "0.65614575", "0.65559924", "0.6482887", "0.6467777", "0.6376878", "0.63721305", "0.63492876", "0.63188666", "0.61869276", "0.61526024", "0.61267203", "0.60332644", "0.602...
0.8017623
0
GET /generator_infos/new GET /generator_infos/new.json
def new @generator_info = GeneratorInfo.new respond_to do |format| format.html # new.html.erb format.json { render json: @generator_info } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @generator = Generator.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator }\n end\n end", "def create\n @generator_info = GeneratorInfo.new(params[:generator_info])\n\n respond_to do |format|\n if @generator_info.save\n ...
[ "0.8090992", "0.7891322", "0.76211685", "0.7536716", "0.73769194", "0.7209613", "0.7102757", "0.7100119", "0.7083458", "0.70036584", "0.6943618", "0.6923939", "0.68963504", "0.6856303", "0.68508047", "0.6817471", "0.6797899", "0.67962635", "0.6792967", "0.6767336", "0.6741940...
0.85566103
0
POST /generator_infos POST /generator_infos.json
def create @generator_info = GeneratorInfo.new(params[:generator_info]) respond_to do |format| if @generator_info.save format.html { redirect_to @generator_info, notice: 'Generator info was successfully created.' } format.json { render json: @generator_info, status: :created, location: @g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @generator_info = GeneratorInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @generator_info }\n end\n end", "def create\n @generator = Generator.new(generator_params)\n\n respond_to do |format|\n if @generator.save\n for...
[ "0.7391535", "0.71054304", "0.70323473", "0.66751105", "0.6495501", "0.640216", "0.6315719", "0.6311654", "0.62511134", "0.61948544", "0.6192045", "0.61844724", "0.61558163", "0.60629576", "0.6049093", "0.60213625", "0.59857494", "0.59639215", "0.5924564", "0.5886682", "0.586...
0.7918936
0
PUT /generator_infos/1 PUT /generator_infos/1.json
def update @generator_info = GeneratorInfo.find(params[:id]) respond_to do |format| if @generator_info.update_attributes(params[:generator_info]) format.html { redirect_to @generator_info, notice: 'Generator info was successfully updated.' } format.json { head :no_content } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { render :show, status: :ok, location: @generator }\n else\n format.html { render :edit }\n for...
[ "0.71187365", "0.71187365", "0.7006139", "0.69810915", "0.6883088", "0.6548272", "0.6409518", "0.63473666", "0.62041783", "0.61811197", "0.6149131", "0.6029252", "0.6020267", "0.59239465", "0.58967006", "0.58490807", "0.58278203", "0.5804549", "0.57554704", "0.5703897", "0.57...
0.7500496
0
DELETE /generator_infos/1 DELETE /generator_infos/1.json
def destroy @generator_info = GeneratorInfo.find(params[:id]) @generator_info.destroy respond_to do |format| format.html { redirect_to generator_infos_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @generator.destroy\n respond_to do |format|\n format.html { redirect_to generators_url...
[ "0.7413984", "0.7197602", "0.7197602", "0.7176681", "0.7007245", "0.6760218", "0.67331195", "0.6680643", "0.66520363", "0.6522609", "0.6521887", "0.6520884", "0.6376413", "0.63665414", "0.6344744", "0.63343006", "0.6313048", "0.630916", "0.630233", "0.62833387", "0.6255577", ...
0.7860438
0
returns true iff the audience recalls the scenes happening in the given order.
def recall? *scenes unmatched = scenes.dup @@memories.each do |memory| unmatched.shift if unmatched[0] == memory end unmatched.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_been_recorded?(order)\n unless Validation.validate(order.to_s) && Order.is_a_valid_item_code?(order.to_s)\n return false\n end\n @customer_order.push order.to_s\n return true\n end", "def probe?\n self.order == -1\n end", "def is_order_next?(order)...
[ "0.5849542", "0.5725551", "0.55982906", "0.54192567", "0.5344008", "0.53244233", "0.5223742", "0.52198446", "0.51924807", "0.5176462", "0.51671374", "0.51642245", "0.5154686", "0.51529115", "0.5137023", "0.5137023", "0.5108884", "0.5108884", "0.5085219", "0.50763226", "0.5063...
0.5998559
0
releases all players from a team back into the field
def release_players Player.where(team_id: id).update_all(team_id: nil, active: false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reordenate_team\n position = 1\n self.players.each do |player|\n player.update_attribute(:position, position)\n position += 1\n end\n end", "def set_player_team!\n player.update!(team_name: team_name) if player.team_name != team_name\n piece.update!(team_name: team_name) if piece.te...
[ "0.65347", "0.6506997", "0.60988814", "0.6079857", "0.6026012", "0.60199046", "0.60080343", "0.5988645", "0.5953333", "0.59214634", "0.59138846", "0.58738226", "0.5826338", "0.57706386", "0.57124436", "0.56759965", "0.56383044", "0.5626219", "0.5619092", "0.56145805", "0.5596...
0.7450621
0
Recipe.most_popular should return the recipe instance with the highest number of users (the recipe that has the most recipe cards)
def most_popular # Recipecard.all.select {|rc| rc.recipe ==self} # most_popular.map {|rc| rc.users} recipe_hash = {} RecipeCard.all.each do |recipecard| if recipe_hash[recipecard.name]==nil recipe_hash[recipecard.name]=1 else recipe_hash[recipecard.name]+= 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_popular\n @books.sort_by {|book| book.rate}\n end", "def get_most_popular_users(num_users = 5)\n get_most_generic_for_users(DOCS[:most_popular_users], num_users)\n end", "def top_three_recipes\n recipe_cards.max_by(3) {|recipe_cards| recipe_cards.rating}\n end", "def fetch_popu...
[ "0.7250678", "0.7133249", "0.71095616", "0.70011556", "0.6951119", "0.69291145", "0.6864851", "0.68501496", "0.668146", "0.6642349", "0.66181916", "0.65168816", "0.6508674", "0.64781153", "0.6431703", "0.642971", "0.63897693", "0.635224", "0.6345496", "0.63325816", "0.6332146...
0.861034
0
Recipeingredients should return all of the ingredients in this recipe
def ingredients recipeingredient.map {|ri| ri.ingredient} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end", "def ingredients\n my_recipe_ingredients = RecipeIngredient.all.select do |recipeingredient|\n recipeingredient.recipe == self\n end\n my_recipe_ingredients.map do |recipe_ingredient|\n ...
[ "0.831865", "0.8068893", "0.7958368", "0.7869872", "0.778758", "0.77806467", "0.77555805", "0.77555805", "0.7738875", "0.77230746", "0.77155066", "0.7692386", "0.759416", "0.753531", "0.75210756", "0.7517456", "0.74817824", "0.745634", "0.74436855", "0.74042046", "0.73536646"...
0.81206983
1
(0 + km) % n == 0 m = 4 n = 10 k = 5 km % n = 0 km = cn k = cn / m This works (100% performance) but is not best way O(log(n + m))
def fast_solution(n, m) # eaten = c * n / m. Find c that makes (c * n) % m == 0. c = 0 begin c += 1 c = m / n if m == 1000000000 end until (c * n) % m == 0 c * n / m end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recessive k, m, n\n all = k + m + n\n mix = m + n\n total = 4.0 * triangle(all) # 2 * squareish all = 2 * 2 * triangle all\n\n lhs = triangle n\n mid = n * mix - n\n rhs = triangle mix\n\n 1 - (lhs+mid+rhs) / total\n end", "def flatlandSpaceStations(n,c,m)\r\n answer = 0\r\n cc = ...
[ "0.7120764", "0.64746976", "0.6395241", "0.6296249", "0.6258625", "0.6237656", "0.6222404", "0.6161289", "0.61592406", "0.6100771", "0.609553", "0.6091242", "0.6090429", "0.60756063", "0.6063286", "0.6044005", "0.60394984", "0.6036066", "0.6027755", "0.60071015", "0.6002906",...
0.6896274
1
Build a new trip place from PlacesDetails element
def from_place_details details components = details[:address_components] unless components.nil? components.each do |component| types = component[:types] if types.nil? next end if 'street_address'.in? types self.address1 = component[:long_name] e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_place_details details\n\n components = details[:address_components]\n unless components.nil?\n components.each do |component|\n types = component[:types]\n if types.nil?\n next\n end\n if 'street_address'.in? types\n self.address = component[:long_n...
[ "0.72132593", "0.64105964", "0.6377707", "0.6343581", "0.61970913", "0.61484677", "0.60855484", "0.605337", "0.5919284", "0.5918735", "0.5836108", "0.58226466", "0.5803015", "0.5792237", "0.5768543", "0.573575", "0.5726044", "0.5690981", "0.5685284", "0.5670187", "0.5670187",...
0.6943853
1
discover the zipcode for this trip place from its relationships
def zipcode return poi.zip unless poi.nil? return place.zip unless place.nil? return get_zipcode end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postal_code\n self[:zip]\n end", "def zip\n self[:address][:postalCode]\n end", "def search_zip_code\r\n @addresses = Address.find_by_zip_code(params[:address][:zip_code])\r\n end", "def load_districts_zip(zip_code)\n params = {'zip' => zip_code}\n @districts = process('...
[ "0.63452387", "0.63422775", "0.6255217", "0.6154878", "0.6084261", "0.59584016", "0.5884672", "0.5824158", "0.57361025", "0.5713872", "0.570411", "0.5701743", "0.5671898", "0.5671898", "0.56452024", "0.5644597", "0.5627292", "0.56267315", "0.5623451", "0.56075126", "0.5591091...
0.6343369
1
Return urlsafe base64 HMAC for data, assumes hmac_secret is set.
def compute_hmac(data) s = [compute_raw_hmac(data)].pack('m').chomp!("=\n") s.tr!('+/', '-_') s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hmac_hash(secret, data)\n algo = 'SHA1'\n _digest = OpenSSL::Digest.new(algo)\n OpenSSL::HMAC.hexdigest(_digest, secret, data)\n end", "def hmac_signature(key, data)\n sha = HMAC::SHA1.new(key)\n sha.update(data)\n base64(sha.digest)\n end", "def signature_for(data, secret)\...
[ "0.71493673", "0.7005676", "0.670317", "0.66372913", "0.66372913", "0.66000056", "0.6567909", "0.6560621", "0.65314186", "0.6423527", "0.6398781", "0.62952703", "0.62781453", "0.6062815", "0.6042645", "0.5962813", "0.5905947", "0.58647203", "0.5829988", "0.5819255", "0.581065...
0.7223387
0
Return a string for the parameter name. This will be an empty string if the parameter doesn't exist.
def param(key) param_or_nil(key).to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param_name\n @param_name.respond_to?(:call) ? @param_name.call : @param_name\n end", "def param_namer(param)\n \"$_#{param}\"\n end", "def parameter_string\n\t\tend", "def parameter_string\n \"\"\n end", "def param_name(key)\n first, *rest = keys(key)\n if firs...
[ "0.7811591", "0.7329533", "0.69914734", "0.6978847", "0.68234736", "0.68229944", "0.68144816", "0.67942953", "0.67942953", "0.67942953", "0.6788499", "0.6788499", "0.67531747", "0.6744404", "0.6744404", "0.6744404", "0.6744404", "0.6744404", "0.6744404", "0.6698332", "0.66686...
0.75049573
1
Return nil by default for values over maximum bytesize.
def over_max_bytesize_param_value(key, value) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_allowed_bytesize(v, max)\n end", "def default_max_size; end", "def max_size\n 1\n end", "def default_max_in_memory_size\n @default_max_in_memory_size || DEFAULT_MAX_IN_MEMORY_SIZE\n end", "def max_size; end", "def max_size=(_arg0); end", "def specific_max_size(number); ...
[ "0.7048917", "0.69685555", "0.6604613", "0.65568906", "0.65325785", "0.64720196", "0.6436458", "0.6316911", "0.63024276", "0.6302215", "0.62844723", "0.6233355", "0.6225882", "0.62036234", "0.6199145", "0.6152728", "0.6145607", "0.61380404", "0.6134343", "0.60376334", "0.6033...
0.74810094
0
Return nil by default for values with null bytes
def null_byte_parameter_value(key, value) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_null_byte(v)\n end", "def null \n return @raw.null \n end", "def process_nillable_values(args:)\n args[:byte_size] = nil if args[:byte_size].blank?\n args\n end", "def process_nillable_values(args:)\n args[:byte_size] = nil unless args[:byte_size].present?\n args\n ...
[ "0.7342216", "0.68070954", "0.66826034", "0.656124", "0.64034367", "0.6388334", "0.6386083", "0.63598377", "0.6342451", "0.6321569", "0.6313501", "0.6313254", "0.6161936", "0.6160538", "0.61589456", "0.61338544", "0.61203986", "0.6091144", "0.6043458", "0.6041877", "0.6041877...
0.73827493
0
Don't set an error status when redirecting in an error case, as a redirect status is needed.
def set_redirect_error_status(status) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect(location, status = '302'); request.redirect(location, status); end", "def redirect?\n # redirects are 3xx\n return @status >= 300 && @status < 400\n end", "def redirect_ok; end", "def redirect_ok; end", "def redirect?; end", "def redirect?\n 300 <= code && code < 400\n end...
[ "0.72776395", "0.7213422", "0.7120492", "0.7120492", "0.70450735", "0.6884401", "0.6833134", "0.6813714", "0.6789967", "0.67788184", "0.6737465", "0.6719334", "0.67080665", "0.67079306", "0.67056316", "0.67028445", "0.669154", "0.6683165", "0.6648155", "0.6641535", "0.6635181...
0.8550512
0
Get the password hash for the user. When using database authentication functions, note that only the salt is returned.
def get_password_hash if account_password_hash_column account![account_password_hash_column] elsif use_database_authentication_functions? db.get(Sequel.function(function_name(:rodauth_get_salt), account ? account_id : session_value)) else # :nocov: password_hash_ds.get(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_user_password\n self.password = sha1_digest(self.user_password, self.salt)\n self.user_password = nil\n end", "def hash_password\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.hashed_password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end"...
[ "0.73407525", "0.7305118", "0.7273412", "0.72535986", "0.701587", "0.6994785", "0.68946946", "0.68771034", "0.6866493", "0.68236434", "0.68070513", "0.67818266", "0.67270565", "0.67245585", "0.66816676", "0.66433036", "0.6640192", "0.6633492", "0.6633174", "0.66188866", "0.66...
0.80357903
0
In cases where retrying on uniqueness violations cannot work, this will detect whether a uniqueness violation is raised by the block and return the exception if so. This method should be used if you don't care about the exception itself.
def raises_uniqueness_violation?(&block) transaction(:savepoint=>:only, &block) false rescue unique_constraint_violation_class => e e end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry_on_uniqueness_violation(&block)\n if raises_uniqueness_violation?(&block)\n yield\n end\n end", "def retry_transaction(&block)\n tries = 3\n begin\n yield\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique\n tries -= 1\n if tries > 0\n ...
[ "0.8227882", "0.62486017", "0.5877959", "0.5869566", "0.5543474", "0.5516552", "0.5399367", "0.5380863", "0.5317911", "0.5317804", "0.5317804", "0.53080606", "0.53064775", "0.53021216", "0.5301212", "0.52759105", "0.5213642", "0.51614475", "0.51512957", "0.50801015", "0.50596...
0.7240546
1
Work around jdbc/sqlite issue where it only raises ConstraintViolation and not UniqueConstraintViolation.
def unique_constraint_violation_class if db.adapter_scheme == :jdbc && db.database_type == :sqlite # :nocov: Sequel::ConstraintViolation # :nocov: else Sequel::UniqueConstraintViolation end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_detecting_duplicate_entry_constraint_violation\n begin\n save\n rescue ActiveRecord::StatementInvalid => e\n # Would that rails gave us the nested exception to check...\n if e.message =~ /.*[Dd]uplicate/\n errors.add_to_base(translate_with_theme('duplicate_entry_please_try_agai...
[ "0.71445197", "0.66329813", "0.6396467", "0.628304", "0.622174", "0.6119858", "0.6055775", "0.60428435", "0.60182035", "0.60038817", "0.592732", "0.5918079", "0.58941764", "0.5809525", "0.57830614", "0.57510746", "0.57140636", "0.56878424", "0.56799215", "0.56777626", "0.5648...
0.70253205
1
POST /frontapp_support_sources POST /frontapp_support_sources.json
def create @support_source = FrontappSupportSource.new(frontapp_support_source_params) respond_to do |format| if @support_source.save format.html { redirect_to support_sources_path, notice: 'Support source was successfully created.' } format.json { render :show, status: :created...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frontapp_support_source_params\n params.require(:frontapp_support_source).\n permit(:name, :frontapp_auth_token,\n :frontapp_user_id, :frontapp_inbox_ids_as_string).\n merge(user: current_user)\n end", "def set_frontapp_support_source\n @support_source = current_user.frontapp_support_...
[ "0.6840675", "0.6512786", "0.6216179", "0.6091219", "0.57109064", "0.55643976", "0.5503779", "0.5502661", "0.5502556", "0.5485731", "0.5462232", "0.5425297", "0.534418", "0.5332665", "0.53206515", "0.5293588", "0.52738035", "0.52652967", "0.5262682", "0.52316916", "0.52239853...
0.7467037
0
PATCH/PUT /frontapp_support_sources/1 PATCH/PUT /frontapp_support_sources/1.json
def update respond_to do |format| if @support_source.update(frontapp_support_source_params) format.html { redirect_to @support_source, notice: 'Support source was successfully updated.' } format.json { render :show, status: :ok, location: @support_source } else format.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n ...
[ "0.6636469", "0.64439833", "0.6161364", "0.6118049", "0.60415477", "0.6025269", "0.59855866", "0.5952451", "0.5941746", "0.5926055", "0.59219974", "0.5919296", "0.5867781", "0.5836152", "0.5822313", "0.58192176", "0.5817657", "0.58020675", "0.57862246", "0.5770091", "0.576766...
0.73294055
0
DELETE /frontapp_support_sources/1 DELETE /frontapp_support_sources/1.json
def destroy @support_source.destroy respond_to do |format| format.html { redirect_to support_sources_url, notice: 'Support source was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n authorize_user!\n respond_to do |format|\n format.html { redirect_to sources_path(@source) }\n format.json { head :no_content }\n @source.destroy\n end\n end", "def destroy\n @cla_source.destroy\n respond_to do |format|\n format.html { redirect_to cla_sources_url...
[ "0.69014657", "0.68325377", "0.677435", "0.67720145", "0.67617685", "0.67617685", "0.67615503", "0.67182916", "0.66766065", "0.6612491", "0.65844524", "0.6569961", "0.65570587", "0.65509456", "0.65509456", "0.6533156", "0.6501823", "0.6498255", "0.64895874", "0.6483071", "0.6...
0.7042307
0
replicate the given item ID on an additional node
def replicate_once(item_id) current_nodes = find_nodes(item_id) possible_nodes = @master.data_nodes.values.select {|n| not current_nodes.include?(n)} target_node = possible_nodes[(rand * possible_nodes.size).floor] begin current_nodes[0].replicate_data(item_id, target_node) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replicate_node(node_id)\n data_to_replicate = get_data_list(node_id)\n data_to_replicate.each do |data_id|\n replicate(data_id)\n end\n end", "def add_replica(item_id, target_node, recovery_mode = false)\n# @logger.log_add_replica(item_id, Marshal.dump(target_node)) unless recov...
[ "0.780044", "0.653256", "0.60542476", "0.6004983", "0.59656054", "0.59132254", "0.5910546", "0.5844275", "0.58354086", "0.5812551", "0.5811051", "0.58055866", "0.57606685", "0.57511157", "0.5748595", "0.57362896", "0.5730767", "0.57136625", "0.56880325", "0.56879205", "0.5683...
0.7394588
1
find all nodes this item ID is currently stored on
def find_nodes(item_id) return @data_to_nodes[item_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes\n nodes_by_id.values\n end", "def get_all_items\n items(@nodename)\n end", "def all\n Directory.all.map do |node_id|\n find node_id\n end\n end", "def nodes\n\t\t# Query the database\n\t\tnodeQuery = Node.select(:node_id)\n\t\t# Place the query in an array\n\t\tn...
[ "0.73976517", "0.6829159", "0.6678692", "0.65628386", "0.64820445", "0.64217794", "0.6364471", "0.636337", "0.63535976", "0.63535976", "0.6306287", "0.6255241", "0.6129386", "0.6109872", "0.60937876", "0.60849595", "0.60497683", "0.60355353", "0.60184646", "0.5997937", "0.596...
0.78986424
0
replicate all data on a node
def replicate_node(node_id) data_to_replicate = get_data_list(node_id) data_to_replicate.each do |data_id| replicate(data_id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replicate_once(item_id)\n current_nodes = find_nodes(item_id)\n possible_nodes = @master.data_nodes.values.select {|n| not current_nodes.include?(n)}\n target_node = possible_nodes[(rand * possible_nodes.size).floor]\n \n begin\n current_nodes[0].replicate_data(item_id, target_n...
[ "0.699328", "0.6991535", "0.6089273", "0.60508937", "0.6039473", "0.5968721", "0.5853404", "0.58148897", "0.5768634", "0.57670987", "0.5750188", "0.57152104", "0.5705888", "0.5638921", "0.56120044", "0.5598138", "0.55959207", "0.55907553", "0.55842155", "0.5553286", "0.550234...
0.8124062
0
POST /po_receipts POST /po_receipts.json
def create @po_receipt = PoReceipt.new(po_receipt_params) respond_to do |format| if @po_receipt.save format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully created.' } format.json { render :show, status: :created, location: @po_receipt } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_receipt(atom)\n form_data = { application: @application_name }\n @hive_party.post \"/atoms/#{atom.id}/receipts\", form_data\n end", "def sms_receipts_post(url, opts = {})\n data, _status_code, _headers = sms_receipts_post_with_http_info(url, opts)\n data\n end", "def create\n...
[ "0.721813", "0.67675304", "0.6680944", "0.6589276", "0.65421957", "0.65368307", "0.6452098", "0.6452098", "0.6449987", "0.63635993", "0.6341161", "0.6330778", "0.6267977", "0.62663114", "0.6241786", "0.6206461", "0.61965257", "0.61912036", "0.61812663", "0.61712927", "0.61522...
0.7144056
1
PATCH/PUT /po_receipts/1 PATCH/PUT /po_receipts/1.json
def update respond_to do |format| if @po_receipt.update(po_receipt_params) format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully updated.' } format.json { render :show, status: :ok, location: @po_receipt } else format.html { render :edit } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @receipt = current_user.receipts.find(params[:id])\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render act...
[ "0.663678", "0.6530603", "0.6501283", "0.6446072", "0.6438361", "0.6438137", "0.6438137", "0.64157146", "0.634435", "0.6319594", "0.6273267", "0.62509465", "0.620919", "0.61912376", "0.6097274", "0.6086628", "0.6084257", "0.60782176", "0.6029632", "0.6028742", "0.59962356", ...
0.7156478
0
DELETE /po_receipts/1 DELETE /po_receipts/1.json
def destroy lifnr = @po_receipt.lifnr lifdn = @po_receipt.lifdn werks = @po_receipt.werks @po_receipt.destroy respond_to do |format| format.html { redirect_to po_receipts_url(lifnr: lifnr, lifdn: lifdn, werks: werks) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to recei...
[ "0.7249442", "0.7205277", "0.71285504", "0.7062397", "0.70389324", "0.702607", "0.69623387", "0.6948784", "0.6899735", "0.68326765", "0.68326765", "0.68326765", "0.67873055", "0.67733824", "0.6762464", "0.6696877", "0.66483766", "0.66245335", "0.66068006", "0.66017556", "0.65...
0.7292007
0
GET /spiders GET /spiders.json
def index @spiders = Spider.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listspiders(project=self.project)\n get('listspiders.json', project: project)['spiders']\n end", "def index\n\t\t@pipelines = Pipeline.all(include: :stages)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @pipelines }\n\t\tend\n\tend", "def index\n ...
[ "0.7527467", "0.578524", "0.5602479", "0.5582062", "0.55442256", "0.554001", "0.554001", "0.5492717", "0.54835296", "0.5453081", "0.54461664", "0.5442363", "0.54386324", "0.538377", "0.5317914", "0.53159386", "0.5291303", "0.5291303", "0.5289522", "0.528471", "0.5277389", "...
0.7576435
0
POST /spiders POST /spiders.json
def create @spider = Spider.new(spider_params) respond_to do |format| if @spider.save format.html { redirect_to @spider, notice: 'Spider was successfully created.' } format.json { render :show, status: :created, location: @spider } else format.html { render :new } fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @spiders = Spider.all\n end", "def listspiders(project=self.project)\n get('listspiders.json', project: project)['spiders']\n end", "def spider_params\n params.require(:spider).permit(:name, :container_id, :status, :image_id, :prefix, :frequency, :run_info, :max_memory)\n end", "d...
[ "0.65026385", "0.6009115", "0.57850796", "0.55037534", "0.54188097", "0.5372787", "0.53106445", "0.53051174", "0.52793837", "0.5213296", "0.5197774", "0.51752377", "0.5118427", "0.5107348", "0.510598", "0.51013225", "0.50770897", "0.50742877", "0.5062011", "0.49972507", "0.49...
0.6690364
0
DELETE /spiders/1 DELETE /spiders/1.json
def destroy @spider.destroy respond_to do |format| format.html { redirect_to spiders_url, notice: 'Spider was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(path)\n RestClient.delete r...
[ "0.6548", "0.64675266", "0.6307504", "0.62991554", "0.6270885", "0.62647176", "0.6261972", "0.62554896", "0.62056506", "0.6178789", "0.61371577", "0.6125963", "0.6096617", "0.6096617", "0.60804516", "0.60776794", "0.60740256", "0.60643065", "0.6057096", "0.6054811", "0.604914...
0.6931202
0
POST /publications POST /publications.json
def create @publication = Publication.new(publication_params) respond_to do |format| if @publication.save format.html { redirect_to publications_url, notice: 'Publication was successfully created.' } format.json { render :show, status: :created, location: @publication } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @publication = Publication.new(publication_params)\n\n if @publication.save\n render json: @publication, status: :created\n else\n reponse = { status: \"error\", code: 422,\n message: \"couldn't create the publication\",\n errors: @publication.error...
[ "0.7351526", "0.7222527", "0.7222527", "0.7187896", "0.7085576", "0.70243484", "0.6952572", "0.6914492", "0.6897696", "0.68479717", "0.6800644", "0.6797221", "0.6747078", "0.6727789", "0.67252874", "0.6698838", "0.6681279", "0.66702557", "0.66583014", "0.6594258", "0.6580721"...
0.7260106
1
GET /crossword_puzzles/new GET /crossword_puzzles/new.json
def new @crossword_puzzle = CrosswordPuzzle.new respond_to do |format| format.html # new.html.erb format.json { render json: @crossword_puzzle } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @paper_word = PaperWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper_word }\n end\n end", "def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n ...
[ "0.6949752", "0.68672717", "0.68672717", "0.68672717", "0.68672717", "0.68672717", "0.6809923", "0.6769404", "0.6591035", "0.6575545", "0.65729815", "0.65692127", "0.6555466", "0.65527725", "0.65492034", "0.6518632", "0.64954877", "0.6488429", "0.6487212", "0.6472325", "0.647...
0.71602786
0
POST /crossword_puzzles POST /crossword_puzzles.json
def create @crossword_puzzle = CrosswordPuzzle.new(params[:crossword_puzzle]) if !@crossword_puzzle.user && current_user @crossword_puzzle.user = current_user end respond_to do |format| if @crossword_puzzle.save if current_user.admin format.html { redirect_to @crossword_puzzle, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @paper_word = PaperWord.new(params[:paper_word])\n\n respond_to do |format|\n if @paper_word.save\n format.html { redirect_to @paper_word, notice: 'Paper word was successfully created.' }\n format.json { render json: @paper_word, status: :created, location: @paper_word }\n ...
[ "0.59651744", "0.55942965", "0.5541964", "0.54664713", "0.54053706", "0.54040056", "0.54001254", "0.5396807", "0.5380307", "0.5374924", "0.53667176", "0.5311728", "0.53114116", "0.53114116", "0.5309286", "0.5309286", "0.5309286", "0.53056145", "0.5303603", "0.5296149", "0.528...
0.59659815
0
PUT /crossword_puzzles/1 PUT /crossword_puzzles/1.json
def update @crossword_puzzle = CrosswordPuzzle.find(params[:id]) respond_to do |format| if @crossword_puzzle.update_attributes(params[:crossword_puzzle]) format.html { redirect_to edit_crossword_puzzle_path(@crossword_puzzle), notice: 'Puzzle saved!' } format.json { head :no_content } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n...
[ "0.6003195", "0.5832756", "0.57551366", "0.5728726", "0.56529737", "0.56529737", "0.56529737", "0.56529737", "0.56218475", "0.5549136", "0.55422103", "0.55068344", "0.549347", "0.54843426", "0.54843426", "0.54843426", "0.54843426", "0.54843426", "0.54679215", "0.5455668", "0....
0.6163839
0
Prints the map in regards to what the player has seen. Additionally, provides current location and the map's name.
def print_map # Provide some spacing from the edge of the terminal. 3.times { print " " }; print @map.name + "\n\n" @map.tiles.each_with_index do |row, r| # Provide spacing for the beginning of each row. 2.times { print " " } row.each_with_index do |tile, t| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_map\n\n # Provide some spacing to center the name.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n\n print @map.name + \"\\n\\n\"\n\n @map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n (0..(@map.name.length/2)).each do\n ...
[ "0.7134865", "0.6895263", "0.6881917", "0.6813431", "0.6575877", "0.653626", "0.64906824", "0.647277", "0.6420577", "0.63627094", "0.6360731", "0.6260933", "0.6221287", "0.621146", "0.6188618", "0.61772645", "0.61495423", "0.6136092", "0.6108629", "0.61017257", "0.60913604", ...
0.7251592
0
Prints a minimap of nearby tiles (using VIEW_DISTANCE).
def print_minimap print "\n" for y in (@location.first-VIEW_DISTANCE)..(@location.first+VIEW_DISTANCE) # skip to next line if out of bounds from above map next if y.negative? # centers minimap 10.times { print " " } for x in (@location.second-VIEW_DISTANCE)..(@locatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_minimap\n print \"\\n\"\n for y in (@location.first-VIEW_DISTANCE)..(@location.first+VIEW_DISTANCE)\n # skip to next line if out of bounds from above map\n next if y < 0\n # centers minimap\n 10.times do\n print \" \"\n end\n for x in (@location.second-VIEW_DIST...
[ "0.83357704", "0.6402761", "0.62895626", "0.62808174", "0.6154004", "0.6044166", "0.60214835", "0.5905696", "0.5888686", "0.58621854", "0.57700944", "0.5757397", "0.57502127", "0.5732081", "0.5726335", "0.5725984", "0.570613", "0.5668745", "0.5655546", "0.56177217", "0.558181...
0.8136597
1
Prints the tile based on the player's location.
def print_tile(coords) if ((@location.first == coords.first) && (@location.second == coords.second)) print "¶ " else print @map.tiles[coords.first][coords.second].to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tile(coords)\n if ((@location.first == coords.first) && (@location.second == coords.second))\n print \"¶ \"\n else\n print @map.tiles[coords.first][coords.second].to_s\n end\n end", "def show_player\n if @position == 1\n puts \"le joueur #{@position} : #{@name.capitalize} #{...
[ "0.7665916", "0.6691956", "0.65180314", "0.6510894", "0.6468359", "0.6464139", "0.6356246", "0.63491505", "0.63429517", "0.629416", "0.62820613", "0.6255598", "0.6245893", "0.62337184", "0.6218377", "0.62048995", "0.61825913", "0.6175415", "0.61319804", "0.612568", "0.6121357...
0.764693
1
Returns the gold given to a victorious Entity after losing a battle and deducts the figure from the Player's total as necessary
def sample_gold gold_lost = 0 # Reduce gold if the player has any. if @gold.positive? type("Looks like you lost some gold...\n\n") gold_lost = @gold/2 @gold -= gold_lost end gold_lost end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gain_gold\n if $game_troop.gold_total > 0\n rate = Grade.rate(:gold)\n gold = $game_troop.gold_total\n gold = gold * rate / 100\n $game_party.gain_gold(gold)\n else\n gold = 0\n end\n return gold\n end", "def lose_gold(n)\n gain_gold(-n)\n end", "def gold_result(en...
[ "0.73759586", "0.7155349", "0.7060013", "0.69382966", "0.68649083", "0.6833854", "0.6819328", "0.6809912", "0.66842455", "0.66752476", "0.662677", "0.6573059", "0.6558426", "0.6470538", "0.64487606", "0.6442957", "0.64313215", "0.641958", "0.6368014", "0.6317911", "0.63106894...
0.7261822
1
GET /test_questions/new GET /test_questions/new.json
def new @test_question = TestQuestion.new respond_to do |format| format.html # new.html.erb format.json { render :json => @test_question } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }...
[ "0.7850332", "0.7842054", "0.7842054", "0.7842054", "0.7842054", "0.7842054", "0.7769053", "0.7741807", "0.76394236", "0.75785047", "0.7525696", "0.74207133", "0.74169517", "0.74103963", "0.7407483", "0.7403773", "0.73939776", "0.73933125", "0.7390224", "0.7376302", "0.737326...
0.7969413
0
POST /test_questions POST /test_questions.json
def create @test_question = TestQuestion.new(params[:test_question]) respond_to do |format| if @test_question.save format.html { redirect_to @test_question, :notice => 'Test question was successfully created.' } format.json { render :json => @test_question, :status => :created, :location ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question ...
[ "0.71973485", "0.71973485", "0.7070897", "0.6947893", "0.6812038", "0.6792296", "0.67156166", "0.6702249", "0.6676173", "0.66741323", "0.6644101", "0.6619836", "0.66078454", "0.6598531", "0.6592832", "0.6485802", "0.6456139", "0.64504063", "0.6449363", "0.64361995", "0.637914...
0.7289749
0
PUT /test_questions/1 PUT /test_questions/1.json
def update @test_question = TestQuestion.find(params[:id]) respond_to do |format| if @test_question.update_attributes(params[:test_question]) format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' } format.json { head :ok } else format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\...
[ "0.6997375", "0.6963279", "0.6862295", "0.6816271", "0.6780306", "0.6747774", "0.6659595", "0.6625654", "0.66036695", "0.65941435", "0.65813667", "0.65140575", "0.6468147", "0.6456749", "0.64493847", "0.6426765", "0.6426765", "0.6426765", "0.6426765", "0.6426765", "0.64069027...
0.7103229
0
DELETE /test_questions/1 DELETE /test_questions/1.json
def destroy @test_question = TestQuestion.find(params[:id]) @test_question.destroy respond_to do |format| format.html { redirect_to test_questions_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was ...
[ "0.77042663", "0.75446856", "0.75446856", "0.75303197", "0.7495366", "0.73791075", "0.734512", "0.734512", "0.734512", "0.734512", "0.734512", "0.734512", "0.73442084", "0.7342919", "0.73042595", "0.73042595", "0.7303724", "0.7284187", "0.7283592", "0.7282965", "0.7282965", ...
0.78112733
0