query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Use callbacks to share common setup or constraints between actions. | def set_guanliyuan
@guanliyuan = Guanliyuan.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def guanliyuan_params
params.require(:guanliyuan).permit(:zhanghao, :xingming, :chuangjianshijian, :dengji, :suoshujiaose, :suoshujigou, :xingbie, :shouji, :qiyong)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
[ [time, event], ... ] | def event(query_name)
@client.call(:event, query_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_runtime_timestamps\n all_events = events.to_a\n start_time = DateTime.parse(all_events.first['timestamp'])\n completion_time = DateTime.parse(all_events.last['timestamp'])\n [start_time, completion_time]\n end",
"def trace_list\n my_list = []\n (0...@list_of_events.length).each do |x|\... | [
"0.62449294",
"0.6188704",
"0.6143977",
"0.60932916",
"0.6067965",
"0.5978275",
"0.59509057",
"0.5947173",
"0.5902428",
"0.5874504",
"0.585986",
"0.57977486",
"0.57768697",
"0.5767739",
"0.574499",
"0.5739414",
"0.57308155",
"0.57308155",
"0.57308155",
"0.57308155",
"0.573081... | 0.0 | -1 |
[ [time, event], ... ] | def see(query_name)
@client.call(:see, query_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_runtime_timestamps\n all_events = events.to_a\n start_time = DateTime.parse(all_events.first['timestamp'])\n completion_time = DateTime.parse(all_events.last['timestamp'])\n [start_time, completion_time]\n end",
"def trace_list\n my_list = []\n (0...@list_of_events.length).each do |x|\... | [
"0.6242884",
"0.6188396",
"0.6143055",
"0.6091989",
"0.6066847",
"0.59785676",
"0.5950707",
"0.59464926",
"0.5902074",
"0.5874607",
"0.58610034",
"0.579731",
"0.5775883",
"0.5767318",
"0.5745717",
"0.57388425",
"0.5732018",
"0.5732018",
"0.5732018",
"0.5732018",
"0.5732018",
... | 0.0 | -1 |
Set an admin user | def correct_user
@comment = current_user.comments.find_by(id: params[:id])
unless @comment.user == current_user || current_user.admin? || @comment.user == @comment.advert.user
redirect_to @comment.advert
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_admin_user\n @admin_user = User.find(params[:id])\n end",
"def set_admin_user\n @admin_user = User.find(params[:id])\n end",
"def set_admin_user\n @admin_user = User.find(params[:id])\n end",
"def set_admin_user\n @admin_user = User.find(params[:id])\n end",
"def... | [
"0.8507883",
"0.8490489",
"0.8490489",
"0.8490489",
"0.84464866",
"0.8412154",
"0.8412154",
"0.8381546",
"0.8362064",
"0.8362064",
"0.8362064",
"0.8362064",
"0.8362064",
"0.8261355",
"0.823165",
"0.8228766",
"0.81822175",
"0.8121296",
"0.7975866",
"0.78788644",
"0.7869431",
... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def comment_params
params.require(:comment).permit(:content)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
used when a master text is changed. Assume localized texts are all created. | def master_text_changed(master_text)
master_text.localized_texts.where(needs_entry: false).update_all(needs_review: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def old_text=(value)\n @old_text = value\n end",
"def set_master_text\n @master_text = MasterText.find(params[:id])\n end",
"def new_text=(value)\n @new_text = value\n ... | [
"0.6709028",
"0.6487884",
"0.64530504",
"0.6183389",
"0.6157423",
"0.6068394",
"0.5998895",
"0.59653056",
"0.59653056",
"0.59480673",
"0.58738744",
"0.5866116",
"0.58241934",
"0.5794909",
"0.5762482",
"0.57290274",
"0.5693016",
"0.56648415",
"0.5633661",
"0.5633661",
"0.55930... | 0.7639839 | 0 |
Returns a new instance and sets options. This can be called from subclasses. ===== Arguments +defaults+ Default options for the subclass (hash). +opts+ Options passed to the sublass initializer (hash). | def initialize(opts, defaults = {})
opts.transform_keys!(&:to_sym)
@options = defaults.update(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize **opts\n @options = DEFAULT_OPTIONS.merge opts\n end",
"def initialize(opts = {})\n super opts.dup\n end",
"def with_opts(opts)\n self.class.new!(name, args, Hash[@opts].merge!(opts))\n end",
"def default_options=(opts); end",
"def initialize\n @options =... | [
"0.75237286",
"0.72577846",
"0.7103617",
"0.682052",
"0.66908294",
"0.66908294",
"0.6687938",
"0.66755503",
"0.6675233",
"0.664634",
"0.66413635",
"0.6610234",
"0.6609874",
"0.6609874",
"0.660931",
"0.6550909",
"0.65395105",
"0.6525045",
"0.65193033",
"0.64989513",
"0.6492712... | 0.7400661 | 1 |
Returns the NO_DATA tag. If the results returned by a subclass contain data, override this methos to return the appropriate tag for the data. This tag can be used to filter data captured by operations. Tags are defined in CapturedDataTags. | def captured_data_tag
CapturedDataTags::NO_DATA
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_no_data &block\n @no_data_callback = block\n end",
"def none(data)\n end",
"def data\n nil\n end",
"def parse_unknown( data )\n return data\n end",
"def on_no_data_received &block\n @no_data_received_callback = block\n end",
"def noop\n tagged_response(\"NOOP\")\n ... | [
"0.6098478",
"0.6020459",
"0.564006",
"0.5527282",
"0.5437263",
"0.54307985",
"0.5363878",
"0.53520185",
"0.53369397",
"0.53218323",
"0.5303802",
"0.5206929",
"0.51771",
"0.5165907",
"0.51623833",
"0.5097492",
"0.50246465",
"0.49968094",
"0.4964375",
"0.4947404",
"0.49449605"... | 0.8364664 | 0 |
Returns the extension for +file+ (a string). This should be the extension for the type the file created by operation will have. If the operation of a subclass will result in a different extension of predictable type, define a target_extension method. | def extension(file)
target_extension || File.extname(file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ext (file)\n\n\t\tif file.is_a? String\n\t\t\treturn File.extname(file)\n\t\telsif file.is_a? File\n\t\t\treturn File.extname(file.path)\n\t\tend\n\n\tend",
"def file_extension\n self.class.file_extension\n end",
"def extension\n split_extension(filename)[1] if filename\n end",
... | [
"0.79106903",
"0.77848214",
"0.75421363",
"0.7536209",
"0.7490978",
"0.7414343",
"0.7261724",
"0.72571874",
"0.7253479",
"0.7245256",
"0.71857244",
"0.7127485",
"0.71035516",
"0.71035516",
"0.71035516",
"0.7095828",
"0.7093494",
"0.70333046",
"0.7033113",
"0.70114857",
"0.700... | 0.85885686 | 0 |
Returns a Results object with the Resultssuccess set to +false+ and any information returned by the operation in log_data (a string error, array, or hash). | def failure(log_data = nil)
results false, log_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def success(log_data = nil)\n results true, log_data\n end",
"def result_log\n end",
"def result_log\n end",
"def result_log\n end",
"def log_result(task_name, user, result)\n if result[0]\n log_success(user, task_name)\n else\n log_fail(user... | [
"0.7820729",
"0.64904124",
"0.64904124",
"0.64904124",
"0.6246449",
"0.6181646",
"0.6133867",
"0.6095231",
"0.6079169",
"0.60349935",
"0.59365886",
"0.5926461",
"0.5925784",
"0.59147745",
"0.5904155",
"0.5890678",
"0.5874877",
"0.5827385",
"0.5734603",
"0.57130086",
"0.568308... | 0.64948195 | 1 |
Returns +true+ if the FIleOperation will create a new version. _Default:_ +true+. | def modifies?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_version?\n !previously_new_record? || (previously_new_record? && !delay_first_version)\n end",
"def create_version?\n !_skip_version? && !merge_version? && !append_version? && super\n end",
"def save_version?\n version_condition_met? && altered?\n end",
"def det... | [
"0.8103539",
"0.77030975",
"0.7436031",
"0.7268513",
"0.7209325",
"0.7177491",
"0.7176051",
"0.7172625",
"0.7109263",
"0.710915",
"0.7032784",
"0.6999913",
"0.6999913",
"0.6992034",
"0.69074243",
"0.68931794",
"0.6883738",
"0.68320674",
"0.68003774",
"0.67998886",
"0.6766606"... | 0.0 | -1 |
Returns the class name (string) of +self+ _without_ the names of the modules that the class is nested in. | def name
self.class.name.split('::').last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_name\n klass = single_class\n while klass.name == ''\n klass = klass.superclass\n end\n if list_context?\n \"[#{klass}]\"\n else\n klass.name\n end\n end",
"def class_name\n self.class.to_s.split('::').last\n end",
"def class_name\n ... | [
"0.7795511",
"0.77915287",
"0.7738223",
"0.7734305",
"0.77248955",
"0.7603224",
"0.75755876",
"0.7479184",
"0.74676836",
"0.74609417",
"0.74331254",
"0.73423725",
"0.7269781",
"0.72494584",
"0.7178471",
"0.7155507",
"0.7133124",
"0.7129013",
"0.7129013",
"0.7122411",
"0.71224... | 0.6645465 | 60 |
:args: src_file, out_file, original = nil To be implemented in subclasses. Should return any logged errors or data produced (a string, error, array, or hash) or +nil+. ===== Arguments src_file Path for the file the operation will use as the basis for the new version it will create. out_file Path the file created by the... | def operation(*_)
raise 'not implemented'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(src_file, directory, original = nil)\n out_file = target directory, extension(src_file) if modifies?\n log_data = operation src_file, out_file, original\n [out_file, success(log_data)]\n rescue StandardError => e\n FileUtils.rm out_file if out_file && File.exist?(out_file)\... | [
"0.7512469",
"0.5729217",
"0.5689716",
"0.5643485",
"0.56006914",
"0.5600547",
"0.55848366",
"0.5463019",
"0.5460933",
"0.5375752",
"0.53047246",
"0.52888477",
"0.5281899",
"0.52734375",
"0.5268396",
"0.5268396",
"0.5249831",
"0.5248997",
"0.51900154",
"0.5184911",
"0.5181243... | 0.0 | -1 |
Runs the operation on src_file and retunes an array with a path for the file created by the operation and a Results object. Subclasses of FileOperation must either implement an operation method, or override the run method, making sure it has the same signature and kind of return value. The method will create a new path... | def run(src_file, directory, original = nil)
out_file = target directory, extension(src_file) if modifies?
log_data = operation src_file, out_file, original
[out_file, success(log_data)]
rescue StandardError => e
FileUtils.rm out_file if out_file && File.exist?(out_file)
[o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_for original\n current_output_directory.join(file_time_by_filepath(original).strftime(settings[:ordered_time_pattern])).join(original.basename)\n end",
"def path_for original\n current_output_directory.join(daily_directory_for(file_time(original).strftime(settings[:ordered_time_... | [
"0.6001964",
"0.56202686",
"0.5341139",
"0.52487487",
"0.52377564",
"0.51709384",
"0.51119393",
"0.510355",
"0.5077934",
"0.504205",
"0.5041993",
"0.50189686",
"0.49949422",
"0.4908917",
"0.4906678",
"0.49045712",
"0.4891867",
"0.48831832",
"0.48560578",
"0.4838667",
"0.47997... | 0.7798433 | 0 |
Returns a Results object with the Resultssuccess set to +true+ and any information returned by the operation in log_data (a string error, array, or hash). | def success(log_data = nil)
results true, log_data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result_log\n end",
"def result_log\n end",
"def result_log\n end",
"def log_result(task_name, user, result)\n if result[0]\n log_success(user, task_name)\n else\n log_fail(user, task_name, result[1])\n end\n end",
"def build_success_resul... | [
"0.6443243",
"0.6443243",
"0.6443243",
"0.6425401",
"0.63286036",
"0.61542106",
"0.6118442",
"0.6088922",
"0.60444045",
"0.6042321",
"0.6019081",
"0.59285957",
"0.590649",
"0.58553004",
"0.5854382",
"0.58382446",
"0.58344066",
"0.57773656",
"0.5768536",
"0.5729305",
"0.572617... | 0.80273336 | 0 |
Returns a new path to which the file created by the operation can be written. The path will be in +directory+, with a new basename determined by +kind+ and have the specified file +extension+. There are two options for the +kind+ of basename to be created: +:timestamp+ (_default_) Creates a timestamp basename. +:random... | def target(directory, extension, kind = :timestamp)
filename = FilePipeline.new_basename(kind) + extension
File.join directory, filename
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_filename(directory, file)\n File.join(directory, File.basename(file))\n end",
"def filename(id, extension)\n path = filepath(id)\n return path if extension.nil?\n \"#{path}.#{extension.gsub(/^\\./, '')}\"\n end",
"def new_file name\n raise \"Not a Valid Directory\" u... | [
"0.53695947",
"0.5239142",
"0.5200522",
"0.5198465",
"0.5167873",
"0.5139138",
"0.51082575",
"0.5023593",
"0.50021064",
"0.49934012",
"0.4985428",
"0.49782825",
"0.4953496",
"0.49469236",
"0.48812437",
"0.48648652",
"0.4830304",
"0.48192194",
"0.48026133",
"0.479671",
"0.4794... | 0.7692178 | 0 |
Returns +nil+. If the operation of a subclass will result in a different extension of predictable type, override this method to return the appropriate type. If, for instance, the operation will always create a TIFF file, the implementation could be: Returns '.tiff' def target_extension '.tiff' end | def target_extension; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def target_extension\n '.tiff'\n end",
"def extension(file)\n target_extension || File.extname(file)\n end",
"def target_filename\n raise NotImplementedError, \"Must be overridden by a subclass\"\n end",
"def file_extension\n self.class.file_extension\n end",
"def ex... | [
"0.8096542",
"0.66798216",
"0.6291738",
"0.6203919",
"0.5957376",
"0.5934924",
"0.5934796",
"0.5918132",
"0.5918057",
"0.5915111",
"0.5906947",
"0.5906947",
"0.5906947",
"0.59037495",
"0.585358",
"0.58490825",
"0.58298516",
"0.5828346",
"0.58197224",
"0.57581806",
"0.574897",... | 0.6974377 | 1 |
INSTANCE METHODS Update wins and losses | def add_win(game)
self.wins += 1
self.games << game
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_coach_win_loss\n \t#this should make the coach of the winning team hae one more win\n \t#and the coach of the losing team have one more loss\n winning_coach.update_attribute :wins, winning_coach.wins + 1\n losing_coach.update_attribute :losses, losing_coach.losses + 1\n end",
"def update_scor... | [
"0.7558256",
"0.71751064",
"0.6841146",
"0.68390936",
"0.67714673",
"0.6765533",
"0.6754543",
"0.67298865",
"0.6726982",
"0.65929914",
"0.6541279",
"0.6516574",
"0.6516574",
"0.6516557",
"0.6512637",
"0.6489216",
"0.6474685",
"0.6474685",
"0.6469578",
"0.6467557",
"0.64575744... | 0.0 | -1 |
GET /paginas/1 GET /paginas/1.xml | def show
@pagina = Pagina.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @pagina }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @progres = Progre.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @progres }\n end\n end",
"def index\n @pagos = Pago.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xm... | [
"0.71771014",
"0.71655756",
"0.7097079",
"0.68519276",
"0.6850782",
"0.67617834",
"0.6760605",
"0.6736688",
"0.67213815",
"0.66452414",
"0.66212434",
"0.6616941",
"0.6589103",
"0.6582714",
"0.6581603",
"0.657514",
"0.65668315",
"0.6555992",
"0.6512813",
"0.6506936",
"0.649309... | 0.688258 | 3 |
GET /paginas/new GET /paginas/new.xml | def new
@pagina = Pagina.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @pagina }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @pagamento = Pagamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagamento }\n end\n end",
"def new\n @pagare = Pagare.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pagare... | [
"0.7755556",
"0.76598305",
"0.75320965",
"0.74420846",
"0.73345995",
"0.733348",
"0.7333138",
"0.73292005",
"0.73292005",
"0.73292005",
"0.73292005",
"0.73292005",
"0.73292005",
"0.729859",
"0.725603",
"0.725603",
"0.7250924",
"0.724969",
"0.72369355",
"0.72341037",
"0.721935... | 0.78973544 | 0 |
POST /paginas POST /paginas.xml | def create
@pagina = Pagina.new(params[:pagina])
respond_to do |format|
if @pagina.save
flash[:notice] = 'Pagina was successfully created.'
format.html { redirect_to(@pagina) }
format.xml { render :xml => @pagina, :status => :created, :location => @pagina }
else
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://l... | [
"0.63353676",
"0.62458056",
"0.6082998",
"0.60533947",
"0.6049327",
"0.60300875",
"0.60108477",
"0.5973968",
"0.59626865",
"0.5958967",
"0.5922332",
"0.5874545",
"0.5836402",
"0.581133",
"0.58082926",
"0.5807295",
"0.579512",
"0.578247",
"0.5772789",
"0.5765069",
"0.5755851",... | 0.63803804 | 0 |
PUT /paginas/1 PUT /paginas/1.xml | def update
@pagina = Pagina.find(params[:id])
respond_to do |format|
if @pagina.update_attributes(params[:pagina])
flash[:notice] = 'Pagina was successfully updated.'
format.html { redirect_to(@pagina) }
format.xml { head :ok }
else
format.html { render :action => "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @pagina = Pagina.find(params[:id])\n\n respond_to do |format|\n if @pagina.update_attributes(params[:pagina])\n format.html { redirect_to(@pagina, :notice => t('exito')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n forma... | [
"0.6599211",
"0.6190162",
"0.61574966",
"0.614898",
"0.61298233",
"0.6030292",
"0.59716773",
"0.59713495",
"0.59328663",
"0.59323263",
"0.5923957",
"0.5906176",
"0.5881325",
"0.58803856",
"0.58585256",
"0.584854",
"0.5836267",
"0.5797383",
"0.5796391",
"0.57567126",
"0.572993... | 0.64285755 | 1 |
DELETE /paginas/1 DELETE /paginas/1.xml | def destroy
@pagina = Pagina.find(params[:id])
@pagina.destroy
respond_to do |format|
format.html { redirect_to(paginas_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @pagamento = Pagamento.find(params[:id])\n @pagamento.destroy\n\n respond_to do |format|\n format.html { redirect_to(pagamentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pagos_detalhe = PagosDetalhe.find(params[:id])\n @pagos_detalhe.destroy\n\n ... | [
"0.7237206",
"0.7177179",
"0.71207905",
"0.70723367",
"0.7013665",
"0.69789636",
"0.6879177",
"0.6872556",
"0.6862328",
"0.680138",
"0.67990863",
"0.6795777",
"0.6740708",
"0.67344964",
"0.6729621",
"0.6725271",
"0.6720122",
"0.67192477",
"0.6717839",
"0.6694857",
"0.66932166... | 0.74414694 | 0 |
GET /catering_types GET /catering_types.json | def index
@catering_types = CateringType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def index\n types = @user.tried_beer_ratings.last.bee... | [
"0.6999757",
"0.67954624",
"0.670295",
"0.6655614",
"0.6500872",
"0.6499485",
"0.6456985",
"0.6448982",
"0.64402515",
"0.6412623",
"0.63912547",
"0.6390783",
"0.63888496",
"0.6359914",
"0.6328613",
"0.62939346",
"0.6277721",
"0.6259387",
"0.6242253",
"0.6235345",
"0.6225479",... | 0.7396883 | 0 |
GET /catering_types/1 GET /catering_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @catering_types = CateringType.all\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def show\n @crate_type = CrateType.find(params[:id])\n\n respond... | [
"0.7263584",
"0.709719",
"0.68409127",
"0.6644873",
"0.6644759",
"0.65717554",
"0.65661085",
"0.65318394",
"0.6521239",
"0.6468416",
"0.645224",
"0.64483297",
"0.6431851",
"0.64164144",
"0.6413499",
"0.6402746",
"0.6387157",
"0.63746744",
"0.6367136",
"0.63368505",
"0.6319297... | 0.0 | -1 |
POST /catering_types POST /catering_types.json | def create
@catering_type = CateringType.new(catering_type_params)
respond_to do |format|
if @catering_type.save
format.html { redirect_to catering_types_path, notice: 'Catering type was successfully created.' }
format.json { render :show, status: :created, location: @catering_type }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def catering_type_params\n params.require(:catering_type).permit(:name,:icon)\n end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def index\n @catering_types = CateringType.all\n end",
"def create\n @crate_type = CrateType.new(p... | [
"0.62748176",
"0.61454713",
"0.6112767",
"0.6101268",
"0.60670066",
"0.60619694",
"0.60146147",
"0.59582907",
"0.59582907",
"0.59512645",
"0.5934805",
"0.5932301",
"0.5932301",
"0.59230906",
"0.5918899",
"0.591021",
"0.5901683",
"0.5866587",
"0.5860122",
"0.5841258",
"0.58214... | 0.65145415 | 0 |
PATCH/PUT /catering_types/1 PATCH/PUT /catering_types/1.json | def update
respond_to do |format|
if @catering_type.update(catering_type_params)
format.html { redirect_to @catering_type, notice: 'Catering type was successfully updated.' }
format.json { render :show, status: :ok, location: @catering_type }
format.js
else
format.html { ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n if @crate_type.update_attributes(params[:crate_type])\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html... | [
"0.68819696",
"0.66336733",
"0.6630757",
"0.6530756",
"0.6502213",
"0.6498627",
"0.6482762",
"0.6454773",
"0.64467454",
"0.6426874",
"0.6402131",
"0.63847667",
"0.6379806",
"0.6358618",
"0.6347659",
"0.63447785",
"0.6339789",
"0.63335925",
"0.63310945",
"0.6315845",
"0.631446... | 0.66511613 | 1 |
DELETE /catering_types/1 DELETE /catering_types/1.json | def destroy
@catering_type.destroy
respond_to do |format|
format.html { redirect_to catering_types_url, notice: 'Catering type was successfully destroyed.' }
format.json { head :no_content }
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n res... | [
"0.7436794",
"0.7337353",
"0.7326712",
"0.72439325",
"0.7212283",
"0.71921307",
"0.7181674",
"0.7171985",
"0.7156894",
"0.71520746",
"0.7139905",
"0.7137129",
"0.7110969",
"0.71058595",
"0.7102402",
"0.7100877",
"0.7077879",
"0.70636034",
"0.70288956",
"0.7026591",
"0.7011426... | 0.7035827 | 18 |
Use callbacks to share common setup or constraints between actions. | def set_catering_type
@catering_type = CateringType.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def catering_type_params
params.require(:catering_type).permit(:name,:icon)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
optional filters for defining usage according to Caseadilla::AdminUser access_levels before_filter :needs_admin, :except => [:action1, :action2] before_filter :needs_admin_or_current_user, :only => [:action1, :action2] | def index
@caseadilla_page_title = 'Roles'
@roles = Role.order(sort_order(:title)).paginate :page => params[:page]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n curre... | [
"0.73191154",
"0.6940093",
"0.68974847",
"0.68102795",
"0.68102795",
"0.68102795",
"0.6757148",
"0.6677361",
"0.66517717",
"0.65912205",
"0.6576176",
"0.65699214",
"0.65238863",
"0.6514225",
"0.6473443",
"0.6460975",
"0.6460223",
"0.63796353",
"0.6371517",
"0.63588774",
"0.63... | 0.0 | -1 |
This should return the minimal set of values that should be in the session in order to pass any filters (e.g. authentication) defined in DeploymentRequestsController. Be sure to keep this updated too. | def valid_session
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_session_variables_from_authenticated_system\n @return_to_query = session[:return_to_query] || params[:return_to_query]\n @return_to = session[:return_to] || params[:return_to]\n @previous_protocol = session[:previous_protocol] || params[:previous_protocol]\n session[:return_to_query] = session[... | [
"0.62266153",
"0.60020083",
"0.5972401",
"0.5972401",
"0.59316844",
"0.58950037",
"0.58919954",
"0.5878516",
"0.58447033",
"0.58248883"
] | 0.0 | -1 |
returns whether a piece can move into the square. | def is_legal?(pos)
# checks if there is a piece in the spot and whether it is the same
# color. Also checks if it is off of the board.
return false unless pos[0].between?(0, 7) && pos[1].between?(0, 7)
return true if board[pos.first][pos.last].nil?
return false if self.color == board[pos.first][po... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def legal_move? piece, square\n if square.piece.nil? || square.piece.color != piece.color\n case piece.symbol\n\n when \"♟︎\", \"♙\"\n # Return true if square is adjacent and in the correct direction for pawn of that color\n pawn_move?(piece, square)\n ... | [
"0.7994726",
"0.7882302",
"0.7819958",
"0.76977843",
"0.7690173",
"0.7686985",
"0.76541966",
"0.76467156",
"0.7623653",
"0.75798774",
"0.75079376",
"0.7444008",
"0.74174124",
"0.7411458",
"0.7382944",
"0.7378596",
"0.7377129",
"0.7336335",
"0.73247135",
"0.73089266",
"0.73066... | 0.6979528 | 56 |
render custom templates because of the ajax file upload plugin being used | def create
max_photos = @listing.premium? ? Listing::MAX_PREMIUM_PHOTOS : Listing::MAX_FREE_PHOTOS
@portfolio_photo = @listing.portfolio_photos.new(params[:portfolio_photo])
if @listing.can_add_photos? && @portfolio_photo.save
render 'create', status: :ok, formats: [:html]
elsif !@listing.can... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_document\n render template: \"/dash/chooser/upload_document\"\n end",
"def upload\n @direct_upload_url = params[:direct_upload_url]\n respond_to do |format|\n format.js { render template: \"#{website.folder}/module_requests/upload.js\", layout: false }\n end # respond_to do |format... | [
"0.68454957",
"0.6840182",
"0.67839885",
"0.6554694",
"0.6466049",
"0.6458904",
"0.6435094",
"0.6435094",
"0.6371079",
"0.63346",
"0.6273868",
"0.62628895",
"0.622743",
"0.622743",
"0.62034124",
"0.61890984",
"0.6181122",
"0.6178875",
"0.61785424",
"0.6141574",
"0.6132983",
... | 0.0 | -1 |
Are we interested in Chef's cloning behavior here? | def load_prior_resource(*args)
Chef::Log.debug("Overloading #{resource_name}.load_prior_resource with NOOP")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_clone\n raise CommandNotImplemented\n end",
"def remote_clone\n raise CommandNotImplemented\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def clone\n end",
"def clone; end",
"def clone; end",
"def clone; end",
"def clone() end",
"def clone(*) end",
... | [
"0.72333515",
"0.71439487",
"0.6951438",
"0.6951438",
"0.6951438",
"0.68534607",
"0.68123436",
"0.68123436",
"0.68123436",
"0.67719835",
"0.662844",
"0.662844",
"0.6578265",
"0.6510702",
"0.64277905",
"0.6386371",
"0.63269734",
"0.6316223",
"0.62701046",
"0.6222009",
"0.62095... | 0.0 | -1 |
Making "internal" methods private is not required, but is a common practice. This helps make clear which methods respond to requests, and which ones do not. | def movie_params
params.require(:movie).permit(:title, :rating, :description, :release_date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def a_private_method\n end",
"def a_private_method\n\tend",
"def private_method\n end",
"def private_method; end",
"def private_method\n\tend",
"def private_method\n\tend",
"def private_methods(all=true) end",
"def internal_methods; end",
"def private_method\n end",
"def method_missing(wh,... | [
"0.8135907",
"0.81090254",
"0.7902069",
"0.78968406",
"0.7852156",
"0.7852156",
"0.7723575",
"0.76517266",
"0.7301688",
"0.7293984",
"0.72685695",
"0.68420327",
"0.6794574",
"0.67701185",
"0.670823",
"0.66595477",
"0.66441333",
"0.66441",
"0.66277796",
"0.662052",
"0.64736235... | 0.0 | -1 |
function : store_answers save answers params : userChoiceData, userId | def store_answers
@user_choice = params[:userChoiceData]
@user_data = params[:userId]
is_save = AnswerService.store_answers(@user_choice, @user_data)
if is_save
render json: @answer, status: :created, location: @answer
else
render json: @answer.errors, status: :unprocessable_entity
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @answers = params[:user_answers]\n @answers.each do |key, value|\n UserAnswer.create(:user_id => current_user.id, :survey_question_id => key.to_i, :text => value)\n end\n redirect_to :root\n end",
"def sync_user_answers\n return head :ok if params[:user_answers].blank?\n\n ... | [
"0.71911615",
"0.7162919",
"0.68854094",
"0.6820874",
"0.67241126",
"0.66731006",
"0.6653792",
"0.6618571",
"0.66156524",
"0.66112417",
"0.6535824",
"0.6533033",
"0.65302366",
"0.65133333",
"0.6511127",
"0.6482035",
"0.646881",
"0.6466451",
"0.6466451",
"0.646126",
"0.6445529... | 0.859267 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_answer
@answer = Answer.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def answer_params
# Rails.logger.debug "Params: #{params.inspect}"
params.require(:answers).permit(:answer, :updated_at, :users_id, :questions_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.6950644",
"0.68134046",
"0.68034387",
"0.6796522",
"0.674668",
"0.6742105",
"0.6527854",
"0.65214247",
"0.6491907",
"0.64294493",
"0.64294493",
"0.64294493",
"0.64004904",
"0.6356768",
"0.63556653",
"0.6348119",
"0.6344521",
"0.63386923",
"0.632588",
"0.632588",
"0.632588"... | 0.0 | -1 |
Check if a transient renewal already exists for this registration so we don't have multiple renewals in progress at once | def no_renewal_in_progress?
return unless RenewingRegistration.where(reg_identifier: reg_identifier).exists?
errors.add(:reg_identifier, :renewal_in_progress)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def will_renew?\n auto_renew_status == 1\n end",
"def needs_renewal?\n file_name = Gitlab['nginx']['ssl_certificate']\n return false unless File.exist? file_name\n\n cert = OpenSSL::X509::Certificate.new File.read(file_name)\n\n cert.issuer.to_s =~ LETSENCRYPT_ISSUER && cert.n... | [
"0.63328767",
"0.6322554",
"0.61998653",
"0.61322105",
"0.58465844",
"0.58243775",
"0.5807326",
"0.5801304",
"0.5688292",
"0.5625111",
"0.56002563",
"0.5596082",
"0.55767906",
"0.55385184",
"0.55346656",
"0.55324376",
"0.55301964",
"0.5516683",
"0.5512151",
"0.5511899",
"0.54... | 0.74933034 | 0 |
Advanced extenstions for some reason my test cant find this matching method | def can_whoohoo(song, room)
add_song(room)
for pref_song in song
if pref_song == song
p "Whoohoo!"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spec; end",
"def spec; end",
"def should; super end",
"def submatchers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def extended(*) end",
"def expected_method; end",
"def matcher; end",
"def matcher; end",
"def test_added_methods\r\n assert_resp... | [
"0.65358704",
"0.65358704",
"0.64927363",
"0.6467169",
"0.6398709",
"0.6398709",
"0.6398709",
"0.6398709",
"0.63342774",
"0.6275201",
"0.62391293",
"0.62391293",
"0.62166786",
"0.61982965",
"0.6197782",
"0.6196908",
"0.6143136",
"0.6117247",
"0.61102843",
"0.61102843",
"0.605... | 0.0 | -1 |
Assumption/ Given: All numbers in the matrix are 0s or 1s If any number is found to be 0, the method updates all the numbers in the corresponding row as well as the corresponding column to be 0. | def matrix_convert_to_0(matrix)
rows = matrix.length
columns = matrix[0].length
track_zeros = []
rows.times do |row|
columns.times do |column|
if matrix[row][column] == 0
track_zeros << [row, column]
end
end
end
track_zeros.length.times do |index|
columns.times do |column|... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_zeroes(matrix)\n marked_rows = []\n marked_cols = []\n\n matrix.each_with_index do |row_arr, row_idx|\n row_arr.each_with_index do |cell, col_idx|\n if cell == 0\n marked_rows << row_idx unless marked_rows.include?(row_idx)\n marked_cols << col_idx unless marked_cols.include?(col_i... | [
"0.80585116",
"0.79499316",
"0.79478383",
"0.778601",
"0.77117926",
"0.770811",
"0.77043295",
"0.7597463",
"0.75931734",
"0.7568465",
"0.7559353",
"0.74963707",
"0.7485717",
"0.7451508",
"0.7393841",
"0.73889863",
"0.73715043",
"0.73696357",
"0.73631144",
"0.7310175",
"0.7300... | 0.7434541 | 14 |
GET /abouts GET /abouts.json | def index
@article = Article.where(url: 'about').first
@welcome = Article.where(url: 'welcome').first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end",
"def show\n @about_page = AboutPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.... | [
"0.7273136",
"0.6638571",
"0.654847",
"0.64319754",
"0.641733",
"0.6353092",
"0.63524413",
"0.63485974",
"0.62489086",
"0.6192875",
"0.61013925",
"0.60886025",
"0.6082991",
"0.6073454",
"0.60523045",
"0.6046525",
"0.6022415",
"0.6001637",
"0.59910446",
"0.59899867",
"0.597883... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def price_params
params.require(:price).permit(:avg_price)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Get one or more (amount) month grids. | def month_list(date, limit: 1)
month_list = []
(0 ... limit).each { |t| month_list.push month(date + t.month) }
month_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_months\n \n @months = RiverEvents::Month.all\n end",
"def make_month_stats(month)\n rows = Account.all(:order => \"position\").map{|account|\n items = Item.all(:conditions => {\n :account_id => account.id,\n :date => month_range(month), \n :type => [\"Expense... | [
"0.6304741",
"0.62941736",
"0.60856974",
"0.59392434",
"0.59281605",
"0.5830169",
"0.5784799",
"0.57731533",
"0.57494706",
"0.5661366",
"0.5645126",
"0.5625083",
"0.56221265",
"0.561642",
"0.5594148",
"0.55473715",
"0.55465126",
"0.55463064",
"0.55321515",
"0.5527194",
"0.552... | 0.5757946 | 8 |
Get month interval for month date. | def month_days_interval(first_month_day)
last_month_day = first_month_day.end_of_month
first_week_day = first_month_day.beginning_of_week(:monday)
last_week_day = last_month_day.end_of_week(:monday)
while (last_week_day - first_week_day).to_i + 1 < DAYS_PER_MONTH
last_week_day = last_week_day + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_number_of_month(m)\n (1..is_leap?[adjust_set_month(m)]).to_a\n end",
"def months() 30 * days end",
"def month\n self.range('month')\n end",
"def month_range(month, year)\n next_month = month == 12 ? 1 : month + 1\n next_year = month == 12 ? year + 1 : year\n Date.new(year... | [
"0.6745975",
"0.66730136",
"0.66112036",
"0.66022",
"0.6509088",
"0.6492179",
"0.6467563",
"0.6461768",
"0.6461768",
"0.6448727",
"0.6437713",
"0.64018005",
"0.6359647",
"0.6356627",
"0.63294995",
"0.632922",
"0.632922",
"0.63225734",
"0.6321734",
"0.63196236",
"0.62868255",
... | 0.6975157 | 0 |
Takes an array of daily stock prices and finds the range that would yield the maximum profit if you were to buy the stock at the beginning and sell at the end. For a price array of [10,1,5,7,6,1] the result would be [1,4] as buying in at a price of 1$ and selling at 6$ yields the largest return. | def stock_picker(price_arr)
profit = 0
# Handles edge case of first price being a low point
if price_arr[0] < price_arr[1]
if price_arr.max - price_arr[0] > profit
profit = price_arr.max - price_arr[0]
best_range = [0, price_arr.index(price_arr.max)]
end
end
#fin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_profit(prices)\n max = 0\n min = (2**(0.size * 8 -2) -1)\n\n prices.each do |price|\n if price < min\n min = price\n else\n max = [max, price - min].max\n end\n end\n\n max\nend",
"def max_profit(prices)\n max_profit = 0\n min_price = prices[0]\n \n prices.each do |pri... | [
"0.831443",
"0.8085606",
"0.80801463",
"0.80664206",
"0.8040127",
"0.8028627",
"0.8006195",
"0.7986815",
"0.7972271",
"0.79286754",
"0.7912418",
"0.7896904",
"0.78792673",
"0.7874209",
"0.7857147",
"0.78481615",
"0.7831195",
"0.78207463",
"0.78158593",
"0.7811808",
"0.7810324... | 0.789934 | 11 |
setting the initial status of a question | def set_initial_status
if self.status.blank?
self.status = "unsolved"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def for_new_question\n @for_new_question ||= false\n end",
"def set_initial_status\n \tself.status = \"waiting\"\n end",
"def set_correct_answer\r\n set_question_and_answer\r\n @answer.correct = 1\r\n save_answer_and_render\r\n end",
"def set_question\n\t\t\t@question = Question.find(params[:... | [
"0.6759687",
"0.6676038",
"0.64893144",
"0.628298",
"0.628298",
"0.628298",
"0.62693125",
"0.62635785",
"0.62635785",
"0.6256628",
"0.6244037",
"0.6205856",
"0.61889434",
"0.6177802",
"0.6164686",
"0.614422",
"0.6143816",
"0.6143816",
"0.6143816",
"0.6143816",
"0.6143816",
... | 0.68223983 | 0 |
associates the question as being asked from a specific company or community | def associate_member_with_community
self.community.members << self.member unless self.community.members.include? self.member
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_question_to_campaign\n return if campaign.questions.include?(question)\n campaign.substitution_questions << question\n end",
"def ask(question, context, to, jid_user)\n puts \"Bot: #{question}\"\n @questions[to]=context\n end",
"def ask_questionaire\n alert_reserved_and_ex... | [
"0.65080476",
"0.62543386",
"0.6226444",
"0.6089308",
"0.5937773",
"0.5910637",
"0.58855593",
"0.58833903",
"0.57930624",
"0.57867825",
"0.5782698",
"0.57512033",
"0.5744761",
"0.57086676",
"0.57012874",
"0.5646393",
"0.564497",
"0.56061184",
"0.5600844",
"0.5578913",
"0.5559... | 0.0 | -1 |
Get users from all membership (including nested user groups) | def users
users = []
members.each do |member|
if member.is_a? User
users << member
elsif member.is_a? UserGroup
users + member.users
else
raise UserGroupException, "While retrieving users from a user group (#{self}), found a member that was not a User or UserGroup recor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def memberships_users\n group_ids_select = memberships.select(:user_id).where(user_type: 'Group')\n\n User.where('id IN (:user_ids) OR id IN (:group_owner_ids)',\n user_ids: memberships.select(:user_id).where(user_type: 'User'),\n group_owner_ids: Group.where(id: group_ids_selec... | [
"0.7534453",
"0.73863876",
"0.73716956",
"0.7219998",
"0.70756656",
"0.70098567",
"0.6994174",
"0.6905192",
"0.6773984",
"0.6772081",
"0.6666818",
"0.6483067",
"0.647092",
"0.6453258",
"0.64368874",
"0.6427235",
"0.6413384",
"0.64032376",
"0.64025694",
"0.6399715",
"0.637302"... | 0.7383454 | 2 |
Returns an array of tas option hashes | def tas_params(_environment_id = nil)
[{ title: "User",
model_name: "user_group",
attribute_name: "user_ids",
select_title: "Select a new member",
options: User.all.collect { |u| [u.username, u.id] },
selected_options: user_ids }]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def option_keys\n []\n end",
"def options\n self.items\n itemsArr = @items.keys\n @options = []\n for i in 1..(items.length) do\n @options = @options + itemsArr.combination(i).to_a\n end\n @options\n end",
"def get_options()\n\n all_options = []\n\n @raw.raw_options.each do |s... | [
"0.67652315",
"0.67060447",
"0.64903337",
"0.6413724",
"0.6413724",
"0.6389137",
"0.62537545",
"0.62503594",
"0.624229",
"0.6196416",
"0.61084116",
"0.6092388",
"0.6052116",
"0.6037835",
"0.60082",
"0.59941095",
"0.5988958",
"0.59753424",
"0.59633833",
"0.59633833",
"0.595169... | 0.0 | -1 |
Takes a name attribute and returns a valid shortname attribute | def conform_name_to_shortname(name = nil)
name ||= self.name
name.to_s.downcase.strip.gsub(/[^a-z0-9]+/, "-").gsub(/^-|-$/, "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortname\n attributes['shortName']\n end",
"def short_name\n @short_name ||= name.to_s.split('').shift\n end",
"def shortname\n @shortname.nil? ? @name : @shortname\n end",
"def shortname\n name.downcase.gsub(/[^a-z]/, \"-\")\n end",
"def shortname\n name.downcase.gs... | [
"0.81514996",
"0.76696163",
"0.7391221",
"0.73742825",
"0.7298566",
"0.721649",
"0.72131634",
"0.7153927",
"0.7151752",
"0.7112378",
"0.7112378",
"0.7006623",
"0.6954647",
"0.6941616",
"0.693321",
"0.68982416",
"0.6840832",
"0.6837856",
"0.67233807",
"0.66506106",
"0.66467696... | 0.71335995 | 10 |
Overwrite the default name setter to add shortname attribute when creating a name | def name=(value)
self.shortname = conform_name_to_shortname(value)
write_attribute(:name, value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name=(value)\n self.shortname = conform_name_to_shortname(value)\n write_attribute(:name,value)\n end",
"def name=(value)\n self.shortname = conform_name_to_shortname(value)\n write_attribute(:name,value)\n end",
"def name_setter(new_name)\n @name = new_name\n end",
"def set_full_name\n... | [
"0.7875028",
"0.7875028",
"0.73948586",
"0.73844886",
"0.73588264",
"0.73493713",
"0.7230511",
"0.7145227",
"0.71425796",
"0.7140013",
"0.713252",
"0.711408",
"0.711408",
"0.7101772",
"0.7074554",
"0.7051045",
"0.70477706",
"0.7047053",
"0.700581",
"0.7000784",
"0.6989024",
... | 0.785465 | 3 |
Give a principal ID and return a principal record | def get_principal(principal_id)
if principal_id =~ /(.+)-(\d+)/
if Regexp.last_match(1).classify == UserGroup.to_s
UserGroup.find(Regexp.last_match(2))
elsif Regexp.last_match(1).classify == User.to_s
User.find(Regexp.last_match(2))
else
Exception.new("Invalid principal typ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def principal_id\n return @principal_id\n end",
"def principal_id\n return @principal_id\n end",
"def get_principal\n @principal = Principal.active.first\n end",
"def principal_id\n self.class.to_s + \"-#{id}\"\n end",
"def principal_id=(value)\n ... | [
"0.72882473",
"0.72882473",
"0.7223332",
"0.70674855",
"0.67117965",
"0.67117965",
"0.6661488",
"0.65946317",
"0.65594196",
"0.65079623",
"0.65079623",
"0.6149479",
"0.5967819",
"0.59592974",
"0.59015304",
"0.59015304",
"0.58931994",
"0.58868665",
"0.5809438",
"0.577297",
"0.... | 0.6767318 | 4 |
All principals, including all users and all user groups within self.unit. Return records sorted alphabetically. | def all_principals
(User.all + UserGroup.where_unit(unit).not(self)).sort { |a, b| a.name.downcase <=> b.name.downcase }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n \n @allPeople = User.all.order('name ASC')\n @allNonUser = NonUser.all.order('name ASC')\n @allVets = Veterinarian.all.order('name ASC')\n @allTrainer = Trainer.all.order('name ASC')\n @allAniFaci = AnimalFacility.all.order('name ASC')\n user = User.all.order('name ASC')\n end",
"... | [
"0.58861417",
"0.5833678",
"0.5780454",
"0.5618736",
"0.5443237",
"0.54278505",
"0.541117",
"0.53940135",
"0.5391644",
"0.5376905",
"0.53723526",
"0.53362656",
"0.5328701",
"0.5316494",
"0.53088206",
"0.5268796",
"0.5268181",
"0.5264093",
"0.5255481",
"0.51936334",
"0.5188383... | 0.7631755 | 0 |
====================================================================================== HAPPYMORE'S CODE: [5 May 2009 Changes]: Happymore changed the carton_search method to use the generic search_engine's method to render the search engine's form instead of the previous go to search form for cartons. Happymore used the... | def carton_search
# render :inline => %{
# <% @content_header_caption = "'search cartons'"%>
#
# <%= build_carton_search_form()%>
#
# }, :layout => 'content'
dm_session[:redirect] = true
dm_session['se_layout'] = 'content'
@content_header_caption = 'search cartons'
buil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_cartons\n \n render :inline => %{\n\t\t<% @content_header_caption = \"'find cartons'\"%> \n\n\t\t<%= build_carton_search_form()%>\n\n\t\t}, :layout => 'content'\n \n end",
"def build_bins_tipped_search_form(bin_tipped, action, caption, is_flat_search = nil, is_multi_select = nil)\n #@bin_tip... | [
"0.73916805",
"0.61106026",
"0.5941012",
"0.58594596",
"0.5768568",
"0.57468617",
"0.5630385",
"0.5546627",
"0.5514358",
"0.5500035",
"0.54914254",
"0.5487714",
"0.54789007",
"0.54758793",
"0.54511255",
"0.540325",
"0.5401347",
"0.5362509",
"0.53624547",
"0.53587466",
"0.5338... | 0.80126506 | 0 |
============ RECEIVE CODE ============ | def receive_carton
render :inline => %{
<% @content_header_caption = "'receive reworks items'"%>
<%= build_receive_item_form("receive_carton_submit","receive","carton_number")%>
<script>
document.getElementById('received_item_carton_number').focus();
</script>
}, :layout => 'content'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(s, id)\n out = [MESSAGE_GET, id].pack(\"II\")\n s.write(out)\n\n # Type (don't care)\n get_int(s)\n\n # Length\n len = get_int(s)\n\n #puts(\"Retrieving #{len} bytes\")\n data = s.recv(len)\n\n # It should end with this code\n receive_code(s, 0x00001004, \"get\")\n\n return data\n\nend",
"def ... | [
"0.7271592",
"0.71806705",
"0.7088674",
"0.6942748",
"0.6767478",
"0.6750344",
"0.67450786",
"0.67450786",
"0.66955125",
"0.6540215",
"0.6486006",
"0.6462114",
"0.63573897",
"0.6341296",
"0.6327838",
"0.6327838",
"0.63119364",
"0.6289633",
"0.6282427",
"0.62474394",
"0.623799... | 0.0 | -1 |
======================== OBSERVER HANDLERS ======================== | def cpc_changed
session[:selected_cpc]= get_selected_combo_value(params)
set_calculated_mass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handler; end",
"def handler; end",
"def handlers; end",
"def handlers; end",
"def handlers; end",
"def handle; end",
"def process_response(obj)\n end",
"def receive_object obj\n # stub\n end",
"def handler_method; end",
"def handle\n end",
"def server(&blk); end",
"def s... | [
"0.66417074",
"0.66417074",
"0.65780175",
"0.65780175",
"0.65780175",
"0.63904256",
"0.63255703",
"0.61259663",
"0.60816056",
"0.6047472",
"0.59902084",
"0.59902084",
"0.5801145",
"0.5792792",
"0.57521236",
"0.5742628",
"0.5721074",
"0.5713398",
"0.56670797",
"0.5666967",
"0.... | 0.0 | -1 |
========================== Luks' code ========= ========================== | def receive_tipped_bins
search_bins_tipped_hierarchy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def schubert; end",
"def probers; end",
"def refutal()\n end",
"def malts; end",
"def suivre; end",
"def lsi; end",
"def weber; end",
"def rossini; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def villian; end",
"def blg; end"... | [
"0.7354549",
"0.6565744",
"0.6471833",
"0.63124806",
"0.62814194",
"0.6274955",
"0.62744",
"0.62588406",
"0.62540644",
"0.624293",
"0.624293",
"0.624293",
"0.624293",
"0.6228696",
"0.6169144",
"0.61621433",
"0.6133903",
"0.6131996",
"0.607128",
"0.60569674",
"0.6045856",
"0... | 0.0 | -1 |
search combo_changed event handlers for the unique index on this table(bins_tipped) | def bins_tipped_production_schedule_name_search_combo_changed
production_schedule_name = get_selected_combo_value(params)
session[:bins_tipped_search_form][:production_schedule_name_combo_selection] = production_schedule_name
@production_run_codes = BinsTipped.find_by_sql("select distinct production_run_cod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_bins_tipped_search_form(bin_tipped, action, caption, is_flat_search = nil, is_multi_select = nil)\n #@bin_tipped = BinsTipped.new\n #@bin_tipped.tipped_in_reworks = nil\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine an observer for ... | [
"0.58245635",
"0.5622936",
"0.53455037",
"0.5183998",
"0.5165807",
"0.5054206",
"0.5017277",
"0.49900544",
"0.49895707",
"0.49611065",
"0.4947167",
"0.4943379",
"0.49385956",
"0.48864558",
"0.4880216",
"0.4877468",
"0.48295042",
"0.4800231",
"0.47981423",
"0.4789612",
"0.4785... | 0.5162776 | 5 |
use the parent appliactions layout simple methor to delegate missing path helper to the main app a bit of a hack | def method_missing method, *args, &block
method.to_s.end_with?('_path', '_url') and main_app.respond_to?(method) ? main_app.send(method, *args) : super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_in_layout?; end",
"def place_in_layout?; end",
"def resolve_layout\n case action_name\n when \"edit\"\n \"editlayout\"\n when \"show_image\"\n \"application_png\"\n else\n \"application\"\n end\n end",
"def set_vie... | [
"0.66306305",
"0.66306305",
"0.6397958",
"0.6289957",
"0.6286146",
"0.622919",
"0.61815083",
"0.61815083",
"0.61266696",
"0.6121094",
"0.60759515",
"0.60291505",
"0.6012037",
"0.5973608",
"0.59721595",
"0.5962758",
"0.5930503",
"0.5930503",
"0.5930503",
"0.59170014",
"0.59159... | 0.5430311 | 75 |
GET /currencies GET /currencies.json | def index
@currencies = Currency.order('currencies.name asc')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_currencies\n response_xml = http_get(@client, \"#{xero_url}/Currencies\")\n parse_response(response_xml, {}, {:request_signature => 'GET/currencies'})\n end",
"def supported_currencies\n get 'simple/supported_vs_currencies'\n end",
"def get_currencies_with_http_info(opts = {})\... | [
"0.80505896",
"0.7732985",
"0.7371407",
"0.7322576",
"0.725598",
"0.72487366",
"0.7211608",
"0.7211608",
"0.71403205",
"0.71397",
"0.70704395",
"0.69565403",
"0.6951001",
"0.688252",
"0.68525153",
"0.68391013",
"0.67918295",
"0.6777153",
"0.67616695",
"0.67575806",
"0.6757438... | 0.58980554 | 81 |
GET /currencies/1 GET /currencies/1.json | def show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_currencies\n response_xml = http_get(@client, \"#{xero_url}/Currencies\")\n parse_response(response_xml, {}, {:request_signature => 'GET/currencies'})\n end",
"def show\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.... | [
"0.7460089",
"0.73086417",
"0.7293503",
"0.7186989",
"0.7185397",
"0.71244717",
"0.71180326",
"0.71180326",
"0.704543",
"0.7008445",
"0.69465375",
"0.6771911",
"0.6731562",
"0.66913915",
"0.6688981",
"0.6657626",
"0.663562",
"0.6632888",
"0.65825814",
"0.653668",
"0.6486737",... | 0.0 | -1 |
POST /currencies POST /currencies.json | def create
@find_currency = Currency.find_by(name: currency_params[:name])
if @find_currency.nil?
@currency = Currency.new(currency_params)
if @currency.save
render json: index
else
render json: @currency.errors, status: :unprocessable_entity
end
else
@find_curr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @currency = Currency.new(params[:currency])\n\n respond_to do |format|\n if @currency.save\n format.html { redirect_to @currency, notice: 'Currency was successfully created.' }\n format.json { render json: @currency, status: :created, location: @currency }\n else\n ... | [
"0.68200094",
"0.67826843",
"0.6711558",
"0.65830034",
"0.656766",
"0.64766395",
"0.6415453",
"0.64109814",
"0.6287212",
"0.62661844",
"0.6168001",
"0.61541194",
"0.611254",
"0.607718",
"0.6061881",
"0.6061235",
"0.6044119",
"0.6043232",
"0.6026303",
"0.60148823",
"0.60050416... | 0.5911885 | 22 |
PATCH/PUT /currencies/1 PATCH/PUT /currencies/1.json | def update
if @currency.update(currency_params)
render :show, status: :ok
else
render json: @currency.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @currency = Currency.find(params[:id])\n\n respond_to do |format|\n if @currency.update_attributes(params[:currency])\n format.html { redirect_to @currency, notice: 'Currency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ren... | [
"0.6945826",
"0.69057995",
"0.6826684",
"0.67598516",
"0.6679917",
"0.66279656",
"0.662223",
"0.66174245",
"0.64784575",
"0.64622945",
"0.6425376",
"0.6199565",
"0.6185276",
"0.61251163",
"0.6083999",
"0.6066276",
"0.6042872",
"0.5987949",
"0.5980779",
"0.59788454",
"0.597858... | 0.6760233 | 3 |
DELETE /currencies/1 DELETE /currencies/1.json | def destroy
if @currency.destroy
json_response({ success: true, message: 'The currency was deleted' })
else
json_response({ success: false, message: @contact.errors }, :unprocessable_entity)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @currency.destroy\n respond_to do |format|\n format.html { redirect_to currencies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @currency.destroy\n respond_to do |format|\n format.html { redirect_to currencies_url, notice: 'Currency was success... | [
"0.7691959",
"0.7416886",
"0.73983914",
"0.7303468",
"0.72561586",
"0.7249605",
"0.724899",
"0.72182393",
"0.69064647",
"0.6900719",
"0.6853647",
"0.6792145",
"0.67761254",
"0.67634815",
"0.6726836",
"0.67237437",
"0.67151207",
"0.6714023",
"0.66574043",
"0.66535884",
"0.6648... | 0.6631051 | 22 |
Use callbacks to share common setup or constraints between actions. | def set_currency
@currency = Currency.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def currency_params
params.require(:currency).permit(:name, :code, :symbol, :kind, :decimal_places, :fx_eur)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
This returns an array of arrays AKA: it returns the game state | def evolve
neighbors_array = Array.new
next_state = @state.clone
0.upto(@state.length - 1){|row|
neighbors_array << Array.new(size=@state.length)
}
0.upto(@state.length - 1){|row|
0.upto(@state.length - 1){|col|
neighbor_count = 0
for i in (-1..1)
(row + i >... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_array\n %w(AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY)\nend",
"def current_board_state(brd) # returns nested arrays of each winning line and their state.\n current_state_of_lines = []\n WINN... | [
"0.71440774",
"0.71346873",
"0.6910554",
"0.6910554",
"0.68736863",
"0.6868837",
"0.6833226",
"0.68308616",
"0.6796879",
"0.67918",
"0.67778355",
"0.67563516",
"0.6646385",
"0.6593037",
"0.6549421",
"0.6542814",
"0.6529026",
"0.64955646",
"0.6462102",
"0.64407533",
"0.6422297... | 0.0 | -1 |
Overriding friendly id's sluggin mechanism, using our own | def manage_slug
self.slug = self.title.parameterize if self.slug.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slug_base_string\n self.id || sluggify\n end",
"def friendly_id\n slug(true).to_friendly_id\n end",
"def normalize_friendly_id(slug_str)\n super.gsub(\"-\", \"\")\n end",
"def normalize_friendly_id(string)\n if slug.blank?\n super\n else\n super(slug)\n end\n end",
"def ... | [
"0.840177",
"0.8341248",
"0.8010503",
"0.800939",
"0.7958395",
"0.79405475",
"0.7939085",
"0.78887194",
"0.78492004",
"0.7810437",
"0.76924235",
"0.76917833",
"0.76668537",
"0.76636034",
"0.76533806",
"0.76533806",
"0.7618482",
"0.7606085",
"0.75948054",
"0.7578857",
"0.75788... | 0.73158365 | 44 |
GET /sundays GET /sundays.json | def index
@sundays = Sunday.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dates\n render json: @standings\n end",
"def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end",
"def index\n if params[:date]\n redirect_date(params[:date])\n else\n @school_d... | [
"0.6038636",
"0.5973804",
"0.5972794",
"0.59056914",
"0.573311",
"0.5715174",
"0.57011473",
"0.56909883",
"0.5621114",
"0.56151944",
"0.5602706",
"0.5598711",
"0.55844754",
"0.55683047",
"0.5567596",
"0.5557989",
"0.5504108",
"0.5476092",
"0.54756474",
"0.5471367",
"0.5446046... | 0.6888144 | 0 |
GET /sundays/1 GET /sundays/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sundays = Sunday.all\n end",
"def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end",
"def show\n @closing_day = ClosingDay.find(params[:id])\n\n respond_to do |format|\n forma... | [
"0.66710716",
"0.6081332",
"0.59222025",
"0.59142494",
"0.5856339",
"0.5762975",
"0.5754645",
"0.57126296",
"0.56668365",
"0.5664638",
"0.56493044",
"0.56475866",
"0.56464964",
"0.56411314",
"0.5611607",
"0.55882645",
"0.556656",
"0.5546457",
"0.55377764",
"0.5531077",
"0.550... | 0.0 | -1 |
POST /sundays POST /sundays.json | def create
@sunday = Sunday.new(sunday_params)
respond_to do |format|
if @sunday.save
format.html { redirect_to @sunday, notice: 'Sunday was successfully created.' }
format.json { render :show, status: :created, location: @sunday }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @closing_day = ClosingDay.new(params[:closing_day])\n\n respond_to do |format|\n if @closing_day.save\n format.html { redirect_to @closing_day, notice: 'Closing day was successfully created.' }\n format.json { render json: @closing_day, status: :created, location: @closing_day... | [
"0.5929283",
"0.580052",
"0.57273805",
"0.5694854",
"0.56644183",
"0.566375",
"0.56588995",
"0.5655362",
"0.5632172",
"0.5621429",
"0.55414695",
"0.55377185",
"0.5509401",
"0.5476865",
"0.54728967",
"0.5471659",
"0.54394996",
"0.5427154",
"0.54196733",
"0.5410891",
"0.5406568... | 0.6298437 | 0 |
PATCH/PUT /sundays/1 PATCH/PUT /sundays/1.json | def update
respond_to do |format|
if @sunday.update(sunday_params)
format.html { redirect_to @sunday, notice: 'Sunday was successfully updated.' }
format.json { render :show, status: :ok, location: @sunday }
else
format.html { render :edit }
format.json { render json: @su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @essay = Essay.find(params[:id])\n\n respond_to do |format|\n if @essay.update_attributes(params[:essay])\n format.html { redirect_to @essay, notice: 'Essay was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.6305839",
"0.62914073",
"0.6114226",
"0.6092384",
"0.60774136",
"0.6066302",
"0.6063706",
"0.60587025",
"0.6036466",
"0.6035907",
"0.6026401",
"0.60065967",
"0.59946907",
"0.5968293",
"0.5959527",
"0.59301126",
"0.591639",
"0.590186",
"0.5897041",
"0.58941627",
"0.5873526"... | 0.6583633 | 0 |
DELETE /sundays/1 DELETE /sundays/1.json | def destroy
@sunday.destroy
respond_to do |format|
format.html { redirect_to sundays_url, notice: 'Sunday was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @weekday = Weekday.find(params[:id])\n @weekday.destroy\n\n respond_to do |format|\n format.html { redirect_to weekdays_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @essay = Essay.find(params[:id])\n @essay.destroy\n\n respond_to do |format|\n f... | [
"0.6988496",
"0.6944382",
"0.69022465",
"0.689663",
"0.68371856",
"0.6802645",
"0.67901134",
"0.67252976",
"0.6703713",
"0.670039",
"0.66818124",
"0.66719425",
"0.66690755",
"0.666529",
"0.6659567",
"0.6640064",
"0.66200805",
"0.6606339",
"0.65909237",
"0.658815",
"0.6582047"... | 0.7403677 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_sunday
@sunday = Sunday.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def sunday_params
params.require(:sunday).permit(:issue_id, :date, :entry, :mantra, :moon_sign, :theme, :number_1, :number_2, :number_3)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Adds any files (such as an install script) required by the installer to the list of files the config_generator will transfer to the remote host. The actual transfer happens in a later step. Must be implemented by subclasses. | def setup_files(config_generator)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_remote_config_files\n (config_files || []).each do |file|\n filename, file_uri = file.split(\"::\")\n if file_uri.nil?\n file_uri = filename\n filename = File.basename(file_uri)\n end\n\n file_uri = File.expand_path(file_uri) if URI.parse(file_uri).scheme... | [
"0.68486166",
"0.63661844",
"0.5988251",
"0.5967651",
"0.5917538",
"0.5915488",
"0.5877248",
"0.5852124",
"0.58404636",
"0.57751924",
"0.5744144",
"0.57415736",
"0.5713681",
"0.57051337",
"0.56971127",
"0.56924397",
"0.5687521",
"0.56796485",
"0.56738305",
"0.5655918",
"0.564... | 0.6470466 | 1 |
Runs the install process via the `transport` object. Must be implemented by subclasses. | def install(transport)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n raise NotImplementedError\n end",
"def install\n raise NotImplementedError\n end",
"def install\n raise \"Not implemented yet!\"\n end",
"def install\n end",
"def install\n # we prefetched also not installed ports so @portorigin may be present\n name = @port... | [
"0.70880276",
"0.70880276",
"0.70350254",
"0.7022721",
"0.6991056",
"0.6991056",
"0.6903156",
"0.67348105",
"0.6730745",
"0.6730745",
"0.67001146",
"0.6615837",
"0.6581637",
"0.6493357",
"0.6469161",
"0.6454366",
"0.64293045",
"0.6413624",
"0.6402907",
"0.6382213",
"0.6366412... | 0.8180347 | 0 |
Gives the base chefclient command to run (without any flags). This can be overridden by subclasses that install chefclient to a custom location. | def chef_client_command
"chef-client"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chef_client\n command = \"chef-client\"\n if sudo\n command = \"sudo #{command}\"\n end\n\n run(command)\n end",
"def cli_base_cmd\n \"#{cli} -n #{network} -i '#{identity}' -p #{password}\"\n end",
"def chef_client(host, options = {})\n exe... | [
"0.67223686",
"0.6466364",
"0.63050264",
"0.62106454",
"0.6093531",
"0.5982973",
"0.58555496",
"0.5715367",
"0.5709445",
"0.56653804",
"0.5631578",
"0.5618864",
"0.55842483",
"0.5565829",
"0.552541",
"0.5524082",
"0.53451633",
"0.53301513",
"0.5322307",
"0.531252",
"0.5283243... | 0.72594213 | 0 |
TODO: create a proper abstraction for RDSM payload. event_identifier is not an attribute of contact. | def inject_event_identifier_into_contact(payload, account_id)
contact = payload['contact']
return payload unless contact
contact['event_identifier'] = last_event_identifier(contact['uuid'], payload, account_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_code\n @payload.fetch('event')\n end",
"def get_event(row, obj_identifier)\n obj_id = @new_id_for[row['intellectual_object_id']]\n gf_id = @new_id_for[row['generic_file_id']]\n inst_id = @new_id_for[row['institution_id']]\n new_event_type = transform_event_type(row['event_type'], ro... | [
"0.6292839",
"0.60349137",
"0.58156365",
"0.58130723",
"0.5808561",
"0.5775023",
"0.5617218",
"0.5561011",
"0.55267024",
"0.5518897",
"0.54839826",
"0.54711556",
"0.5469751",
"0.5465025",
"0.5432909",
"0.5431868",
"0.5427713",
"0.54216266",
"0.5399697",
"0.5398677",
"0.539333... | 0.67870224 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_good_action
@good_action = GoodAction.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def good_action_params
params.require(:good_action).permit(:description, :score, :sender_id, :receiver_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.71230334",
"0.70530915",
"0.69479465",
"0.6902122",
"0.67367256",
"0.67172784",
"0.6689043",
"0.66784793",
"0.6660117",
"0.6555213",
"0.6528485",
"0.6458438",
"0.6452378",
"0.6451654",
"0.64478326",
"0.6433326",
"0.6413599",
"0.6413599",
"0.63907677",
"0.63787645",
"0.6378... | 0.0 | -1 |
GET /emotional_words/1 GET /emotional_words/1.xml | def show
@emotional_word = EmotionalWord.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @emotional_word }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @emotional_word = EmotionalWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @emotional_word }\n end\n end",
"def create\n @emotional_word = EmotionalWord.new(params[:emotional_word])\n\n respond_to do |format|\n if @emotional... | [
"0.66369593",
"0.6346081",
"0.61804456",
"0.6179101",
"0.61141247",
"0.6015502",
"0.5984453",
"0.598413",
"0.59175724",
"0.58752763",
"0.5806326",
"0.5799433",
"0.5766648",
"0.57638824",
"0.5746571",
"0.5745274",
"0.5716902",
"0.5699171",
"0.56755257",
"0.56755257",
"0.560768... | 0.7259433 | 0 |
GET /emotional_words/new GET /emotional_words/new.xml | def new
@emotional_word = EmotionalWord.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @emotional_word }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @emotional_word = EmotionalWord.new(params[:emotional_word])\n\n respond_to do |format|\n if @emotional_word.save\n format.html { redirect_to(@emotional_word, :notice => 'Emotional word was successfully created.') }\n format.xml { render :xml => @emotional_word, :status => :c... | [
"0.7368931",
"0.7282559",
"0.71071726",
"0.676215",
"0.6736481",
"0.67226326",
"0.67226326",
"0.67226326",
"0.67226326",
"0.67226326",
"0.669428",
"0.6645602",
"0.6633928",
"0.6602859",
"0.65912676",
"0.65891075",
"0.6561177",
"0.6517914",
"0.6505619",
"0.64766806",
"0.645244... | 0.781168 | 0 |
POST /emotional_words POST /emotional_words.xml | def create
@emotional_word = EmotionalWord.new(params[:emotional_word])
respond_to do |format|
if @emotional_word.save
format.html { redirect_to(@emotional_word, :notice => 'Emotional word was successfully created.') }
format.xml { render :xml => @emotional_word, :status => :created, :lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @emotional_word = EmotionalWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @emotional_word }\n end\n end",
"def word_params\n params.require(:complete_word).permit(words: [:id, :word_word, :meaning_word, :image_word, :etymos_versi... | [
"0.62162435",
"0.6116437",
"0.59883267",
"0.597877",
"0.59295726",
"0.5868818",
"0.5853647",
"0.58400613",
"0.5838789",
"0.5837643",
"0.5837572",
"0.58292675",
"0.5820919",
"0.58159846",
"0.580708",
"0.57881254",
"0.57734275",
"0.5749826",
"0.5746021",
"0.5743054",
"0.5732447... | 0.7376201 | 0 |
PUT /emotional_words/1 PUT /emotional_words/1.xml | def update
@emotional_word = EmotionalWord.find(params[:id])
respond_to do |format|
if @emotional_word.update_attributes(params[:emotional_word])
format.html { redirect_to(@emotional_word, :notice => 'Emotional word was successfully updated.') }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @emotional_word = EmotionalWord.new(params[:emotional_word])\n\n respond_to do |format|\n if @emotional_word.save\n format.html { redirect_to(@emotional_word, :notice => 'Emotional word was successfully created.') }\n format.xml { render :xml => @emotional_word, :status => :c... | [
"0.64948654",
"0.64232844",
"0.62868685",
"0.6246508",
"0.6176348",
"0.6118582",
"0.6118582",
"0.6118582",
"0.6118582",
"0.6104195",
"0.6103644",
"0.6085148",
"0.60280466",
"0.60265034",
"0.60141766",
"0.59724855",
"0.59686863",
"0.5967655",
"0.5958802",
"0.59512246",
"0.5951... | 0.74678016 | 0 |
DELETE /emotional_words/1 DELETE /emotional_words/1.xml | def destroy
@emotional_word = EmotionalWord.find(params[:id])
@emotional_word.destroy
respond_to do |format|
format.html { redirect_to(emotional_words_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to(words_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @enword = Enword.find(params[:id])\n @enword.destroy\n respond_to do |format|\n format.html... | [
"0.69332033",
"0.6698109",
"0.653356",
"0.65200406",
"0.6518861",
"0.6478809",
"0.64629745",
"0.64475584",
"0.6420598",
"0.639613",
"0.63956434",
"0.6370402",
"0.6370402",
"0.6370402",
"0.6370402",
"0.6370402",
"0.6368578",
"0.6361745",
"0.63614905",
"0.63570863",
"0.6355328"... | 0.7621341 | 0 |
date format: YYYYMMDD physical_location i.e "Map%20Division"&field=physicalLocation | def get_items_since(query, since_date, until_date)
url = @server_url+'/items/search.json?q='+query+'&since='+since_date+'&until='+until_date+'&per_page=500'
json = self.get_json(url)
results = []
result = json["nyplAPI"]["response"]["result"]
results << result
totalPages = json["nypl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solrize_date(date)\n date.strftime('%Y-%m-%dT00:00:00Z')\n end",
"def sqlify_date(raw_date)\n m, d, y = raw_date.split('/')\n \"%04d-%02d-%02d\" % [y, m, d]\nend",
"def geek_date(date)\n date.strftime(\"%Y-%m-%d\") \n end",
"def solr_date(date)\n return Time.utc(date.year, date.mon, da... | [
"0.63669443",
"0.60720515",
"0.5958081",
"0.5942722",
"0.5942722",
"0.5868872",
"0.57954985",
"0.57517534",
"0.57324123",
"0.57239",
"0.5716127",
"0.5609549",
"0.5602174",
"0.5518348",
"0.55114317",
"0.54913914",
"0.5489548",
"0.54709816",
"0.54561764",
"0.54483634",
"0.54431... | 0.0 | -1 |
Given a container uuid, or biblographic uuid, returns a list of mods uuids. | def get_capture_items(c_uuid)
url = "#{@server_url}/items/#{c_uuid}.json?per_page=500"
json = self.get_json(url)
captures = []
capture = json["nyplAPI"]["response"]["capture"]
captures << capture
totalPages = json["nyplAPI"]["request"]["totalPages"].to_i
if totalPages >= 2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mods_uuid(bibl_uuid, image_id)\n url = \"#{@server_url}/items/#{bibl_uuid}.json?per_page=500\"\n json = self.get_json(url)\n mods_uuid = nil\n \n json[\"nyplAPI\"][\"response\"][\"capture\"].each do | capture|\n if capture[\"imageID\"] == image_id\n mods_uuid = capture[\"uui... | [
"0.56296927",
"0.5626476",
"0.5343014",
"0.5119131",
"0.5076789",
"0.50762826",
"0.5038518",
"0.49264312",
"0.48451927",
"0.4800498",
"0.4749131",
"0.46728638",
"0.46497533",
"0.46433282",
"0.4638339",
"0.46114147",
"0.46114147",
"0.4571841",
"0.45572385",
"0.4526455",
"0.452... | 0.4138464 | 66 |
get the item detail from a uuid | def get_mods_item(mods_uuid)
url = "#{@server_url}/items/mods/#{mods_uuid}.json"
json = self.get_json(url)
item = nil
if json["nyplAPI"]["response"]["mods"]
item = json["nyplAPI"]["response"]["mods"]
end
return item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def item_from_uuid(id)\n @items.find { |i| i[:id].to_s == id } || raise(\"Unable to resolve item for uuid '#{id}'\")\n end",
"def value_for_item(it)\n it.data[uuid]\n end",
"def without_uuid(item)\n Serializer.extract(item, ... | [
"0.82614815",
"0.7497539",
"0.6956074",
"0.6650341",
"0.6584183",
"0.65246093",
"0.62411594",
"0.6212264",
"0.61878085",
"0.61492825",
"0.61335",
"0.61277205",
"0.61199856",
"0.6110787",
"0.60888165",
"0.60807276",
"0.60656357",
"0.6056771",
"0.60415214",
"0.6026273",
"0.6002... | 0.59483135 | 29 |
gets the mods uuid of the item, passing in the bibliographic uuid and image_id since there could be many maps for the same item | def get_mods_uuid(bibl_uuid, image_id)
url = "#{@server_url}/items/#{bibl_uuid}.json?per_page=500"
json = self.get_json(url)
mods_uuid = nil
json["nyplAPI"]["response"]["capture"].each do | capture|
if capture["imageID"] == image_id
mods_uuid = capture["uuid"]
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_id(bibl_uuid, mods_uuid)\n url = \"#{@server_url}/items/#{bibl_uuid}.json?per_page=500\"\n json = self.get_json(url)\n image_id = nil\n \n json[\"nyplAPI\"][\"response\"][\"capture\"].each do | capture|\n if capture[\"uuid\"] == mods_uuid\n image_id = capture[\"im... | [
"0.6810509",
"0.67458093",
"0.65342295",
"0.5882201",
"0.5637462",
"0.5604986",
"0.5537586",
"0.5529597",
"0.55163765",
"0.54968876",
"0.5487594",
"0.5398352",
"0.5351448",
"0.5335221",
"0.5335221",
"0.5335221",
"0.53030145",
"0.53030145",
"0.5280436",
"0.5274838",
"0.5258301... | 0.7665365 | 0 |
gets the image id for an item based on the the bibliographic uuid (container uuid) and the mods uuid (the actual item) | def get_image_id(bibl_uuid, mods_uuid)
url = "#{@server_url}/items/#{bibl_uuid}.json?per_page=500"
json = self.get_json(url)
image_id = nil
json["nyplAPI"]["response"]["capture"].each do | capture|
if capture["uuid"] == mods_uuid
image_id = capture["imageID"]
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mods_uuid(bibl_uuid, image_id)\n url = \"#{@server_url}/items/#{bibl_uuid}.json?per_page=500\"\n json = self.get_json(url)\n mods_uuid = nil\n \n json[\"nyplAPI\"][\"response\"][\"capture\"].each do | capture|\n if capture[\"imageID\"] == image_id\n mods_uuid = capture[\"uui... | [
"0.72429335",
"0.6768949",
"0.6756048",
"0.64748204",
"0.63918597",
"0.6343367",
"0.62255394",
"0.62255394",
"0.62255394",
"0.62205243",
"0.62205243",
"0.62133294",
"0.6199468",
"0.61733806",
"0.6161826",
"0.60886896",
"0.6002755",
"0.5950604",
"0.59437203",
"0.5930254",
"0.5... | 0.79428035 | 0 |
get bibliographic container uuid from an image_id | def get_bibl_uuid(image_id)
url = "#{@server_url}/items/local_image_id/#{image_id}.json"
json = self.get_json(url)
bibl_uuid = nil
if json["nyplAPI"]["response"]["numResults"].to_i > 0
bibl_uuid = json["nyplAPI"]["response"]["uuid"]
end
return bibl_uuid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id\n container_info.ids[0] if container_info.entries.length == 1\n end",
"def get_image_id(bibl_uuid, mods_uuid)\n url = \"#{@server_url}/items/#{bibl_uuid}.json?per_page=500\"\n json = self.get_json(url)\n image_id = nil\n \n json[\"nyplAPI\"][\"response\"][\"capture\"].each... | [
"0.66343844",
"0.6524525",
"0.6473865",
"0.6417029",
"0.63109785",
"0.62856895",
"0.6214562",
"0.6190389",
"0.60786927",
"0.59713256",
"0.5927996",
"0.5898333",
"0.5896232",
"0.587799",
"0.5863073",
"0.5856119",
"0.5814629",
"0.570951",
"0.5672628",
"0.56659746",
"0.56418043"... | 0.7719815 | 0 |
get highreslink from an item, matching up the image idi since some bibliographic items may have many maps under them | def get_highreslink(bibl_uuid, image_id)
url = "#{@server_url}/items/#{bibl_uuid}.json?per_page=500"
json = self.get_json(url)
highreslink = nil
json["nyplAPI"]["response"]["capture"].each do | capture|
if capture["imageID"] == image_id
highreslink = capture["highResLin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maybe_item_thumb_link(shortlist_item_id, item_code)\n maybe_item_id_root_div(shortlist_item_id).link(:class => \"img\", :href => /#{item_code}/)\n end",
"def item_image_existed(item_id)\r\n image_link = all(:xpath, \"//*[@id='MainContent']//div[@id='#{item_id}']//a/img\").last\r\n image_link['src']... | [
"0.6597948",
"0.6145265",
"0.5956043",
"0.59269506",
"0.5852045",
"0.5779536",
"0.5660583",
"0.5635022",
"0.55974704",
"0.55908203",
"0.5588662",
"0.558112",
"0.55807376",
"0.55658746",
"0.5529276",
"0.5527942",
"0.5523712",
"0.5518955",
"0.5518955",
"0.55176514",
"0.551566",... | 0.7647553 | 0 |
checks the response for error | def check_error(json)
if json["nyplAPI"]["response"]["headers"]["status"] == "error"
msg = "NYPL Repo API Error: " + json["nyplAPI"]["response"]["headers"]["code"] + " "+ json["nyplAPI"]["response"]["headers"]["message"]
raise msg
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_response\n errors.add(:base, :invalid) unless response.present? && response[\"res\"] == 1\n end",
"def error?(response)\n response.key?('errorcode')\n end",
"def validate_response!(response)\n raise \"empty response\" unless response\n\n status = response[\"stat\"]\n ... | [
"0.84200627",
"0.82960963",
"0.7974241",
"0.78961617",
"0.7829464",
"0.78097045",
"0.7794231",
"0.77350146",
"0.76639646",
"0.7656291",
"0.7640223",
"0.7609114",
"0.7525328",
"0.74581736",
"0.7454395",
"0.7450425",
"0.7448045",
"0.7440199",
"0.7411124",
"0.7401612",
"0.740124... | 0.6896696 | 49 |
range of years and outputs those years which do not have any repeated digits. You should probably write a helper function, `no_repeat?(year)` which returns true/false if a single year doesn't have a repeat. Difficulty: 1/5 =begin APPROACH 1) requirements: given argument: a range (of positive integers) return value: arr... | def no_repeat?(number)
digits = number.to_s.chars
seen = []
digits.each do |digit|
return false if seen.include?(digit)
seen << digit
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_repeat_years(first_yr, last_yr)\n result = []\n (first_yr..last_yr).each do |num|\n if not_repeat_year?(num)\n result << num\n end\n end\n result\nend",
"def no_repeats(year_start, year_end)\nanswer = []\n\n for year in year_start..year_end do\n if no_repeat?(year)\n answer << year... | [
"0.8262554",
"0.81219506",
"0.81020075",
"0.80706686",
"0.7992814",
"0.79841155",
"0.79744345",
"0.79593784",
"0.79194903",
"0.79052126",
"0.7902015",
"0.7798717",
"0.7736019",
"0.7733101",
"0.7699401",
"0.76797",
"0.76428455",
"0.7636557",
"0.76175493",
"0.7616831",
"0.75959... | 0.58092725 | 49 |
There has got to be a better way to do this! ^ | def combine_sorted_lists(arr1, arr2)
i, j = 0, 0
result = []
while result.count < (arr1.count + arr2.count)
if !arr1[i].nil? && arr1[i] <= arr2[j]
result << arr1[i]
i += 1
else
result << arr2[j]
j += 1
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def anchored; end",
"def offences_by; end",
"def formation; end",
"def suivre; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def transform; end",
"def stderrs; end",
"def terpene; end",
"de... | [
"0.6491413",
"0.5972702",
"0.583636",
"0.5758031",
"0.56487507",
"0.55682653",
"0.5487841",
"0.5426259",
"0.5426259",
"0.5426259",
"0.5426259",
"0.53216004",
"0.5306869",
"0.5259646",
"0.5239237",
"0.5235852",
"0.5235852",
"0.5235852",
"0.5217952",
"0.5200569",
"0.51842105",
... | 0.0 | -1 |
POST /kanban_states POST /kanban_states.json | def create
@kanban_state = KanbanState.new(kanban_state_params)
authorize @kanban_state
respond_to do |format|
if @kanban_state.save
url = params[:url] || edit_admin_project_path(@kanban_state.project_id, anchor: "kanban_states")
format.html { redirect_to url, notice: t('actions.cre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @project_states = ProjectState.create!(project_state_params)\n json_response(@project_states, :created)\n end",
"def kanban_state_params\n params.require(:kanban_state).permit(:name, :project_id, :position, :archived)\n end",
"def states_params\n\t \t params.require(:state).permit(:... | [
"0.6428806",
"0.631429",
"0.6304994",
"0.61811775",
"0.61381024",
"0.6079759",
"0.6077232",
"0.6036133",
"0.60043246",
"0.59724474",
"0.59135824",
"0.59135824",
"0.5901917",
"0.5891544",
"0.587166",
"0.5837713",
"0.58368844",
"0.5825071",
"0.58026105",
"0.58007526",
"0.579825... | 0.67954874 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.