query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Get a list of all cities that contain galleries that a specific artist has paintings in | def cities
galleries.map {|g| g.city}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cities\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery.city\n end\n end.compact.uniq\n end",
"def cities()\n self.galleries().map { | gallery | gallery.city }.uniq\n end",
"def galleries\n Painting.all.map do |paint... | [
"0.7546464",
"0.71309644",
"0.7099127",
"0.70389485",
"0.70389485",
"0.70332885",
"0.70041895",
"0.6988819",
"0.6875623",
"0.6875623",
"0.68692666",
"0.6863109",
"0.68223846",
"0.6793912",
"0.6761507",
"0.67142034",
"0.6705853",
"0.6697353",
"0.66963",
"0.6590664",
"0.6566883... | 0.70277566 | 6 |
GET /peer_to_peer_messages GET /peer_to_peer_messages.json | def index
@peer_to_peer_messages_incoming = PeerToPeerMessage.where(reciever: @current_user.id).order('updated_at desc')
@peer_to_peer_messages_outgoing = PeerToPeerMessage.where(sender: @current_user.id).order('updated_at desc')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def messages( params={} )\n messages = get_connections(\"messages\", params)\n return map_connections messages, :to => Facebook::Graph::Message\n end",
"def message_peer(peer, path, method, params = nil)\n ip,port = peer.strip.split(':')\n\n if method == 'GET'\n JSON.parse(Net::HTTP.get(ip, pat... | [
"0.6591803",
"0.6558801",
"0.6558801",
"0.639517",
"0.636537",
"0.63542885",
"0.63310367",
"0.6317927",
"0.6195676",
"0.6139081",
"0.6120397",
"0.6089118",
"0.6049228",
"0.6047423",
"0.60434854",
"0.6033964",
"0.6028271",
"0.6018269",
"0.6012439",
"0.5991966",
"0.5985504",
... | 0.67530507 | 0 |
GET /peer_to_peer_messages/1 GET /peer_to_peer_messages/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_peer(peer, path, method, params = nil)\n ip,port = peer.strip.split(':')\n\n if method == 'GET'\n JSON.parse(Net::HTTP.get(ip, path, port)) rescue nil\n elsif method == 'POST' && params\n JSON.parse(Net::HTTP.new(ip, port).post(path, parameterize(params)).body) rescue nil\n end\n ... | [
"0.6759859",
"0.6759859",
"0.65851426",
"0.6542075",
"0.6485046",
"0.6457486",
"0.6450974",
"0.6408195",
"0.6389629",
"0.63548356",
"0.6311099",
"0.6276855",
"0.6259388",
"0.62247926",
"0.62017167",
"0.6178163",
"0.6146384",
"0.6132821",
"0.6132208",
"0.61249566",
"0.6106559"... | 0.0 | -1 |
POST /peer_to_peer_messages POST /peer_to_peer_messages.json | def create
@peer_to_peer_message = PeerToPeerMessage.new(params[:peer_to_peer_message])
if @peer_to_peer_message.save
redirect_to peer_to_peer_messages_path, notice: 'Deine Nachricht wurde abgeschickt.'
else
render "new.html.erb"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def peer_to_peer_message_params\n params.require(:peer_to_peer_message).permit(:sender, :reciever, :subject, :message)\n end",
"def create\n @message = Message.new(params[:message])\n if params[:recipient_ids]\n recipients = User.find(params[:recipient_ids])\n for rec in recipients\n ... | [
"0.66369003",
"0.62358373",
"0.6222492",
"0.61029947",
"0.6091709",
"0.6091709",
"0.6065962",
"0.60373825",
"0.6028942",
"0.60237455",
"0.59995395",
"0.59872735",
"0.59573156",
"0.5925383",
"0.5896308",
"0.5870327",
"0.58558947",
"0.58531463",
"0.58531463",
"0.58458936",
"0.5... | 0.65999377 | 1 |
PATCH/PUT /peer_to_peer_messages/1 PATCH/PUT /peer_to_peer_messages/1.json | def update
@peer_to_peer_message = PeerToPeerMessage.find(params[:id])
respond_to do |format|
if @peer_to_peer_message.update(params[:peer_to_peer_message])
format.html { redirect_to @peer_to_peer_message, notice: 'Deine Nachricht wurde erfolgreich abgeschickt.' }
format.json { head :no_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @message.update(message_params)\n render... | [
"0.6688706",
"0.65078026",
"0.65044034",
"0.64212835",
"0.6402321",
"0.626815",
"0.6204449",
"0.6177297",
"0.61717707",
"0.6167456",
"0.6143235",
"0.6131245",
"0.60978097",
"0.6083931",
"0.6075926",
"0.6072028",
"0.60557735",
"0.60531837",
"0.60195845",
"0.6014002",
"0.601361... | 0.70113736 | 0 |
DELETE /peer_to_peer_messages/1 DELETE /peer_to_peer_messages/1.json | def destroy
@peer_to_peer_message.destroy
respond_to do |format|
format.html { redirect_to peer_to_peer_messages }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n # delete a specific messag... | [
"0.74429554",
"0.7402202",
"0.72495055",
"0.72076255",
"0.7207349",
"0.7206007",
"0.7206007",
"0.7164388",
"0.7107189",
"0.70760036",
"0.70755744",
"0.70722765",
"0.70701975",
"0.7068949",
"0.7068949",
"0.7065018",
"0.70303476",
"0.7022571",
"0.7022057",
"0.7022057",
"0.70195... | 0.8000487 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_peer_to_peer_message
@peer_to_peer_message = PeerToPeerMessage.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 peer_to_peer_message_params
params.require(:peer_to_peer_message).permit(:sender, :reciever, :subject, :message)
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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
True if the user shouldn't resubmit for the same problem. | def accepted?
score == max_score
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_submit\n redirect_to problem_path(@problem) and return if @no_new_submission\n if current_user.sk.submissions.where(:problem => @problem, :status => [:draft, :waiting]).count > 0\n redirect_to problem_path(@problem) and return\n end\n end",
"def auto_submit?\n false\n end",
"... | [
"0.7174207",
"0.69873255",
"0.67209595",
"0.6664321",
"0.6502797",
"0.63830304",
"0.63591117",
"0.63591117",
"0.63591117",
"0.6358111",
"0.63420516",
"0.63313085",
"0.63298434",
"0.63252974",
"0.6277312",
"0.62665004",
"0.6220836",
"0.6215822",
"0.62135077",
"0.62118876",
"0.... | 0.0 | -1 |
io is an IO object. | def initialize(name)
@name = name
@sections = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def io; end",
"def io; end",
"def io; end",
"def io; end",
"def io\n @io\n end",
"def initialize(io)\n @io = io\n end",
"def read_io io\n handle_client io\n end",
"def output=(io); end",
"def io\n @io ||= :output\n end",
"def load(io)\n io.re... | [
"0.8282867",
"0.8282867",
"0.8282867",
"0.8282867",
"0.8112737",
"0.7666121",
"0.7557627",
"0.752134",
"0.7404128",
"0.7392868",
"0.7333619",
"0.72531515",
"0.7238237",
"0.7227417",
"0.7227417",
"0.7180378",
"0.71232677",
"0.7123266",
"0.7088202",
"0.7044728",
"0.7044275",
... | 0.0 | -1 |
True if the keymap file has AllowSetConflicts set to 1 | def allow_conflicts
((s = self.sections["Settings"]) &&
(a = s.attributes["AllowSetConflicts"]) &&
(a.value.pri == '1'))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def any_key?\n @keys == UndefinedSetting\n end",
"def options_set?(key)\n @options.key? key\n end",
"def allowed?(key)\n @status[key] == :allowed\n end",
"def perms_set\n PRIV_FLAG_COLUMNS.select { |pfc| self[pfc] == 'Y' }.to_set\n end",
"def are_only_global?\n se... | [
"0.5897868",
"0.5755835",
"0.57237506",
"0.5709856",
"0.5701093",
"0.5687288",
"0.5658812",
"0.5641483",
"0.55085284",
"0.5480471",
"0.54732007",
"0.54502124",
"0.5446494",
"0.540288",
"0.5402694",
"0.53858113",
"0.53729576",
"0.53520656",
"0.5349449",
"0.5333373",
"0.5311913... | 0.74212223 | 0 |
returns a Fixnum between 0 and 0xFFFF or :EOF | def look_ahead(pos)
offset = @index + pos - 1
if @buffer.length < offset + 1
char = @input.read(offset + 1 - @buffer.length)
@buffer << char if not char.nil?
end
if offset < @buffer.length
@buffer[offset]
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_int\n raise EOFError if @position + 4 > @size\n value = @response[@position, 4].unpack('N*').first\n @position += 4\n return value\n end",
"def integer(buf, n)\n limit = 2**n - 1\n i = !n.zero? ? (buf.getbyte & limit) : 0\n\n m = 0\n while (byte = buf.ge... | [
"0.6556184",
"0.59336317",
"0.59229857",
"0.5916277",
"0.5862862",
"0.58423996",
"0.5830782",
"0.57900274",
"0.57714635",
"0.57531327",
"0.57177377",
"0.5616561",
"0.55954885",
"0.55798364",
"0.55725175",
"0.5557038",
"0.5539598",
"0.5537672",
"0.5533679",
"0.55243134",
"0.55... | 0.0 | -1 |
list of patient is empty | def empty?
@element_repository.all.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patients\n my_patients = self.appointments.map do |appointment|\n appointment.patient\n end \n\n my_patients.uniq\n end",
"def patients\n appointments.map{|appointment| appointment.patient}.uniq\n end",
"def list\n begin\n doc = healthinfo_doc()\n @... | [
"0.6531858",
"0.6441745",
"0.6338303",
"0.63242775",
"0.63242775",
"0.63242775",
"0.6320478",
"0.6313569",
"0.6299868",
"0.6294039",
"0.6286559",
"0.622639",
"0.6155764",
"0.6125888",
"0.6115498",
"0.6072322",
"0.605857",
"0.60413027",
"0.6036918",
"0.6035076",
"0.6020678",
... | 0.0 | -1 |
Make getting value from underlying hash thread safe. | def [](key)
@mutex.synchronize{@hash[key]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key)\n @semaphore.synchronize do\n return @hashed_storage[key]&.value\n end\n end",
"def value\n mutex.lock\n execute_task_once\n apply_deref_options(@value)\n ensure\n mutex.unlock\n end",
"def lookup_uncached(val); end",
"def lookup_uncached(val); end",
"def ... | [
"0.6909861",
"0.6218103",
"0.61776197",
"0.61776197",
"0.6144785",
"0.6118312",
"0.6078941",
"0.6021406",
"0.6001636",
"0.5985703",
"0.5866726",
"0.58429253",
"0.5838045",
"0.5813757",
"0.5810871",
"0.57774293",
"0.57723993",
"0.5749235",
"0.5721991",
"0.5721991",
"0.57041264... | 0.5822776 | 13 |
Make setting value in underlying hash thread safe. | def []=(key, value)
@mutex.synchronize{@hash[key] = value}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_set(hash, key, value)\n hash[key] = value.freeze\n end",
"def set(thing)\n @cache[section(thing)][key(thing)] = digest(thing)\n end",
"def thread_safe=(value)\n @lock = value ? Mutex.new : PlaceboLock.new\n end",
"def value=(val)\n mutex.lock\n @value = val\... | [
"0.6499774",
"0.6463191",
"0.63151103",
"0.6256516",
"0.6171121",
"0.6046616",
"0.6009809",
"0.59813476",
"0.594365",
"0.594365",
"0.59241354",
"0.59241354",
"0.58995",
"0.5891201",
"0.5872993",
"0.5853178",
"0.5812106",
"0.5796741",
"0.5791901",
"0.57890373",
"0.57883",
"0... | 0.60244405 | 6 |
Return the frozen internal hash. The internal hash can then be accessed directly since it is frozen and there are no thread safety issues. | def freeze
@hash.freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash\n to_h.hash ^ self.class.hash\n end",
"def hash\n @hash || calculate_hash!\n end",
"def hash\n @hash ||= begin\n ... | [
"0.69803894",
"0.6573416",
"0.65558",
"0.65044",
"0.6504151",
"0.6504151",
"0.64919627",
"0.6487728",
"0.6383373",
"0.6340077",
"0.6303938",
"0.6291439",
"0.6278804",
"0.6275261",
"0.62539494",
"0.6230495",
"0.62192065",
"0.6210474",
"0.6157601",
"0.6155386",
"0.61363757",
... | 0.69822085 | 0 |
Create a copy of the cache with a separate mutex. | def initialize_copy(other)
@mutex = Mutex.new
other.instance_variable_get(:@mutex).synchronize do
@hash = other.instance_variable_get(:@hash).dup
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_client\n @m ||= Mutex.new\n @m.synchronize do\n if instance_variable_defined?(:@cache_client)\n @cache_client\n else\n dir = Rails.root.join(CacheDirectory.find_by(name: 'efs_twitter_user')&.dir || 'tmp/efs_cache')\n FileUtils.mkdir_p(dir) ... | [
"0.6974861",
"0.6891699",
"0.66936624",
"0.66707426",
"0.65846175",
"0.64999366",
"0.6369836",
"0.61871004",
"0.61868197",
"0.61782247",
"0.61621785",
"0.6101799",
"0.6016833",
"0.6005638",
"0.59688413",
"0.5942515",
"0.5942515",
"0.5942515",
"0.5942515",
"0.5937455",
"0.5928... | 0.64028585 | 7 |
number = gets.chomp number = number.to_i | def counter()
number = gets.chomp
number = number.to_i
for num in 1..number.to_i
# if num % 15 == 0
if num % 5 == 0 && num % 3 == 0
p "FizzBuzz"
elsif num % 5 == 0
p "Buzz"
elsif num % 3 == 0
p "Fizz"
else
p num
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_for_number\n gets.chomp.to_i\n end",
"def get_number\nprint \"What number do you want to check? \"\n@number = gets.to_i\nend",
"def get_input_i\n\tgets.chomp.to_i\nend",
"def get_number(identifier)\n print \"==> Enter the #{identifier} number: \"\n gets.chomp.to_i\nend",
"def get_input\n get... | [
"0.81370425",
"0.79016143",
"0.77195966",
"0.76714",
"0.76520216",
"0.76448184",
"0.7553562",
"0.7546997",
"0.7530526",
"0.7501405",
"0.7494675",
"0.745302",
"0.7380136",
"0.73381215",
"0.7337637",
"0.73046607",
"0.72786224",
"0.72539055",
"0.72343826",
"0.7227975",
"0.721958... | 0.0 | -1 |
display_name is defined for activeadmin | def display_name
self.short_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_display_name\n \"#{course.organization.abbreviation} #{term.slug} #{course.number} (#{label})\"\n end",
"def display_name\n @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n ... | [
"0.7958606",
"0.77906364",
"0.77758074",
"0.7691827",
"0.76130533",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
"0.76024866",
... | 0.74219775 | 59 |
Check Unactives teachers users | def user_active?
return true if teacher? && !activated
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engaged_users\n self.users.select { |u| u.ideas.count > 0 || u.comments.count > 0 || u.votes.count > 0 || u.support_messages.count > 0 }\n end",
"def teacher_requests\n @teachers = User.where(\"teacher_status_cd IS NOT NULL\")\n end",
"def teacher_only\n false\n end",
"def teacher_only\n f... | [
"0.6744448",
"0.67340803",
"0.6393459",
"0.6393459",
"0.6393459",
"0.6278495",
"0.6257762",
"0.6201374",
"0.61557907",
"0.6152035",
"0.61084473",
"0.61042637",
"0.60858715",
"0.60746163",
"0.60692835",
"0.60592425",
"0.5999062",
"0.59954536",
"0.598097",
"0.5975893",
"0.59663... | 0.6427395 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_order
@order = Order.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 order_params
params.require(:order).permit(:date, :customer_id, :address_id, :grand_total, :payment_receipt)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
rubocop:enable GuardClause can't autogen server_hosts, special array handling | def server_hosts
return [:default] if @resource[:server_hosts] &&
@resource[:server_hosts][0] == :default &&
@property_hash[:server_hosts] ==
@aaa_group.default_servers
@property_hash[:server_hosts]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hosts(args = nil)\n if args and args[:server]\n args[:server].split(';').collect { |server| $hosts[server] ||\n Config.warn_fail(\"#{server} is not a known host\") }\n else\n $hosts.values\n end\nend",
"def all_server_hosts\n [server_host]\n end",
"def... | [
"0.7373726",
"0.7196552",
"0.70619214",
"0.70619214",
"0.69671607",
"0.6961437",
"0.6882276",
"0.6739088",
"0.66769224",
"0.66769224",
"0.66769224",
"0.66673464",
"0.66536283",
"0.6607486",
"0.65479076",
"0.6517113",
"0.6497701",
"0.64906836",
"0.6463013",
"0.6436772",
"0.643... | 0.72012216 | 1 |
can't autogen because named 'vrf', not 'vrf_name' in node utils | def vrf_name
return :default if @resource[:vrf_name] == :default &&
@property_hash[:vrf_name] ==
@aaa_group.default_vrf
@property_hash[:vrf_name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n \"#{self[:afi]} #{self[:vrf]}\"\n end",
"def test_harness_bgp_vrf(tests, id, vrf)\n orig_desc = tests[id][:desc]\n tests[id][:desc] += \" (vrf #{vrf})\"\n tests[id][:title_pattern] = \"#{tests[:asn]} #{vrf}\"\n\n test_harness_run(tests, id)\n tests[id][:desc] = orig_desc\nend",
"def name\n ... | [
"0.64470965",
"0.60007024",
"0.57751447",
"0.54026353",
"0.52675503",
"0.5247355",
"0.51951903",
"0.5172742",
"0.5117186",
"0.50721043",
"0.50118035",
"0.50118035",
"0.50118035",
"0.50118035",
"0.50118035",
"0.49835855",
"0.49413127",
"0.49294317",
"0.49240443",
"0.49095085",
... | 0.5902869 | 2 |
Add product to watchlist | def add_product(product)
products << product
# save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_product product\n\t\t@products.push product\n\t\tproduct\n\tend",
"def create\n # Get the product id\n watchlist_item = params.require(:watchlist)[:product_id]\n # Find the product id\n product = Product.find(watchlist_item)\n # Find the watchlist\n @watchlist = current_user.watchlist u... | [
"0.7036758",
"0.69849676",
"0.6696211",
"0.6683077",
"0.6647386",
"0.6626733",
"0.66080934",
"0.65887207",
"0.6561608",
"0.6555865",
"0.65263176",
"0.65191287",
"0.6509405",
"0.6504337",
"0.6502925",
"0.6497681",
"0.64912623",
"0.64909494",
"0.64899445",
"0.6487452",
"0.64673... | 0.6799278 | 2 |
Remove product from watchlist | def remove_product(product)
products.delete(product)
# save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # Get the product id\n watchlist_item = params[:watchlist][:product_id]\n # Find the product id\n product = Product.find(watchlist_item)\n # Delete product id from watchlist\n current_user.watchlist.remove_product(product)\n\n respond_to do |format|\n format.html { redirect_... | [
"0.7169025",
"0.68592286",
"0.6785812",
"0.6776499",
"0.67694104",
"0.65844285",
"0.65261585",
"0.65238816",
"0.6504937",
"0.6498992",
"0.6447885",
"0.64012396",
"0.6383513",
"0.6377894",
"0.63636315",
"0.63358",
"0.6333195",
"0.63200104",
"0.63015956",
"0.6294331",
"0.623984... | 0.7295612 | 0 |
Access a product from watchlist | def product(product)
products.find(product.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product\n nic_view.product\n end",
"def product\n FarMar::Product.find(@product_id)\n end",
"def currentProduct()\n @products[@current_product]\n end",
"def product\n FarMar::Product.find(self.product_id)\n end",
"def product\n self[\"ProductName\"]\n end",
"def wa... | [
"0.6612195",
"0.64390695",
"0.64321005",
"0.6427617",
"0.6334265",
"0.6323704",
"0.6282767",
"0.6241135",
"0.6214119",
"0.6174637",
"0.6152275",
"0.61483645",
"0.6139298",
"0.6136491",
"0.60968953",
"0.60834134",
"0.6060023",
"0.6051558",
"0.60381776",
"0.60287595",
"0.601091... | 0.6501404 | 1 |
Check if product already added in watchlist | def includes_product?(product)
products.include?(product)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def added_to_watchlist?(product)\n return false unless user_signed_in?\n return false if current_user.watchlist.blank?\n current_user.watchlist.includes_product?(product)\n end",
"def check_new_product\n product_name = query(\"* id:'text_view_product_name'\", :text)\n product_name[0] == @@product... | [
"0.74837136",
"0.6891579",
"0.6530012",
"0.6363673",
"0.629468",
"0.6274116",
"0.62142295",
"0.6158653",
"0.61182046",
"0.6064577",
"0.6029355",
"0.60248655",
"0.60226953",
"0.6021013",
"0.59988606",
"0.5988427",
"0.596045",
"0.5931875",
"0.58767337",
"0.58700836",
"0.5867419... | 0.64281535 | 3 |
If output is a hash, it appends it to the output and returns a string. | def print(output = STDOUT, options = {})
super(output, options)
if @output.is_a?(Hash)
@array << { 'profiled' => @output }
@output = json
else
@output.puts json
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_to_output(output, str)\n if !str.kind_of?(String)\n output << str\n return\n end\n return if str.empty?\n if output.last.kind_of?(String)\n output.last << str\n else\n output << str\n end\n end",
"def output_hash; end",
"def append_output(... | [
"0.64188117",
"0.6273252",
"0.609434",
"0.6092455",
"0.60116684",
"0.59078413",
"0.58557796",
"0.5791811",
"0.57913744",
"0.5785354",
"0.5781223",
"0.57407343",
"0.56905055",
"0.56664383",
"0.56474173",
"0.5616676",
"0.5616676",
"0.56070143",
"0.5601137",
"0.5582687",
"0.5571... | 0.0 | -1 |
Override for this printer to sort by self time by default | def sort_method
@options[:sort_method] || :self_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_timestamp\n self.created_at\n end",
"def sort_times\n @links.each_value { |l| l.sort_times }\n end",
"def sort_entries; end",
"def sort_order\n super\n end",
"def sort_by_time\n (updated_at || published_at)\n end",
"def sort\n\t@events = @events.sort_by { | e | e.time_fro... | [
"0.67981815",
"0.6520414",
"0.64539856",
"0.64513946",
"0.6377446",
"0.6373837",
"0.6340209",
"0.6311779",
"0.62676114",
"0.62342125",
"0.62047493",
"0.6198619",
"0.6149796",
"0.5999475",
"0.5987668",
"0.59433025",
"0.593826",
"0.58693874",
"0.5868538",
"0.583923",
"0.5837602... | 0.6680521 | 1 |
Benefits : Make changes in one place, example adding a "." | def say(words)
puts words + "." ## <= we only make the change here!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_period stringthing\n stringthing << \".\"\nend",
"def say(words)\n puts words + '.' ## <= We only make the change here!\n end",
"def say(words)\n puts words + '.' #We only make the change here\nend",
"def say(words='hello')\n puts words + '.' ## <= We only make the change here!\nend",
"de... | [
"0.70619375",
"0.62686956",
"0.62059313",
"0.6149094",
"0.6113312",
"0.60637045",
"0.5974304",
"0.59578127",
"0.59112537",
"0.589029",
"0.5886821",
"0.5840477",
"0.58172923",
"0.5806579",
"0.56944823",
"0.566509",
"0.5646914",
"0.56371677",
"0.56371677",
"0.56371677",
"0.5598... | 0.6165547 | 3 |
Method with default value | def say2(words="hello2")
puts words
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default; end",
"def default; end",
"def default\n end",
"def default=(_arg0); end",
"def method_missing(*args)\n default\n end",
"def set_default\n end",
"def default=(_); end",
"def default=(value); end",
"def default!\n @value = default\n end",
"def default_value(value)... | [
"0.8204959",
"0.8204959",
"0.8144845",
"0.81434137",
"0.8100181",
"0.80391467",
"0.7996388",
"0.78906435",
"0.7876526",
"0.77920896",
"0.7655075",
"0.7642913",
"0.7642913",
"0.7466074",
"0.74175864",
"0.74175864",
"0.74175864",
"0.74175864",
"0.74175864",
"0.74175864",
"0.741... | 0.0 | -1 |
TODO: Rotate smallest angle to reach bearing Convert bearing to positive radians coterminal in first turn | def to_relative_bearing(bearing)
position_rad = @position.convert(@motor_steps, 2 * Math::PI)
difference = bearing.coterminal(2 * Math::PI, 1, 1) - position_rad.coterminal(2 * Math::PI, 1, 1)
closest_position = position_rad + difference
if self.range.include? closest_position
go_to_position = clos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_bearing(angle)\n \t return ((angle + Math::PI) % (2 * Math::PI)) - Math::PI\n \tend",
"def bearing\n\n if self > 360\n self - 360\n elsif self < 0\n 360 + self\n else\n self\n end\n\n end",
"def stabilise\n\t\tif almost_at_angle(0, @angle, @rotation_speed)\n\t\t\tup... | [
"0.7082153",
"0.69686604",
"0.6864544",
"0.68512934",
"0.68084055",
"0.6773",
"0.64903796",
"0.64499664",
"0.64486766",
"0.6433741",
"0.6418924",
"0.64146227",
"0.6401175",
"0.63660955",
"0.6359798",
"0.6351625",
"0.63510174",
"0.633318",
"0.63234",
"0.63155764",
"0.62915593"... | 0.64396614 | 9 |
Lowercase English letters and the ' char ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "'"] | def array_of_single_char_substrings
@array_of_single_char_substrings ||= (97..122).map {|int| int.chr } << "'"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_chars(char)\n ROMAN_CHARS.split(char)[0]\n end",
"def encode\n @word.chars.map { |letter|\n index = @abc.index(letter)\n cipher_character = @abc_reverse[index]\n }.join\n end",
"def get_letters(word)\n word.encode('UTF-8').downcase.split(\"\")\n end",
"def only_letters\n ... | [
"0.6811231",
"0.66377974",
"0.6598559",
"0.655822",
"0.6485255",
"0.642027",
"0.6387005",
"0.635327",
"0.63285995",
"0.6325394",
"0.63026303",
"0.6302244",
"0.6281212",
"0.6269885",
"0.6246855",
"0.61242217",
"0.61064917",
"0.61028",
"0.60549957",
"0.6049296",
"0.60458827",
... | 0.0 | -1 |
["aa", "ab", ... "'z", "''"] | def array_of_2_char_substrings
@array_of_2_char_substrings ||= array_of_single_char_substrings.map do |a|
array_of_single_char_substrings.map {|b| "#{a}#{b}" }
end.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_of_single_char_substrings\n @array_of_single_char_substrings ||= (97..122).map {|int| int.chr } << \"'\"\n end",
"def letter_array (name)\n\tname.chars\nend",
"def quotelist( *args )\n\t\t\treturn args.flatten.collect {|part| part =~ /\\s/ ? part.inspect : part}\n\t\tend",
"def filter_repeated_... | [
"0.69158804",
"0.6144626",
"0.60232687",
"0.59006727",
"0.58010244",
"0.57526076",
"0.57512414",
"0.5727487",
"0.57181835",
"0.5684293",
"0.5679074",
"0.56645036",
"0.5637296",
"0.5631566",
"0.56164604",
"0.5594338",
"0.5577398",
"0.5552549",
"0.5543167",
"0.5531806",
"0.5513... | 0.54932445 | 23 |
["aaa", "aab", ... ] | def array_of_3_char_substrings
@array_of_3_char_substrings ||= array_of_2_char_substrings.map do |a|
array_of_single_char_substrings.map {|b| "#{a}#{b}" }
end#.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_array (name)\n\tname.chars\nend",
"def filter_repeated_character_strings(arr)\nend",
"def alphabet_array\n ('A'..'Z').to_a\n end",
"def suffix_array text\n sufs = {}\n 0.upto(text.length - 1){|i| sufs[text[i..text.length]] = i}\n lexo_sufs = sufs.keys.sort\n array = []\n lexo_sufs.each{|s... | [
"0.6728126",
"0.6626681",
"0.6580115",
"0.6393728",
"0.63839227",
"0.63777864",
"0.6368073",
"0.6283828",
"0.62822366",
"0.6243061",
"0.62271875",
"0.6203109",
"0.61857784",
"0.6174897",
"0.61449707",
"0.61283755",
"0.61146414",
"0.6110444",
"0.6108688",
"0.6107385",
"0.60872... | 0.5970062 | 35 |
GET /event_mailing_lists GET /event_mailing_lists.json | def index
@event_mailing_list = EventMailingList.new
@event_sites = EventSite.all
# if params[:id]
# @mail = EventMailingList.find(params[:id])
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n perform_request(Entities::MarketingEmail, 'newsletter/list.json')\n end",
"def list\n @client.call(method: :get, path: 'recipient-lists')\n end",
"def calendar_list\n logger.info(\"-- calendar list st --\") if logger\n auth unless @auth\n uri = URI.pars... | [
"0.6705904",
"0.6628275",
"0.65128654",
"0.6466207",
"0.6435999",
"0.64053327",
"0.6235349",
"0.6227544",
"0.622566",
"0.62149",
"0.62087035",
"0.6176919",
"0.6162262",
"0.6161009",
"0.61354595",
"0.60997206",
"0.60957247",
"0.6013968",
"0.60111594",
"0.5980474",
"0.59712416"... | 0.65773827 | 2 |
GET /event_mailing_lists/1 GET /event_mailing_lists/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @mailing_list = MailingList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mailing_list }\n end\n end",
"def index\n @event_mailing_list = EventMailingList.new\n @event_sites = EventSite.all\n # if params[:id]\n ... | [
"0.69611156",
"0.6813388",
"0.66432893",
"0.6547184",
"0.65323037",
"0.6322311",
"0.6275468",
"0.62630457",
"0.62608254",
"0.62446344",
"0.61906165",
"0.61482537",
"0.6140315",
"0.6101374",
"0.6084493",
"0.60448927",
"0.59894586",
"0.59633595",
"0.59406745",
"0.5920282",
"0.5... | 0.0 | -1 |
POST /event_mailing_lists POST /event_mailing_lists.json | def create
@event_mailing_list = EventMailingList.find_by_email(params[:event_mailing_list][:email])
unless @event_mailing_list
@event_mailing_list = EventMailingList.new(event_mailing_list_params)
@event_mailing_list.save
EventLog.create(event_user_id: @event_mailing_list.id, screen_type: "Ev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @mailing_list = MailingList.new(params[:mailing_list])\n\n respond_to do |format|\n if @mailing_list.save\n format.html { redirect_to @mailing_list, notice: 'Mailing list was successfully created.' }\n format.json { render json: @mailing_list, status: :created, location: @mail... | [
"0.66890544",
"0.6575431",
"0.6264821",
"0.6254067",
"0.6253475",
"0.61985815",
"0.61827916",
"0.6102709",
"0.6093285",
"0.608102",
"0.6075535",
"0.60503715",
"0.6035761",
"0.5973016",
"0.5914041",
"0.5898641",
"0.58577514",
"0.5851381",
"0.58232045",
"0.58104795",
"0.5809687... | 0.62379235 | 5 |
PATCH/PUT /event_mailing_lists/1 PATCH/PUT /event_mailing_lists/1.json | def update
respond_to do |format|
if @event_mailing_list.update(event_mailing_list_params)
format.html { redirect_to @event_mailing_list, notice: 'Event mailing list was successfully updated.' }
format.json { render :show, status: :ok, location: @event_mailing_list }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @mailing_list = MailingList.find(params[:id])\n\n respond_to do |format|\n if @mailing_list.update_attributes(params[:mailing_list])\n format.html { redirect_to @mailing_list, notice: 'Mailing list was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.6993114",
"0.690204",
"0.6699072",
"0.65941495",
"0.65400606",
"0.65175945",
"0.6493013",
"0.6427229",
"0.6403127",
"0.6387098",
"0.62858915",
"0.6156639",
"0.6110806",
"0.60567194",
"0.59961754",
"0.598601",
"0.5983403",
"0.597883",
"0.59320915",
"0.591179",
"0.5905872",
... | 0.7501657 | 0 |
DELETE /event_mailing_lists/1 DELETE /event_mailing_lists/1.json | def destroy
@event_mailing_list.destroy
respond_to do |format|
format.html { redirect_to event_mailing_lists_url, notice: 'Event mailing list was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mailing_list = MailingList.find(params[:id])\n @mailing_list.destroy\n\n respond_to do |format|\n format.html { redirect_to mailing_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailing_list.destroy\n respond_to do |format|\n format.... | [
"0.7696376",
"0.7542861",
"0.7384666",
"0.7304823",
"0.72483563",
"0.71402884",
"0.7108932",
"0.7061873",
"0.6978388",
"0.6938064",
"0.6833889",
"0.68251455",
"0.68146807",
"0.67656296",
"0.67257935",
"0.6721431",
"0.6719896",
"0.67142177",
"0.67052066",
"0.67052066",
"0.6673... | 0.79835904 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_event_mailing_list
@event_mailing_list = EventMailingList.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def event_mailing_list_params
params[:event_mailing_list].permit(:email)
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 |
redefine your position_taken? method here, so that you can use it in the valid_move? method above. | def position_taken?(board, index)
a = board[index]
filled = a == "X" || a == "O"
return filled
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend",
"def position_taken?\nend",
"def valid_move?(board, index)\n if index.between?(0, 8)\n # re-define your #position_taken? method here, so that you can use it in the #v... | [
"0.8409212",
"0.81628245",
"0.8090222",
"0.8027092",
"0.80135226",
"0.7896449",
"0.78932965",
"0.7884584",
"0.7843486",
"0.784155",
"0.7830964",
"0.7813449",
"0.7812499",
"0.78090835",
"0.78006256",
"0.78000057",
"0.7799687",
"0.7788274",
"0.7781896",
"0.7773916",
"0.77728736... | 0.0 | -1 |
DELETE /purchases/1 DELETE /purchases/1.json | def destroy
@purchase.destroy
respond_to do |format|
format.html { redirect_to purchases_url, notice: 'Purchase was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |for... | [
"0.75726354",
"0.75726354",
"0.7561192",
"0.7556757",
"0.7556757",
"0.7556757",
"0.7556757",
"0.7556757",
"0.7554956",
"0.74132746",
"0.7412022",
"0.74064875",
"0.73987836",
"0.7253456",
"0.72090435",
"0.71847177",
"0.7113888",
"0.7111887",
"0.7108084",
"0.70912975",
"0.70828... | 0.7218594 | 16 |
Use callbacks to share common setup or constraints between actions. | def set_purchase
@purchase = Purchase.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def purchase_params
params.fetch(:purchase, {}).permit(:email, :stripe_token)
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 |
field :user, Types::Objects::UserType, null: true | def authorized?(blank_schedule:, **args)
context[:user_signed_in] && blank_schedule.can_write?(context[:current_user])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_type; end",
"def allowed_types\n [Tapir::Entities::User]\nend",
"def allowed_types\n [User]\nend",
"def user_class()\n @user\n end",
"def model_class\n User\n end",
"def allowed_types\n [ Entities::Username ]\nend",
"def user\n @user\n end",
"def user\n @user\n end",
"de... | [
"0.69374615",
"0.69322914",
"0.6786371",
"0.65782505",
"0.6489278",
"0.64091146",
"0.6349247",
"0.6349247",
"0.6349247",
"0.63271785",
"0.63271785",
"0.63264346",
"0.62836516",
"0.62715507",
"0.6207173",
"0.615772",
"0.6155108",
"0.6130765",
"0.6130765",
"0.6105784",
"0.60803... | 0.0 | -1 |
A git submission can have automatically detected contributors | def detectable_contributors?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_contributors(contributor_names_per_commit)\n # Cache contributors to speed up processing wiped databases. They are about\n # 1400 so we can afford this hash.\n contributors = Hash.new {|h, name| h[name] = Contributor.find_or_create_by_name(name)}\n\n Commit.with_no_contributors.find_each do ... | [
"0.63118064",
"0.62127566",
"0.6170053",
"0.6105986",
"0.6066905",
"0.6015502",
"0.59849",
"0.58790237",
"0.5827196",
"0.58189034",
"0.5815715",
"0.580792",
"0.57763016",
"0.57686627",
"0.5764028",
"0.575767",
"0.57575494",
"0.57446367",
"0.5720266",
"0.57087773",
"0.57058465... | 0.680053 | 0 |
Returns the url to a specific file on github | def file_url(filename)
raw_url = git_repository_url[0..-5]
"#{raw_url}/blob/#{git_commit_sha}/#{filename}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_to_file_on_github\n \"https://github.com/#{@repo.name}/blob/master/#{@file}#L#{@todo.line_number}\"\n end",
"def github_url\n GITHUB_ARTICLES_URL + file_name\n end",
"def github_url(ruby_doc)\n version, file, line = ruby_doc.source_location.split(\":\")\n\n if version == MASTER\n pa... | [
"0.8178304",
"0.80104345",
"0.777752",
"0.7690382",
"0.76031476",
"0.7513142",
"0.7452557",
"0.7420448",
"0.74197733",
"0.74197733",
"0.7359402",
"0.73476344",
"0.7216457",
"0.7209253",
"0.7186319",
"0.71819526",
"0.7142451",
"0.7115491",
"0.7092376",
"0.7075284",
"0.7052895"... | 0.76328164 | 4 |
TODO: settle on one | def generate_service_name
service_module = ret_service_module
assembly_name = request_params(:assembly_name)
if version = request_params(:version)
version = nil if BASE_VERSION_STRING.include?(version)
else
version = compute_latest_version(service_module)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def refutal()\n end",
"def terpene; end",
"def weber; end",
"def offences_by; end",
"def first; end",
"def first; end",
"def str... | [
"0.72093016",
"0.67309767",
"0.6574207",
"0.65276784",
"0.65276784",
"0.65276784",
"0.65276784",
"0.6343623",
"0.6238271",
"0.6230491",
"0.6087505",
"0.59811354",
"0.5956525",
"0.5956525",
"0.5953082",
"0.5918551",
"0.5912381",
"0.5901453",
"0.589369",
"0.58911383",
"0.588505... | 0.0 | -1 |
return a list of tokens. Token delimiters are doublequotes and whitespace, except for whitespace within doublequotes. | def tokenize
out_tokens = Array.new
@token_offset = 0
until @token_offset >= (self.length - 1)
out_tokens << next_token
end
out_tokens.reject {|token| token.empty? }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize\n return @value.split(/\\s+/)\n end",
"def tokens(force = nil)\n data(force).map(&:token)\n end",
"def tokenize(text)\n text.downcase.split(/[\\s\\.,\"']+/)\n end",
"def tokens\n tok_sequence = []\n until @scanner.eos?\n token = _next_token\n tok... | [
"0.7029048",
"0.6910994",
"0.6886686",
"0.6731829",
"0.6615913",
"0.65684134",
"0.65382427",
"0.6529096",
"0.6529096",
"0.65088564",
"0.6422568",
"0.6358353",
"0.6354249",
"0.63345265",
"0.6320311",
"0.6309776",
"0.6202382",
"0.6173733",
"0.616961",
"0.6149492",
"0.6090504",
... | 0.6275057 | 16 |
This is how you daemonize in ruby, preventing an orphaned inner process. | def daemonize(&block)
temp_pid = fork do
Process.setsid
trap 'SIGHUP', 'IGNORE'
fork do
yield
end
end
# This prevents the short lived fork from sticking around as a zombie
Process.detach(temp_pid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daemonize\n exit if fork\n Process.setsid\n exit if fork\n Dir.chdir \"/\"\n end",
"def daemonize! \n raise 'First fork failed' if (pid = fork) == -1\n exit unless pid.nil?\n Process.setsid\n raise 'Second fork failed' if (pid = fork) == -1\n exit unless pid.nil?\n ... | [
"0.77734137",
"0.77666533",
"0.7593893",
"0.7419774",
"0.739861",
"0.7395222",
"0.729707",
"0.7294659",
"0.7252151",
"0.7189443",
"0.7139246",
"0.7064692",
"0.70543385",
"0.69893944",
"0.69776434",
"0.6884858",
"0.68845314",
"0.67550904",
"0.66994935",
"0.66994935",
"0.660760... | 0.79690486 | 0 |
if Rails.env == "production" | def authenticate
authenticate_or_request_with_http_basic do |user_name, password|
# Change these to username and password required
user_name == "shitlister" && password == "letmein"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def production?\n environment == :production\nend",
"def production? ; @app.options[:env] == :production ; end",
"def production?\n settings.environment == 'production'\n end",
"def production?\n @environment == :production\n end",
"def production?\n self.environment == ENV_PROD\n end"... | [
"0.9018766",
"0.8776443",
"0.8693348",
"0.8641812",
"0.8623317",
"0.8514745",
"0.84782124",
"0.8451877",
"0.8450106",
"0.843399",
"0.8332547",
"0.8313249",
"0.8294357",
"0.82830274",
"0.828132",
"0.82293475",
"0.81512684",
"0.80506366",
"0.78446966",
"0.7823411",
"0.77848756"... | 0.0 | -1 |
Build a devise resource passing in the session. Useful to move temporary session data to the newly created user. | def build_resource(hash=nil)
self.resource = resource_class.new_with_session(hash || {}, session)
self.resource.role = params[:r] if hash.blank?
self.resource.build_profile if self.resource.profile.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n attrs = session[\"devise.user_attributes\"]\n self.resource.first_name = attrs[\"first_name\"]\n self.resource.last_name = attrs[\"last_name\"]\n self.resource.picture = attrs[\"picture\"]\n end",
... | [
"0.7091186",
"0.6656826",
"0.66357183",
"0.6563214",
"0.6234899",
"0.6205804",
"0.6152574",
"0.61236125",
"0.611247",
"0.6099068",
"0.6014181",
"0.59724724",
"0.59724724",
"0.59543395",
"0.59440666",
"0.5900429",
"0.58953875",
"0.588996",
"0.585942",
"0.58219326",
"0.58096445... | 0.5600924 | 54 |
The default url to be used after updating a resource. You need to overwrite this method in your own RegistrationsController. | def after_update_path_for(resource)
backend_profile_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_after_update\n resources_url {}\n end",
"def after_update_path_for(resource)\n edit_user_registration_path\n end",
"def after_update_path_for(resource)\n edit_user_registration_path\n end",
"def after_update_path_for(resource)\n\t\tedit_user_registration_path\n\tend",
"... | [
"0.7350846",
"0.72481936",
"0.72481936",
"0.7220217",
"0.72045016",
"0.71853065",
"0.71853065",
"0.71853065",
"0.71853065",
"0.71853065",
"0.71853065",
"0.70562035",
"0.70562035",
"0.6972375",
"0.6889528",
"0.6888951",
"0.6801213",
"0.67298096",
"0.66958827",
"0.6687004",
"0.... | 0.63221806 | 46 |
Example: Input: 1>2>4, 1>3>4 Output: 1>1>2>3>4>4 iterative solution | def merge_two_lists(list1, list2)
# 1) create new list, we make a dummy first value
list3 = ListNode.new(nil)
# 2) create pointer on our merged list to keep track of where we are
prev = list3
# 3) ensure we have 2 values to compare by looping until we don't
while list1 && list2
# 4) compare head of lis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\... | [
"0.61643815",
"0.61490643",
"0.60505265",
"0.60240823",
"0.60229516",
"0.5979703",
"0.5970344",
"0.591987",
"0.5868655",
"0.58526623",
"0.5839184",
"0.5803182",
"0.5793159",
"0.5781071",
"0.5754875",
"0.57531184",
"0.57301795",
"0.57115376",
"0.57100475",
"0.5699223",
"0.5697... | 0.0 | -1 |
called when we have a newly created record, to initialize any nil collections to empty arrays. We can do this because if its a brand new record, then any collections that are still nil must not have any children. | def initialize_collections
if (!vector || vector.empty?) && id && id != ''
Base.set_vector_lookup(self, [@model, *find_by_vector(@model.primary_key => id)])
end
Base.load_data do
@model.reflect_on_all_associations.each do |assoc|
next if !assoc.collection? || @attributes[asso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_access if @link_fields.length == 0\n end",
"def handle_empty_arrays\n @fields = {}.with_indifferent_access if @fields.length == 0\n @link_fields = {}.with_indifferent_... | [
"0.62045455",
"0.62045455",
"0.61854243",
"0.6024458",
"0.6003004",
"0.5872381",
"0.5826149",
"0.5743893",
"0.57104385",
"0.5705919",
"0.56906563",
"0.56257755",
"0.5564415",
"0.5553452",
"0.55433977",
"0.5533339",
"0.5525489",
"0.5508914",
"0.54896885",
"0.5469907",
"0.54614... | 0.5889909 | 5 |
sync! now will also initialize any nil collections | def sync!(hash = {}) # does NOT notify (see saved! for notification)
# hash.each do |attr, value|
# @attributes[attr] = convert(attr, value)
# end
@synced_attributes = {}
hash.each { |attr, value| sync_attribute(attr, convert(attr, value)) }
@changed_attributes = []
@saving =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync()\n #This is a stub, used for indexing\n end",
"def init_collection\n strong_memoize(:init_collection) do\n filter(finder.execute).reorder(nil)\n end\n end",
"def initialize\n @collection={}\n end",
"def sync; end",
"def sync_unscoped_collection!\n if destroy... | [
"0.67625076",
"0.6550265",
"0.6391101",
"0.6380841",
"0.63556004",
"0.63205934",
"0.63205934",
"0.63205934",
"0.61856174",
"0.61625004",
"0.6107463",
"0.60795635",
"0.60795635",
"0.5934472",
"0.59103554",
"0.5894655",
"0.5894655",
"0.5894001",
"0.5890513",
"0.5877223",
"0.585... | 0.5549082 | 43 |
this keeps the unscoped collection up to date. | def sync_unscoped_collection!
if destroyed
return if @destroy_sync
@destroy_sync = true
else
return if @create_sync
@create_sync = true
end
model.unscoped._internal_push ar_instance
@synced_with_unscoped = !@synced_with_unscoped
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @collection = []\n end",
"def reset_collection\n LogMessage.collection.drop\n create_collection\n end",
"def initialize\n @collection={}\n end",
"def reload_data\n reset_collection_data\n reload_collection_data\n end",
"def collection_scope; end",
"de... | [
"0.68675196",
"0.6456754",
"0.64304554",
"0.63290596",
"0.626899",
"0.61111563",
"0.60342366",
"0.6026736",
"0.60233605",
"0.60041124",
"0.6002572",
"0.599798",
"0.59545213",
"0.5951542",
"0.59162766",
"0.5915836",
"0.58736736",
"0.5855053",
"0.58063906",
"0.5798607",
"0.5774... | 0.75479156 | 0 |
These strip out null bytes because we were having a problem with them getting sent up | def db_license_key
params[:customer_id].split("-").first.gsub("\u0000", "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean\n self.encode!('UTF-8', :invalid => :replace, :undef => :replace, replace: '')\n end",
"def no_leading_spaces str\n return str.force_encoding('ASCII-8BIT').gsub(/\\302\\240/,'').strip # What a hack.\n end",
"def trim_id3v1_string(str)\n str.tr(\"\\x00\".b, '').strip\n end",
"def to_bina... | [
"0.6675618",
"0.64932686",
"0.63797873",
"0.62923205",
"0.62308437",
"0.6222401",
"0.6221028",
"0.61654735",
"0.6150278",
"0.6121034",
"0.6116837",
"0.6046965",
"0.6035324",
"0.60053474",
"0.599762",
"0.59969723",
"0.5969048",
"0.5969048",
"0.5965971",
"0.58524776",
"0.583446... | 0.0 | -1 |
Retrieves the current user. | def current_user
session[:user_id] ||= cookies[:auth_token]
@current_user ||= User.includes(:role, :main_room).find_by(id: session[:user_id])
if Rails.configuration.loadbalanced_configuration
unless @current_user.nil?
if !@current_user.has_role?(:super_admin) &&
@current_user.provi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n get(\"/v1/users/me\")\n end",
"def get_user\n @current_user = current_user\n end",
"def get_current_user\n request(Route.new(:GET, '/users/@me'))\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def current_user\n ... | [
"0.8155445",
"0.80535954",
"0.8022193",
"0.7828696",
"0.7821942",
"0.78169096",
"0.7742774",
"0.77390486",
"0.77302086",
"0.77168834",
"0.7712165",
"0.7712165",
"0.7712165",
"0.7712165",
"0.7712165",
"0.7712165",
"0.7712165",
"0.7712165",
"0.7711935",
"0.7700004",
"0.76804155... | 0.0 | -1 |
Block unknown hosts to mitigate host header injection attacks | def block_unknown_hosts
return if Rails.configuration.hosts.blank?
raise UnsafeHostError, "#{request.host} is not a safe host" unless Rails.configuration.hosts.include?(request.host)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unknown_host\n update_code(:unknown_host, %i(unknown redirected))\n end",
"def allowHost\n end",
"def validate_host_header(value)\n # allow only valid hostnames\n value.match?(host_regex) && !value.match?(/_/)\n end",
"def host_unreachable_exceptions\n [\n... | [
"0.695342",
"0.6868641",
"0.66794336",
"0.6413781",
"0.63080466",
"0.62420905",
"0.6126701",
"0.60789365",
"0.6049803",
"0.5926581",
"0.58342654",
"0.58342654",
"0.58198965",
"0.58049095",
"0.58049095",
"0.57759833",
"0.57687974",
"0.5723818",
"0.5714646",
"0.57134783",
"0.57... | 0.81496865 | 0 |
Sets the user domain variable | def set_user_domain
if Rails.env.test? || !Rails.configuration.loadbalanced_configuration
@user_domain = "greenlight"
else
@user_domain = parse_user_domain(request.host)
check_provider_exists
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_domain(domain=@settings['default_domain'])\n @domain = domain\n end",
"def set_domain\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\">>>>\"}\n\t\tif params[:domain]\n\t\t\tsession[:domain] = params[:domain]\n\t\tend\n\t\tLOG.debug(fname) {\"<<<<session[:domain]=#{sessio... | [
"0.7769306",
"0.7760763",
"0.7747981",
"0.76563233",
"0.7552309",
"0.751048",
"0.74332273",
"0.737966",
"0.7271733",
"0.7264006",
"0.7207236",
"0.7207236",
"0.71790415",
"0.7115257",
"0.7102215",
"0.7016641",
"0.7016641",
"0.70155764",
"0.70155764",
"0.6939252",
"0.6935473",
... | 0.7810814 | 0 |
Sets the settinfs variable | def set_user_settings
@settings = Setting.includes(:features).find_or_create_by(provider: @user_domain)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_setting\n end",
"def set; end",
"def set; end",
"def set(&block)\n @set = block\n end",
"def set(&block)\n @set = block\n end",
"def set=(_arg0); end",
"def set\r\n assert_exists\r\n assert_enabled\r\n #highlight(:set)\r\n set_clear_item(tr... | [
"0.7401003",
"0.69488496",
"0.69488496",
"0.6416489",
"0.6416489",
"0.6385836",
"0.62801343",
"0.61958057",
"0.61958057",
"0.6169051",
"0.616024",
"0.6147713",
"0.60699934",
"0.6051573",
"0.5963897",
"0.5950029",
"0.59447247",
"0.5936466",
"0.5936222",
"0.5936053",
"0.5934605... | 0.0 | -1 |
Redirects the user to a Maintenance page if turned on | def maintenance_mode?
if ENV["MAINTENANCE_MODE"] == "true"
render "errors/greenlight_error", status: 503, formats: :html,
locals: {
status_code: 503,
message: I18n.t("errors.maintenance.message"),
help: I18n.t("errors.maintenance.help"),
}
end
maintenance... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_maintenance_page\n if ENV.key? 'VEC_MAINTENANCE_UNDERWAY'\n redirect_to \"/maintenance.html\"\n end\n end",
"def enforce_maintenance_mode\n return if !ENV['MAINTENANCE_MODE'] && Rails.configuration.published_locales.include?(I18n.locale)\n return if %w[sessions switch_user].includ... | [
"0.7928293",
"0.7182929",
"0.7182929",
"0.6979188",
"0.69787335",
"0.6921758",
"0.6707779",
"0.6669384",
"0.66413796",
"0.6608081",
"0.6608081",
"0.6569703",
"0.65528786",
"0.651876",
"0.65167636",
"0.6463163",
"0.64465415",
"0.6430509",
"0.64063424",
"0.6370042",
"0.63507336... | 0.58710414 | 88 |
Show an information page when migration fails and there is a version error. | def migration_error?
render :migration_error, status: 500 unless ENV["DB_MIGRATE_FAILED"].blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_upgrade_in_progress\n return render_error(:unprocessable_entity, \"Your application is being upgraded and configuration changes can not be made at this time. Please try again later.\", 1)\n end",
"def error_version_help\n if @parsed_options.show_version then\n $stdout.puts... | [
"0.6243589",
"0.59731865",
"0.5814736",
"0.5722561",
"0.5663181",
"0.56442535",
"0.5578315",
"0.54657096",
"0.5461527",
"0.54353225",
"0.53410214",
"0.53095454",
"0.5276911",
"0.5261237",
"0.5241973",
"0.52288723",
"0.5159124",
"0.51562935",
"0.5155945",
"0.51521075",
"0.5151... | 0.66046685 | 0 |
Sets the appropriate locale. | def user_locale(user = current_user)
locale = if user && user.language != 'default'
user.language
else
http_accept_language.language_region_compatible_from(I18n.available_locales)
end
begin
I18n.locale = locale.tr('-', '_') unless locale.nil?
rescue
# Default to English if t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_locale\n end",
"def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end",
"def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end",
"def set_locale\n I18n.locale = params[:locale]\n end",
"def set_locale\r\n I18n.l... | [
"0.86406165",
"0.81833",
"0.81833",
"0.8124579",
"0.8066869",
"0.8028272",
"0.80099994",
"0.7980849",
"0.796673",
"0.7949681",
"0.7927998",
"0.7918919",
"0.79000664",
"0.79000664",
"0.78827053",
"0.78827053",
"0.78827053",
"0.78827053",
"0.7878443",
"0.7796614",
"0.7781119",
... | 0.0 | -1 |
Checks to make sure that the admin has changed his password from the default | def check_admin_password
if current_user&.has_role?(:admin) && current_user.email == "admin@example.com" &&
current_user&.greenlight_account? && current_user&.authenticate(Rails.configuration.admin_password_default)
flash.now[:alert] = I18n.t("default_admin",
edit_link: change_password_path(us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_password_changed\n self.temp_password = nil if ( changed.include?('encrypted_password') && !(changed.include?('temp_password')))\n end",
"def need_change_password?\n password_change_requested? || password_too_old?\n end",
"def change_password\n set_breadcrumbs(\"change_password\") \n... | [
"0.7712535",
"0.7600863",
"0.7519729",
"0.7490966",
"0.74634194",
"0.74634194",
"0.7431519",
"0.7229461",
"0.7228164",
"0.7208702",
"0.7206323",
"0.71991426",
"0.7190343",
"0.71651155",
"0.7156135",
"0.71551526",
"0.7134454",
"0.71170104",
"0.711",
"0.7100751",
"0.7099547",
... | 0.79937714 | 0 |
Checks if the user is banned and logs him out if he is | def check_user_role
if current_user&.has_role? :denied
session.delete(:user_id)
redirect_to root_path, flash: { alert: I18n.t("registration.banned.fail") }
elsif current_user&.has_role? :pending
session.delete(:user_id)
redirect_to root_path, flash: { alert: I18n.t("registration.approval... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def banned?\n if current_user.present? && current_user.banned?\n sign_out current_user\n flash[:error] = \"This account has been suspended.\"\n root_path\n end\n end",
"def banned?\r\n if current_user.present? && !current_user.activated?\r\n sign_out current_user\r\n flash[:err... | [
"0.82446516",
"0.8228608",
"0.8083211",
"0.8083211",
"0.7638078",
"0.7482223",
"0.7225686",
"0.70463175",
"0.7033767",
"0.6965138",
"0.6858754",
"0.6789202",
"0.6738327",
"0.67282695",
"0.66602",
"0.656356",
"0.6538279",
"0.64826494",
"0.64322275",
"0.63835853",
"0.63754386",... | 0.63357604 | 21 |
Relative root helper (when deploying to subdirectory). | def relative_root
Rails.configuration.relative_url_root || ""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_path\n Pathname.new(File.expand_path(File.join(__dir__, '..', '..')))\nend",
"def based_on_root(rel_path)\n File.expand_path(File.join(options.root,rel_path))\n end",
"def root\n \"#{File.dirname(__FILE__)}/..\"\nend",
"def root_path(path) File.join(root, path) end",
... | [
"0.77374643",
"0.7672897",
"0.7640271",
"0.762893",
"0.7612252",
"0.76018596",
"0.758198",
"0.758198",
"0.7581372",
"0.7563761",
"0.7554047",
"0.75465894",
"0.75149685",
"0.7489643",
"0.74580115",
"0.74580115",
"0.74119854",
"0.74119854",
"0.74119854",
"0.73937744",
"0.738944... | 0.74844056 | 14 |
Determines if the BigBlueButton endpoint is configured (or set to default). | def bigbluebutton_endpoint_default?
return false if Rails.configuration.loadbalanced_configuration
Rails.configuration.bigbluebutton_endpoint_default == Rails.configuration.bigbluebutton_endpoint
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test?\n self.endpoint == DEFAULT_ENDPOINT\n end",
"def http_endpoint_enabled\n data[:http_endpoint_enabled]\n end",
"def config_service?\n true\n end",
"def endpoints?\n endpoints.any?\n end",
"def valid_endpoint?(target)\n endpoints.include? target\n end",
"de... | [
"0.7412571",
"0.6620746",
"0.6428806",
"0.6332187",
"0.608071",
"0.6013194",
"0.5984988",
"0.5906996",
"0.5905358",
"0.5863535",
"0.58314246",
"0.5809208",
"0.5803382",
"0.57714206",
"0.5766506",
"0.5739159",
"0.5725776",
"0.57106537",
"0.56977254",
"0.5681498",
"0.56749177",... | 0.8521946 | 0 |
Determine if Greenlight is configured to allow user signups. | def allow_user_signup?
Rails.configuration.allow_user_signup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_sign_up?\n @allow_sign_up\n end",
"def check_user_signup_allowed\n redirect_to root_path unless Rails.configuration.allow_user_signup\n end",
"def allow_registration?\n true\n end",
"def password_signup?\n if password_digest\n return false\n else\n bool1=(@non_signup... | [
"0.80877095",
"0.72419983",
"0.6844482",
"0.67571944",
"0.67497504",
"0.6596976",
"0.6596976",
"0.6566732",
"0.6520843",
"0.648413",
"0.6447115",
"0.64090985",
"0.63890564",
"0.63821936",
"0.6352289",
"0.632784",
"0.632122",
"0.63198125",
"0.63051397",
"0.6297916",
"0.6296",
... | 0.78985906 | 2 |
Gets all configured omniauth providers. | def configured_providers
Rails.configuration.providers.select do |provider|
Rails.configuration.send("omniauth_#{provider}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def omniauth_providers\n @omniauth_providers ||= Account.omniauth_providers.map(&:to_s)\n end",
"def providers\n authentication_strategies.pluck :provider\n end",
"def providers\n @providers.keys\n end",
"def providers\n @providers ||= load_hash 'config/providers.yml'\n end",
"def p... | [
"0.84262794",
"0.68141556",
"0.67772514",
"0.66577953",
"0.6641196",
"0.6562133",
"0.64844584",
"0.64192677",
"0.64192677",
"0.63804334",
"0.62793094",
"0.62040824",
"0.59561",
"0.5936019",
"0.59356314",
"0.59356314",
"0.5829006",
"0.58203703",
"0.5800234",
"0.5713585",
"0.56... | 0.82497025 | 2 |
Indicates whether users are allowed to share rooms | def shared_access_allowed
@settings.get_value("Shared Access") == "true"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_share?\n can?('s')\n end",
"def can_share\n return @can_share\n end",
"def is_admin\n \tif current_user.nil? or !current_user.user_attributes[:room_reserve_admin]\n return false\n else\n return true\n end\n end",
"def can_share=(value)\n set_pr... | [
"0.7063917",
"0.6854212",
"0.675184",
"0.66968",
"0.6672033",
"0.66684055",
"0.6616354",
"0.65847516",
"0.6543997",
"0.6539688",
"0.6510436",
"0.6499205",
"0.6482692",
"0.6414019",
"0.63866633",
"0.6385308",
"0.63811135",
"0.6363031",
"0.63622713",
"0.63301563",
"0.63178724",... | 0.682302 | 2 |
Indicates whether users are allowed to share rooms | def recording_consent_required?
@settings.get_value("Require Recording Consent") == "true"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_share?\n can?('s')\n end",
"def can_share\n return @can_share\n end",
"def shared_access_allowed\n @settings.get_value(\"Shared Access\") == \"true\"\n end",
"def is_admin\n \tif current_user.nil? or !current_user.user_attributes[:room_reserve_admin]\n retu... | [
"0.7063917",
"0.6854212",
"0.682302",
"0.675184",
"0.66968",
"0.6672033",
"0.66684055",
"0.6616354",
"0.65847516",
"0.6543997",
"0.6539688",
"0.6510436",
"0.6499205",
"0.6482692",
"0.6414019",
"0.63866633",
"0.6385308",
"0.63811135",
"0.6363031",
"0.63622713",
"0.63301563",
... | 0.0 | -1 |
Returns a list of allowed file types | def allowed_file_types
Rails.configuration.allowed_file_types
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type_allowlist\n Rails.configuration.x.file_upload_content_type_allowlist.split(/\\s*,\\s*/)\n end",
"def mime_types\n safe_const_get(:MIME_TYPES) || []\n end",
"def supported(files)\n files.select { |f| SUPPORTED_TYPES.include?(f.extname.delete('.')) }\n end",
"def ge... | [
"0.7717821",
"0.766991",
"0.7403855",
"0.7395623",
"0.73262036",
"0.7231161",
"0.72302026",
"0.70975804",
"0.70975804",
"0.7087521",
"0.7063905",
"0.70412415",
"0.6982324",
"0.694697",
"0.69313765",
"0.69097424",
"0.68710035",
"0.6835206",
"0.68334633",
"0.68262076",
"0.68141... | 0.8169212 | 0 |
Returns the page that the logo redirects to when clicked on | def home_page
return root_path unless current_user
return admins_path if current_user.has_role? :super_admin
return room_path(current_user.main_room) if current_user.role&.get_permission("can_create_rooms") && current_user.main_room.present?
cant_create_rooms_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logo_link\n root_path\n end",
"def logo_path\n root_path\n end",
"def logo_path\n root_path\n end",
"def logo_path\n root_path\n end",
"def logo_link\n link_to(logo_img, view_context.root_path)\n end",
"def get_logo_route\n\t\tif !logged_in?\n\t\t\treturn root_path\n\t\tend\n\t\ti... | [
"0.7574535",
"0.6957004",
"0.6957004",
"0.6957004",
"0.6709076",
"0.6570772",
"0.63736206",
"0.62727326",
"0.61959356",
"0.61477613",
"0.61477613",
"0.6133779",
"0.6130641",
"0.6068701",
"0.6053437",
"0.6042846",
"0.60375917",
"0.6036973",
"0.6023121",
"0.6010122",
"0.6004983... | 0.0 | -1 |
Parses the url for the user domain | def parse_user_domain(hostname)
return hostname.split('.').first if Rails.configuration.url_host.empty?
Rails.configuration.url_host.split(',').each do |url_host|
return hostname.chomp(url_host).chomp('.') if hostname.include?(url_host)
end
''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_domain_name\n if @options[:domain].blank? && !@options[:username].blank?\n if @options[:username].include?('\\\\')\n @options[:domain], @options[:username] = username.split('\\\\')\n elsif @options[:username].include?('/')\n @options[:domain], @options[:username] = us... | [
"0.7416398",
"0.7317945",
"0.7103995",
"0.70858574",
"0.6983892",
"0.69391584",
"0.6881301",
"0.68106776",
"0.6774486",
"0.66947246",
"0.666891",
"0.66674316",
"0.6597012",
"0.6572077",
"0.65346885",
"0.6525162",
"0.6446448",
"0.64341545",
"0.63793314",
"0.63668376",
"0.63490... | 0.74649364 | 0 |
Include user domain in lograge logs | def append_info_to_payload(payload)
super
payload[:host] = @user_domain
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_url\n \"#{@mailgun.base_url}/#{@domain}/log\"\n end",
"def log_username\n @config.audit_usernames ? username : \"user with key #{@key_id}\"\n end",
"def log_prefix\n if self.host\n \"upguard #{self.host}:\"\n else\n \"upguard:\"\n end\n end",
"def user_domain\n @u... | [
"0.63472795",
"0.6200234",
"0.61488223",
"0.6036727",
"0.5990538",
"0.5947302",
"0.58110666",
"0.5621383",
"0.55875105",
"0.5584614",
"0.5573809",
"0.55433154",
"0.5506263",
"0.5492877",
"0.54833025",
"0.54725426",
"0.54725426",
"0.54244274",
"0.5423528",
"0.5423528",
"0.5410... | 0.5802567 | 7 |
Segment Marketing Info Sending | def segment_upgrade_date(email)
user = User.find_by_email(email)
Analytics.identify(
user_id: user.id,
traits: {
first_name: user.first_name,
last_name: user.first_name,
email: user.email,
available_sessions: user.remaining_monthly_sessions,
host: user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marketing\n @marketing = SfmoltenPost.check_marketing_message_for_contact(current_contact)\n index\n end",
"def ice_request(info)\n\n # Formatter\n formatter = DateTimeFormatter.new\n\n # Get booking\n booking_id = info[:booking_id]\n booking = Booking.where({:id => booking_id})\n ... | [
"0.62221694",
"0.5383029",
"0.5351246",
"0.53308016",
"0.5316244",
"0.52306193",
"0.5221095",
"0.5188978",
"0.51743",
"0.51473266",
"0.51305526",
"0.5128899",
"0.5128826",
"0.5119358",
"0.5106857",
"0.51017743",
"0.5091856",
"0.5079186",
"0.50725925",
"0.5067148",
"0.5063741"... | 0.0 | -1 |
HSID Checkout: MyUHC Full Login | def setup
caps = Selenium::WebDriver::Remote::Capabilities.new
caps['browser'] = 'Firefox'
@driver = Selenium::WebDriver.for :remote, url: "http://localhost:8001", :desired_capabilities => caps
# @driver = Selenium::WebDriver.for :firefox
@driver.manage.timeouts.implicit_wait = 10
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login; end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def idt_login\n show do\n title \"Prepare to order primer\"\n ... | [
"0.69634765",
"0.66516274",
"0.66516274",
"0.66516274",
"0.66516274",
"0.66516274",
"0.66516274",
"0.66516274",
"0.66516274",
"0.66516274",
"0.66397476",
"0.66314906",
"0.65560883",
"0.65083504",
"0.65083504",
"0.64689136",
"0.6448575",
"0.63777673",
"0.63708216",
"0.63667744",... | 0.0 | -1 |
GET /committee_types GET /committee_types.json | def index
@committee_types = CommitteeType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n @client.make_request :get, reports_path\n end",
"def types\n commit('types', nil)\n end",
"def set_committee_type\n @committee_type = CommitteeType.find(params[:id])\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def... | [
"0.6487803",
"0.634089",
"0.6252378",
"0.5865145",
"0.58548534",
"0.5836093",
"0.58310837",
"0.5762908",
"0.5761878",
"0.5683014",
"0.5681881",
"0.5674895",
"0.5656754",
"0.56433505",
"0.5607397",
"0.5605595",
"0.5586829",
"0.5585463",
"0.5579726",
"0.5577573",
"0.5576552",
... | 0.76719254 | 0 |
GET /committee_types/1 GET /committee_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @committee_types = CommitteeType.all\n end",
"def set_committee_type\n @committee_type = CommitteeType.find(params[:id])\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def update\n respond_to do |format|\n if @committee_type.update(committee_type... | [
"0.7541829",
"0.6716674",
"0.6205192",
"0.6133136",
"0.6087899",
"0.607764",
"0.6002935",
"0.57688063",
"0.56905025",
"0.5668565",
"0.5632939",
"0.5600963",
"0.5576255",
"0.5574225",
"0.5567411",
"0.5525795",
"0.5518657",
"0.55122733",
"0.5509673",
"0.5509673",
"0.5478338",
... | 0.0 | -1 |
POST /committee_types POST /committee_types.json | def create
@committee_type = CommitteeType.new(committee_type_params)
respond_to do |format|
if @committee_type.save
format.html { redirect_to @committee_type, notice: 'Committee type was successfully created.' }
format.json { render :show, status: :created, location: @committee_type }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def committee_type_params\n params.require(:committee_type).permit(:comtype)\n end",
"def index\n @committee_types = CommitteeType.all\n end",
"def set_committee_type\n @committee_type = CommitteeType.find(params[:id])\n end",
"def types\n commit('types', nil)\n end",
"def evals... | [
"0.6727415",
"0.6667146",
"0.65497375",
"0.65413696",
"0.5899464",
"0.5867961",
"0.5811137",
"0.5811137",
"0.5783372",
"0.5783372",
"0.5589167",
"0.5586961",
"0.5499329",
"0.548427",
"0.5350845",
"0.5341589",
"0.533309",
"0.53152966",
"0.5302558",
"0.52957755",
"0.5287175",
... | 0.6889416 | 0 |
PATCH/PUT /committee_types/1 PATCH/PUT /committee_types/1.json | def update
respond_to do |format|
if @committee_type.update(committee_type_params)
format.html { redirect_to @committee_type, notice: 'Committee type was successfully updated.' }
format.json { render :show, status: :ok, location: @committee_type }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_committee_type\n @committee_type = CommitteeType.find(params[:id])\n end",
"def update\n @specification_type = SpecificationType.find(params[:id])\n\n if @specification_type.update(specification_type_params)\n audit(@specification_type, current_user)\n render json: @specification_... | [
"0.6368255",
"0.60645086",
"0.60080487",
"0.5910897",
"0.5906671",
"0.58774066",
"0.58249795",
"0.5815689",
"0.5795315",
"0.57865345",
"0.5762653",
"0.57555455",
"0.57505417",
"0.5749332",
"0.57214093",
"0.570189",
"0.56868404",
"0.5684955",
"0.56841844",
"0.5677842",
"0.5676... | 0.73513037 | 0 |
DELETE /committee_types/1 DELETE /committee_types/1.json | def destroy
@committee_type.destroy
respond_to do |format|
format.html { redirect_to committee_types_url, notice: 'Committee type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @politicalcommittee = Politicalcommittee.find(params[:id])\n @politicalcommittee.destroy\n\n respond_to do |format|\n format.html { redirect_to politicalcommittees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @voivodship_committee = VoivodshipCommi... | [
"0.66868186",
"0.6684878",
"0.6519566",
"0.65076125",
"0.64954853",
"0.647984",
"0.64779264",
"0.6455766",
"0.6423572",
"0.6423572",
"0.64027935",
"0.63951886",
"0.63895524",
"0.6388725",
"0.6387456",
"0.63829595",
"0.6364229",
"0.6361848",
"0.6360539",
"0.6356262",
"0.635446... | 0.7795634 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_committee_type
@committee_type = CommitteeType.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def committee_type_params
params.require(:committee_type).permit(:comtype)
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 |
Because there are three outcomes, rather than a ternary. | def game_system_win_fail
case @board.win_or_fail
when 'win' then end_game(win: true)
when 'fail' then end_game(fail: true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ternary(statement, true_result, false_result)\n statement && true_result || false_result\nend",
"def yeah_or_booh boolean\n boolean && 'yeah' || 'booh'\nend",
"def triple_expression?; false; end",
"def conditionally(*) end",
"def conditionally(*) end",
"def yeah_or_boo( a,b )\n (a > b) && 'yeah' |... | [
"0.77827555",
"0.6717414",
"0.6587167",
"0.64198446",
"0.64198446",
"0.6393439",
"0.634789",
"0.63235545",
"0.6310983",
"0.6234077",
"0.61551845",
"0.6143949",
"0.61132795",
"0.6077021",
"0.60472494",
"0.6029006",
"0.595964",
"0.59585655",
"0.59392685",
"0.59329945",
"0.58983... | 0.0 | -1 |
Save save_game load_game in module. | def options
new_screen
puts options_info
@new_length = options_input
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_game_from_save\n #TODO implement game state saving and loading\n end",
"def save_game\n store = YAML.dump(self)\n File.open('lib/saved_game.yml', 'w') do |file|\n file.puts(store)\n end\n puts 'your game has been saved!'\n end",
"def save_game\n\t\tall_saved_games = yaml_load... | [
"0.838465",
"0.78874433",
"0.76615363",
"0.7520646",
"0.74164057",
"0.74151236",
"0.73702514",
"0.736153",
"0.735866",
"0.7350502",
"0.7247603",
"0.72254676",
"0.71729666",
"0.71202713",
"0.71151555",
"0.71126413",
"0.7008942",
"0.6999264",
"0.6955468",
"0.690119",
"0.6896164... | 0.0 | -1 |
This is here because I was using the word friendo originally to say goodbye. "So long friendo", then wondered what the actual quote was. Kind of an appropriate movie character for a game that's technically about hanging people. | def exit_game
print clear_screen, "\n"
print "\"What business is it of yours where I'm from, friendo?\"", "\n"
print '-- Anton Chigurh : No Country for Old Men', "\n\n"
throw :exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yell_happily(words)\r\n words + \"!!!\" + \" :)\"\r\n end",
"def yell_happily(words)\r\n words + \"!!!\" + \" :)\"\r\n end",
"def work_out\n self.happiness += 2\n self.hygiene -= 3\n return \"♪ another one bites the dust ♫\" \n end",
"def take_bath\n self.hygien... | [
"0.6835874",
"0.6810434",
"0.67535657",
"0.6725675",
"0.6725675",
"0.66999793",
"0.6650148",
"0.6622218",
"0.6592841",
"0.6583064",
"0.64606196",
"0.644885",
"0.64449376",
"0.64282715",
"0.6420426",
"0.639768",
"0.6384979",
"0.63365126",
"0.6331332",
"0.6320699",
"0.63003707"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def accesses_params
params.permit(:contract_id, :update_ids => [], :delete_ids => [])
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 |
Retrieve a list of all thermostats registered to this account | def get_thermostat_list
create_thermostats(HTTParty.get("#{NestApi::API_URL}/devices/thermostats", query: { auth: @token.access_token }))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_thermostats(thermostat_list)\n thermostat_list.map { |device, info| [ info['name'], NestApi::Thermostat.new(device, @token) ] }.to_h\n end",
"def get_all\n @monkeys.dup\n end",
"def list_of_accounts_online\n Stripe.api_key = Rails.application.credentials.stripe[Rails.env.to_sym]... | [
"0.6265287",
"0.58384794",
"0.57916427",
"0.57694924",
"0.55641335",
"0.556411",
"0.5558535",
"0.5551926",
"0.55059546",
"0.5482456",
"0.541498",
"0.541498",
"0.541498",
"0.541498",
"0.53967744",
"0.5378484",
"0.53375435",
"0.5336616",
"0.5330098",
"0.5311074",
"0.5299334",
... | 0.7385266 | 0 |
Retrieve a single thermostat by name | def get_thermostat_by_name(name)
get_thermostat_list[name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thermostate_in_sidekiq_queue(reading_id)\n queue = Sidekiq::Queue.new\n queue.each do |job|\n if job.args[4] == reading_id.to_i\n thermostat = Thermostat.find_by_id(job.args[0])\n return thermostat\n end\n end\n end",
"def getHose(name)\n @gang.tributaries.detect { |x| ... | [
"0.57834566",
"0.56313497",
"0.56313175",
"0.5515885",
"0.5456457",
"0.54096484",
"0.5309736",
"0.5302455",
"0.5302455",
"0.5269221",
"0.5205647",
"0.5205647",
"0.51644164",
"0.5129365",
"0.5096694",
"0.5087855",
"0.5078038",
"0.50508475",
"0.50296634",
"0.5008974",
"0.500897... | 0.7109157 | 0 |
Transform the nest api thermostats reponse into NestApi::Thermostat objects | def create_thermostats(thermostat_list)
thermostat_list.map { |device, info| [ info['name'], NestApi::Thermostat.new(device, @token) ] }.to_h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_thermostat_list\n create_thermostats(HTTParty.get(\"#{NestApi::API_URL}/devices/thermostats\", query: { auth: @token.access_token }))\n end",
"def transform_forecast_object(response)\n forecast_response = {}\n\n lat_lng = {\n latitude: response['item']['lat'],\n longitude: respon... | [
"0.6816719",
"0.5206527",
"0.5133851",
"0.5124505",
"0.50800186",
"0.50648797",
"0.5017978",
"0.49411023",
"0.4939871",
"0.49397752",
"0.4889414",
"0.48768988",
"0.48650444",
"0.48634738",
"0.4849354",
"0.48462662",
"0.48406366",
"0.48319647",
"0.48317003",
"0.4826049",
"0.48... | 0.6605077 | 1 |
Print data about a Tweet | def print_tweet(tweets)
gets tweets.each do |tweet| puts tweet["text"]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_twitter_search(tweets)\n #puts JSON.pretty_generate(tweet)\n tweets.each do |tweet|\n puts tweet[\"text\"] \n end \n end",
"def print_tweets(tweets)\n\t\ttweets.each{ |tweet|\n\t\t\tprint_tweet(tweet)\n\t\t}\n\tend",
"def print_tweets(tweets)\n\t\ttweets.each{ |tweet|... | [
"0.72737205",
"0.7197026",
"0.7197026",
"0.70737624",
"0.7046569",
"0.68866986",
"0.68286645",
"0.68286645",
"0.67838323",
"0.6721837",
"0.670769",
"0.6680486",
"0.66001064",
"0.658984",
"0.65803146",
"0.6553065",
"0.65509903",
"0.65099823",
"0.6509266",
"0.6505234",
"0.64987... | 0.72029984 | 1 |
Expands tabs to +n+ spaces. Nondestructive. If +n+ is 0, then tabs are simply removed. Raises an exception if +n+ is negative. Thanks to GGaramuno for a more efficient algorithm. Very nice. CREDIT: Gavin Sinclair CREDIT: Noah Gibbs CREDIT: GGaramuno | def expand_tabs(n=8)
n = n.to_int
raise ArgumentError, "n must be >= 0" if n < 0
return gsub(/\t/, "") if n == 0
return gsub(/\t/, " ") if n == 1
str = self.dup
while
str.gsub!(/^([^\t\n]*)(\t+)/) { |f|
val = ( n * $2.size - ($1.size % n) )
$1 << (' ' * val)
}
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tabto(n)\n if self =~ /^( *)\\S/\n indent(n - $1.length)\n else\n self\n end\n end",
"def tabto(n)\n if self =~ /^( *)\\S/\n indent(n - $1.length)\n else\n self\n end\n end",
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^... | [
"0.72115713",
"0.7178367",
"0.6945862",
"0.6945298",
"0.6873043",
"0.67082936",
"0.64523536",
"0.64332765",
"0.6429306",
"0.6308416",
"0.62625176",
"0.6242557",
"0.6135731",
"0.60851604",
"0.60652965",
"0.6058426",
"0.6058426",
"0.59251887",
"0.5916703",
"0.5760019",
"0.57560... | 0.83770114 | 1 |
Preserves relative tabbing. The first nonempty line ends up with n spaces before nonspace. CREDIT: Gavin Sinclair | def tabto(n)
if self =~ /^( *)\S/
indent(n - $1.length)
else
self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tabto(n)\n if self =~ /^( *)\\S/\n indent(n - $1.length)\n else\n self\n end\n end",
"def tabbed_text(text, spaces = 0)\n Array(text).join(\"\\n\").gsub(\"\\n\", \"\\n#{' ' * (4 + spaces.to_i)}\").strip\n end",
"def handle_tab_width(body)\n if /\\t/ =~ body\n ... | [
"0.7316793",
"0.70851815",
"0.7044695",
"0.7005247",
"0.69813854",
"0.6927167",
"0.6899304",
"0.6890843",
"0.6788069",
"0.67433953",
"0.6680349",
"0.6672962",
"0.66044444",
"0.66044444",
"0.66028035",
"0.65974075",
"0.65575236",
"0.65310085",
"0.6522057",
"0.6507636",
"0.6474... | 0.7414653 | 0 |
Indent left or right by n spaces. (This used to be called tab and aliased as indent.) CREDIT: Gavin Sinclair CREDIT: Trans | def indent(n)
if n >= 0
gsub(/^/, ' ' * n)
else
gsub(/^ {0,#{-n}}/, "")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end",
"def indent(n)\n indent = \" \" * n\n gsub '\\n', \"\\n#{indent}\"\n end",
"def tabto(n)\n if self =~ /^( *)\\S/\n indent(n - $1.length)\n else\n self\n end\... | [
"0.7617667",
"0.7581974",
"0.74689734",
"0.7446565",
"0.735291",
"0.72894716",
"0.72607327",
"0.72603625",
"0.72212446",
"0.72212446",
"0.72212446",
"0.72212446",
"0.72212446",
"0.7113704",
"0.7113704",
"0.70983106",
"0.70211744",
"0.68831074",
"0.6864305",
"0.6851188",
"0.67... | 0.76129353 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.