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
Write an .erb from source to destination, catching and reporting errors along the way
def write_erb(source, destination) begin @task.shell.mute do @task.create_file(destination) do @project.parse_erb(source) end end rescue Exception => e @task.say "Error while building #{File.basename(source)}:" @task.say e.message + "\n", Thor:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def erbFileHandler(src)\n # try to copy file to the project directory\n dest = getFileDest(src)\n raise \"File \" + src + \"does not belong to the template\" if dest == nil\n\n if dest =~ /.erb$/ then dest = dest[0..dest.length-5] end\n\n cmdline = ''\n\n # set environment variables if possible\n...
[ "0.6553724", "0.6489394", "0.63403064", "0.6284842", "0.6217545", "0.61641157", "0.6161068", "0.61047214", "0.6074828", "0.6002059", "0.59314746", "0.5918138", "0.59011805", "0.5898837", "0.5839922", "0.5839922", "0.58382523", "0.58367664", "0.58190125", "0.5808264", "0.57954...
0.78918356
0
USING ARGUMENTS say_hello returns 'hello'
def say_hello 'hello' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def say_hello name1=\"oscar\", name2=\"shane\"\n\t\"hello, #{name1} and #{name2}\"\nend", "def say_hello\n me = \"Chris P. Bacon\"\n puts \"hello from #{me}\"\nend", "def say_hello\n 'hello'\n end", "def say_hello name\n \"Hello, #{name}!\"\nend", "def say_hello(name)\n \"Hello, #{name}.\"\n end...
[ "0.8066508", "0.80409735", "0.786744", "0.7859391", "0.7854179", "0.7823369", "0.7822087", "0.78177315", "0.7813887", "0.780884", "0.7763005", "0.7730942", "0.7717409", "0.7711996", "0.7702983", "0.76957244", "0.76934516", "0.76778334", "0.7673846", "0.7671188", "0.76706964",...
0.79700834
2
echo returns the input string i.e., if the passed input string is "hello", returns "hello"
def echo(str) str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def echo(string)\n string\n end", "def echo(str)\n str\n end", "def echo (input)\n input\n end", "def echo(string)\n string\nend", "def echo(input)\n input\nend", "def echo(input)\n \"#{input}\"\nend", "def echo(s)\n s\nend", "def echo(str)\n str\nend", "def echo(input)\n re...
[ "0.8112701", "0.79045033", "0.7831075", "0.7693906", "0.7547855", "0.7517844", "0.7515068", "0.74899113", "0.7470483", "0.73577803", "0.73492455", "0.7309006", "0.7291037", "0.72585726", "0.72428817", "0.7235455", "0.70557386", "0.69892406", "0.6900244", "0.6863362", "0.67563...
0.7532258
6
eddie_izzards_height calculates and returns Eddie Izzard's height takes in the height of heels he's wearing (default value: 0) and adds heel height to his base 67 inches for the result
def eddie_izzards_height(heel_height = 0) 67 + heel_height end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eddie_izzards_height (heel_height=0)\n 67 + heel_height\n end", "def eddie_izzards_height(height_of_heels=0)\n new_height = height_of_heels + 67\n return new_height\n end", "def eddie_izzards_height(heelHeight=0)\n heelHeight + 67\nend", "def eddie_izzards_height(heels_height=0)\n heels_heig...
[ "0.83160186", "0.8266309", "0.77419645", "0.7681273", "0.7660618", "0.7577849", "0.6069454", "0.5926648", "0.59022003", "0.58091474", "0.5788478", "0.5776449", "0.57301855", "0.5667775", "0.5646424", "0.56252474", "0.5625165", "0.5614428", "0.5554383", "0.55524814", "0.554166...
0.80258375
2
how_many_args accepts any number of arguments without complaint returns the total number of arguments passed to the function Hint: google ruby args
def how_many_args(*args) args.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def how_many_args *args\n args.length\n # accepts any number of arguments without complaint\n # returns the total number of arguments passed to the function\n # Hint: google ruby *args\nend", "def how_many_args(*args)\n args.count\nend", "def how_many_args(*args)\n args.count\n end", "def how_many_a...
[ "0.93475616", "0.90360755", "0.8963783", "0.89469504", "0.89217275", "0.8807136", "0.8724325", "0.8698214", "0.7953533", "0.7679422", "0.7660943", "0.75519186", "0.7302221", "0.7185443", "0.71772563", "0.70158845", "0.7005771", "0.6981783", "0.69494593", "0.6881684", "0.67991...
0.8882939
5
find_answer returns the value associated with the 'answer' keyword argument returns nil if it cannot find the 'answer' keyword argument complains when given nonkeyword arguments Hint: google ruby keyword arguments
def find_answer(options={}) options[:answer] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_answer(answer: nil, **opts)\n answer\n end", "def find_answer(kwargs={})\n kwargs[:answer]\nend", "def find_answer(*args)\n args.each do |arg|\n \targ.each_key { |key| if key === :answer then return arg[key] end }\n end\n return nil\n end", "def find_answer keyword={}\n keyword[:a...
[ "0.8547098", "0.8412626", "0.8380612", "0.81502473", "0.7820159", "0.76628065", "0.76056933", "0.74467707", "0.69745433", "0.6676515", "0.649953", "0.6195417", "0.61814696", "0.6079669", "0.60666686", "0.59778345", "0.5946412", "0.5942646", "0.5920448", "0.5875732", "0.586622...
0.83914286
2
Return your answer as a number.
def sum_mix(arr) arr.map! { |x| x.to_i } arr.sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result(answer)\n @answer == answer.to_i \n end", "def interpret\r\n return @number.to_i\r\n end", "def get_number(result)\n # This is not mathematical correct, because we cant subtract\n puts \"Well done, #{result} == 24\" if 1 / 3 + 4 * 6 == result\n # But, if we can, here is solution: 6.0 / (...
[ "0.7119772", "0.6852891", "0.68319476", "0.6814671", "0.6566181", "0.65174234", "0.6394186", "0.6365025", "0.6356861", "0.626956", "0.6269481", "0.62608427", "0.6230521", "0.6229525", "0.62115216", "0.61778605", "0.61743855", "0.615501", "0.6153499", "0.61258113", "0.60973376...
0.0
-1
Join the underlying thread. This is a blocking call.
def join @thread.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join\n @thread.join\n end", "def join\n return if not running?\n @thread.join\n end", "def join\n thread && thread.join\n end", "def join\n @thread.join\n unset_thread_task\n end", "def join_thread\n @thread&.join\n end", "def join\n @cond.wa...
[ "0.8089089", "0.8054324", "0.79739195", "0.79482424", "0.79436535", "0.7605656", "0.75707054", "0.750054", "0.73913306", "0.7377309", "0.73613846", "0.72548044", "0.7228799", "0.7213692", "0.7213456", "0.7183658", "0.70915383", "0.7078526", "0.70576555", "0.70228267", "0.6919...
0.8172442
0
Handle the message. This needs to be overwritten by concrete implementations.
def handle(_request) fail NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(msg)\n raise \"The handle() method must be implemented in #{self.class.to_s}\"\n end", "def handle_msg msg\n throw Exception(\"handle_msg must be implemented\")\n end", "def handle_message(request, message)\n #\n end", "def process_message(message)\n end", "def h...
[ "0.77331185", "0.7644825", "0.74614835", "0.7396809", "0.7200166", "0.7144659", "0.7083334", "0.7058774", "0.70191526", "0.698522", "0.6972786", "0.6961261", "0.6907505", "0.68848187", "0.6877964", "0.6809597", "0.67771184", "0.67368746", "0.6706952", "0.67024106", "0.6696873...
0.0
-1
Concrete implementations that want to change the options used for queue subscription may override this for their specific requirements.
def subscription_opts { manual_ack: true, block: true } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_queue_options(options = {})\n @queue_options = options\n end", "def sidekiq_options(opts = T.unsafe(nil)); end", "def queue_opts\n {\n :max_bytes => 50_000,\n :service => config.kafka_response_topic,\n }\n end", "def initialize options\n super\n\n...
[ "0.7389216", "0.6692001", "0.6672528", "0.6628448", "0.6626808", "0.63843757", "0.6383831", "0.6185646", "0.6049891", "0.5959204", "0.591284", "0.5878031", "0.5867837", "0.5838161", "0.5834981", "0.582625", "0.582625", "0.58171904", "0.5816752", "0.5807549", "0.57887834", "...
0.6353319
7
GET /datos_usuarios GET /datos_usuarios.json
def index @datos_usuarios = DatosUsuario.all @talla = Talla.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @usuarios = Usuario.all\n\n respond_to do |format|\n format.html # index.html.erb\...
[ "0.7519951", "0.74547815", "0.74547815", "0.74547815", "0.7385613", "0.7343958", "0.7199539", "0.7184966", "0.7144348", "0.7110191", "0.7110191", "0.7069025", "0.70162743", "0.69480664", "0.67649865", "0.67649865", "0.67649865", "0.676061", "0.6754323", "0.6754323", "0.674306...
0.0
-1
GET /datos_usuarios/1 GET /datos_usuarios/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @usuario = Usuario.find(params[:id])\n\n render json: @usuario\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def show\n ...
[ "0.74363554", "0.7435379", "0.7362068", "0.7362068", "0.727093", "0.727093", "0.727093", "0.7173732", "0.70721734", "0.7041897", "0.6986085", "0.69748753", "0.69748753", "0.6967847", "0.6959963", "0.6899481", "0.68991673", "0.68777704", "0.67736435", "0.6683068", "0.66206574"...
0.0
-1
POST /datos_usuarios POST /datos_usuarios.json
def create @datos_usuario = DatosUsuario.new(datos_usuario_params) respond_to do |format| if @datos_usuario.save format.html { redirect_to "/inicio/success", success: 'Datos usuario was successfully created.' } else format.html { render action: 'new' } format.json {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @usuario = Usuario.new(usuario_params)\n\n if @usuario.save\n render json: @usuario, status: :created, location: @usuario\n else\n render json: @usuario.errors, status: :unprocessable_entity\n end\n end", "def create\n\n puts request.body.string\n\n if request.body.strin...
[ "0.7109719", "0.6738844", "0.6637198", "0.6607863", "0.6558902", "0.6545033", "0.65222543", "0.64741856", "0.6442691", "0.6431416", "0.6431416", "0.6431416", "0.64096564", "0.63900983", "0.6371617", "0.634856", "0.633861", "0.63312125", "0.63268054", "0.6308064", "0.630754", ...
0.6822908
1
PATCH/PUT /datos_usuarios/1 PATCH/PUT /datos_usuarios/1.json
def update respond_to do |format| if @datos_usuario.update(datos_usuario_params) format.html { redirect_to root_path, notice: 'Datos usuario was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @usuario = Usuario.find(params[:id])\n\n if @usuario.update(usuario_params)\n head :no_content\n else\n render json: @usuario.errors, status: :unprocessable_entity\n end\n end", "def update \n retorno = {erro: \"322\" ,body: \"\"}\n if @usuario.update(valid_request?...
[ "0.69414735", "0.68605804", "0.6786797", "0.6735289", "0.6701734", "0.661858", "0.6613183", "0.65865344", "0.65610427", "0.6542306", "0.6533505", "0.6482275", "0.6458359", "0.64562005", "0.64476734", "0.6444712", "0.64343387", "0.6413493", "0.6413493", "0.6413493", "0.6403426...
0.6762894
3
DELETE /datos_usuarios/1 DELETE /datos_usuarios/1.json
def destroy @datos_usuario.destroy respond_to do |format| format.html { redirect_to datos_usuarios_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to usuarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario = Usuario.find(params[:id])\n @usuario.destroy\n\n respond_to do |fo...
[ "0.726784", "0.726784", "0.726784", "0.7264051", "0.713006", "0.71264446", "0.7099148", "0.7086893", "0.7081484", "0.7074859", "0.7073987", "0.70734173", "0.70703757", "0.70668596", "0.7061297", "0.7061297", "0.7061297", "0.70513105", "0.70404595", "0.70344204", "0.7025415", ...
0.74203104
0
Use callbacks to share common setup or constraints between actions.
def set_datos_usuario @datos_usuario = DatosUsuario.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 datos_usuario_params params.require(:datos_usuario).permit(:usuario_id, :tel1, :tel2, :correo, :direccion1, :direccion2, :contacto1, :contacto2, :tipo_sangre_id, :talla_id) 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.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.629117...
0.0
-1
Increase the dogs position values by 5 using Array.map!.
def chasing_squirrels(dogs) dogs.map! do |individual_dog| individual_dog[:position] += 5 individual_dog end return dogs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_dogs(dogs)\n dogs.map! do |individual_dogs|\n individual_dogs[:position] = 0\n individual_dogs\n end \n return dogs\nend", "def return_dogs(my_dogs)\n my_dogs.map! do |dog|\n dog[:position] = 0\n end\nend", "def walk_dogs\n dogs.map {|dog| dog.mood = \"happy\"}\n end"...
[ "0.6887292", "0.6700912", "0.6237477", "0.6179858", "0.6001572", "0.5958741", "0.5921573", "0.5817727", "0.57489455", "0.5707864", "0.5541045", "0.5515709", "0.55032694", "0.54967415", "0.5496465", "0.54896796", "0.5483739", "0.5477751", "0.5451388", "0.545095", "0.54459155",...
0.77814525
0
Write a new method called return_dogs that takes an array of dogs as an argument. It should reset all of the dogs' positions back to 0.
def return_dogs(dogs) dogs.map! do |individual_dogs| individual_dogs[:position] = 0 individual_dogs end return dogs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_dogs(my_dogs)\n my_dogs.map! do |dog|\n dog[:position] = 0\n end\nend", "def chasing_squirrels(dogs)\n dogs.map! do |individual_dog|\n individual_dog[:position] += 5\n individual_dog\n end\n return dogs\nend", "def dogs_by_size_results\n dogs_by_size_results = []\n end"...
[ "0.70954454", "0.6231123", "0.55703455", "0.5535698", "0.5495427", "0.54411733", "0.5422618", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5411562", "0.5244353", "0.52318317", "0.5107641", "0.5105909",...
0.7431859
0
Results from the WordReference.com API include a 'note' field that is rarely populated and does not seem very useful.
def strip_note!(data_array) data_array.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notes\n @data[:notes]\n end", "def extract_references(hackney_note)\n WorkOrderReferenceFinder\n .new(hackney_note.work_order_reference)\n .find(hackney_note.text || \"\")\n end", "def notes params=nil\n @nimble.get \"contact/#{self.id}/notes\", params\n end", "def reference_doc...
[ "0.6204273", "0.6130791", "0.6130684", "0.60005224", "0.59732217", "0.59448814", "0.5924261", "0.59074587", "0.58917123", "0.58571905", "0.5809384", "0.5803652", "0.5802366", "0.57787323", "0.57570773", "0.57346076", "0.5729203", "0.57263875", "0.57116216", "0.5672291", "0.56...
0.0
-1
This method takes three parameters: (1) An input file object containing the log messages that need to be translated (2) An output file object to write the translated messages to (3) The depth of the translations The input file object should be open for reading, while the output file object should be open for writing. T...
def reverse_translate(input_file, output_file, depth) LogParser.parse(input_file).each do |log_message| @tables[0].reverse_translate(log_message, depth) output_file.puts(log_message) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_file(filename, locale, output_locale)\n\n def assemble(templ, local)\n # If already assembling the string\n return local unless templ.is_a?(Hash)\n\n # If templ is a hash but local is nil, it means that the entire current \n # branch is not yet translated. Therefore cre...
[ "0.59356", "0.5324292", "0.53112483", "0.52723163", "0.5198342", "0.51301986", "0.51266295", "0.5124699", "0.5114014", "0.5016925", "0.49943918", "0.4972415", "0.49414447", "0.49370247", "0.4913986", "0.4822616", "0.48075086", "0.47923738", "0.47459108", "0.4742143", "0.47181...
0.7104412
0
scoped collection for sortable column on Customers
def scoped_collection end_of_association_chain.includes([:customer]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __sortable__\n self\n end", "def sortable_columns\n @sortable_columns ||= ['Passport.name']\n end", "def sortable_columns\n resource_class.column_names + self.class.custom_sort_fields.keys.map(&:to_s)\n end", "def sortable_sort\n @sortable_sort\n end", "def sortable_columns\...
[ "0.673435", "0.6656733", "0.65638524", "0.64786065", "0.6463767", "0.6199091", "0.61962616", "0.6162556", "0.60689604", "0.6068808", "0.6054389", "0.603937", "0.603937", "0.6008708", "0.59576327", "0.59016144", "0.57791984", "0.57561135", "0.5751532", "0.57115704", "0.5657649...
0.5515113
28
Pause for one second before each vote Pass in array of candidates to vote from
def vote(candidates) sleep(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vote \n \t\n voters = Voter.voters_created\n \n politicians = Voter.voters_created.select {|voter| voter if voter.is_a? Politician}\n vote_count = Hash.new(0)\n who_voted_for_whom = Hash.new(0)\n #introduce an element of fairness by varying when candidates get to visit voters \n campaign_s...
[ "0.6240795", "0.6240795", "0.600417", "0.6002265", "0.59443545", "0.5872333", "0.5861349", "0.5665093", "0.5640046", "0.5535868", "0.5522088", "0.5502625", "0.54801744", "0.54690236", "0.54465747", "0.5413406", "0.53993326", "0.53858495", "0.5385673", "0.53786284", "0.5355261...
0.8610753
0
Follow links corresponding to each character in the key Encounter a null link: create new node Encounter the last character of the key: set value in that node
def put(key, value) @root = put_rec(@root, key, value, 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def []=(key, value)\n current = @head\n until current.key == key\n @tail = @tail.nil? ? current.nxt : current\n current.nxt = current.nxt.nil? ? Link.new(current.key + 1, nil, nil, current) : current.nxt\n current = current.nxt\n end\n @tail = current if current.nxt.nil?\n current.val...
[ "0.6807187", "0.6225873", "0.61746067", "0.6075987", "0.59658736", "0.59555244", "0.5862611", "0.5843943", "0.5787012", "0.5778651", "0.5755244", "0.5711249", "0.56569636", "0.5650341", "0.56378967", "0.563169", "0.55845034", "0.5577295", "0.55724865", "0.55655384", "0.556387...
0.0
-1
Search hit : Node where search ends has a non null value Search miss: Reach a node with null links or node where search ends has null value
def get(key) node = get_rec(@root, key, 0) return nil if node.nil? return node.value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(node = @root)\n if node.position == @target\n @target_node = node\n return\n else\n node.connected_knights.each { |knight| search(knight) }\n end\n end", "def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##ind...
[ "0.58559656", "0.5639993", "0.5631654", "0.55755275", "0.553574", "0.55067873", "0.54931533", "0.54804397", "0.54681164", "0.5435645", "0.54339176", "0.54141426", "0.5386681", "0.5369071", "0.5301404", "0.5287991", "0.5287899", "0.5285222", "0.526787", "0.52652586", "0.525714...
0.0
-1
d is the depth of the current node in the trie
def put_rec(node, key, value, d) node = Node.new if node.nil? if(d == key.length) node.value = value return node end c_index = key[d].ord node.next[c_index] = put_rec(node.next[c_index], key, value, d+1) return node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth(d)\n @depth = d\n self\n end", "def depth; end", "def depth\n node = @kids.max {|k, j| k.depth <=> j.depth }\n node.depth + 1\n end", "def total_depth(node, depth = 0)\n @d = depth\n @d = @d + 1 if node.children.size > 0\n node.children.map{|c| x = total_depth(c,@d) - 1...
[ "0.7234422", "0.66203463", "0.6538041", "0.6509234", "0.6468997", "0.64514095", "0.63912433", "0.6209808", "0.6192375", "0.6163275", "0.605258", "0.60335445", "0.60137516", "0.59910554", "0.59877807", "0.59876424", "0.5974969", "0.5973535", "0.5952356", "0.5936411", "0.591080...
0.0
-1
toggle status of a chain_task to be active/inactive
def toggle_status @chain_task.toggle_status! render :text => :ok and return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle(task_number) # Toggle method that calls the toggle_status method on the appropriate task from the all_tasks array\n all_tasks[task_number - 1].toggle_status\n end", "def make_inactive\n self.status = \"I\"\n end", "def toggle_status # Toggle status method that negates the completed? meth...
[ "0.7088847", "0.6777788", "0.6747348", "0.66822916", "0.6665876", "0.6624774", "0.6588358", "0.653686", "0.65157086", "0.6429222", "0.6387258", "0.6383257", "0.6362976", "0.63434106", "0.62647796", "0.6263705", "0.6255527", "0.6252904", "0.6242338", "0.6238309", "0.6222973", ...
0.7906999
0
It defines a task that update status of resources.
def write_task(task_name, session, admin_auth=false, &block) task(task_name, session, :wt, admin_auth, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update task\n now = Time.now.to_i\n wait = task.wait.nil? ? now : task.wait\n wake = now + wait\n tasks = @db[:tasks]\n r = tasks.where(:id => task.id).update :changed => now,\n :status => task.getStatus,\n :wake...
[ "0.6845698", "0.6801073", "0.67391175", "0.6583245", "0.6478638", "0.64548254", "0.63506466", "0.63223267", "0.6319783", "0.6287183", "0.6284366", "0.62749386", "0.6274118", "0.6180931", "0.6166728", "0.6117071", "0.6110622", "0.6088655", "0.60884917", "0.6060909", "0.6023869...
0.0
-1
It defines a task that queries information about resources.
def read_task(task_name, session, admin_auth=false, &block) task(task_name, session, :rd, admin_auth, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources\n @task[:resources]\n end", "def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end", "def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end", "def retrieve_tasks\n Query.ge...
[ "0.6930796", "0.6444213", "0.6444213", "0.6444213", "0.63464266", "0.6272939", "0.6172204", "0.6088833", "0.60840183", "0.6071859", "0.60604024", "0.6060078", "0.6015344", "0.60143095", "0.59993577", "0.5964142", "0.5947044", "0.5943093", "0.5943093", "0.5930226", "0.5928961"...
0.0
-1
It is used for define an xml handler's task. It does 1) locking, 2) authenticating, 3) executing a task, and 4)returning a result to a client. +task_name+ name of task +session+ a string that represents a user session +lock_mode+ a mode flag for exclusive access :rd for read lock and :wt for write lock. +admin_auth+ it...
def task(task_name, session, lock_mode, admin_auth=false, &block) begin # lock if lock_mode == :wt @lock.write_lock else @lock.read_lock end begin rc = authenticate(session, admin_auth, &block) log_msg = rc ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_task(task_name, session, admin_auth=false, &block)\n task(task_name, session, :wt, admin_auth, &block)\n end", "def task(&block) \n task = TaskRunnable.new\n task.proc = Proc.new(block)\n task\n end", "def read_task(task_name, session, admin_auth=false, &block)\n tas...
[ "0.6658985", "0.62150043", "0.6152634", "0.6058406", "0.60057646", "0.5915731", "0.57130474", "0.56931907", "0.56901515", "0.5670516", "0.5629411", "0.5472292", "0.5410859", "0.54104996", "0.54104996", "0.54072577", "0.53668725", "0.53229", "0.5310133", "0.5310133", "0.527507...
0.73301953
0
It log rpc call result. +task_name+ name of called method +user+ name of user who executes this rpc call +result[0]+ true or false +result[1]+ a string representing error if result[0] is false, otherwise undefined
def log_result(task_name, user, result) if result[0] log_success(user, task_name) else log_fail(user, task_name, result[1]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_log\n end", "def result_log\n end", "def result_log\n end", "def add_result name, res\n \n end", "def print_rpc_stats(stats)\n out.puts stats.report(\"Task Stats\", false, @verbose)\n end", "def log_http_call(payload); end", "def log_http_call(pay...
[ "0.6135386", "0.6135386", "0.6135386", "0.58090156", "0.5774704", "0.5705321", "0.5705321", "0.56731874", "0.55995214", "0.55908805", "0.55908805", "0.5586277", "0.5569239", "0.5554616", "0.5554616", "0.5534579", "0.5484125", "0.5464913", "0.54558444", "0.5438367", "0.5433518...
0.76327723
0
Permet d'afficher un user
def show @user = User.find(params[:id]) @titre = "Utilisateur" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user; end", "def set_user\n puts \"STAN THE MANNNNNNNNNNN\"\n @user = User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n\n return if unauthorized_local_access(@user.uo_id)\n end", "def set_user\n @user = User.where(:username => params[:id])....
[ "0.7425988", "0.710629", "0.7079632", "0.6988175", "0.697693", "0.69426143", "0.6921789", "0.6921789", "0.69029236", "0.68942374", "0.6894115", "0.6852207", "0.6847351", "0.6847351", "0.6843697", "0.6839744", "0.68086606", "0.6803851", "0.6803851", "0.6803851", "0.6803851", ...
0.0
-1
Fin de def show Permet d'afficher la page d'un nouvel user
def new @user = User.new @titre = "Inscription" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n set_user\n end", "def show\n unless @user\n render 'not_found_page'\n end\n end", "def show\n # сделать текущего пользователя адмиристратором\n #current_user.update_attribute :admin, true\n @user = User.find(params[:id])\n @title = @user.username\n #@user_internals...
[ "0.7754268", "0.7669289", "0.7650964", "0.76124954", "0.7576232", "0.7525393", "0.7501673", "0.7491344", "0.74366623", "0.7423454", "0.74190444", "0.7419031", "0.7417646", "0.740664", "0.73871315", "0.73198366", "0.73183495", "0.7300365", "0.7299271", "0.72986585", "0.7296277...
0.0
-1
Fin de def create Permet d'afficher la liste des users
def showUserList @titre = "Liste des utilisateurs" @users = User.all generatePDF(@users) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_list_users\n\n end", "def create_users\n @user_admin = User.create(:email => \"admin@test.tld\", :name => \"Admin user\", :password => \"testtest\", :password_confirmation => \"testtest\", :level => User::LEVEL_ADMINISTRATOR)\n @user_normal = User.create(:email => \"normal@test.tld\", :name =>...
[ "0.7537084", "0.7170311", "0.6947841", "0.6914339", "0.68977755", "0.6812174", "0.6793629", "0.6735086", "0.6730102", "0.6688161", "0.6618217", "0.658859", "0.65717727", "0.65678287", "0.65619665", "0.6558257", "0.654893", "0.6539257", "0.65384805", "0.65250003", "0.6522454",...
0.0
-1
Fin de def showUserList Permet d'afficher la liste des users non sportif voulant faire du sport
def showNonSportifList @users = User.where(isSportif: false, wantDoSport: true) @titre = "Liste des utilisateurs non sportifs" generatePDFnonSportif(@users) render 'showUserList' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n flash[:notice] = \"Het volg-systeem is neergestort als een mir. Iedereen volgt gewoon iedereen. Wel zo communistisch en makkelijk\";\n @user = User.find(:all)\n end", "def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to ...
[ "0.7508745", "0.7289053", "0.7224238", "0.72154486", "0.713127", "0.71035314", "0.70729965", "0.70715046", "0.7012907", "0.70045507", "0.698844", "0.6974018", "0.6945427", "0.6931473", "0.6894762", "0.6888174", "0.6881643", "0.6876684", "0.6847996", "0.6827284", "0.68108994",...
0.7696338
0
Fin de def showNonSportifList Genere un PDF de la liste des users
def generatePDF(all_users) Prawn::Document.generate("public/listUsers.pdf", :page_layout => :landscape) do |pdf| table_data = [["Nom", "Email", "Date de naissance", "Poids actuel", "Poids Idéal", "Taille", "IMC", "Sportif", "Souhaite faire du sport" ]] all_users.each do |u| tab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showNonSportifList\n @users = User.where(isSportif: false, wantDoSport: true)\n @titre = \"Liste des utilisateurs non sportifs\"\n generatePDFnonSportif(@users)\n render 'showUserList'\n end", "def showUserList\n @titre = \"Liste des utilisateurs\"\n @users = User.all\n generatePDF(@use...
[ "0.9142709", "0.7918038", "0.7681406", "0.662754", "0.61289126", "0.60317403", "0.5996198", "0.5926648", "0.59234524", "0.5917533", "0.59018946", "0.5886396", "0.58857334", "0.5835835", "0.58339727", "0.58128566", "0.5802537", "0.5786431", "0.57667625", "0.5758169", "0.574243...
0.6936076
3
Fin de def generatePDFsportif Genere un PDF de la liste des users non sportif voulant faire du sport
def generatePDFnonSportif(all_users) Prawn::Document.generate("public/listUsers.pdf", :page_layout => :landscape) do |pdf| table_data = [["Nom", "Email", "Date de naissance", "Poids actuel", "Poids Idéal", "Taille", "IMC"]] all_users.each do |u| table_data += [["#{u.nom}", "#{u....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generatePDF(all_users) \n Prawn::Document.generate(\"public/listUsers.pdf\", :page_layout => :landscape) do |pdf|\n \n table_data = [[\"Nom\", \"Email\", \"Date de naissance\", \"Poids actuel\", \"Poids Idéal\", \"Taille\", \"IMC\", \"Sportif\", \"Souhaite faire du sport\" ]]\n \n all...
[ "0.84078646", "0.7781275", "0.77485985", "0.72366893", "0.7180817", "0.6885193", "0.6836498", "0.6719058", "0.6714711", "0.6677746", "0.66435486", "0.6566865", "0.65306133", "0.65212435", "0.6520843", "0.6507961", "0.6481148", "0.6470316", "0.6405768", "0.6405592", "0.6389643...
0.86636144
0
:nodoc: Google Calendar does not have a category concept. Instead a feed consists of multiple calendars. We've chosen to map the category into the calendar concept. This function, category, returns an array of calendar objects which match the requested category(ies). categories can be a single string/symbol or an array...
def category categories categories = categories.to_a if !categories.is_a? Array categories.collect { |i| calendars.find_by_title i.to_s }.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n nodes = @doc.xpath(\"atom:feed/atom:category\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomCategory.new(node) }\n end", "def categories\n if @categories.nil?\n @categories = []\n category_nodes =\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node...
[ "0.6852299", "0.6690106", "0.66218275", "0.6471427", "0.6290092", "0.6238935", "0.6154424", "0.61530167", "0.5992287", "0.5916889", "0.588686", "0.5878624", "0.58754045", "0.58141625", "0.5810971", "0.58008677", "0.57922906", "0.5766532", "0.57505065", "0.57494134", "0.574028...
0.76557314
0
Sessions are opened to the google api using a google username and password. This implemented so that only one session is used per feed. You probably won't need to use this, but if you do, you can access the session for a feed object by: feed = GCalendar::Feed.first feed.login assigns session feed.session => returns the...
def session @@session ||= [] if @@session[self.id].nil? session = GData::Client::Calendar.new token = session.clientlogin(username,password) @@session[self.id] = session end @@session[self.id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n self.session = GData::Client::Calendar.new if session.nil?\n @token = session.clientlogin(username,password)\n true\n end", "def get_session\n\t\trefresh_token = get_refresh_token\n\n\t\tclient = OAuth2::Client.new(\n\t\t CLIENT_ID,\n\t\t CLIENT_SECRET,\n\t\t si...
[ "0.68258905", "0.672245", "0.63258857", "0.6272637", "0.6261305", "0.6250484", "0.6180397", "0.61020875", "0.61020875", "0.61020875", "0.601425", "0.59638363", "0.5951496", "0.59470797", "0.5916242", "0.5915621", "0.5907507", "0.58968884", "0.5867331", "0.586653", "0.58419687...
0.7790588
0
Assign a value to the session for this object. note that it is saved in a class instance variable so it only needs to be done once per Feed id. You shouldn't ordinarily need to use this function.
def session=(val) @@session ||= [] @@session[self.id] = val end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_set(name,value)\n session[name] = value\n end", "def set_session\n @session = session[:user_id]\n end", "def set_session\r\n @session = Session.find(params[:id])\r\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @se...
[ "0.7102262", "0.6969943", "0.6961682", "0.69135517", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", "0.6913235", ...
0.6955854
3
create a new calendar object for this feed. name name or title of the calendar opts hash of fields for creating the calendar object. TODO, move or add function to the calendars association
def create_calendar(name, opts={}) opts[:name] = name cal = GCalendar::Calendar.new(:opts=>opts) calendars << cal cal.sync save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_google_calendar\n unless self.apps_cal_id\n result = Gandalf::GoogleApiClient.insert_google_calendar({\n \"summary\" => self.name\n })\n self.apps_cal_id = result.data.id\n self.save!\n end\n end", "def create\n\t@calendar = @user.calendars.build(params[:calendar])\n\...
[ "0.6745043", "0.64037484", "0.6184438", "0.61106306", "0.60955787", "0.604115", "0.60359687", "0.60336", "0.60326886", "0.5978073", "0.59324664", "0.5932209", "0.59209985", "0.5810863", "0.57801867", "0.570104", "0.559059", "0.5587822", "0.5585916", "0.55622834", "0.55153537"...
0.82752556
0
Creates a login session for this feed. You shouldn't ordinarily need to use this function.
def login self.session = GData::Client::Calendar.new if session.nil? @token = session.clientlogin(username,password) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end", "def create\n action = LogUserIn.new :web\n @session = Session.new params[:session]\n\n if user = action.run(@session.login, @session.password)\n pre...
[ "0.7176973", "0.6638318", "0.65476924", "0.65343523", "0.6487713", "0.64872646", "0.6450655", "0.64279324", "0.6418893", "0.6397594", "0.63657343", "0.63279396", "0.62852913", "0.628054", "0.62694526", "0.6267532", "0.6263845", "0.62122685", "0.6194611", "0.61873055", "0.6180...
0.6095762
33
Uses session to get the calendar feed for the user
def get_user_calendar_xml # :nodoc: response = session.get(USER_FEED) Nokogiri::XML(response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calendar\n @calendars = Calendar.all.where(:UserId => [current_user.id, nil]).order(:start_time)\n end", "def get_feed\n if user_authorized?\n self.class.fetch_from_cache @canvas_course_id do\n get_feed_internal\n end\n else\n nil\n end\n end", "def get_calendars\r\n ...
[ "0.66995835", "0.65903664", "0.6545744", "0.64435136", "0.64212537", "0.6359534", "0.63205767", "0.6309486", "0.62912303", "0.62804157", "0.62491924", "0.6234602", "0.62235904", "0.61670417", "0.61228895", "0.6111004", "0.6107281", "0.6093176", "0.6074947", "0.6073134", "0.60...
0.69711167
0
As stated, the goal of this library is to manipulate the google calendar, using ActiveRecord as a cache. This means that synchronization needs to follow these rules: a) data exists in gcal and not in local > create local objects note that deletion of a local event must either immediately delete the google object, or ma...
def sync_calendars(opts={}) # why does the primary calendar feed change every time? feed_xml = get_user_calendar_xml xml_ts = Time.zone.parse(feed_xml.xpath('/ns:feed/ns:updated', 'ns'=>'http://www.w3.org/2005/Atom').text) self.body = feed_xml.to_s if xml_ts != synced_at feed_xml.css('ent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_events\n # TODO: handle simple \"date\" in \"all day\" events\n google_updated_events = get_updated_events\n current_user.events.destroy_all\n if google_updated_events.length > 0\n google_updated_events.each do |event|\n new_event = current_user.events.find_or_create_by(g_id: eve...
[ "0.59438396", "0.5750888", "0.5750374", "0.5620669", "0.54809636", "0.5429109", "0.53840345", "0.5326818", "0.52438563", "0.52224904", "0.52220815", "0.52198017", "0.5211574", "0.51997334", "0.5149853", "0.51306593", "0.5128895", "0.5109369", "0.5105655", "0.5094184", "0.5074...
0.6464298
0
return a Nokogiri xml object of this feed. For docs on functions to view and manipulate the xml object, see Nokogiri. For docs on the format of the Atom xml feed, see the google calendar api docs.
def xml Nokogiri::XML(body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rss\r\n Nokogiri::XML(body)\r\n end", "def xml\n @feed ||= FeedzirraPodcast::Parser::Podcast.parse(open(self.url))\n end", "def xml\n xml = Builder::XmlMarkup.new(indent: 2)\n\n xml.instruct! :xml, encoding: 'UTF-8'\n xml.rss version: '2.0' do |rss|\n rss.channel do |channel|\n ...
[ "0.73685086", "0.71328753", "0.6789851", "0.66832626", "0.6654748", "0.6617596", "0.6617596", "0.6574094", "0.6538268", "0.65363604", "0.63761663", "0.63690704", "0.63032526", "0.6260213", "0.6195887", "0.6177639", "0.6134267", "0.61024654", "0.6069902", "0.6034875", "0.60018...
0.64805335
10
has_many :questions, foreign_key: 'author_id' has_many :answers, foreign_key: 'author_id' has_many :comments
def password @password ||= BCrypt::Password.new(hashed_password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authored_questions\n Question.find_by_author_id(self.id)\n end", "def authored_questions\n Question.find_by_author_id(self.id)\n end", "def authored_questions\n Question.find_by_author_id(@id)\n end", "def author\n # data = QuestionsDatabase.instance.execute(\"SELECT fname, lname FROM ques...
[ "0.67443025", "0.67443025", "0.6645587", "0.6143136", "0.6134022", "0.5980279", "0.58381337", "0.57939976", "0.57939184", "0.57310164", "0.56920415", "0.56775796", "0.56759346", "0.5598748", "0.55856943", "0.5510686", "0.54476494", "0.54476494", "0.53976554", "0.538454", "0.5...
0.0
-1
compare the results of "working solution" with "optimized solution"
def compare_solutions(count = 5, n_min = 1, n_max = 300) arr = generate(count, n_min, n_max) if solve(arr) != solve_opt(arr) puts "\nFAILED" puts 'data: ' + arr.to_s puts 'solution: ' + solve(arr).to_s puts 'optimized solution: ' + solve_opt(arr).to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_tests\n check_solution(1, [6, 29, 18, 2, 72, 19, 18, 10, 37], 18, 2)\n check_solution(2, [6, 29, 18, 2, 72, 19, 18, 10, 37], 9, -1)\nend", "def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], fals...
[ "0.7030417", "0.67422885", "0.67422885", "0.66741127", "0.6667087", "0.6551995", "0.6245569", "0.6243538", "0.62407213", "0.62390614", "0.62370056", "0.6219705", "0.61195153", "0.61195153", "0.61195153", "0.6039978", "0.60141444", "0.5994897", "0.5981281", "0.59684575", "0.59...
0.76241046
0
I chose to add the room object just in case I need to access the fields for each room
def add_room(room) @@number_of_rooms += 1 @rooms << room end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def room; end", "def room\n end", "def room\n Room.all.find { |room| room.id == room_id }\n end", "def add_room(room)\n @rooms << room\n return self\nend", "def create_room\n Room.new\n end", "def initialize\n @credentials = Authenticate.get_credentials\n @db = CouchRest.data...
[ "0.7319732", "0.7277355", "0.6999474", "0.693979", "0.690429", "0.6823303", "0.67996067", "0.6752659", "0.6752659", "0.66493374", "0.65897214", "0.6576417", "0.6555604", "0.65161395", "0.65097165", "0.64731073", "0.64707375", "0.64694667", "0.64661926", "0.6459539", "0.645922...
0.6479908
15
prompt asks us to create a list of directors with their names only using source as an argument. pping source indicates that source is the entire nds
def list_of_directors(source) dir_list = [] dir_index =0 while dir_index<source.length do dir_list << source[dir_index][:name] dir_index +=1 end dir_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_of_directors(source)\nrow_index = 0\narray =[]\nwhile row_index < source.length\n array << source[row_index][:name]\n row_index += 1\nend\narray\nend", "def print_directors(nds)\n pp nds\nend", "def directors\n parse_crew('Directed by')\n end", "def list_sources\n sources = Profile.g...
[ "0.6226463", "0.5875862", "0.5812536", "0.5537217", "0.5404482", "0.530637", "0.52944124", "0.5172631", "0.5120825", "0.51141346", "0.5075698", "0.5062013", "0.5061534", "0.50594467", "0.5026288", "0.500214", "0.500214", "0.4969472", "0.4941467", "0.49374163", "0.48720124", ...
0.6517475
0
the goal is to add up gross from every director and return the total amount
def total_gross(source) total =0 name_key = list_of_directors(source) individual_gross_hash = directors_totals(source) dir_index=0 while dir_index < name_key.length total+= individual_gross_hash[name_key[dir_index]] dir_index+=1 end total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gross_for_director(director_data)\n sum = 0\n\t\n\tdirector_data[:movies].each do |movie|\n\t\tsum += movie[:worldwide_gross]\n\tend\n\t\n\treturn sum\nend", "def gross_for_director(director_data)\n total = 0\n movies = director_data[:movies]\n movies.length.times do |movie_idx|\n total+=movies[movie_id...
[ "0.81893647", "0.79300594", "0.7928562", "0.7915463", "0.7907552", "0.7865057", "0.7715541", "0.7697522", "0.7692344", "0.76661074", "0.7602979", "0.7578513", "0.7572221", "0.75611305", "0.7560513", "0.75470454", "0.7504994", "0.7503252", "0.7491744", "0.7475745", "0.74615794...
0.712375
45
cscope egrep is pretty bad very few character classes
def generate_cscope_pattern(base) pattern = base.downcase #in order to do case insensitive matching cscope requires lower case return "^(.* )?#{pattern}" if pattern.length <= 2 return "^(.* )?#{pattern}" #return '^(.* )?p[a-zA-Z0-9]*a' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def re; end", "def filter_chars\n # In Python we apply a string to a regexp,\n # but in Ruby we apply a regexp to a string, that's why we don't have to append\n $stack.push($stack.pop().gsub(Regexp.compile('[\\W_]+'), ' ').downcase)\nend", "def regexp; end", "def regexp; end", "def regexps; end", "def...
[ "0.59010875", "0.5761099", "0.5750851", "0.5750851", "0.5691109", "0.5656059", "0.56263065", "0.56263065", "0.56263065", "0.55732644", "0.55520415", "0.55158806", "0.5479506", "0.5418283", "0.5416123", "0.53727305", "0.5343021", "0.5310164", "0.52442944", "0.52180696", "0.521...
0.5864471
1
Wipe out _all_ data in memcached, use with care.
def cache_clear @store.flush_all rescue ::MemCache::MemCacheError => e Log.error(e) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_cache\n @all = nil\n end", "def clear_all!\n @cache = Cache.new\n end", "def cache_clear\n @client.flushall\n end", "def clear_all\n data.delete_all\n self\n end", "def cache_clear\n @dataset.delete\n end", "def cache_clear\n @dataset.dele...
[ "0.7689602", "0.75279087", "0.746647", "0.74202067", "0.732359", "0.732359", "0.72238535", "0.72179556", "0.7085443", "0.7084503", "0.7064522", "0.7056828", "0.7037176", "0.6992707", "0.6986727", "0.6979858", "0.69779724", "0.69779724", "0.6965602", "0.6954527", "0.69540924",...
0.7071637
10
NOTE: We have no way of knowing whether the value really is nil, we assume you wouldn't cache nil and return the default instead.
def cache_fetch(key, default = nil) value = @store[key] value.nil? ? default : value rescue ::MemCache::MemCacheError => e Log.error(e) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def if_nil(val, default)\n if val.nil?\n return default\n end\n return val\n end", "def value_or_default\n self.value || self.default || self.try_alternate\n end", "def value_or_default\n self.value || self.default || self.try_alternate\n end", "def resolve_value value\n ...
[ "0.78828216", "0.73851043", "0.73851043", "0.7090408", "0.69637555", "0.6917361", "0.68385935", "0.6817701", "0.67880493", "0.6736963", "0.65498435", "0.65226907", "0.65226907", "0.65073395", "0.6489343", "0.6478569", "0.64534724", "0.6426565", "0.6407903", "0.6380114", "0.63...
0.6494071
14
switch to different namespace
def namespace=(ns) @namespace = @store.namespace = ns; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespace=(ns); end", "def namespace=(ns); end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def namespace; end", "def set_namespace\n @namespace = Namespace.find(params[:name...
[ "0.71983963", "0.71983963", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6885492", "0.6877264", "0.68771654", "0.67248905", "0.6709705", "0.6709705", "0.6581664", "0.6539663", "0.6539663", "0.6539663", "0.6539663", "0.6514985",...
0.64632154
21
state of compression (true/false)
def compression; @store.compression; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compressed?\n @compressed == true\n end", "def compression?; end", "def compressed?\n false\n end", "def compression=(bool); @store.compression = bool; end", "def compression_was_achieved\n return compression_ratio() < 1\n end", "def compression; end", "def is_compressed...
[ "0.7953848", "0.7773901", "0.77393115", "0.7299576", "0.7200247", "0.7077999", "0.705533", "0.6734818", "0.6716565", "0.66841877", "0.6625517", "0.6564874", "0.65547127", "0.6514972", "0.6502894", "0.6491436", "0.6430902", "0.6422654", "0.63162684", "0.6301061", "0.6260005", ...
0.68844116
7
turn compression on or off
def compression=(bool); @store.compression = bool; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compression?; end", "def default_compression; end", "def compression; end", "def compression\n configuration[:copy_compression] || :gzip\n end", "def compression_method; end", "def compressed?\n false\n end", "def gzip_enabled; end", "def gzip_enabled; end", ...
[ "0.79042566", "0.7686397", "0.7352654", "0.730841", "0.7262949", "0.72500896", "0.72238404", "0.72238404", "0.7205714", "0.7174773", "0.7150642", "0.7114816", "0.7114453", "0.70307225", "0.69887763", "0.6977512", "0.6913873", "0.6909236", "0.6869278", "0.68684053", "0.6856234...
0.8008264
0
For everything else that we don't care to document right now.
def method_missing(*args, &block) @store.__send__(*args, &block) rescue ::MemCache::MemCacheError => e Log.error(e) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def document?; end", "def document?; end", "def doc; end", "def doc; end", "def doc; end", "def doc; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document...
[ "0.6939718", "0.6720141", "0.6720141", "0.658978", "0.658978", "0.658978", "0.658978", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.64870316", "0.6487...
0.0
-1
GET /legalissues GET /legalissues.json
def index @legalissues = Legalissue.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html...
[ "0.67881715", "0.6640637", "0.65331256", "0.65331256", "0.65331256", "0.65331256", "0.65331256", "0.65185523", "0.6490595", "0.6456931", "0.6420763", "0.6381829", "0.6354505", "0.629856", "0.6297153", "0.6279212", "0.6173057", "0.6162876", "0.61561894", "0.6114037", "0.611284...
0.7637797
0
GET /legalissues/1 GET /legalissues/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @legalissues = Legalissue.all\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n ...
[ "0.7498894", "0.67790335", "0.6697155", "0.6615499", "0.65039104", "0.65039104", "0.65039104", "0.65039104", "0.65039104", "0.6468243", "0.63978815", "0.63960963", "0.63843143", "0.63695896", "0.6331499", "0.62996495", "0.6282418", "0.6257719", "0.624164", "0.6239917", "0.620...
0.0
-1
POST /legalissues POST /legalissues.json
def create @legalissue = Legalissue.new(legalissue_params) respond_to do |format| if @legalissue.save format.html { redirect_to @legalissue, notice: 'Legalissue was successfully created.' } format.json { render :show, status: :created, location: @legalissue } else format.htm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legalissue_params\n params.require(:legalissue).permit(:name, :issue, :comment, :done)\n end", "def create\n @issue = Issue.new(issue_params)\n\n respond_to do |format|\n if @issue.save\n format.html { redirect_to issues_url, notice: 'Issue was successfully created.' }\n form...
[ "0.6914207", "0.6222062", "0.6152061", "0.61462396", "0.6139026", "0.611973", "0.611973", "0.611973", "0.611973", "0.60966796", "0.59854704", "0.5918201", "0.5905252", "0.58883154", "0.58745193", "0.5866919", "0.58435154", "0.5821397", "0.58004516", "0.5793907", "0.5792755", ...
0.70450634
0
PATCH/PUT /legalissues/1 PATCH/PUT /legalissues/1.json
def update respond_to do |format| if @legalissue.update(legalissue_params) format.html { redirect_to @legalissue, notice: 'Legalissue was successfully updated.' } format.json { render :show, status: :ok, location: @legalissue } else format.html { render :edit } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit...
[ "0.65650684", "0.65646195", "0.65445703", "0.65286845", "0.6524324", "0.6488429", "0.6436699", "0.64295053", "0.6403991", "0.6403991", "0.6403991", "0.6403991", "0.6403991", "0.6394467", "0.63700014", "0.63647205", "0.6310345", "0.6296002", "0.62875754", "0.62737715", "0.6266...
0.697537
0
DELETE /legalissues/1 DELETE /legalissues/1.json
def destroy @legalissue.destroy respond_to do |format| format.html { redirect_to legalissues_url, notice: 'Legalissue was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n issues_permissions\n @issue.destroy\n respond_to do |format|\n format.html { redirect_to issues_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @normal_issue = NormalIssue.find(params[:id])\n @normal_issue.destroy\n\n respond_to do |format|\n ...
[ "0.7490082", "0.73655206", "0.7324575", "0.7291069", "0.7239899", "0.7239899", "0.7239899", "0.7239899", "0.71790385", "0.71443486", "0.7019203", "0.7019203", "0.7019203", "0.7019203", "0.7019203", "0.7019203", "0.7018853", "0.7018107", "0.69881946", "0.6968155", "0.6956399",...
0.7760089
0
Use callbacks to share common setup or constraints between actions.
def set_legalissue @legalissue = Legalissue.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
Never trust parameters from the scary internet, only allow the white list through.
def legalissue_params params.require(:legalissue).permit(:name, :issue, :comment, :done) 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
Public: Appends the notice to the notices array attribute. notice The notice data to be sent (Hash or JSON string) Returns nil
def send_to_honeybadger(notice) @notices << notice end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_notice(notice)\n key = notice_key(notice)\n unless @notices.include?(key)\n @notices.add(key)\n end\n end", "def add_notice(notice)\n @notices << notice\n self\n end", "def notice(msg)\n @notices << msg\n blah @notices.last\n end", "def notice=(message)\...
[ "0.74966514", "0.74949765", "0.69697726", "0.6808126", "0.6808126", "0.63089424", "0.6151657", "0.6151657", "0.6143349", "0.60047", "0.60047", "0.60047", "0.60047", "0.60047", "0.5976178", "0.5955026", "0.5923222", "0.5886591", "0.5861925", "0.585482", "0.58275014", "0.5807...
0.7102133
2
=begin ================================================== PROBLEM: MENTAL MODEL: INPUT: OUTPUT: EDGE CASES: ASSUMPTIONS: QUESTIONS: PSEUDO: ================================================== EVALUATION ================================================== =end
def remove_vowels(arr) arr.map { |a| a.tr('aeiouAEIOU', '') } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_out_edges_on_examples\n assert_equal(@small_dfa.ith_edges(0), @small_dfa.out_edges(0,true))\n assert_equal(@small_dfa.ith_edges(1,2,5), @small_dfa.out_edges(1,true))\n assert_equal(@small_dfa.ith_edges(4), @small_dfa.out_edges(2,true))\n assert_equal(@small_dfa.ith_edges(3), @small_dfa...
[ "0.602473", "0.58223206", "0.5796132", "0.5785436", "0.5667515", "0.5629039", "0.55871546", "0.55492944", "0.55449575", "0.55413264", "0.54922765", "0.5463637", "0.54575306", "0.5448993", "0.5435643", "0.53800136", "0.53603363", "0.53337824", "0.53337824", "0.5307849", "0.529...
0.0
-1
REQUIRED. FluidFeatures will call this to determine if your user is logged in, what the unique id of this user is and any additional attributes you wish to use for selecting users.
def fluidfeatures_current_user(verbose=false) if current_user if verbose { :id => @current_user[:id], :name => @current_user[:name], :uniques => { :twitter => @current_user[:twitter_id] }, :cohorts => { # Example attributes for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identify_the_user\n \t@current_user = User.find_by_id(session[\"user_id\"])\n end", "def user?\n get_mode == :user\n end", "def user_on\n session[:user_id] = '3980284084'\n end", "def user_id; config[:user_id]; end", "def client_side_current_user\n if session[:user_id]\n User....
[ "0.6494902", "0.6472428", "0.63992727", "0.6356453", "0.6355614", "0.6339612", "0.6291046", "0.6288785", "0.6267838", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6265769", "0.6230814", "0.6205879", ...
0.6771621
0
OPTIONAL Set default for any new features. These are only used for the first time that FluidFeatures sees a feature. This happens when this feature is deployed for the first time.
def fluidfeatures_defaults { # By default unknown features are disabled. :enabled => false, # no visible to any users # You can also use these values... #:enabled => true, # visible to all users (use for depreciating old features) #:enabled => 10, # 10 percent of user will see it ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_defaults\n self.featured ||= 1\n end", "def set_default\n end", "def default\n @default = true\n end", "def feature_flags_with_defaults\n flag_names = FeatureFlag.pluck(:name).sort\n FeatureFlag.default_flag_hash.merge(feature_flags_for(*flag_names)).with_indifferent_access\n...
[ "0.73025465", "0.7030864", "0.6691541", "0.6508182", "0.64392126", "0.6403648", "0.6371976", "0.63308704", "0.63308704", "0.62926894", "0.62926894", "0.62926894", "0.62926894", "0.62926894", "0.62926894", "0.6229842", "0.62219995", "0.62165314", "0.6201505", "0.6201505", "0.6...
0.7272927
1
Return an array of strings, one for each line in the file
def read_file @read_file ||= File.open(self.file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_as_string_array\n file = (\"#{File.dirname(__FILE__)}/../data/seed.txt\")\n string_array = []\n \n File.open(file, 'r') do |f|\n f.each_line do |line|\n string_array << line\n end\n end\n \n string_array\n end", "def file_to_array file\n lines = []\n Fil...
[ "0.796819", "0.76737267", "0.76098794", "0.7311648", "0.7307313", "0.7231026", "0.71605325", "0.7138764", "0.71165675", "0.7067568", "0.6923033", "0.69197065", "0.6876195", "0.684857", "0.6839768", "0.6839768", "0.6839768", "0.68338364", "0.67883384", "0.6773707", "0.67484325...
0.0
-1
TODO: use generate instead of pretty_generate to pipe output straight into mongoimport
def to_s self.to_array.map{ |hsh| JSON.pretty_generate(hsh) }.join("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_rebalancing\n dbname = 'baybike'\n collection_name = 'rebalancing'\n `mongo #{dbname} --eval \"db.dropDatabase()\"`\n command = \"mongoimport -d #{dbname} -c #{collection_name} --type csv --file #{rebalancing} --headerline\"\n `#{command}`\nend", "def pipeline_to_mongosh_script(infile, outfile)\n...
[ "0.6315777", "0.63128984", "0.5856705", "0.5833997", "0.58271456", "0.5749272", "0.57312155", "0.57312155", "0.57279426", "0.57042867", "0.56055635", "0.55968404", "0.5592614", "0.5576067", "0.5353074", "0.53505224", "0.52975154", "0.5268689", "0.52558255", "0.525003", "0.524...
0.0
-1
each "number" card scores as its value
def score_numbers(cards_numbers) cards_numbers.sum { |card| card.value.to_i } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score\n @cards.map(&:value).inject(:+)\n end", "def possible_scores\n card_values.inject([0]) do |memo, item|\n if ace_value?(item)\n added_one = memo.map { |score| score + 1 }\n added_one << (added_one.last + 10)\n else\n memo.map { |number| number + ite...
[ "0.76956964", "0.75683993", "0.7422125", "0.7393633", "0.726646", "0.71756077", "0.70987636", "0.709381", "0.7031035", "0.7025631", "0.70127255", "0.6932173", "0.69259346", "0.6896456", "0.6887969", "0.6864512", "0.68408483", "0.6835614", "0.6831197", "0.6813478", "0.67920417...
0.7665152
1
each "picture" card scores as 10
def score_pictures(cards_pictures) cards_pictures.count * 10 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score(cards)\n\nend", "def score\n score = 0\n aces_count = 0\n @hand_contents.each do |card|\n if card.type == :face\n score += 10\n elsif card.type == :ace\n aces_count += 1\n score += 11\n elsif card.type == :number\n score += card.rank.to_i\n end\n...
[ "0.6931209", "0.6881471", "0.6875299", "0.6792881", "0.6695651", "0.6609313", "0.65657145", "0.65402746", "0.6505792", "0.64568233", "0.64367497", "0.6379364", "0.6326207", "0.6300978", "0.62843573", "0.62837124", "0.62398225", "0.6170008", "0.6141564", "0.6128588", "0.612218...
0.81018424
0
each "ace" card can score 11 or 1, depending on what is closer to 21, but not exceeding 21
def score_aces(cards_aces, score_without_aces) # first, assume all "ace" cards score as 1 aces_count = cards_aces.count return 0 if aces_count.zero? # check if we can convert one ace card to 11 if (score_without_aces + aces_count <= 11) 11 + (aces_count - 1) else # all ace cards sti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ace_check\n cards[index_of_11][:points] = 1 if index_of_11 && (total > 21)\n end", "def calculate_score(hand_of_cards)\n card_values = hand_of_cards.map{|card_value| card_value[1]}\n total = 0 \n card_values.each do |card_value| \n if card_value == \"ACE\"\n total+= 11\n elsif card_value.to...
[ "0.78671134", "0.75782806", "0.75747365", "0.7501459", "0.7448186", "0.7339252", "0.72493607", "0.7155661", "0.70416915", "0.7010129", "0.69990826", "0.696954", "0.69459033", "0.69375", "0.69259953", "0.69159365", "0.6891451", "0.68762803", "0.6831305", "0.6802142", "0.676052...
0.77168137
1
GET /dvds/1 GET /dvds/1.xml
def show @dvd = Dvd.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @dvd } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @rdv = Rdv.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rdv }\n end\n end", "def index\n @dvds = Dvd.all\n end", "def show\n @dlog = Dlog.find(params[:id])\n\n respond_to do |format|\n format.html # show...
[ "0.6586219", "0.6527771", "0.61583924", "0.60927486", "0.60396004", "0.6035867", "0.60275626", "0.6026148", "0.5991765", "0.59882224", "0.5980108", "0.59005886", "0.58782876", "0.58414924", "0.5800586", "0.57904243", "0.5771207", "0.57632154", "0.5751171", "0.57442474", "0.57...
0.6424875
2
GET /dvds/new GET /dvds/new.xml
def new @dvd = Dvd.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @dvd } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end", "def new\n @dbs_...
[ "0.7429372", "0.6814892", "0.6732278", "0.6720067", "0.6705508", "0.6691929", "0.668242", "0.66818345", "0.66818345", "0.6681061", "0.66394335", "0.66275203", "0.6624707", "0.66233355", "0.65573037", "0.6549791", "0.65289134", "0.6521459", "0.65106595", "0.6474533", "0.646096...
0.7042849
1
POST /dvds POST /dvds.xml
def create @dvd = Dvd.new(params[:dvd]) @dvd.userid = "" @dvd.verliehen = 0 respond_to do |format| if @dvd.save format.html { redirect_to(@dvd, :notice => 'Dvd erfolgreich erstellt.') } format.xml { render :xml => @dvd, :status => :created, :location => @dvd } else form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def create\n @dvr = Dvr.new(dvr_params)\n\n respond_to do |format|\n if @dvr.save\n format.html { redirect_to @dvr, notice: 'Dvr was successfully created.' }...
[ "0.5802217", "0.57882345", "0.5465859", "0.54078716", "0.5396476", "0.5380217", "0.5371849", "0.5353407", "0.5341229", "0.53405243", "0.53110164", "0.5263182", "0.52207303", "0.52128935", "0.5210233", "0.5194966", "0.5172442", "0.5172442", "0.5156328", "0.5155316", "0.5070320...
0.54197085
3
PUT /dvds/1 PUT /dvds/1.xml
def update @dvd = Dvd.find(params[:id]) @dvdusers = @dvd.userid.split(', ') @x = 0 while @x < @dvdusers.size if @dvdusers[@x] == current_user.id.to_s alreadylent = true end @x = @x + 1 end if user_signed_in? if alreadylent != true @dvd.verliehen = @dvd.verliehen + 1 if @dvd.userid == "" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \n end", "def update opts = {}\n opts[:headers] ||= {}\n opts...
[ "0.6386783", "0.6221852", "0.5694655", "0.56694293", "0.56669784", "0.5653485", "0.5586856", "0.5582915", "0.5544645", "0.55345666", "0.5532589", "0.5484315", "0.5470777", "0.5467352", "0.54661566", "0.5455095", "0.54465663", "0.54303336", "0.541763", "0.54076564", "0.5402748...
0.0
-1
DELETE /dvds/1 DELETE /dvds/1.xml
def destroy @dvd = Dvd.find(params[:id]) @dvd.destroy respond_to do |format| format.html { redirect_to(dvds_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @rdv = Rdv.find(params[:id])\n @rdv.destroy\n\n respond_to do |format|\n format.html { redirect_to(rdvs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @dcf = Dcf.find(params[:id])\r\n @dcf.destroy\r\n\r\n respond_to do |format|\r\n format.html ...
[ "0.6729065", "0.6678106", "0.6599096", "0.65213645", "0.64879185", "0.64695346", "0.639679", "0.6383926", "0.63635933", "0.6357291", "0.6327999", "0.62914777", "0.62910974", "0.62866396", "0.6248221", "0.62423587", "0.62402815", "0.6238557", "0.62075335", "0.6204866", "0.6198...
0.67309105
0
Here we want to make a method add_song that takes in an argument of a song and associates that song with the artist by telling the song that it belongs to that artist.
def add_song(song) # We want to tell the song_name passed in that it belongs to the instance # of Artist for which this method is called on aka self. song.artist = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song(song) # Third, we create 'add_song' to associate a song name with a particular artist.\n song.artist = self # When we call 'song.artist', we set the result equal to 'self', or the artist on which we are calling the method.\n end", "def add_song(song)\n @songs << song #add...
[ "0.9042165", "0.8549802", "0.84904087", "0.8483025", "0.84642076", "0.84505314", "0.8435702", "0.8414457", "0.84127015", "0.84127015", "0.8391136", "0.8389795", "0.838415", "0.838415", "0.838415", "0.838415", "0.838415", "0.838415", "0.83786017", "0.8346484", "0.8346484", "...
0.86801213
1
Here we make a method add_song_by_name that takes in an argument of a song name, creates a new song with it, and associates the song and artist.
def add_song_by_name(song_name) # Create a new song called "song" with argument passed in. song = Song.new(song_name) # Associate it with the artist song.artist = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song_by_name(song_name)\n song = Song.new(song_name)\n song.artist = self\n @songs << song\n end", "def add_song_by_name(name) #takes in argument name of (song)\n song = Song.new(name) #creating a new instance of a song\n song.artist = self #Right here all w...
[ "0.8796029", "0.8791209", "0.87682277", "0.8764704", "0.876115", "0.87141365", "0.87141365", "0.8692366", "0.8617347", "0.8602969", "0.85712034", "0.85517794", "0.853808", "0.8475339", "0.8433028", "0.8133378", "0.8076293", "0.80304086", "0.7768808", "0.7701056", "0.7688671",...
0.90073407
0
This method will make it so each Artist is able to HAVE MANY songs!
def songs # Select each song and set the artist value for it equal to the instance # of Artist that this method is being called on (self). Song.all.select do |song| song.artist == self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def artists(artist)\n if song.artist = nil || !Artist.find_by_name(name)\n song.artist = artist \n Artist.all << artist \n end \n end", "def initialize(name) # an Artist instance is initialized w a name\n @name = name\n @songs = [] # each Artist instance will have man...
[ "0.62946147", "0.62897307", "0.61904734", "0.61540633", "0.6139414", "0.60718596", "0.6057385", "0.604872", "0.6015701", "0.6012161", "0.5999761", "0.5999761", "0.5999761", "0.5978175", "0.5977909", "0.59746736", "0.59712315", "0.5956654", "0.5953144", "0.5953144", "0.5943566...
0.5935858
21
TODO: Use accepts_nested_attributes instead of something like this
def update_features(feature_ids=[]) existing_ad_features = self.ad_features existing_ad_features.select{|ad_feature| !feature_ids.include?(ad_feature.feature_id)}.each &:destroy feature_ids.each do |feature_id| ad_feature = existing_ad_features.find_by_feature_id(feature_id) ad_feature ||= self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accepts_nested_attributes_for(name)\n attribute name, Array\n end", "def has_attributes?; end", "def nested_attributes\n []\n end", "def valid_attributes\n attributes_for :post\n end", "def valid_attributes\n {\n title: \"My Title\",\n committee_id: committe...
[ "0.7110692", "0.6701567", "0.6568755", "0.63059485", "0.6165946", "0.615746", "0.615746", "0.615746", "0.615746", "0.615746", "0.615746", "0.615746", "0.615746", "0.6075855", "0.60683256", "0.6058168", "0.605127", "0.5969936", "0.5969936", "0.59377205", "0.59155977", "0.590...
0.0
-1
delegate :decode, :to => :backend
def decode(json) @backend.decode(json) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode; end", "def decode; end", "def decode\n raise NotImplementedError\n end", "def decode\n transform :decode\n end", "def decode=(_arg0); end", "def decode=(_arg0); end", "def converter; end", "def decode(text); end", "def backend; end", "def backend=(backend); end", "def ...
[ "0.7154991", "0.7154991", "0.7037167", "0.70368564", "0.6615661", "0.6615661", "0.61292225", "0.6124752", "0.6063119", "0.60568804", "0.6055541", "0.6055541", "0.59939563", "0.59871614", "0.59697354", "0.59680986", "0.59680986", "0.5948041", "0.5902332", "0.58718055", "0.5855...
0.61555845
6
making the 'or_else' function accessible in views
def title base_title = "My Site" unless @title.nil? "#{base_title} | #{@title}" else base_title end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditionally(*) end", "def conditionally(*) end", "def or_else(&blk)\n yield value\n end", "def or_b\n end", "def render_or_false(to_check, view)\n if to_check.present?\n render_json view\n else\n render json: false, status: 200\n end\n end", "def or_d\n end", "de...
[ "0.63499355", "0.63499355", "0.63428926", "0.6233453", "0.6225068", "0.6158224", "0.612252", "0.61073035", "0.6034948", "0.600363", "0.59588253", "0.5958782", "0.59271395", "0.59177643", "0.5884888", "0.583738", "0.5826465", "0.5769662", "0.57511574", "0.574841", "0.57457155"...
0.0
-1
returns the facebook profile name or nothing
def facebook_profile @network = current_user.network ||= Network.new (@network.facebook.nil?) ? "" : @network.facebook end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile....
[ "0.81749", "0.79702437", "0.76902616", "0.7680518", "0.7657331", "0.76006883", "0.75406325", "0.7537982", "0.75058943", "0.74871516", "0.746452", "0.7459048", "0.744484", "0.73043185", "0.726662", "0.7253938", "0.72537565", "0.7197072", "0.7169443", "0.71677405", "0.716763", ...
0.7903896
2
returns true if current_user has a facebook profile
def facebook_profile? @network = current_user.network ||= Network.new !(@network.facebook.nil? || @network.facebook.blank?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_facebook_profile?\n fb_userid.present?\n end", "def has_profile?\n return self.profile.present?\n end", "def connected_to_facebook?\n fb_uid && fb_access_token\n end", "def is_current_profile?(profile)\n if current_user.present?\n @current_profile = current_user.profile\n ret...
[ "0.87015873", "0.76989144", "0.7509506", "0.74241304", "0.7413598", "0.7387876", "0.7323472", "0.7251311", "0.7251311", "0.7223152", "0.71958345", "0.71569824", "0.7134959", "0.70727354", "0.7048229", "0.7044053", "0.7040191", "0.6987692", "0.6985623", "0.6981677", "0.6973202...
0.84910864
1
returns the facebook profile name or nothing
def twitter_profile @network = current_user.network ||= Network.new (@network.twitter.nil?) ? "" : @network.twitter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile....
[ "0.817356", "0.79700387", "0.7904319", "0.7689265", "0.76799816", "0.7658345", "0.76024956", "0.7541604", "0.7537486", "0.7506942", "0.74846613", "0.74654686", "0.7459085", "0.7445542", "0.73052406", "0.7267499", "0.7255232", "0.7254633", "0.719719", "0.71701044", "0.71678036...
0.0
-1
returns true if current_user has a facebook profile
def twitter_profile? @network = current_user.network ||= Network.new !(@network.twitter.nil? || @network.twitter.blank?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_facebook_profile?\n fb_userid.present?\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def has_profile?\n return self.profile.present?\n end", "def connected_to_facebook?\n fb_uid && fb...
[ "0.87015873", "0.84910864", "0.76989144", "0.7509506", "0.74241304", "0.7413598", "0.7387876", "0.7323472", "0.7251311", "0.7251311", "0.7223152", "0.71958345", "0.71569824", "0.7134959", "0.70727354", "0.7048229", "0.7044053", "0.7040191", "0.6987692", "0.6985623", "0.698167...
0.6797714
27
returns the facebook profile name or nothing
def linkedin_profile @network = current_user.network ||= Network.new (@network.linkedin.nil? || @network.linkedin.blank?) ? "" : @network.linkedin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile....
[ "0.81749", "0.79702437", "0.7903896", "0.76902616", "0.7680518", "0.7657331", "0.76006883", "0.75406325", "0.7537982", "0.75058943", "0.74871516", "0.746452", "0.7459048", "0.744484", "0.73043185", "0.726662", "0.7253938", "0.72537565", "0.7197072", "0.7169443", "0.71677405",...
0.6437591
58
returns true if current_user has a facebook profile
def linkedin_profile? @network = current_user.network ||= Network.new !(@network.linkedin.nil? || @network.linkedin.blank?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_facebook_profile?\n fb_userid.present?\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def has_profile?\n return self.profile.present?\n end", "def connected_to_facebook?\n fb_uid && fb...
[ "0.87015873", "0.84910864", "0.76989144", "0.7509506", "0.74241304", "0.7413598", "0.7387876", "0.7323472", "0.7251311", "0.7251311", "0.7223152", "0.71958345", "0.71569824", "0.7134959", "0.70727354", "0.7048229", "0.7044053", "0.7040191", "0.6987692", "0.6985623", "0.697320...
0.6981677
20
returns the facebook profile name or nothing
def youtube_profile @network = current_user.network ||= Network.new (@network.youtube.nil?) ? "" : @network.youtube end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile....
[ "0.817356", "0.79700387", "0.7904319", "0.7689265", "0.76799816", "0.7658345", "0.76024956", "0.7541604", "0.7537486", "0.7506942", "0.74846613", "0.74654686", "0.7459085", "0.7445542", "0.73052406", "0.7267499", "0.7255232", "0.7254633", "0.719719", "0.71701044", "0.71678036...
0.0
-1
returns true if current_user has a facebook profile
def youtube_profile? @network = current_user.network ||= Network.new !(@network.youtube.nil? || @network.youtube.blank?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_facebook_profile?\n fb_userid.present?\n end", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def has_profile?\n return self.profile.present?\n end", "def connected_to_facebook?\n fb_uid && fb...
[ "0.87015873", "0.84910864", "0.76989144", "0.7509506", "0.74241304", "0.7413598", "0.7387876", "0.7323472", "0.7251311", "0.7251311", "0.7223152", "0.71958345", "0.71569824", "0.7134959", "0.70727354", "0.7048229", "0.7044053", "0.7040191", "0.6987692", "0.6985623", "0.698167...
0.64752364
51
returns the facebook profile name or nothing
def youtube_network_profile(user) (user.network.youtube.nil?) ? "" : user.network.youtube end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile....
[ "0.81749", "0.79702437", "0.7903896", "0.76902616", "0.7680518", "0.7657331", "0.76006883", "0.75406325", "0.7537982", "0.75058943", "0.74871516", "0.746452", "0.7459048", "0.744484", "0.73043185", "0.726662", "0.7253938", "0.72537565", "0.7197072", "0.7169443", "0.71677405",...
0.0
-1
returns the facebook profile name or nothing
def youtube_network_profile(user) (user.network.youtube.nil?) ? "" : user.network.youtube end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile....
[ "0.81749", "0.79702437", "0.7903896", "0.76902616", "0.7680518", "0.7657331", "0.76006883", "0.75406325", "0.7537982", "0.75058943", "0.74871516", "0.746452", "0.7459048", "0.744484", "0.73043185", "0.726662", "0.7253938", "0.72537565", "0.7197072", "0.7169443", "0.71677405",...
0.0
-1
returns the facebook profile name or nothing
def youtube_network_profile(user) (user.network.youtube.nil?) ? "" : user.network.youtube end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n if facebook_authentication && facebook_authentication.display_name\n return facebook_authentication.display_name\n end\n return username\n end", "def get_fb_user_name\n return self.facebook_user.now_profile.first_name unless self.facebook_user.nil? || self.facebook_user.now_profile....
[ "0.817356", "0.79700387", "0.7904319", "0.7689265", "0.76799816", "0.7658345", "0.76024956", "0.7541604", "0.7537486", "0.7506942", "0.74846613", "0.74654686", "0.7459085", "0.7445542", "0.73052406", "0.7267499", "0.7255232", "0.7254633", "0.719719", "0.71701044", "0.71678036...
0.0
-1
^ necessary bc, in App Controller we `before_action :require_login` '/'
def welcome end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_login\n redirect_to root_path unless logged_in?\n end", "def require_login\n redirect_to root_path unless logged_in?\n end", "def require_login\n if !current_user\n redirect_to \"/\"\n end\n end", "def require_login\n if !current_user\n ...
[ "0.76762307", "0.76762307", "0.7632807", "0.76071453", "0.7596361", "0.75547576", "0.7424636", "0.7424636", "0.7423367", "0.73578566", "0.73342437", "0.7304159", "0.72936404", "0.7193835", "0.71849567", "0.71783984", "0.71689326", "0.7160785", "0.7144828", "0.71428394", "0.71...
0.0
-1
3rd Party API authentication
def omniauth if params[:provider] == 'github' @user = User.find_or_create_by_github_omniauth(auth) else @user = User.find_or_create_by_google_omniauth(auth) end session[:user_id] = @user.id redirect_to user_path(@user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_auth\n # output the APIkey from the header\n # puts request.headers[\"X-APIkey\"];\n creator = Creator.find_by(creator: request.headers[:creator])\n if creator && creator.authenticate(request.headers[:password])\n render json: { auth_token: encodeJWT(creator), id: creator.id}\n else\n ...
[ "0.7542506", "0.7407642", "0.73714185", "0.73508185", "0.734789", "0.7343505", "0.7331537", "0.73241913", "0.73095644", "0.73095644", "0.7290699", "0.72262955", "0.7197101", "0.71726876", "0.7153163", "0.7110424", "0.7074053", "0.70686835", "0.7064648", "0.7062985", "0.703002...
0.0
-1
returns omniauth user hash
def auth request.env['omniauth.auth'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('/services/api/json/1.2.2/?method=smugmug.auth.checkAccessToken').body)['Auth']['User']\n end", "def identity_hash\n request.env['omniauth.auth']\n end", "def hash_from_omniauth(omniauth)\n {\n :provider => omniauth...
[ "0.73344475", "0.71055675", "0.69837326", "0.69754326", "0.6938071", "0.6927372", "0.6882496", "0.6882496", "0.6882496", "0.6882496", "0.6882496", "0.6882496", "0.6793636", "0.67863935", "0.6696307", "0.6679914", "0.65857804", "0.656548", "0.65444183", "0.64659125", "0.645699...
0.0
-1
Go to index if signed out
def home if !view_context.signed_in? redirect_to '/' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n redirect_to(:action => 'login') #unless logged_in? || User.count > 0\n end", "def index_corruption?; end", "def index\n redirect_to(:action => 'login') unless logged_in? \n end", "def index\n # if !user_signed_in?\n # redirect_to new_user_session_path\n # end\n end", "def ...
[ "0.6618343", "0.6537232", "0.6519096", "0.6436865", "0.63356555", "0.63183683", "0.6230366", "0.6205425", "0.6205425", "0.61788887", "0.611416", "0.61067694", "0.6098385", "0.6061535", "0.6061535", "0.6059238", "0.6006852", "0.6006852", "0.59912", "0.59912", "0.59912", "0.5...
0.0
-1
def record_not_found head :not_found end
def error(status, code, message) render :json => {:response_type => "ERROR", :response_code => code, :message => message}.to_json, :status => status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_found; end", "def record_not_found\n render 'shared/not_found' # Assuming you have a template named 'record_not_found'\n end", "def record_not_found!\n render partial: 'errors/404', status: 404 && return\n end", "def record_not_found\n render file: 'public/404.zh-TW.html', stats: :not_foun...
[ "0.84997445", "0.8062281", "0.7952498", "0.7915873", "0.7879534", "0.78600055", "0.78586394", "0.7848627", "0.78346914", "0.7783232", "0.76712215", "0.76682985", "0.7618748", "0.76056796", "0.76056796", "0.76056796", "0.7598709", "0.7591212", "0.75892204", "0.75778055", "0.75...
0.0
-1