query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Query the context for the most recent copy of a message by type | def find_by_type( type )
return @messages[ type ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cached_message type_name\n cached_obj @prior_messages, type_name\n end",
"def get_specific_conversations usr, c_type \n conv_ids = Array.new\n convos = Conversation.get_conversations(usr)\n convos.find_each do |convo|\n convo.posts.find_each do |post|\n if (c_type == \"receiv... | [
"0.64233696",
"0.5479395",
"0.5441389",
"0.533675",
"0.5155024",
"0.5115295",
"0.5067762",
"0.5043197",
"0.5040463",
"0.49355263",
"0.49256632",
"0.49063772",
"0.48996243",
"0.4846096",
"0.4845721",
"0.48181874",
"0.4815648",
"0.478703",
"0.478703",
"0.4758576",
"0.47325197",... | 0.5580696 | 1 |
Set the most recent copy of a message by type. Any existing message is overwritten. | def set( message )
@messages[ message.descriptor.type ] = message.dup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_type=(type)\n self.message_type_id = MESSAGE_TYPES.invert[type]\n end",
"def cached_message type_name\n cached_obj @prior_messages, type_name\n end",
"def set_message_type\n @message_type = MessageType.find(params[:id])\n end",
"def content_type=(content_type); @me... | [
"0.6280736",
"0.60991395",
"0.6008557",
"0.54666257",
"0.54044837",
"0.53255373",
"0.5277625",
"0.5165847",
"0.51412004",
"0.51318544",
"0.51207036",
"0.51109344",
"0.50967246",
"0.5078213",
"0.5043629",
"0.50348383",
"0.5029947",
"0.5012565",
"0.49909952",
"0.49907452",
"0.4... | 0.71746457 | 0 |
Get the list of descriptors associated with the open PX4 log file. If a valid descriptor cache was specified at startup, the descriptors are loaded from the cache. Otherwise, the descriptors are parsed from the open log. | def descriptors( &block )
if @log_file && @message_descriptors.empty?
if @descriptor_cache && @descriptor_cache.exist?
@message_descriptors = @descriptor_cache.read_descriptors
else
@message_descriptors = LogFile::read_descriptors( @log_file, @descriptor_cache, &block )
end
@message_descri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_firmware_iom_descriptor_list(opts = {})\n data, _status_code, _headers = get_firmware_iom_descriptor_list_with_http_info(opts)\n data\n end",
"def descriptors(arg = nil)\n if arg.nil?\n storage.map { |_, (descriptor, _)| descriptor }\n else\n with_interest(arg).map { |_, desc... | [
"0.55762297",
"0.5383673",
"0.5364133",
"0.52710927",
"0.52452326",
"0.51260567",
"0.5087144",
"0.5005252",
"0.490131",
"0.49000594",
"0.49000594",
"0.4873191",
"0.480384",
"0.47972667",
"0.47545296",
"0.4745057",
"0.4739712",
"0.47161612",
"0.47117537",
"0.47113132",
"0.4704... | 0.68161917 | 0 |
Iterate over all log messages. Embedded message descriptors are skipped. If a "with" list is supplied, only messages in the list are passed to the callersupplied block. If a "without" list supplied, all messages except those in the list are passed to the callersupplied block. The caller must supply a block. | def each_message( options = {}, &block )
opts ={
with: [], # white list - empty means all minus those in without list
without: ['FMT'] # black list - includes types or names
}.merge( options || {} )
opts[:with].map! do |val|
if val.class == String
descriptor = descriptors.values.find ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_block(&block)\n return enum_for(:each_block) unless block_given?\n\n each_log do |log|\n log.each_block(&block)\n end\n end",
"def each(&block)\n @messages.each(&block)\n end",
"def each_block\n unless block_given?\n return enum_for(:each_block)\n end\n\n ... | [
"0.68506944",
"0.679366",
"0.6641456",
"0.6488992",
"0.64099014",
"0.6264239",
"0.6257899",
"0.62248707",
"0.6157667",
"0.6114694",
"0.59598035",
"0.5895701",
"0.57562315",
"0.56654865",
"0.5584014",
"0.5580064",
"0.5518322",
"0.5468103",
"0.53865594",
"0.5383677",
"0.5376745... | 0.7694941 | 0 |
GET /linkers GET /linkers.json | def index
@linkers = Linker.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def links\n json_hyperschema[\"links\"] || []\n end",
"def links\n response = Clever.request :get, url\n response[:links]\n end",
"def links\n data['links']\n end",
"def index\n render json: @links\n end",
"def index\n links = all_links\n render json: { success: true, lin... | [
"0.7031974",
"0.696591",
"0.69285816",
"0.66210544",
"0.65901345",
"0.65591985",
"0.6403536",
"0.63891697",
"0.6349022",
"0.62791204",
"0.6223168",
"0.62085176",
"0.6207957",
"0.61892486",
"0.61892486",
"0.61892486",
"0.6174676",
"0.61660075",
"0.61660075",
"0.61660075",
"0.6... | 0.7481699 | 0 |
POST /linkers POST /linkers.json | def create
@linker = Linker.new(linker_params)
respond_to do |format|
if @linker.save
format.html { redirect_to @linker, notice: 'Linker was successfully created.' }
format.json { render :show, status: :created, location: @linker }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @link_request = LinkRequest.new(link_request_params)\n\n respond_to do |format|\n if @link_request.save\n @link_request.sterrenlinks.create!\n format.html { redirect_to @link_request, notice: 'Link request was successfully created.' }\n format.json { render :show, statu... | [
"0.65013206",
"0.6474064",
"0.6377264",
"0.6311157",
"0.62924874",
"0.62617254",
"0.6194391",
"0.6134379",
"0.61183584",
"0.607425",
"0.6063035",
"0.6063035",
"0.60541934",
"0.6035315",
"0.60277706",
"0.6000556",
"0.59999204",
"0.59947354",
"0.59783554",
"0.5970733",
"0.59449... | 0.659273 | 0 |
DELETE /linkers/1 DELETE /linkers/1.json | def destroy
@linker.destroy
respond_to do |format|
format.html { redirect_to linkers_url, notice: 'Linker was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end",
"def destroy\n destroy_and_respond(@link)\n end",
"def ... | [
"0.6946011",
"0.6946011",
"0.69355476",
"0.6929076",
"0.68720865",
"0.6852387",
"0.6852387",
"0.6852387",
"0.6812328",
"0.6797859",
"0.67786455",
"0.6767648",
"0.6754019",
"0.67517275",
"0.6750615",
"0.6732307",
"0.6732307",
"0.6732307",
"0.6732307",
"0.6732307",
"0.6732307",... | 0.7224523 | 0 |
GET /fg_bookings GET /fg_bookings.json | def index
@fg_bookings = FgBooking.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n ... | [
"0.7622552",
"0.74592304",
"0.740094",
"0.740094",
"0.740094",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.7149267",
"0.71383554",
"0.70608073",
"0.70577234",
... | 0.747126 | 1 |
PATCH/PUT /fg_bookings/1 PATCH/PUT /fg_bookings/1.json | def update
respond_to do |format|
if @fg_booking.update(fg_booking_params)
format.html { redirect_to getting_started_welcome_path, notice: 'Booking was successfully updated.' }
format.json { render :show, status: :ok, location: @fg_booking }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end",
"def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booki... | [
"0.6860899",
"0.6778849",
"0.6667386",
"0.6667386",
"0.6667386",
"0.66633373",
"0.66064864",
"0.6552615",
"0.6544953",
"0.6543623",
"0.65305024",
"0.652486",
"0.652486",
"0.652486",
"0.652354",
"0.6519628",
"0.64751965",
"0.64693725",
"0.6463658",
"0.6460832",
"0.6457936",
... | 0.6841598 | 1 |
DELETE /fg_bookings/1 DELETE /fg_bookings/1.json | def destroy
@fg_booking.destroy
respond_to do |format|
format.html { redirect_to fg_bookings_url, notice: 'Booking was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |fo... | [
"0.7108041",
"0.7108041",
"0.7108041",
"0.7108041",
"0.709098",
"0.707182",
"0.707182",
"0.7065558",
"0.6917805",
"0.6913106",
"0.6906084",
"0.68992096",
"0.68696755",
"0.6830031",
"0.68269175",
"0.67883563",
"0.6781664",
"0.6775332",
"0.6775332",
"0.6772609",
"0.6772175",
... | 0.7153057 | 0 |
Returns a new instance for +time+ (a Time object). ===== Options :validity Integer, duration in seconds during which a timestamp is valid. :reference_time Time, the time that is the point of reference for expiration (default: the current UTC time). :formatter String, the format string used by Time.strftime create a for... | def initialize(time, validity: 60,
reference_time: Time.now.utc,
formatter: '%Y-%m-%d %H:%M:%S.%6L %Z')
@reference_time = reference_time
@time = time
@validity = validity
@formatter = formatter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_time(time)\n unless time['duration'].is_a? Integer\n duration = duration_to_seconds(time['duration'])\n time['duration'] = duration\n\n # Duration at this point contains an error_msg if it's not an int\n return duration unless time['duration'].is_a? Integer\n end\n\n if time... | [
"0.6103263",
"0.60612404",
"0.6045295",
"0.59468853",
"0.5930667",
"0.5703511",
"0.5644326",
"0.558651",
"0.5582991",
"0.55599105",
"0.5509744",
"0.54468316",
"0.539078",
"0.53828514",
"0.53767985",
"0.53712237",
"0.536504",
"0.53626084",
"0.53348637",
"0.5324465",
"0.5314597... | 0.8090588 | 0 |
Returns +true+ if the delta between time and reference_time exceeds the allowed validity span. | def expired?
return if missing?
validity < (reference_time - time)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def later?(target_time, ref_time)\n target_time.to_f - ref_time.to_f > 0.01\n end",
"def more_than_a_day_passed?(start_time, end_time)\n end_time - start_time > 60 * 60 * 24\n end",
"def valid?(time=Time.now.utc)\n time>not_before && time<self.not_after\n end",
"def _timeout? changed_time... | [
"0.7064664",
"0.6690272",
"0.64969385",
"0.631873",
"0.6232966",
"0.61365294",
"0.60901314",
"0.6082805",
"0.6048665",
"0.6048665",
"0.6037859",
"0.5998494",
"0.5988431",
"0.5987782",
"0.5987782",
"0.59778655",
"0.59689885",
"0.58981496",
"0.5886937",
"0.5882449",
"0.58381796... | 0.6742259 | 1 |
Returns +true+ if the time attribute of +self+ is a a time in the future relative to the reference_time. | def future?
return if missing?
reference_time < time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def later?(target_time, ref_time)\n target_time.to_f - ref_time.to_f > 0.01\n end",
"def future?\r\n @at > DateTime.now\r\n end",
"def future?\n start_date.future?\n end",
"def historical?\n self.as_of_time.present?\n end",
"def in_the_future(now=Time.now)\n trip_time > now\n en... | [
"0.7500459",
"0.7132985",
"0.7019621",
"0.6968327",
"0.6962669",
"0.6937079",
"0.67950094",
"0.6608741",
"0.65910304",
"0.65903187",
"0.65612936",
"0.65450805",
"0.6543769",
"0.6485338",
"0.6485338",
"0.6484777",
"0.6479321",
"0.6470232",
"0.6453995",
"0.6453995",
"0.64508694... | 0.83900136 | 0 |
Returns a timestamp (String representation) for the reference_time. | def reference_timestamp
reference_time.strftime formatter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestamp\n _timestamp.as_time\n end",
"def timestamp\n _timestamp.as_time\n end",
"def timestamp\n time.strftime formatter\n end",
"def timestamp\n time_formated = Time.now.to_i.to_s.reverse.chop.chop.chop.reverse.to_i\n return time_formated.to_s\nend",
"def get_formatted_tim... | [
"0.6908702",
"0.6863267",
"0.68387777",
"0.6686364",
"0.662848",
"0.6606359",
"0.6582293",
"0.64391303",
"0.6406028",
"0.6390529",
"0.638036",
"0.63692075",
"0.6345251",
"0.6339497",
"0.63311124",
"0.63137734",
"0.6290373",
"0.62851137",
"0.6279971",
"0.62626296",
"0.62075627... | 0.87412626 | 0 |
Returns a timestamp as a String for +self+. | def timestamp
time.strftime formatter
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_formatted_timestamp()\n return Time.now.iso8601.to_s\n end",
"def timestamp\n current_time = DateTime.now\n \"#{current_time.strftime(\"%d/%m/%y %H:%M:%S\")} -\"\n end",
"def timestamp\n mask = class_trait[:timestamp]\n Time.now.strftime(mask || \"%Y-%m-%d %H:%M:%... | [
"0.8017756",
"0.759984",
"0.74723697",
"0.7466139",
"0.7463398",
"0.74336416",
"0.73540777",
"0.73522544",
"0.7275035",
"0.72639924",
"0.7237221",
"0.71552444",
"0.71462554",
"0.7117651",
"0.7054738",
"0.70543885",
"0.7037421",
"0.7037421",
"0.69866526",
"0.6935484",
"0.69283... | 0.78723156 | 1 |
Returns message (String) when the timestamp is expired. | def expired_msg
return unless expired?
delta = reference_time - time - validity
"Expired timestamp: #{timestamp};"\
" #{delta.to_i} seconds past expiration."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expired?\n timestamp.nil? || (Time.now.to_i - timestamp.to_i).abs > 300\n end",
"def expired(payload)\n Time.zone.at(payload['exp']) < Time.zone.now\n end",
"def expired?(payload)\n Time.at(payload['exp']) < Time.now\n end",
"def missing_msg\n return unless missing?\n\n ... | [
"0.6565335",
"0.6516956",
"0.63292474",
"0.62557805",
"0.6246613",
"0.62417513",
"0.620384",
"0.6169135",
"0.6118661",
"0.6113683",
"0.60188353",
"0.5982069",
"0.59450924",
"0.59263057",
"0.5923897",
"0.59107625",
"0.5908549",
"0.5905709",
"0.5900538",
"0.5893792",
"0.5873543... | 0.8503037 | 0 |
Returns message (String) when the timestamp is in the future. | def future_msg
return unless future?
delta = time - reference_time
"Invalid timestamp: #{timestamp};"\
" #{delta.to_i} seconds ahead of time."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def since t\n t.to_now\n end",
"def datetimeperformed_cannot_be_in_the_future\n if datetimeperformed.present? && datetimeperformed > Time.now \n errors.add(:datetimeperformed, \"cannot be in the future\")\n end\n end",
"def expired_msg\n return unless expired?\n\n delta = refe... | [
"0.6312165",
"0.6273602",
"0.6238385",
"0.61125535",
"0.6108313",
"0.6032549",
"0.5928881",
"0.5891012",
"0.58671224",
"0.5821111",
"0.5795002",
"0.5773816",
"0.57709605",
"0.57209814",
"0.57078725",
"0.56932527",
"0.56586856",
"0.5635252",
"0.56317157",
"0.56259984",
"0.5622... | 0.80855185 | 0 |
Returns message (String) when the timestamp is missing. | def missing_msg
return unless missing?
'Missing timestamp.'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n missing_msg || future_msg || expired_msg || timestamp\n end",
"def timestamp\n nil\n end",
"def future_msg\n return unless future?\n\n delta = time - reference_time\n \"Invalid timestamp: #{timestamp};\"\\\n \" #{delta.to_i} seconds ahead of time... | [
"0.6593171",
"0.63649756",
"0.6245806",
"0.6097163",
"0.6082293",
"0.6050867",
"0.60149086",
"0.5981572",
"0.59410876",
"0.58738667",
"0.5847053",
"0.5846065",
"0.5791138",
"0.57727146",
"0.56976694",
"0.5695673",
"0.5617357",
"0.55909777",
"0.5589414",
"0.5561384",
"0.552118... | 0.88346106 | 0 |
Returns the versions, bypassing the project_statement method patched above | def versions(options = {})
Version.visible.
where(project_statement(false)).# bypass overridden method
where(options[:conditions]).
includes(:project).
references(:project).
to_a
rescue ::ActiveRecord::StatementInvalid => e
raise StatementInvalid.new(e.message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def versions\n versions = Backlogjp.base._command \"getVersions\", self.id\n versions.map {|hash| Version.new(hash)}\n end",
"def versions\n Version.all\n end",
"def versions\n self.apar_defect_version_maps.map { |m| m.version }\n end",
"def getVersions\r\n\t\t\t\t\treturn @versi... | [
"0.74128276",
"0.72224337",
"0.72117674",
"0.7195049",
"0.69509834",
"0.6926755",
"0.69138205",
"0.6896606",
"0.6884435",
"0.6884435",
"0.6861387",
"0.6860854",
"0.680563",
"0.6709103",
"0.6686741",
"0.6678842",
"0.66582763",
"0.65091753",
"0.6490963",
"0.6474872",
"0.6464375... | 0.8174002 | 0 |
POST /cambio_comision_registros POST /cambio_comision_registros.json | def create
@cambio_comision_registro = current_user.cambio_comision_registros.build(cambio_comision_registro_params)
if @cambio_comision_registro.save
flash[:success] = "Su solicitud para registrar el cambio comisión revisora de tesis fue creada!"
if current_user.tipos_usuario.tipo == "Alumno"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\r\n @comite_registro = current_user.comite_registros.build(comite_registro_params)\r\n\r\n if @comite_registro.save\r\n flash[:success] = \"Su petición para registrar su comité tutorial fue creada!\"\r\n if current_user.tipos_usuario.tipo == \"Alumno\"\r\n redirect_to alumnos_path... | [
"0.7112228",
"0.6465226",
"0.64506114",
"0.63754755",
"0.6348455",
"0.6344423",
"0.63419175",
"0.63370794",
"0.633042",
"0.62951434",
"0.6282906",
"0.62643063",
"0.62295175",
"0.6225241",
"0.621955",
"0.6204152",
"0.62034416",
"0.62016106",
"0.6198143",
"0.6185357",
"0.609866... | 0.7532299 | 0 |
PATCH/PUT /cambio_comision_registros/1 PATCH/PUT /cambio_comision_registros/1.json | def update
respond_to do |format|
if @cambio_comision_registro.update(cambio_comision_registro_params)
format.html { redirect_to @cambio_comision_registro, notice: 'Cambio comision registro was successfully updated.' }
format.json { render :show, status: :ok, location: @cambio_comision_registr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n respond_to do |format|\r\n if @comite_registro.update(comite_registro_params)\r\n format.html { redirect_to @comite_registro, notice: 'Su petición para registrar su comité tutorial fue actualizada.' }\r\n format.json { render :show, status: :ok, location: @comite_registro }\r\n... | [
"0.6834587",
"0.6483392",
"0.62798417",
"0.62583333",
"0.6249241",
"0.6228642",
"0.6154822",
"0.6148632",
"0.6144729",
"0.6122083",
"0.6104952",
"0.6070255",
"0.6067732",
"0.6052843",
"0.6044723",
"0.60371983",
"0.60259426",
"0.601404",
"0.6003383",
"0.6003267",
"0.5995533",
... | 0.6931963 | 0 |
DELETE /cambio_comision_registros/1 DELETE /cambio_comision_registros/1.json | def destroy
@cambio_comision_registro.destroy
respond_to do |format|
format.html { redirect_to cambio_comision_registros_url, notice: 'Cambio comision registro was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\r\n @comite_registro.destroy\r\n respond_to do |format|\r\n format.html { redirect_to comite_registros_url, notice: 'Su petición para registrar su comité tutorial fue eliminada.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @cambio_director_tesis_regi... | [
"0.74563485",
"0.732304",
"0.7243939",
"0.709651",
"0.7040907",
"0.7035399",
"0.7031135",
"0.70310986",
"0.7029875",
"0.70093375",
"0.70037496",
"0.6964801",
"0.6960962",
"0.69432026",
"0.692193",
"0.69188553",
"0.6906292",
"0.69049776",
"0.6902614",
"0.68997616",
"0.68959224... | 0.76422995 | 0 |
TODO add authentication as a option for go live as Github Rate Limit is 60 hits per hour when unauthenticated by 5000 per hour when authenticated. TODO PRIORITY username and password variables are not using "gets" correctly when used in terminal. When in terminal after typing in credentials github api returns a bad cre... | def ghAuthenticate (username, password)
# puts "Enter GitHub Username:"
# username = ""
# puts "Enter GitHub Password:"
# password = ""
# Octokit.auto_paginate = true
@ghClient = Octokit::Client.new(:login => username.to_s, :password => password.to_s, :per_page =>100)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_credentials\n self.username = cli.prompt \"Your GitHub username: \"\n self.password = cli.prompt_secret \"Your GitHub password (never stored): \"\n end",
"def ask_token\n self.username = cli.prompt \"Your GitHub username: \"\n self.user_defined_token = cli.prompt_secret \... | [
"0.6802039",
"0.6618084",
"0.6450719",
"0.6350213",
"0.62897384",
"0.61337006",
"0.6120754",
"0.6043551",
"0.60281485",
"0.5969612",
"0.59672064",
"0.5965212",
"0.5959407",
"0.594398",
"0.58749336",
"0.5866352",
"0.586415",
"0.5846172",
"0.58066285",
"0.5778766",
"0.5735763",... | 0.6795407 | 1 |
find records in Mongodb that have a comments field value of 1 or higher returns only the number field TODO rebuild in option to not have to call MongoDB and add option to pull issues to get comments from directly from getIssues method | def getIssueComments(issueNumber)
# issuesWithComments = @coll.find({"comments" => {"$gt" => 0}},
# {:fields => {"_id" => 0, "number" => 1}}
# ).to_a
issueComments = @ghClient.issue_comments(@repository.to_s, issueNumber.to_s)
issueCommentsRaw = JSON.parse(@ghClient.last_response.body)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"com... | [
"0.6537961",
"0.64506286",
"0.6416352",
"0.63914245",
"0.6138587",
"0.61315155",
"0.5979445",
"0.59729105",
"0.58830315",
"0.5882186",
"0.5844262",
"0.57901627",
"0.5784754",
"0.5707286",
"0.56933165",
"0.5681097",
"0.5642766",
"0.5642766",
"0.56352895",
"0.5628732",
"0.56274... | 0.7093299 | 0 |
TODO Setup so it will get all repo events since the last time a request was made | def getRepositoryEvents
respositoryEvents = @ghClient.repository_events(@repository.to_s)
respositoryEventsRaw = JSON.parse(@ghClient.last_response.body)
ghLastReponse = @ghClient.last_response
while ghLastReponse.rels.include?(:next) do
ghLastReponse = ghLastReponse.rels[:next].get
respositoryEventsRaw... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repository_events(repo, options={})\n get(\"/repos/#{Repository.new(repo)}/events\", options, 3)\n end",
"def watched_repos\n super\n end",
"def recent_commits\n public_events = @client.user_public_events @user[:login]\n public_events.select! { |e| e[:type] == \"PushEvent\" }\n commi... | [
"0.6865734",
"0.65944004",
"0.65899485",
"0.6390656",
"0.6313105",
"0.6294419",
"0.6155147",
"0.6131523",
"0.6127501",
"0.60734886",
"0.6064072",
"0.60636777",
"0.6037365",
"0.5976474",
"0.59476423",
"0.59083146",
"0.57867354",
"0.5784179",
"0.5758835",
"0.56995386",
"0.56995... | 0.7631854 | 0 |
TODO Setup so will get issues events since the last time they were downloaded TODO Consider adding Issue Events directly into the Issue Object in Mongo | def getIssueEvents (issueNumber)
# issueNumbers = @coll.aggregate([
# { "$project" => {number: 1}},
# { "$group" => {_id: {number: "$number"}}},
# { "$sort" => {"_id.number" => 1}}
# ])
issueEvents = @ghClient.issue_events(@repository, issueNumber)
issueEventsRaw = JSON.pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_issue_events(owner, repo, issue_id)\n currepo = ensure_repo(owner, repo)\n\n if currepo.nil?\n warn \"Could not find repository #{owner}/#{repo} for retrieving events for issue #{issue_id}\"\n return\n end\n\n issue = ensure_issue(owner, repo, issue_id, false, false, fa... | [
"0.6661183",
"0.6364875",
"0.62115735",
"0.60032505",
"0.59893435",
"0.59884876",
"0.58697295",
"0.5862619",
"0.5765426",
"0.57641536",
"0.5713394",
"0.56885344",
"0.5673847",
"0.56736976",
"0.56702024",
"0.5660209",
"0.5640432",
"0.5630753",
"0.5573927",
"0.5508966",
"0.5505... | 0.76675373 | 0 |
Get list of time logs for the project. ==== Parameters projectId:: ID 0f the project. queryMap:: This queryMap contains the filters in the form of keyvalue pair. ==== Returns TimelogList object. | def getTimeLogs(projectId, queryMap)
url = getBaseURL+"projects/"+String(projectId)+"/logs/"
response = ZohoHTTPClient.get(url, getQueryMap(queryMap))
return $timesheetParser.getTimeLogs(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_logs(user_id:, queries: nil)\n path = '/users/{userId}/logs'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n queries: que... | [
"0.5696256",
"0.56157535",
"0.5509633",
"0.53502285",
"0.5177358",
"0.5157544",
"0.5085997",
"0.5058653",
"0.5019479",
"0.50043094",
"0.49224234",
"0.49016744",
"0.4895208",
"0.487327",
"0.48673984",
"0.4806951",
"0.47869515",
"0.47531185",
"0.474953",
"0.47337064",
"0.469601... | 0.8082578 | 0 |
Add a new task log for the project. ==== Parameters projectId:: ID of the project. tasklog:: Tasklog object. ==== Returns Tasklog object. | def addTasklog(projectId, tasklog)
url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(tasklog.getTaskId)+"/logs/"
response = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)
return $timesheetParser.getTasklog(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateTasklog(projectId, tasklog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(tasklog.getTaskId)+\"/logs/\"+String(tasklog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getTasklog(respon... | [
"0.7270358",
"0.670275",
"0.635152",
"0.6237317",
"0.61696374",
"0.6115398",
"0.5977757",
"0.59596676",
"0.5854124",
"0.57529837",
"0.57242626",
"0.5643681",
"0.5534113",
"0.55309814",
"0.5506589",
"0.549159",
"0.54759026",
"0.54631937",
"0.5438807",
"0.54115635",
"0.54115635... | 0.8639101 | 0 |
Update the details of a task log. ==== Parameters projectId ID of the project. tasklog:: Tasklog object. ==== Returns Tasklog object. | def updateTasklog(projectId, tasklog)
url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(tasklog.getTaskId)+"/logs/"+String(tasklog.getId)+"/"
response = ZohoHTTPClient.post(url, getQueryMap, tasklog.toParamMAP)
return $timesheetParser.getTasklog(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.e... | [
"0.722958",
"0.69112635",
"0.6649512",
"0.6631488",
"0.6609345",
"0.6573202",
"0.6558166",
"0.65401715",
"0.6524673",
"0.6522404",
"0.6513108",
"0.6458808",
"0.6458808",
"0.6458808",
"0.64417285",
"0.6426898",
"0.63763165",
"0.62982994",
"0.62477064",
"0.62415165",
"0.6227037... | 0.8647746 | 0 |
Delete an existing task log for the project. ==== Parameters projectId:: ID of the project. taskId:: ID of the task. logId:: ID of the log. ==== Returns String object. | def deleteTasklog(projectId, taskId, logId)
url = getBaseURL+"projects/"+String(projectId)+"/tasks/"+String(taskId)+"/logs/"+String(logId)+"/"
response = ZohoHTTPClient.delete(url, getQueryMap)
return $timesheetParser.getResult(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteGenerallog(projectId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend",
"def deleteBuglog(projectId, bugId, logId)\... | [
"0.71801114",
"0.68418723",
"0.60814387",
"0.59169453",
"0.5891257",
"0.587059",
"0.585648",
"0.5828042",
"0.57387763",
"0.57286125",
"0.56962794",
"0.56492037",
"0.56492037",
"0.54758954",
"0.545893",
"0.54365385",
"0.54251975",
"0.539682",
"0.5377201",
"0.5360542",
"0.53544... | 0.8557406 | 0 |
Add a new bug log for the project. ==== Parameters projectId:: ID of the project. buglog:: Buglog object. ==== Returns Buglog object. | def addBuglog(projectId, buglog)
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(buglog.getBugId)+"/logs/"
response = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)
return $timesheetParser.getBuglog(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"+String(buglog.getId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\... | [
"0.7331927",
"0.6420672",
"0.60176027",
"0.5876627",
"0.5761503",
"0.5723727",
"0.569731",
"0.5679494",
"0.55371684",
"0.55122095",
"0.5349955",
"0.5329497",
"0.5249734",
"0.5233404",
"0.5215649",
"0.52150685",
"0.5204753",
"0.51925904",
"0.518287",
"0.5135109",
"0.50979376",... | 0.8624892 | 0 |
Update the details of a bug log. ==== Parameters projectId:: ID of the project. buglog:: Buglog object. ==== Returns Buglog object. | def updateBuglog(projectId, buglog)
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(buglog.getBugId)+"/logs/"+String(buglog.getId)+"/"
response = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)
return $timesheetParser.getBuglog(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addBuglog(projectId, buglog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/bugs/\"+String(buglog.getBugId)+\"/logs/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, buglog.toParamMAP)\t\t\r\n\t\t\t\treturn $timesheetParser.getBuglog(response)\r\n\t\t\tend",
"def updateTasklo... | [
"0.7116334",
"0.6524365",
"0.6214276",
"0.61958617",
"0.60275775",
"0.59494716",
"0.5939012",
"0.58407605",
"0.5823737",
"0.5780291",
"0.5755026",
"0.574328",
"0.57302403",
"0.5729758",
"0.5726732",
"0.5726439",
"0.5724277",
"0.5686232",
"0.5675895",
"0.5659279",
"0.56356454"... | 0.8651246 | 0 |
Delete an existing bug log for the project. ==== Parameters projectId:: ID of the project. bugId:: ID of the bug. logId:: ID of the log. ==== Returns String object. | def deleteBuglog(projectId, bugId, logId)
url = getBaseURL+"projects/"+String(projectId)+"/bugs/"+String(bugId)+"/logs/"+String(logId)+"/"
response = ZohoHTTPClient.delete(url, getQueryMap)
return $timesheetParser.getResult(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteGenerallog(projectId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend",
"def deleteTasklog(projectId, taskId, logId... | [
"0.7142091",
"0.6956854",
"0.6182351",
"0.59739757",
"0.5900415",
"0.584281",
"0.5813457",
"0.57272506",
"0.57272506",
"0.56348777",
"0.5613421",
"0.5612092",
"0.5606971",
"0.5580716",
"0.55606985",
"0.55378646",
"0.5496478",
"0.54311246",
"0.54148203",
"0.5403991",
"0.538280... | 0.848432 | 0 |
Add a new general log for the project. ==== Parameters projectId:: ID of the project. generallog:: Generallog object. ==== Returns Generallog object. | def addGenerallog(projectId, generallog)
url = getBaseURL+"projects/"+String(projectId)+"/logs/"
requestBody = generallog.toParamMAP
requestBody["name"] = generallog.getName
response = ZohoHTTPClient.post(url, getQueryMap, requestBody)
return $timesheetParser.getGenerallog(response)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"+String(generallog.getId)+\"/\"\t\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, ... | [
"0.75810695",
"0.5910373",
"0.5597355",
"0.53472376",
"0.5316535",
"0.52600914",
"0.50749403",
"0.50287175",
"0.49866185",
"0.49507076",
"0.48273593",
"0.4794948",
"0.47909224",
"0.47854152",
"0.47738454",
"0.47495914",
"0.46370867",
"0.46265438",
"0.46098772",
"0.45838755",
... | 0.84833056 | 0 |
Update the details of a general log. ==== Parameters projectId:: ID of the project. generallog:: Generallog object. ==== Returns Generallog object. | def updateGenerallog(projectId, generallog)
url = getBaseURL+"projects/"+String(projectId)+"/logs/"+String(generallog.getId)+"/"
requestBody = generallog.toParamMAP
requestBody["name"] = generallog.getName
response = ZohoHTTPClient.post(url, getQueryMap, requestBody)
return $timesheetPars... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addGenerallog(projectId, generallog)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/logs/\"\t\r\n\t\t\t\trequestBody = generallog.toParamMAP\t\t\r\n\t\t\t\trequestBody[\"name\"] = generallog.getName\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, requestBody)\t\t\r\n\t\t\t\tretu... | [
"0.7433099",
"0.59417474",
"0.5861666",
"0.55503225",
"0.5535288",
"0.54980934",
"0.54008055",
"0.51105887",
"0.50986356",
"0.50932467",
"0.5079231",
"0.507351",
"0.5068042",
"0.50541276",
"0.505149",
"0.5027356",
"0.5014346",
"0.49955258",
"0.4991671",
"0.4991671",
"0.499167... | 0.86089516 | 0 |
Delete an existing general log for the project. ==== Parameters projectId:: ID of the project. logId:: ID of the log. ==== Returns String object. | def deleteGenerallog(projectId, logId)
url = getBaseURL+"projects/"+String(projectId)+"/logs/"+String(logId)+"/"
response = ZohoHTTPClient.delete(url, getQueryMap)
return $timesheetParser.getResult(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deleteTasklog(projectId, taskId, logId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(taskId)+\"/logs/\"+String(logId)+\"/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.delete(url, getQueryMap)\t\t\r\n\t\t\t\treturn $timesheetParser.getResult(response)\r\n\t\t\tend",
"def delete... | [
"0.72782505",
"0.709319",
"0.6227472",
"0.60458577",
"0.6035807",
"0.5991523",
"0.58855873",
"0.57131463",
"0.5693283",
"0.5641964",
"0.55347586",
"0.55156606",
"0.5511078",
"0.5510426",
"0.5468517",
"0.5468517",
"0.5423575",
"0.53990316",
"0.5356973",
"0.53476304",
"0.529756... | 0.86152554 | 0 |
Resolve security group names to their ids in the given VPC | def get_vpc_security_group_ids(vpc_id, group_names)
group_map = {}
@log.info "resolving security groups #{group_names} in #{vpc_id}"
ec2.describe_security_groups(filters: [{ name: 'vpc-id', values: [vpc_id] }]).
each do |response|
response.security_groups.each do |sg|
group_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_security_group(name, vpc_id)\n sg = ec2.create_security_group({\n group_name: name,\n description: \"Kontena Grid\",\n vpc_id: vpc_id\n })\n\n sg.authorize_ingress({ # SSH\n ip_protocol: 'tcp', from_port: 22, to_port: 22, cidr_ip: '0.0.0.0/0'\n })\n s... | [
"0.6421951",
"0.60523486",
"0.60523486",
"0.59858024",
"0.5910377",
"0.590571",
"0.590571",
"0.574062",
"0.5737266",
"0.57033783",
"0.56034845",
"0.5554998",
"0.5508641",
"0.54767305",
"0.54542273",
"0.54423124",
"0.5420101",
"0.54068077",
"0.53830445",
"0.53771174",
"0.53089... | 0.68202025 | 0 |
POST /alerts or /alerts.json | def create
@alert = Alert.new(alert_params)
respond_to do |format|
if @alert.save
format.html { redirect_to root_path, notice: "Has creado una nueva alerta. Pronto te avisaremos cuando encontremos lo que buscas" }
format.json { render :show, status: :created, location: @alert }
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to alerts_path, notice: 'Alert was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @alert }\n else\n format.html { ren... | [
"0.66645277",
"0.6408699",
"0.62529373",
"0.6199479",
"0.6155851",
"0.6121954",
"0.6121954",
"0.6100382",
"0.6080726",
"0.6074785",
"0.6049897",
"0.5976953",
"0.59527975",
"0.59466314",
"0.5938756",
"0.5926984",
"0.59240925",
"0.59033805",
"0.5862788",
"0.585587",
"0.5824317"... | 0.6582375 | 1 |
GET /push_notifications/1 GET /push_notifications/1.json | def show
@push_notification = PushNotification.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @push_notification }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end",
"def get_notifications\n begin\n response = notifications_api.get\n [parse_json(response), nil]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end",... | [
"0.71470237",
"0.71149594",
"0.702024",
"0.6739455",
"0.67365307",
"0.65377253",
"0.6502985",
"0.6464229",
"0.6418267",
"0.6395495",
"0.63823366",
"0.63689196",
"0.6342196",
"0.6319888",
"0.62753266",
"0.62753266",
"0.62730664",
"0.622044",
"0.6213916",
"0.6213185",
"0.615197... | 0.7308819 | 0 |
GET /push_notifications/new GET /push_notifications/new.json | def new
@push_notification = PushNotification.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @push_notification }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @push_notification = PushNotification.new(params[:push_notification])\n\n respond_to do |format|\n if @push_notification.save\n format.html { redirect_to @push_notification, notice: 'Push notification was successfully created.' }\n format.json { render json: @push_notification... | [
"0.7425958",
"0.73184174",
"0.7194499",
"0.7119298",
"0.7028306",
"0.6984908",
"0.697821",
"0.6941635",
"0.6912806",
"0.6861983",
"0.68489474",
"0.68405056",
"0.68377465",
"0.67580867",
"0.67577994",
"0.67005837",
"0.67005837",
"0.6647367",
"0.6646978",
"0.65984",
"0.65745527... | 0.81968904 | 0 |
DELETE /push_notifications/1 DELETE /push_notifications/1.json | def destroy
@push_notification = PushNotification.find(params[:id])
@push_notification.destroy
respond_to do |format|
format.html { redirect_to push_notifications_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(id)\n client.delete(\"/api/rest/v1/notifications/#{id}.json\")\n true\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notific... | [
"0.73669475",
"0.7322984",
"0.7322984",
"0.7322984",
"0.7322984",
"0.72661036",
"0.7231263",
"0.7179823",
"0.7177439",
"0.71410805",
"0.71193784",
"0.7118383",
"0.709722",
"0.7091996",
"0.70538527",
"0.7053221",
"0.7049058",
"0.70370585",
"0.70303464",
"0.70303464",
"0.703034... | 0.78665096 | 0 |
The host on which this process' tasks run This is always 'localhost' as ruby tasks are instanciated inside the ruby process | def host_id; 'localhost' end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host\n @manager.primary_pool.host\n end",
"def get_host\n @host\n end",
"def host\n 'localhost'\n end",
"def host\n @host\n end",
"def host\r\n return for_context(nil, false) { |c| c.host }\r\n end",
"def hostname\n name + '.localhost'\n end",
"def local_... | [
"0.7599148",
"0.75907105",
"0.75867385",
"0.7541308",
"0.7479843",
"0.74679273",
"0.73633075",
"0.7356637",
"0.73507243",
"0.7324868",
"0.7324868",
"0.7320991",
"0.7320991",
"0.7307072",
"0.73064476",
"0.7283643",
"0.7283643",
"0.7283643",
"0.7283643",
"0.7283643",
"0.7283643... | 0.76236296 | 0 |
The PID of the process in which the tasks run This is always Process.pid as ruby tasks are instanciated inside the ruby process | def pid; ::Process.pid end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pid\n @pid ||= Process.pid\n end",
"def pid\n @pid ||= Process.pid\n end",
"def pid\n @pid ||= Process.pid\n end",
"def pid\n $PROCESS_ID\n end",
"def _pid\n @@_pid ||= Process.pid\n end",
"def ppid\n Process.ppid\n end",
... | [
"0.8546602",
"0.84667057",
"0.84667057",
"0.8281586",
"0.8248475",
"0.7923126",
"0.7800208",
"0.77250016",
"0.77250016",
"0.77250016",
"0.7653343",
"0.7580763",
"0.7555151",
"0.7496516",
"0.7496516",
"0.7496516",
"0.7415169",
"0.7398324",
"0.73734504",
"0.7369817",
"0.7367834... | 0.8517214 | 1 |
GET /event_facebook_pages GET /event_facebook_pages.json | def index
@event_facebook_pages = EventFacebookPage.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pages\n get(\"v1/event/#{@id}/pages\")\n end",
"def index\n @facebook_pages = FacebookPage.all\n end",
"def set_event_facebook_page\n @event_facebook_page = EventFacebookPage.find(params[:id])\n end",
"def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\... | [
"0.74158573",
"0.670044",
"0.64896655",
"0.6421518",
"0.63990253",
"0.6333035",
"0.6326266",
"0.6278609",
"0.62673265",
"0.62254834",
"0.61614174",
"0.61593974",
"0.6149332",
"0.613689",
"0.613662",
"0.613333",
"0.6120827",
"0.61084807",
"0.60969895",
"0.6076426",
"0.60709494... | 0.7717961 | 0 |
POST /event_facebook_pages POST /event_facebook_pages.json | def create
@event_facebook_page = EventFacebookPage.new(event_facebook_page_params)
respond_to do |format|
if @event_facebook_page.save
format.html { redirect_to @event_facebook_page, notice: 'Event facebook page was successfully created.' }
format.json { render :show, status: :created, l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_facebook_page_params\n params.require(:event_facebook_page).permit(:evnt_id, :facebook_page_id, :created_dt)\n end",
"def index\n @event_facebook_pages = EventFacebookPage.all\n end",
"def create\n \n params['facebook'] = {\n :name => params[:event][:name],\n :start_time =... | [
"0.69411737",
"0.67510545",
"0.6624868",
"0.6488519",
"0.6393019",
"0.63797003",
"0.62870497",
"0.6284959",
"0.60912263",
"0.602314",
"0.5971448",
"0.5904261",
"0.5788121",
"0.57671255",
"0.57366395",
"0.5735167",
"0.57136226",
"0.5707099",
"0.5673284",
"0.56723607",
"0.56396... | 0.7537748 | 0 |
PATCH/PUT /event_facebook_pages/1 PATCH/PUT /event_facebook_pages/1.json | def update
respond_to do |format|
if @event_facebook_page.update(event_facebook_page_params)
format.html { redirect_to @event_facebook_page, notice: 'Event facebook page was successfully updated.' }
format.json { render :show, status: :ok, location: @event_facebook_page }
else
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n \n params['facebook'] = {\n :name => params[:event][:name],\n :start_time => get_date_string_from_params(params[:event]['start_time(1i)'],params[:event]['start_time(2i)'],params[:event]['start_time(3i)'],params[:event]['start_time(4i)'],params[:event]['start_time(5i)']),\n :end_ti... | [
"0.6905974",
"0.6639611",
"0.6562121",
"0.6425062",
"0.63814306",
"0.6377962",
"0.63669616",
"0.6346461",
"0.6345063",
"0.6315546",
"0.631254",
"0.63024455",
"0.63018286",
"0.62860894",
"0.6268523",
"0.6268523",
"0.61567485",
"0.6151587",
"0.61481",
"0.61447835",
"0.61439",
... | 0.7414764 | 0 |
DELETE /event_facebook_pages/1 DELETE /event_facebook_pages/1.json | def destroy
@event_facebook_page.destroy
respond_to do |format|
format.html { redirect_to event_facebook_pages_url, notice: 'Event facebook page was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.find(params[:id])\n faceresponse = @graph.delete_object(@event.facebookID)\n \n if faceresponse == true\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end\n end... | [
"0.7375406",
"0.7243202",
"0.72237515",
"0.7064322",
"0.7013192",
"0.68683267",
"0.68385804",
"0.6826523",
"0.6807789",
"0.6778725",
"0.676255",
"0.67607397",
"0.67584455",
"0.6749123",
"0.6744463",
"0.6734683",
"0.6734683",
"0.6734683",
"0.6723085",
"0.671951",
"0.67194915",... | 0.7853551 | 0 |
pass in limit: 5 to get the top 5 errors | def get_honeybadger_errors(options = {})
api_token = "YOUR API TOKEN HERE"
project_id = "YOUR PROJECT ID HERE"
url = "https://api.honeybadger.io/v1/projects/#{project_id}/faults?auth_token=#{api_token}"
if options[:order]
url += "&order=#{options[:order]}"
end
uri = URI.parse(url)
http = Net::HTTP.ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def errors(queue, limit, offset)\n conditions = {:error.not => nil}\n conditions[:record_class_name] = queue.class_names unless queue.class_names.empty?\n all(conditions.merge(:limit => limit, :offset => offset, :order => :id))\n end",
"def max_errors\n OrigenSim.ma... | [
"0.6226895",
"0.62037313",
"0.6157945",
"0.6070162",
"0.6070162",
"0.6070162",
"0.6034135",
"0.59960884",
"0.59824985",
"0.59481597",
"0.5932228",
"0.59252304",
"0.58591545",
"0.58138794",
"0.5812405",
"0.5768332",
"0.57221687",
"0.56619966",
"0.56574327",
"0.5652571",
"0.565... | 0.6254479 | 0 |
GET /secret_keys GET /secret_keys.json | def index
@secret_keys = SecretKey.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secretkey(apikey)\n get 'secretkey', {apikey: apikey} { |x| x['secretkey'] }\n end",
"def secret_key\n credentials['secret_key']\n end",
"def secret_key\n credentials['secret_key']\n end",
"def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end",
"def show\n r... | [
"0.7315136",
"0.71182024",
"0.71182024",
"0.7078885",
"0.7009751",
"0.6991159",
"0.69349295",
"0.691555",
"0.6743916",
"0.66876966",
"0.66311103",
"0.6575756",
"0.65401965",
"0.6512641",
"0.65039593",
"0.64806354",
"0.64522874",
"0.6422989",
"0.63935554",
"0.6378652",
"0.6357... | 0.7366338 | 0 |
GET /secret_keys/1 GET /secret_keys/1.json | def show
render :json => @secret_key.to_json({})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secretkey(apikey)\n get 'secretkey', {apikey: apikey} { |x| x['secretkey'] }\n end",
"def index\n @secret_keys = SecretKey.all\n end",
"def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end",
"def get(secret_id)\n request('/accounts/' + account_id + '/secrets/' + secret_i... | [
"0.7278278",
"0.69595635",
"0.69550973",
"0.6954143",
"0.6925694",
"0.6925694",
"0.67357373",
"0.6636985",
"0.6565648",
"0.65168345",
"0.6457483",
"0.64468193",
"0.6431183",
"0.6392815",
"0.63761866",
"0.63154864",
"0.6286288",
"0.6274083",
"0.6254343",
"0.62469256",
"0.62328... | 0.7147912 | 1 |
POST /secret_keys POST /secret_keys.json | def create
@secret_key = SecretKey.new(secret_key_params)
respond_to do |format|
if @secret_key.save
#format.html { redirect_to @secret_key, notice: 'Secret key was successfully created.' }
format.json { render :json=> @secret_key.to_json({}) }
else
format.html { render acti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create body = {}\n @connection.request(method: :post, path: \"/secrets/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def secret_key_params\n params.require(:secret_key).permit(:secretKey)\n end",
"def secret_key; end",
"def call\n JsonWebTo... | [
"0.6654314",
"0.65644795",
"0.6501072",
"0.6404883",
"0.6358265",
"0.62994224",
"0.6282049",
"0.62638855",
"0.6228947",
"0.6197391",
"0.6197391",
"0.6192218",
"0.61480415",
"0.6134636",
"0.6103253",
"0.610023",
"0.60743576",
"0.60434437",
"0.60247207",
"0.60117745",
"0.600521... | 0.7164528 | 0 |
PATCH/PUT /secret_keys/1 PATCH/PUT /secret_keys/1.json | def update
respond_to do |format|
if @secret_key.update(secret_key_params)
format.html { redirect_to @secret_key, notice: 'Secret key was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @secre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_secret\n resource.refresh_secret!\n\n respond_to do |format|\n format.json { render json: { secret: resource.secret } }\n end\n end",
"def update!(**args)\n @legacy_secret_key = args[:legacy_secret_key] if args.key?(:legacy_secret_key)\n end",
"def update\n if @secr... | [
"0.7113271",
"0.6653773",
"0.6574041",
"0.64721984",
"0.63784695",
"0.62995344",
"0.6260749",
"0.62383765",
"0.6217892",
"0.61888534",
"0.61790395",
"0.611519",
"0.60868496",
"0.60821855",
"0.6072671",
"0.6070256",
"0.6044613",
"0.6027984",
"0.6004947",
"0.5990207",
"0.594768... | 0.71105415 | 1 |
DELETE /secret_keys/1 DELETE /secret_keys/1.json | def destroy
@secret_key.destroy
respond_to do |format|
format.html { redirect_to secret_keys_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @secret.destroy\n head :no_content\n end",
"def delete_secret_key\n\t\takey = GPGME::Key.find(:secret, @dname)\n\t\takey.each do |akey|\n\t\takey.delete!(allow_secret = true)\n\t\tend\n\tend",
"def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to se... | [
"0.71263814",
"0.7061591",
"0.69951266",
"0.68707645",
"0.68013763",
"0.6764238",
"0.6719346",
"0.67113805",
"0.66667426",
"0.66657424",
"0.6661418",
"0.6655528",
"0.6620707",
"0.6620132",
"0.6596752",
"0.6561845",
"0.6548554",
"0.65265644",
"0.6500443",
"0.6485812",
"0.64506... | 0.7774702 | 0 |
GET /matchs/1 GET /matchs/1.json | def show
@match = Match.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @match }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end",
"def show\n @match = Match.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @match }\n end\n end",
"def get_match ( match_key )\n get_api_resource \"#{@@api_base_url}mat... | [
"0.7566503",
"0.7555019",
"0.7450852",
"0.73728883",
"0.72528493",
"0.70715123",
"0.7068406",
"0.7018088",
"0.7017495",
"0.69765025",
"0.68974364",
"0.687791",
"0.68285143",
"0.6807695",
"0.676487",
"0.675521",
"0.6708733",
"0.6708733",
"0.6708733",
"0.6708733",
"0.6708733",
... | 0.75990415 | 0 |
PUT /matchs/1 PUT /matchs/1.json | def update
@match = match.find(params[:id])
respond_to do |format|
if @match.update_attributes(params[:match])
format.html { redirect_to @match, notice: 'match was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n match = Match.find_by(id: match_params[:id])\n\n match.update match_params\n if match.valid?\n render json: { match: match}, status: :created\n else\n render json: { errors: match.errors.full_messages }, status: :not_accepted\n end\n end",
... | [
"0.7366723",
"0.6968276",
"0.69544584",
"0.694611",
"0.69208413",
"0.69208413",
"0.69208413",
"0.69208413",
"0.69208413",
"0.69208413",
"0.69208413",
"0.69208413",
"0.69208413",
"0.69208413",
"0.69204366",
"0.69202495",
"0.6915333",
"0.68965554",
"0.68938047",
"0.6764857",
"0... | 0.7070172 | 1 |
DELETE /matchs/1 DELETE /matchs/1.json | def destroy
@match = match.find(params[:id])
@match.destroy
respond_to do |format|
format.html { redirect_to matchs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\... | [
"0.76211053",
"0.76043123",
"0.76043123",
"0.76043123",
"0.755507",
"0.7508835",
"0.7446173",
"0.7330209",
"0.7319407",
"0.7309181",
"0.73089856",
"0.72890025",
"0.72890025",
"0.72890025",
"0.72890025",
"0.72890025",
"0.72890025",
"0.72890025",
"0.72890025",
"0.72890025",
"0.... | 0.7758525 | 0 |
evaluate transaction status change | def eval_transaction_status_change params
return if params.blank? or params[:status_notification].blank? or params[:status_notification][:transaction].blank?
init_data_by_payment(Spree::Payment.find_by_sofort_transaction(params[:status_notification][:transaction]))
raw_response = HTTParty.post(@sofort... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_transfer\n if status_changed? && status_changed?(from: \"finish\")\n errors.add(:base, \"错误的操作\")\n end\n end",
"def changed\n @status = true\n end",
"def update_status\n begin\n if self.service_test.status_changed?\n results = self.service_test.test_results.last(2)\n ... | [
"0.64662635",
"0.6388516",
"0.62790674",
"0.623466",
"0.61943907",
"0.61943156",
"0.6155995",
"0.6134327",
"0.61225134",
"0.61059034",
"0.60855407",
"0.60820657",
"0.607373",
"0.6066787",
"0.60397434",
"0.60397434",
"0.60300416",
"0.6027858",
"0.60225224",
"0.60185456",
"0.60... | 0.71097296 | 0 |
Return an array list of themes that this user is permitted to use in a project | def author_themes
return [] if meta.nil? || meta['roles'].nil?
# if this is a superuser, return all available themes
# if we only have an array of roles, all themes are available
if role?(:superuser) || (meta['roles'].is_a?(Array) && role?(:author, :editor))
themes = Rails.configuration.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_themes\n themes_dir = File.join(File.dirname(__FILE__), '/public/themes')\n\n themes = []\n Dir.entries(themes_dir).sort.each do |dir|\n themes.push dir if ((dir != 'fonts') and (dir[0] != '.'))\n end\n themes\n end",
"def editor_themes\n return [] if... | [
"0.7200508",
"0.6968776",
"0.6531828",
"0.6449759",
"0.63100535",
"0.6282218",
"0.6279101",
"0.6198157",
"0.61793166",
"0.6157119",
"0.6125918",
"0.6083742",
"0.6067845",
"0.60221076",
"0.5992865",
"0.5992865",
"0.5986286",
"0.5970423",
"0.59126174",
"0.59126174",
"0.59011084... | 0.71059227 | 1 |
Return an array of themes that this user is allowed to edit. Editors can see and change other users' projects. This user will be limited to projects that use these themes. | def editor_themes
return [] if meta.nil? || meta['roles'].nil?
# authors can't edit other projects
return [] unless role?(:editor, :superuser)
# if we only have an array, superusers and editors can edit all themes
# also, superusers can always edit all the themes, even if we have a hash of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def author_themes\n return [] if meta.nil? || meta['roles'].nil?\n # if this is a superuser, return all available themes\n # if we only have an array of roles, all themes are available\n if role?(:superuser) || (meta['roles'].is_a?(Array) && role?(:author, :editor))\n themes = Rails.conf... | [
"0.71528304",
"0.64106244",
"0.5802137",
"0.57948714",
"0.5700719",
"0.56590044",
"0.56555265",
"0.5652926",
"0.5596658",
"0.55074036",
"0.55002177",
"0.54541475",
"0.54521096",
"0.5438579",
"0.53935593",
"0.5368208",
"0.5368208",
"0.5335459",
"0.5335307",
"0.52945167",
"0.52... | 0.8083726 | 0 |
Validation uniqueness of path, constrained by county. | def path_must_be_unique_in_county
return nil if path.blank? || !county
my_path = self.path.to_s.downcase
county.graveyards.each do |g|
if (g.path.to_s.downcase == my_path) && (g.id != self.id)
errors.add(:path, "#{self.path} has already been taken")
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniqueness_for_school_and_subject\n school = School.find(school_id)\n school.courses.where(subject_id: subject_id).each do |course|\n if (course.call_number == call_number)\n errors.add(:course, 'course call number already exists')\n return\n elsif (course.friendly_name == friendl... | [
"0.5821685",
"0.56460184",
"0.56175864",
"0.54954046",
"0.54770005",
"0.5422412",
"0.53575736",
"0.5328905",
"0.53194606",
"0.52935666",
"0.529042",
"0.52890325",
"0.5287985",
"0.5246418",
"0.5206022",
"0.5187312",
"0.51832515",
"0.5117289",
"0.51170653",
"0.51132596",
"0.509... | 0.8701248 | 0 |
GET /constituencies/1 GET /constituencies/1.xml | def show
@constituency = Constituency.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @constituency }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup\n @constituency = @request.get.first\n\n redirect_to constituency_path(@constituency.graph_id)\n end",
"def show\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @concert }\n end\n end",
"def get(... | [
"0.6222115",
"0.5971463",
"0.5902317",
"0.5852832",
"0.58352184",
"0.5820329",
"0.57773244",
"0.5688305",
"0.56456155",
"0.5645165",
"0.56139857",
"0.5613748",
"0.55987144",
"0.55851483",
"0.5571247",
"0.55611724",
"0.55537677",
"0.55506533",
"0.5541908",
"0.5526804",
"0.5524... | 0.6909627 | 0 |
GET /constituencies/new GET /constituencies/new.xml | def new
@constituency = Constituency.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @constituency }
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 create\n @constituency = Constituency.new(params[:constituency])\n\n respond_to do |format|\n if @constituency.save\n flash[:notice] = 'Constituency was su... | [
"0.68227774",
"0.6763014",
"0.66978467",
"0.66190505",
"0.65733135",
"0.65503794",
"0.6540074",
"0.65079314",
"0.6492418",
"0.6488922",
"0.6488922",
"0.6463498",
"0.64566034",
"0.6436784",
"0.642023",
"0.64196604",
"0.6419493",
"0.6410595",
"0.6410595",
"0.6400944",
"0.639142... | 0.7473389 | 0 |
POST /constituencies POST /constituencies.xml | def create
@constituency = Constituency.new(params[:constituency])
respond_to do |format|
if @constituency.save
flash[:notice] = 'Constituency was successfully created.'
format.html { redirect_to(@constituency) }
format.xml { render :xml => @constituency, :status => :created, :lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @constituency = Constituency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @constituency }\n end\n end",
"def create\n @constat = Constat.new(constat_params)\n\n respond_to do |format|\n if @constat.save\n format.html { ... | [
"0.55601114",
"0.5400987",
"0.5211219",
"0.51572895",
"0.5139422",
"0.50838923",
"0.5079335",
"0.5051694",
"0.5023281",
"0.50112855",
"0.5005782",
"0.4980672",
"0.49752426",
"0.49628162",
"0.49553454",
"0.4943119",
"0.49299672",
"0.49194336",
"0.49115142",
"0.48938355",
"0.48... | 0.64474565 | 0 |
PUT /constituencies/1 PUT /constituencies/1.xml | def update
@constituency = Constituency.find(params[:id])
respond_to do |format|
if @constituency.update_attributes(params[:constituency])
flash[:notice] = 'Constituency was successfully updated.'
format.html { redirect_to(@constituency) }
format.xml { head :ok }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def upd... | [
"0.5962064",
"0.58543646",
"0.55823255",
"0.5503839",
"0.54679924",
"0.54611045",
"0.543626",
"0.5423922",
"0.5384145",
"0.53753436",
"0.5324049",
"0.5320335",
"0.53050303",
"0.53023005",
"0.5279995",
"0.52788395",
"0.52670753",
"0.5208511",
"0.52018803",
"0.5181989",
"0.5178... | 0.65752196 | 0 |
DELETE /constituencies/1 DELETE /constituencies/1.xml | def destroy
@constituency = Constituency.find(params[:id])
@constituency.destroy
respond_to do |format|
format.html { redirect_to(constituencies_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls... | [
"0.646807",
"0.64062953",
"0.637815",
"0.63681245",
"0.6295755",
"0.62838995",
"0.6182841",
"0.61613566",
"0.6142679",
"0.6137103",
"0.6135968",
"0.6131631",
"0.6129161",
"0.6129106",
"0.61277664",
"0.61153686",
"0.6107311",
"0.6097522",
"0.608922",
"0.60174847",
"0.6014349",... | 0.72173804 | 0 |
GET /win_conditions GET /win_conditions.json | def index
@win_conditions = params[:game_id].present? ? Game.find(params[:game_id]).win_conditions.all : WinCondition.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_conditions\n question = Question.find(params[:question_id])\n authorize question\n render json: { container: render_to_string(partial: 'org_admin/conditions/container',\n formats: :html,\n layout... | [
"0.64627",
"0.6295687",
"0.6100754",
"0.59391516",
"0.5691808",
"0.56303114",
"0.56244797",
"0.55324847",
"0.55153716",
"0.5447018",
"0.544389",
"0.5428287",
"0.5428287",
"0.5385598",
"0.5363043",
"0.53579056",
"0.5295867",
"0.52797246",
"0.5255074",
"0.5255074",
"0.52535844"... | 0.6649024 | 0 |
POST /win_conditions POST /win_conditions.json | def create
@win_condition = WinCondition.new(win_condition_params)
respond_to do |format|
if @win_condition.save
format.html { redirect_to @win_condition, notice: 'Win condition was successfully created.' }
format.json { render :show, status: :created, location: @win_condition }
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def win_condition_params\n params.require(:win_condition).permit(:name, :game_id)\n end",
"def create\n render_json_auto @survey.add_logic_control_rule(params[:logic]) and return\n end",
"def win_params\n params.require(:win).permit(:company, :agents, :mrr, :reps)\n end",
"def create\n ... | [
"0.6565656",
"0.58910054",
"0.57967585",
"0.5756708",
"0.57271993",
"0.5668605",
"0.56656796",
"0.56583244",
"0.5614089",
"0.55920935",
"0.55799574",
"0.5519848",
"0.5453747",
"0.5432144",
"0.54258853",
"0.54057586",
"0.5348766",
"0.5344986",
"0.53258073",
"0.5309213",
"0.527... | 0.7375267 | 0 |
PATCH/PUT /win_conditions/1 PATCH/PUT /win_conditions/1.json | def update
respond_to do |format|
if @win_condition.update(win_condition_params)
format.html { redirect_to @win_condition, notice: 'Win condition was successfully updated.' }
format.json { render :show, status: :ok, location: @win_condition }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render_json_auto @survey.update_logic_control_rule(params[:id].to_i, params[:logic]) and return\n end",
"def update\n @human_condition = HumanCondition.find(params[:id])\n\n respond_to do |format|\n if @human_condition.update_attributes(params[:human_condition])\n format.html {... | [
"0.66584647",
"0.6166113",
"0.6012476",
"0.6001384",
"0.59345716",
"0.58404654",
"0.5839187",
"0.5829148",
"0.58228487",
"0.5820189",
"0.5800443",
"0.5798872",
"0.5782197",
"0.5777942",
"0.5769346",
"0.5748067",
"0.5740029",
"0.571588",
"0.5711324",
"0.5711117",
"0.569516",
... | 0.71610093 | 0 |
DELETE /win_conditions/1 DELETE /win_conditions/1.json | def destroy
@win_condition.destroy
respond_to do |format|
format.html { redirect_to win_conditions_url, notice: 'Win condition was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @human_condition = HumanCondition.find(params[:id])\n @human_condition.destroy\n\n respond_to do |format|\n format.html { redirect_to human_conditions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @condition.destroy\n respond_to do |format|\n ... | [
"0.67884463",
"0.67107534",
"0.66656786",
"0.64525366",
"0.6440423",
"0.6417379",
"0.63794756",
"0.6322817",
"0.6315701",
"0.62950385",
"0.62916243",
"0.6227997",
"0.62242717",
"0.6211542",
"0.6200861",
"0.61911196",
"0.61656684",
"0.61544955",
"0.6153352",
"0.61040944",
"0.6... | 0.710256 | 0 |
Add the exhibit home page to the sitemap | def add_exhibit_root
sitemap.add sitemap.exhibit_root_path(exhibit)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_pages\n exhibit.feature_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_feature_page_path(exhibit, p), priority: 0.8, lastmod: p.updated_at\n end\n\n exhibit.about_pages.published.find_each do |p|\n sitemap.add sitemap.exhibit_about_page_path(exhibit, p), priorit... | [
"0.70925486",
"0.67437726",
"0.65935045",
"0.6369032",
"0.63406163",
"0.63031775",
"0.6259364",
"0.6259364",
"0.62206346",
"0.62206346",
"0.61736685",
"0.6119472",
"0.6119472",
"0.60759777",
"0.6031398",
"0.6025497",
"0.6018672",
"0.6013575",
"0.59930176",
"0.59622645",
"0.59... | 0.7341908 | 0 |
Add all published feature and about pages to the sitemap | def add_pages
exhibit.feature_pages.published.find_each do |p|
sitemap.add sitemap.exhibit_feature_page_path(exhibit, p), priority: 0.8, lastmod: p.updated_at
end
exhibit.about_pages.published.find_each do |p|
sitemap.add sitemap.exhibit_about_page_path(exhibit, p), priority: 0.5, las... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sitemap\n store_location\n\n # note: icons could be included, but do not seem to add much\n # note: tried showing unavailable pages as 'sans link', results not particularly attractive\n\n # TBD: My Talks, My Messsages, Current Messages\n # TBD: Maps, Calendars, Tags & Topics, Friends & Groups,... | [
"0.73238945",
"0.7089889",
"0.7019592",
"0.69738644",
"0.69283986",
"0.67798644",
"0.67486095",
"0.6743766",
"0.65847194",
"0.6533413",
"0.6515004",
"0.65099895",
"0.6489272",
"0.6356194",
"0.6268795",
"0.6219053",
"0.61954296",
"0.61258113",
"0.6106279",
"0.60770166",
"0.600... | 0.82855546 | 0 |
Add published browse categories to the sitemap | def add_browse_categories
exhibit.searches.published.find_each do |s|
sitemap.add sitemap.exhibit_browse_path(exhibit, s), priority: 0.5, lastmod: s.updated_at
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEX... | [
"0.608349",
"0.6065135",
"0.5996792",
"0.5961147",
"0.5954829",
"0.5884802",
"0.5876969",
"0.5845587",
"0.582028",
"0.58174735",
"0.57482165",
"0.56921375",
"0.56493396",
"0.56242836",
"0.56211925",
"0.56196785",
"0.56089264",
"0.56074655",
"0.5592723",
"0.5590939",
"0.556259... | 0.8357393 | 0 |
Add all catalog resources to the sitemap | def add_resources
exhibit.solr_documents.each do |d|
sitemap.add sitemap.exhibit_solr_document_path(exhibit, d), priority: 0.25, lastmod: document_last_modified(d)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sitemap\n store_location\n\n # note: icons could be included, but do not seem to add much\n # note: tried showing unavailable pages as 'sans link', results not particularly attractive\n\n # TBD: My Talks, My Messsages, Current Messages\n # TBD: Maps, Calendars, Tags & Topics, Friends & Groups,... | [
"0.663915",
"0.65118396",
"0.62684333",
"0.6230909",
"0.60525185",
"0.60361695",
"0.6025151",
"0.5959331",
"0.5937014",
"0.59295493",
"0.5924765",
"0.59173447",
"0.5867088",
"0.5858609",
"0.58148926",
"0.571064",
"0.56768185",
"0.56091964",
"0.55983377",
"0.55945176",
"0.5577... | 0.74172276 | 0 |
To Track the entity | def track(entity)
if entity.is_a?(Sociographer::Entity)
# @@neo = Neography::Rest.new
self_node = self.get_node
tracked_node = entity.get_node
if self_node && tracked_node && !self.tracks?(entity)
relation = Neography::Relationship.create(:friends, self_node, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def track\n self.class.track(@tracking)\n end",
"def save\n if @entity\n before_save\n @entity.save\n end\n self\n end",
"def track\n post\n end",
"def track(entity_type='npc')\n GameMachine::GameSystems::EntityTracking::GRID.set(entity.id,position.x,pos... | [
"0.67914736",
"0.6594084",
"0.6452052",
"0.6438693",
"0.6316617",
"0.63028574",
"0.6280601",
"0.62383753",
"0.62269795",
"0.6203516",
"0.61181885",
"0.6090879",
"0.60651416",
"0.60590696",
"0.60590696",
"0.60570484",
"0.603211",
"0.6016936",
"0.60007244",
"0.60007244",
"0.597... | 0.691833 | 0 |
To unTrack the entity | def untrack(entity)
if entity.is_a?(Sociographer::Entity)
# @@neo = Neography::Rest.new
self_node = self.get_node
tracked_node = entity.get_node
if self_node && tracked_node
relation = @@neo.get_node_relationships_to(self_node, tracked_node, "out", :friends).f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @entity.destroy\n self\n end",
"def unsave\n client.post('/api/unsave', id: read_attribute(:name))\n end",
"def unsave\n self.saved_at = nil\n end",
"def destroy\n @world.remove_entity(self)\n end",
"def unsave\n post(\"/api/unsave\", id: full... | [
"0.6821956",
"0.6688395",
"0.65249914",
"0.6486991",
"0.6439338",
"0.6330571",
"0.63251334",
"0.62900496",
"0.6231193",
"0.6187877",
"0.6182222",
"0.61566496",
"0.61472493",
"0.6133834",
"0.61223525",
"0.6121989",
"0.6101171",
"0.61001396",
"0.6070958",
"0.60514283",
"0.60153... | 0.7271832 | 0 |
To get friends: The common entities between trackers and trackings | def friends
# @@neo = Neography::Rest.new
friends = self.trackers & self.tracking
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trackers\n # @@neo = Neography::Rest.new\n self_node = User.first.get_node\n if self_node\n trackers = []\n begin\n trackers_list = self_node.incoming(:friends).map{ |n| [n.object_type, n[:object_id]] }\n trackers_list = trackers_list.group_by{|x| x[... | [
"0.74777555",
"0.7411428",
"0.7242166",
"0.7242166",
"0.71287173",
"0.70923585",
"0.702671",
"0.70255065",
"0.7011074",
"0.69539845",
"0.69445086",
"0.69310766",
"0.69235945",
"0.6912643",
"0.690255",
"0.68993014",
"0.6896605",
"0.6894356",
"0.68681747",
"0.6859657",
"0.68555... | 0.80789185 | 0 |
To check if friend with the entity or net | def friend_with?(entity)
if entity.is_a?(Sociographer::Entity)
# @@neo = Neography::Rest.new
# self_node = self.get_node
tracked_node = entity.get_node
# if self_node && tracked_entity_node
# trackings = self_node.outgoing(:friends).map{ |n| n}
# t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_friends_with?(friend)\n \t friends.include?(friend)\n \t end",
"def for_friend?\n return true if skill? and skill.for_friend?\n return true if item? and item.for_friend?\n return false\n end",
"def is_friends_or_pending_with?(friend)\n \t pending_or_accepted_friends.include?(fr... | [
"0.71997064",
"0.7134967",
"0.7095948",
"0.707487",
"0.7072164",
"0.6989772",
"0.6989354",
"0.6963993",
"0.6954462",
"0.6939116",
"0.6923071",
"0.6891178",
"0.6885402",
"0.68337446",
"0.68187237",
"0.68136144",
"0.68000585",
"0.67836857",
"0.67826045",
"0.67732733",
"0.675738... | 0.80415875 | 0 |
Suggest friends: friends of friends | def friend_suggestions
# @@neo = Neography::Rest.new
self_node = self.get_node
if self_node
recommendations = self_node.both(:friends).order("breadth first").uniqueness("node global").filter("position.length() == 2;").depth(2)
all_recommendations = recommendations.map{|n|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friends_suggestion(friends_of_friends = false)\n\t\t#sql query for the requested and accepted friendships ID's using the user id\n\t\tactive_ids = \"SELECT friend_pasive_id FROM relationships WHERE friend_active_id = :user_id AND accepted = true\"\n\t\t#sql query for the received and accepted friendships ID's... | [
"0.7735645",
"0.754192",
"0.7355418",
"0.7275208",
"0.717137",
"0.7074245",
"0.7051741",
"0.70130235",
"0.69649345",
"0.69506353",
"0.6806629",
"0.6778449",
"0.6770352",
"0.67640525",
"0.6751163",
"0.6750401",
"0.6750112",
"0.6740888",
"0.6730716",
"0.67286414",
"0.6702798",
... | 0.7927101 | 0 |
Get all paths of entities between you and the entity (like linkedin) | def all_degrees_of_separation(entity)
if entity.is_a?(Sociographer::Entity)
# @@neo = Neography::Rest.new
self_node = self.get_node
entity_node = entity.get_node
if self_node && entity_node
paths = []
self_node.all_simple_paths_to(entity_node).inco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paths_to(node)\n find_paths do\n find { |n| n == node }\n end\n end",
"def ascendant_and_self_ids\n full_path.map{ |c| c.id }\n end",
"def path_ids\n ancestor_ids + [id]\n end",
"def path_ids\n ancestor_ids + [id]\n end",
"def shortest_degrees_of_separation(e... | [
"0.6391371",
"0.62053007",
"0.6157841",
"0.6157841",
"0.61304885",
"0.60848004",
"0.60718846",
"0.60569453",
"0.60332465",
"0.6022259",
"0.6021929",
"0.6017129",
"0.598154",
"0.5928004",
"0.59005487",
"0.5890457",
"0.58458966",
"0.58448637",
"0.58096784",
"0.57796735",
"0.577... | 0.6550341 | 0 |
Get the shortest path of entities between you and the entity (like linkedin) | def shortest_degrees_of_separation(entity)
@@neo = Neography::Rest.new
self_node = self.get_node
entity_node = entity.get_node
if self_node && entity_node
paths = []
self_node.shortest_path_to(entity_node).incoming(:friends).depth(5).nodes.each do |path|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortest_path\n initial_position_obj = { position: start_position, source: {} }\n\n knights_path = [initial_position_obj]\n\n while knights_path.present?\n current_position = knights_path.shift\n\n position = current_position[:position]\n\n if position == end_position\n return pa... | [
"0.67333233",
"0.64659196",
"0.64617217",
"0.63662803",
"0.6359947",
"0.63562536",
"0.634624",
"0.63197494",
"0.6240554",
"0.62347084",
"0.61692154",
"0.61053044",
"0.6094674",
"0.60816056",
"0.6070206",
"0.6050557",
"0.6046724",
"0.6039486",
"0.6020205",
"0.6018814",
"0.5947... | 0.72070897 | 0 |
To sort the trackers according to "calculate_relation" method desendingly | def sorted_trackers
ratings = []
self.trackers.each do |user|
ratings << {entity: user.id, weight: self.calculate_relation(user).to_i}
end
return ratings.sort_by{ |h| h[:weight] }.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_tracking\n ratings = []\n self.tracking.each do |user|\n ratings << {entity: user.id, weight: self.calculate_relation(user).to_i}\n end\n return ratings.sort_by{ |h| h[:weight] }.reverse\n end",
"def apply_sorting(relation)\n relation.order(@q.sorting.t... | [
"0.63994277",
"0.6317887",
"0.6144767",
"0.61250585",
"0.6035595",
"0.602506",
"0.59194386",
"0.5871662",
"0.5862867",
"0.5768755",
"0.5673008",
"0.5663715",
"0.5654938",
"0.56385857",
"0.5636068",
"0.5630438",
"0.5582725",
"0.55579746",
"0.5544479",
"0.55114",
"0.54913956",
... | 0.67141896 | 0 |
To sort the tracking entities according to "calculate_relation" method desendingly | def sorted_tracking
ratings = []
self.tracking.each do |user|
ratings << {entity: user.id, weight: self.calculate_relation(user).to_i}
end
return ratings.sort_by{ |h| h[:weight] }.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end",
"def sort_norm_data\n store.sort_norm_data!\n end",
"def group_relations\n relations = EntityGroupRelationship.where(entity_id: self.id)\n relations.sort_by { |r| r[:position] }\n end",
"def sort_data\n st... | [
"0.65073085",
"0.6207778",
"0.59522796",
"0.5870793",
"0.5827948",
"0.5820088",
"0.5776126",
"0.5773468",
"0.57366174",
"0.5736589",
"0.5722441",
"0.5708928",
"0.5692724",
"0.5669905",
"0.56661355",
"0.56501687",
"0.56373686",
"0.5633106",
"0.5602645",
"0.55976903",
"0.558945... | 0.64485884 | 1 |
To sort the friends according to "calculate_relation" method desendingly | def sorted_friends
ratings = []
self.friends.each do |user|
ratings << {entity: user.id, weight: self.calculate_relation(user).to_i}
end
return ratings.sort_by{ |h| h[:weight] }.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friend_requests \n self.friend_requests_as_receiver.sort_by{ |request| request.requestor.name }\n end",
"def call\n Friendship.all.\n pluck(:from_member_id, :to_member_id).\n flat_map{ |friends| [friends, friends.reverse] }.\n map{ |friends| friends.append(DEFAULT_FRIENDSH... | [
"0.6568983",
"0.6302386",
"0.6122671",
"0.6073548",
"0.60036314",
"0.59447694",
"0.59340316",
"0.5915157",
"0.59138596",
"0.5741854",
"0.5715058",
"0.57112366",
"0.57078093",
"0.57025164",
"0.56959426",
"0.5686379",
"0.56751907",
"0.56744474",
"0.56706077",
"0.5661308",
"0.56... | 0.7278169 | 0 |
Call it to make the relation between the entity and the actionable | def make_relation(actionable, relation, magnitude=1)
if actionable.is_a?(Sociographer::Actionable) && relation.present? && relation
# @@neo = Neography::Rest.new
self_node = self.get_node
actionable_node = actionable.get_node
if self_node && actionable_node
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_actionable\n @actionable = Actionable.find(params[:id])\n end",
"def set_actionable\n @actionable = Actionable.find(params[:id])\n end",
"def create_actionable\n actionable_node = Neography::Node.create(\"object_id\" => self.id, \"object_type\" => self.class.to_s)\n actionable... | [
"0.60413265",
"0.59907585",
"0.5984374",
"0.5908979",
"0.56276965",
"0.56272906",
"0.5567703",
"0.55306613",
"0.5488789",
"0.54324484",
"0.5431984",
"0.5349256",
"0.53455496",
"0.53401387",
"0.53295684",
"0.5326619",
"0.5307637",
"0.5297942",
"0.5260373",
"0.5260352",
"0.5256... | 0.6194696 | 0 |
removes "version" and "op_success" fields from the document before save or update, this ensures that these fields can only be persisted by the versioned_create and versioned_update methods. prevents inadvertent persistence of these fields. return[nil] | def filter_fields
remove_attribute(:version)
remove_attribute(:op_success)
attributes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persist\n prepare do\n document.attributes.delete(field)\n execute(\"$unset\")\n end\n end",
"def after_persist(doc,instance)\n\t\t\t\t\tdoc.keys.each do |f|\n\t\t\t\t\t\tif f == \"version\"\n\t\t\t\t\t\t\tinstance.send(\"#{f}=\",doc[f])\n\t\t\t\t\t\telse\n\t\t\... | [
"0.5988097",
"0.5891741",
"0.57869065",
"0.5775962",
"0.5774656",
"0.5752363",
"0.57133436",
"0.5659219",
"0.56515336",
"0.55760515",
"0.5569905",
"0.55579877",
"0.5555406",
"0.5541297",
"0.55291134",
"0.5526416",
"0.5526416",
"0.5504303",
"0.5500296",
"0.54991007",
"0.548384... | 0.6261284 | 1 |
creates the document, uses the query parameters provided. Increments the version of the document to 1 on successfull creation. Sets "op_success" to true on successfull creation , otherwise false. | def versioned_create(query={},log=false)
self.send("op_success=",false)
update = {}
options = {}
id_query = {"_id" => as_document["_id"]}
query = query.empty? ? id_query : query
if version == 0
update["$setOnInsert"] = {}
options[:upsert] = true
expe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n set_unique_id if respond_to?(:set_unique_id) # hack\n save_doc\n end",
"def create\r\n # not authorized\r\n unless dc_user_can(DcPermission::CAN_CREATE)\r\n flash[:error] = t('drgcms.not_authorized')\r\n return index\r\n end\r\n\r\n # create document\r\n if params['id'].nil?\... | [
"0.648188",
"0.62009674",
"0.6178386",
"0.61285865",
"0.6108398",
"0.60818386",
"0.602869",
"0.6019062",
"0.60034835",
"0.59937906",
"0.59593177",
"0.5952028",
"0.59466875",
"0.5932189",
"0.59105223",
"0.59067696",
"0.59016013",
"0.5891489",
"0.58667207",
"0.58667207",
"0.584... | 0.7399619 | 0 |
Custom validation to be used in validates :email | def validate_email
if !self.email.match(/\A#{ApplicationHelper.form_field_attr('email')[:regex]}\Z/i)
self.errors.add(:email, "#{ApplicationHelper.form_field_attr('email')[:generic]}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_validator(user_email)\n EmailValidator.regexp\n EmailValidator.valid?(user_email)\n end",
"def validate_email\n return if self.email.blank?\n errors.add(:email, :not_a_valid_email) if !Valid.email?(self.email)\n end",
"def validates_email\n self.type == 'email'\n end",
"de... | [
"0.7823798",
"0.7814339",
"0.7598883",
"0.7571887",
"0.7397064",
"0.73885334",
"0.73600036",
"0.73571575",
"0.7267605",
"0.7226947",
"0.7219834",
"0.7182961",
"0.7081259",
"0.7022746",
"0.6956654",
"0.6907628",
"0.68923545",
"0.68640786",
"0.6857352",
"0.6850524",
"0.6822495"... | 0.79128623 | 0 |
Change children value to zero if set to nil to be used before validation | def children_to_zero
self.youngsters ||= 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_parent_favorite_to_zero\n return unless parent\n\n parent.update_attribute(:favorite, '0')\n parent.change_parent_favorite_to_zero\n end",
"def default_values\n self.unread_entries = 0 if self.unread_entries.blank? || self.unread_entries < 0\n end",
"def default_values\n self.unread... | [
"0.60107934",
"0.56709814",
"0.56709814",
"0.5652151",
"0.56515354",
"0.5592876",
"0.55549604",
"0.5549173",
"0.55039585",
"0.547701",
"0.5437217",
"0.54254687",
"0.5419518",
"0.5400208",
"0.5383862",
"0.53809404",
"0.5348891",
"0.5341103",
"0.5305409",
"0.5300384",
"0.529184... | 0.74915636 | 0 |
Verify the error returning the ActiveMerchant::Billing object with the message | def verify_error action, ret
if !ret.nil? and ret.has_key? :erro
ActiveMerchant::Billing::Response.new(false, "Cielo: #{ret[:erro][:codigo]} - #{ret[:erro][:mensagem]}", {}, {})
else
ActiveMerchant::Billing::Response.new(false, Spree.t("cielo.messages.#{action}_rescue"), {}, {})
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failed_purchase_response\n <<~RESPONSE\n {\n \"error\": {\n \"message\": \"The card number is invalid. Make sure the number entered matches your credit card.\",\n \"caused_by\": \"buyer\",\n \"param\": \"number\",\n \"type\": \"card_error\",\n \"code\... | [
"0.72056973",
"0.70541024",
"0.67874736",
"0.6717485",
"0.66636217",
"0.66073775",
"0.6573101",
"0.6562755",
"0.65247095",
"0.65093184",
"0.64394206",
"0.64335907",
"0.6397986",
"0.6356284",
"0.63264555",
"0.6324921",
"0.6274152",
"0.6256668",
"0.62176573",
"0.621561",
"0.617... | 0.71355 | 1 |
Generates a neighbor of this state by randomly selecting a parameter and then changing it by a randomly selected delta | def neighbor &block
factory = block || lambda { |o| State.new o }
new_params = @o.merge(
(p = @params.sample) => @o[p] + @deltas.call(p).sample
)
legal(new_params)?
factory.call(new_params) :
neighbor
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_neighbor\n # rand_num = (rand * neighbors.size).floor\n # rand_key = neighbors.keys[rand_num]\n # neighbors[rand_key]\n # rand_key\n @neighbors.first[0]\n end",
"def random_neighbor\n if roomAdj\n # Choose neighboring adjacent room\n return roomAdj.to_a.sam... | [
"0.6356956",
"0.6192738",
"0.6010979",
"0.5998278",
"0.59272575",
"0.58092684",
"0.5757316",
"0.57493526",
"0.5747699",
"0.573366",
"0.5675287",
"0.56358904",
"0.56284016",
"0.5599641",
"0.556666",
"0.5523831",
"0.5496732",
"0.54812914",
"0.5456059",
"0.54249495",
"0.5402633"... | 0.72736067 | 0 |
Renders a blocklike block of HTML from title and content. This method can be used from anywhere to display a block of HTML content with a title. | def html_blocklike_show(title, content)
render('layouts/block', :title => title, :content => content) unless content.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_block(title = nil, options = {}, &block)\n block_to_partial('shared/block', options.merge(:title => title), &block)\n end",
"def html_block_show(block)\n title, content = send(block.class.to_s.underscore, block)\n html_blocklike_show(title, content)\n end",
"def display_as_html(content,... | [
"0.71504974",
"0.6965838",
"0.68358856",
"0.68358856",
"0.64900947",
"0.64826816",
"0.61566854",
"0.61262363",
"0.61181176",
"0.6089423",
"0.6080067",
"0.60370106",
"0.601753",
"0.59882444",
"0.59811985",
"0.59563714",
"0.5922628",
"0.59192467",
"0.59129065",
"0.5907278",
"0.... | 0.7968744 | 0 |
Nonblocking request for service_addresses. | def service_addresses!(service, index = nil)
meta = {}
resp = _service.get(service, :all, {index: index, wait: '2s'}, meta)
if (nindex = meta[:index]) != index
addresses = resp.map do |address|
{
id: address.ServiceID,
ip: address.ServiceAddress,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_address_service\n addresses = []\n success = call_ok?(:address_search, make_request) do |body|\n ServiceClient.iterate_element(body[:address_list]) do |address|\n add_address(addresses, address) unless address.nil?\n end\n end\n [success, addresses]\n end",
"def get_contrac... | [
"0.73342156",
"0.6139034",
"0.6009499",
"0.5953351",
"0.590231",
"0.57831436",
"0.5773047",
"0.5744745",
"0.5705205",
"0.5700011",
"0.56882113",
"0.5545608",
"0.5545509",
"0.5526167",
"0.5511673",
"0.5460535",
"0.54573846",
"0.5425588",
"0.54134387",
"0.5359847",
"0.5309535",... | 0.6599183 | 1 |
def twitter_url_exists? return false if twitter == "" || twitter == nil return true end | def facebook_url_exists?
return false if facebook == "" || twitter == nil
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def twitter?\n false\n end",
"def twitter?; twitter.to_s != \"\" end",
"def twitter_profile?\n @network = current_user.network ||= Network.new\n !(@network.twitter.nil? || @network.twitter.blank?)\n end",
"def twitter?\n self.twitter_token && self.twitter_secret\n end",
"def twitter?\n se... | [
"0.8026088",
"0.79164547",
"0.75957566",
"0.7543868",
"0.736628",
"0.73557776",
"0.73441595",
"0.7219426",
"0.71831214",
"0.71710753",
"0.71428806",
"0.70775014",
"0.69464326",
"0.69257295",
"0.68999577",
"0.6872689",
"0.6865414",
"0.6845968",
"0.68290126",
"0.68053347",
"0.6... | 0.9134085 | 0 |
VALIDATE/CREATE CountryName for city as when artist is created/updated | def ensure_CountryName
if self.CountryName == ""
self.CountryName = "United States"
end
if ["AB", "BC", "MB", "NB"].include?(self.State)
self.CountryName = "Canada"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_quick_city_name(hash,name)\n corrected_name = name.strip.titleize\n if[\n \"Houston\",\n \"Katy\",\n \"Spring\",\n \"Austin\",\n \"Sugar Land\",\n \"Blanco\",\n \"Portland\",\n \"Brenham\",\n \"Conroe\",\n \"Meadows Place\",\n \"League Cit... | [
"0.64925826",
"0.6492329",
"0.6460233",
"0.6402264",
"0.62617785",
"0.6249138",
"0.6213983",
"0.61953133",
"0.6180432",
"0.6175494",
"0.6132899",
"0.6120531",
"0.6089509",
"0.60081226",
"0.59451073",
"0.5918122",
"0.5918122",
"0.5918122",
"0.5895548",
"0.5880662",
"0.58754593... | 0.6672219 | 1 |
Branches this environment and puts some additional explicit definitions. This method is provided for (with ...) expressions and should not be overriden by subclasses. | def branch(defs)
Explicit.new(defs, self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_environment (initial_vars=nil)\n\n @environment_id = @fei.dup\n @environment_id.expression_name = EN_ENVIRONMENT\n\n parent_fei = nil\n parent = nil\n\n parent, _fei = get_expression_pool.fetch(@parent_id) \\\n if @parent_id\n\n parent_fei = parent.environment_id if par... | [
"0.52933764",
"0.5286487",
"0.528187",
"0.51998067",
"0.51785547",
"0.5163257",
"0.5163257",
"0.5088034",
"0.5083556",
"0.4988153",
"0.49532187",
"0.49175993",
"0.49129614",
"0.49030185",
"0.48869172",
"0.4878474",
"0.48570415",
"0.48296884",
"0.48217487",
"0.4812493",
"0.480... | 0.55452096 | 0 |
update the state of this object, and then delegate to the update on the wrapped object if that is a necessary part of the contract. NOTE: Most of the time, you want to read the state transition callbacks and ignore the complexity of this method. | def update(*args) # args only necessary for delegation
load_wrapped_object() # => @wrapped_object
# delegate to wrapped object if :update is part of the contract
if !@wrapped_object.nil? and @contract.include? :update
# TODO: maybe memoize the invariant? could get bad if @contact is long
protect_runt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @state_lock.synchronize do\n @state = yield @state\n end\n end",
"def update_state\n raise \"Nothing to do\"\n end",
"def perform_state_update\n return unless state_changed?\n\n return if @ignore_state_changes\n\n case state_change\n when %w(mill_build buyer_unc... | [
"0.6230203",
"0.6148862",
"0.6096569",
"0.5843052",
"0.5705288",
"0.5662664",
"0.5637792",
"0.5616954",
"0.5577694",
"0.5562994",
"0.55574477",
"0.55291516",
"0.5527059",
"0.55223966",
"0.55134934",
"0.55049336",
"0.55049336",
"0.55049336",
"0.55049336",
"0.55049336",
"0.5504... | 0.6467465 | 0 |
Replace running Snippet classes with updated versions (binds should always happen before loads) NOTE: Reload should NOT be implemented with a combination of load / unload. (1) you need different debug information. (2) reloading involves transplanting data from the old instance, to the new one. | def reload(obj)
# (each time a Snippet is reloaded, the class ID will change)
# NOTE: Sometimes this replaces working code with broken code.
# That's fine. Always want what's current, even if it's broken.
# ASSUME: Only one class definition per file.
# ^ This check is enforced above, after loading... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload!\n unload!\n versions\n get_json\n get_map\n last_updated\n third_party_links\n mappings\n end",
"def reload!\n new_instance = instance(_id)\n update_instance_variables!(\n :public_addresses => new_instance.public_addresses,\n :private_addresses => new_ins... | [
"0.6332332",
"0.62747407",
"0.6272521",
"0.6272521",
"0.6235362",
"0.6235362",
"0.6232977",
"0.6226022",
"0.62136847",
"0.62136847",
"0.620844",
"0.6189222",
"0.6161927",
"0.6157085",
"0.6146739",
"0.61433035",
"0.60363024",
"0.6024652",
"0.5990847",
"0.5990847",
"0.5990847",... | 0.7416939 | 0 |
Get current currency (for use in event cond. branch) | def get_current_currency
$game_party.current_currency[:sym]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def curr\n Currency.where('client_id = ? and default_currency = ?', current_user.client_id, \"t\").first.try(:currency_symbol)\n end",
"def current_currency(checkout_obj)\n symbol = ExchangeRateService.currency_symbol_mappings[checkout_obj.currency.downcase.to_sym]\n { code: checkout_obj.currency, sy... | [
"0.7785002",
"0.7755168",
"0.77353585",
"0.7626988",
"0.76184523",
"0.75700045",
"0.74717844",
"0.74617755",
"0.7388218",
"0.7387024",
"0.7383762",
"0.7307661",
"0.7307138",
"0.7307138",
"0.7289657",
"0.728093",
"0.7278962",
"0.7278962",
"0.72668135",
"0.7235496",
"0.721979",... | 0.8154682 | 0 |
Overwrite Method; Draw Total Price | def draw_total_price
width = contents_width - 8
draw_currency_value(@price * @number, @currency_unit, 4, price_y, width, @currency)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_price\n puts \"O PRECO TOTAL DE ORDER FOI CHAMADO\"\n self.line_items.to_a.sum{ |item| item.total_price}\n end",
"def sub_total_price\n line_items.inject(0) {|sum, item| sum += item.price * item.qty }\n end",
"def total_price\n self.line_items.each.sum {|li| li.total_price}\n end... | [
"0.7498781",
"0.7433152",
"0.740586",
"0.73571366",
"0.73524135",
"0.7317448",
"0.7297184",
"0.72935206",
"0.72562724",
"0.7255841",
"0.7200599",
"0.7200599",
"0.7200599",
"0.7200599",
"0.71997726",
"0.7189589",
"0.7145178",
"0.7131362",
"0.71303993",
"0.71294355",
"0.7116583... | 0.864281 | 0 |
Resets left or right generator based on internal state. | def reset_main_generator
@main_generator =
if @right_generator.length > @left_generator.length
@right_generator
else
@left_generator
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @left_generator.reset\n @right_generator.reset\n\n nil\n end",
"def reset\n\t\tself.rs \t= 0\n\t\tself.ps \t= 0\n\t\tself.ss \t= 0\n\t\tself.gen\t= Random.new(SEED)\n\tend",
"def reset()\n @rand_count = 0\n @sideup = nil\n end",
"def reset\n\t\tself.gen ... | [
"0.8471291",
"0.68176115",
"0.66692066",
"0.6434911",
"0.6434911",
"0.6430289",
"0.63532746",
"0.63394326",
"0.6302699",
"0.62748617",
"0.6183007",
"0.6127471",
"0.6112817",
"0.61115694",
"0.6096389",
"0.6049628",
"0.6047095",
"0.6025806",
"0.6020039",
"0.60028344",
"0.597796... | 0.770566 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.