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 |
|---|---|---|---|---|---|---|
Get all the entries from the database belonging to a column | def get_column_entries(column)
jso = Hash.new()
jss = self.get_structure()
db_column = nil
# Is the column recognized?
if jss.has_key? column then
db_column = jss[column].split("/")[1]
else
return MIDB::Interface::Server.json_error(400, "Bad Request")... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def where(column_name, value)\n table_name = self.to_s.pluralize.underscore\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE #{column_name} = ?;\", value)\n results_as_objects = []\n results.each do |results_hash|\n results_as_objects << self.new(results_hash)\n end\n \n ... | [
"0.6837136",
"0.6648131",
"0.64641756",
"0.6453655",
"0.6434043",
"0.63484013",
"0.63450646",
"0.62969416",
"0.62904996",
"0.62754846",
"0.6260379",
"0.61874753",
"0.61760336",
"0.6173172",
"0.61495435",
"0.61458874",
"0.61406565",
"0.6120886",
"0.61172056",
"0.6114335",
"0.6... | 0.68941635 | 0 |
The TRN segment is used to uniquely identify a claim payment and advice. | def reassociation_trace
trn_elements = ['TRN', '1', ref_number]
if @check_amount.to_f > 0 && @check.payment_method == "EFT"
trn_elements << '1' + @facility.facility_tin if @facility.facility_tin.present?
else
trn_elements << '1999999999'
end
trn_elements.join(@element_seperator)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reassociation_trace\n simple_client_array_for_1000000009 = [\"NAVICURE\", \"ASCEND CLINICAL LLC\"]\n trn_elements = ['TRN', '1', ref_number]\n if simple_client_array_for_1000000009.include? (@client_name)\n trn_elements << '1000000009'\n elsif @check_amount.to_f > 0 && @check.payment_method ==... | [
"0.53945345",
"0.5211734",
"0.5185856",
"0.51497644",
"0.5107368",
"0.5098984",
"0.4833837",
"0.48334157",
"0.48223868",
"0.48030886",
"0.47886717",
"0.47705758",
"0.475236",
"0.47472116",
"0.4729691",
"0.47189945",
"0.46477008",
"0.4630088",
"0.46125108",
"0.46125108",
"0.46... | 0.5293861 | 1 |
Loses money from stack | def pay(amount)
throw new Exception unless @stack >= amount
@stack -= amount
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lose!\n\t\t@bet = 0\n\tend",
"def place_bet(amount)\n @total_money -= amount\n end",
"def debitCoins(amount)\r\n @betESSCoins -= amount\r\n end",
"def lose(val)\n\t\t@wallet.add(-1 * val)\n\tend",
"def do_sell(number)\r\r\n $game_party.gain_currency(@gold_window.currency, number * se... | [
"0.71440095",
"0.6684222",
"0.66300845",
"0.66140884",
"0.6580884",
"0.65648127",
"0.6549398",
"0.6508613",
"0.65064883",
"0.649259",
"0.6482159",
"0.64208215",
"0.6387511",
"0.63650084",
"0.63618016",
"0.635441",
"0.6344504",
"0.6343606",
"0.63292456",
"0.63235754",
"0.63102... | 0.67228115 | 1 |
Lookup does a best effort attempt at finding the intended klass based on what the frontend sent in. For example, ember might pass in a task model that is not a toplevel model, but instead belongs inside the TahiStandardTasks namespace, so we need to find it. Right now we assume if we cannot find it then limit the scope... | def lookup_task_klass(klass_name)
if Object.const_defined?(klass_name)
klass_name.constantize
else
Task.descendants.find do |descendant|
descendant.name.demodulize == klass_name
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_find(task_class)\n tasks_active.to_a.find { |t| t.is_a?(task_class) }\n end",
"def find_task_type\n TaskType.find_by_id(params[:task_type_id])\n end",
"def find_finder_class_for record #:nodoc: \n class_hierarchy = [record.class]\n\n while class_hierarchy.last !=... | [
"0.6339758",
"0.6219697",
"0.60574824",
"0.6056576",
"0.6002164",
"0.5981532",
"0.59491843",
"0.59221274",
"0.5910793",
"0.5852683",
"0.5846471",
"0.58461225",
"0.5815392",
"0.57983106",
"0.5795969",
"0.5795787",
"0.57706434",
"0.57369703",
"0.5736042",
"0.5728786",
"0.572437... | 0.7391371 | 0 |
Checks whether DB 'ProjectRazor' is selected in MongoDB | def is_db_selected?
logger.debug "Is ProjectRazor DB selected?(#{(@razor_database != nil and @connection.active?)})"
(@razor_database != nil and @connection.active?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def database?\n\t\t\tif !(framework.db and framework.db.usable)\n\t\t\t\treturn false\n\t\t\telse\n\t\t\t\treturn true\n\t\t\tend\n\t\tend",
"def project?\n true\n end",
"def check_db?\n @check_db == true\n end",
"def query?\n object.nil? || !object.first.is_a?(Mongoid::Document)\n... | [
"0.5933574",
"0.5901851",
"0.588293",
"0.5865342",
"0.58373785",
"0.57790256",
"0.5778303",
"0.57487386",
"0.57430154",
"0.5736347",
"0.571983",
"0.566974",
"0.566974",
"0.56583357",
"0.5651724",
"0.565124",
"0.5647784",
"0.5607476",
"0.5597811",
"0.5584752",
"0.5580622",
"... | 0.7529019 | 0 |
From [Array] of documents return [Array] containing newest/unique documents this also takes all older/duplicate documents and calls [cleanup_old_documents] to remove them | def object_doc_get_all(collection_name)
logger.debug "Get all documents from collection (#{collection_name})"
unique_object_doc_array = [] # [Array] to hold new/unique docs
old_object_doc_array = [] # [Array] to hold old/duplicate docs
# Get all docs from 'collection_name' Collection ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup_old_docs(old_object_doc_array, collection_name)\n logger.debug \"Clean up old documents\"\n # iterate over each old doc\n old_object_doc_array.each do\n |old_object_doc|\n # Remove it from MongoDB by referencing '_id' key\n collection_by_name(collection_nam... | [
"0.7080236",
"0.6816776",
"0.675539",
"0.6494443",
"0.6240138",
"0.60803324",
"0.60678214",
"0.6010169",
"0.5887005",
"0.5880239",
"0.5819226",
"0.5759611",
"0.57595855",
"0.563553",
"0.5625498",
"0.55450845",
"0.55449796",
"0.5527461",
"0.5487549",
"0.5471009",
"0.5468836",
... | 0.69273037 | 1 |
Removes all documents from collection: 'collection_name' with 'uuid' in 'object_doc'' | def object_doc_remove(object_doc, collection_name)
logger.debug "Remove document in collection (#{collection_name}) with uuid (#{object_doc['@uuid']})"
while collection_by_name(collection_name).find({"@uuid" => object_doc["@uuid"]}).count > 0
unless collection_by_name(collection_name).remove({... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup_old_docs(old_object_doc_array, collection_name)\n logger.debug \"Clean up old documents\"\n # iterate over each old doc\n old_object_doc_array.each do\n |old_object_doc|\n # Remove it from MongoDB by referencing '_id' key\n collection_by_name(collection_nam... | [
"0.75898474",
"0.722222",
"0.722222",
"0.7123795",
"0.68629724",
"0.67480993",
"0.6707811",
"0.66721374",
"0.6657365",
"0.66310394",
"0.65970445",
"0.6533824",
"0.65300035",
"0.6505743",
"0.64894193",
"0.6476657",
"0.64723784",
"0.6463704",
"0.64584255",
"0.6419516",
"0.64122... | 0.773122 | 0 |
Mongo internal stuff we don't want exposed' Gets the current version number and returns an incremented value, or returns '1' if none exists | def get_next_version(object_doc, collection_name)
logger.debug "Get next version number for document in collection (#{collection_name}) with uuid (#{object_doc['@uuid']})"
object_array =collection_by_name(collection_name).find("@uuid" => object_doc["@uuid"]).sort("@version",-1).to_a
if (object_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_number\n if self.unversioned?\n 0\n else\n self.versions.current.number\n end\n end",
"def next_version\n (new_record? ? 0 : versions.calculate(:maximum, version_column).to_i) + 1\n end",
"def version\n return last_ver... | [
"0.7301055",
"0.7279449",
"0.7256261",
"0.704011",
"0.70314837",
"0.70182186",
"0.70030046",
"0.6997194",
"0.6948827",
"0.693921",
"0.69291425",
"0.6919907",
"0.6859796",
"0.68102074",
"0.6792178",
"0.67684203",
"0.6765146",
"0.6710591",
"0.67050046",
"0.6696542",
"0.666543",... | 0.7506806 | 0 |
Takes [Array] of docs and removes MongoDB specific keys | def remove_mongo_keys(object_doc_array)
logger.debug "Strip MongoDB keys from document"
object_doc_array.each do
|object_doc|
# remove the doc "_id" key as it won't match an instance variable
object_doc.delete("_id")
# remove timestamp also
object_doc.dele... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup_old_docs(old_object_doc_array, collection_name)\n logger.debug \"Clean up old documents\"\n # iterate over each old doc\n old_object_doc_array.each do\n |old_object_doc|\n # Remove it from MongoDB by referencing '_id' key\n collection_by_name(collection_nam... | [
"0.7168284",
"0.6947019",
"0.66109985",
"0.65451926",
"0.651479",
"0.64696324",
"0.63506085",
"0.63506085",
"0.6331747",
"0.633126",
"0.6312104",
"0.630877",
"0.6301587",
"0.6247922",
"0.62317675",
"0.6206433",
"0.6186759",
"0.61543304",
"0.6120764",
"0.610757",
"0.6097855",
... | 0.81943053 | 0 |
Takes an [Array] of docs and removes each from collection: 'collection_name' | def cleanup_old_docs(old_object_doc_array, collection_name)
logger.debug "Clean up old documents"
# iterate over each old doc
old_object_doc_array.each do
|old_object_doc|
# Remove it from MongoDB by referencing '_id' key
collection_by_name(collection_name).remove({"_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_collection(db, coll_name)\n if db.collection('__METADATA__').find_one('_id' => coll_name) == nil\n raise \"collection does not exist\"\n end\n\n db.collection(coll_name).drop\n db.collection_names.keep_if {|c| c.start_with? coll_name+'__'}.each {|related_collec... | [
"0.73917973",
"0.7227846",
"0.71953356",
"0.70531476",
"0.68874645",
"0.6821122",
"0.6714883",
"0.6696359",
"0.6690822",
"0.6678693",
"0.6629098",
"0.6587565",
"0.6584148",
"0.65824944",
"0.6570307",
"0.65302783",
"0.65266466",
"0.65193576",
"0.65171075",
"0.6502638",
"0.6485... | 0.79480636 | 0 |
Indicates whether to use chunked encoding based on presence of the "TransferEncoding: chunked" header or the :ignore_chunked_encoding opts parameter. | def do_chunked_encoding?(hdrs=@headers)
( (not @opts[:ignore_chunked_encoding]) and
(hdrs.get_header_value("Transfer-Encoding").to_s =~ /(?:^|\W)chunked(?:\W|$)/) )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunked_encoding?\n /chunked/i === self[HttpClient::TRANSFER_ENCODING]\n end",
"def chunked?(encoding)\n return false unless encoding\n (/(?:\\A|[^\\-\\w])chunked(?![\\-\\w])/i =~ encoding) ? true : false\n end",
"def chunked?; end",
"def check_accept_encoding\n if accept = ... | [
"0.75176466",
"0.70452946",
"0.61684304",
"0.5912702",
"0.5762712",
"0.5705792",
"0.5608427",
"0.5464056",
"0.5422725",
"0.5386708",
"0.53853494",
"0.53853494",
"0.5382348",
"0.5345167",
"0.5326639",
"0.52597195",
"0.5238508",
"0.5238508",
"0.52357084",
"0.51916605",
"0.51895... | 0.80888605 | 0 |
Returns a new BoundBody object. This is the default object which will be used when composing fresh Response body entities. | def default_body_obj(*args)
BoundBody.new(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_body_obj(*args)\n Body.new(*args)\n end",
"def body(new = nil)\n if new.nil?\n @body\n else\n with(body: body.merge(new))\n end\n end",
"def default_body_of_nearest_route\n\t\t\t\t## Return nil if must be no body for current HTTP status\n\t\t\t\tr... | [
"0.711464",
"0.6795403",
"0.6039114",
"0.5972691",
"0.5931629",
"0.5838928",
"0.5823366",
"0.5791282",
"0.575748",
"0.57165843",
"0.5658497",
"0.5631684",
"0.5600855",
"0.5600855",
"0.55571645",
"0.5520302",
"0.55060035",
"0.5502474",
"0.5471781",
"0.54561764",
"0.5432733",
... | 0.8085905 | 0 |
ids_to_s([[1,2],[7,3]]) > "(1,2),(7,3)" ids_to_s([[1,2],[7,3]], ',', ';') > "1,2;7,3" | def ids_to_s(many_ids, id_sep = CompositePrimaryKeys::ID_SEP, list_sep = ',', left_bracket = '(', right_bracket = ')')
many_ids.map {|ids| "#{left_bracket}#{CompositePrimaryKeys::CompositeKeys.new(ids)}#{right_bracket}"}.join(list_sep)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ids_to_s(many_ids, id_sep = CompositePrimaryKeys::ID_SEP, list_sep = ',', left_bracket = '(', right_bracket = ')')\r\n many_ids.map {|ids| \"#{left_bracket}#{ids}#{right_bracket}\"}.join(list_sep)\r\n end",
"def get_ids(array)\n ids = \"(\"\n array.each do |me|\n ids << me.id.to_s ... | [
"0.82178617",
"0.70565426",
"0.684667",
"0.65009034",
"0.64812636",
"0.647975",
"0.64389426",
"0.6426761",
"0.6395012",
"0.6355201",
"0.6328285",
"0.63154346",
"0.6254718",
"0.61979717",
"0.6175294",
"0.61608875",
"0.61103535",
"0.601788",
"0.5972249",
"0.5972249",
"0.5899253... | 0.78169096 | 1 |
Computes the path to a stylesheet asset in the public stylesheets directory. If the +source+ filename has no extension, .css will be appended (except for explicit URIs). Full paths from the document root will be passed through. Used internally by +stylesheet_link_tag+ to build the stylesheet path. stylesheet_path "styl... | def stylesheet_path(source)
asset_paths.compute_public_path(source, 'stylesheets', :ext => 'css', :protocol => :request)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stylesheet_path(source)\n compute_public_path(source, 'stylesheets', 'css')\n end",
"def stylesheet_path(source, options = {})\n asset_path source, { :dir => 'stylesheets', :ext => 'css' }.merge(options)\n end",
"def stylesheet_path(source, options={})\n path = compute_public_pat... | [
"0.8342827",
"0.8297269",
"0.8251219",
"0.81497955",
"0.81424844",
"0.8142228",
"0.7726261",
"0.75963694",
"0.74472827",
"0.74052584",
"0.7349195",
"0.71253765",
"0.7119212",
"0.7065518",
"0.70362675",
"0.69312054",
"0.68938076",
"0.6819997",
"0.6811345",
"0.677111",
"0.67070... | 0.8473698 | 0 |
GET api/events/expired GET api/events/expired/:count | def list_expired
if params[:count] && params[:count].to_i
render status: 200,
json: Event.where('end_date < ? AND archived = ?', Time.now, false).order('start_date desc').limit(params[:count].to_i).as_json(include: { event_type: {}, briefing:{ include: { starting_system: {}, ending_system: {}, operation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n number = request.query_parameters.first[1].to_i\n respond_with Event.where(date_time: Date.current..(Date.current + number.days))\n end",
"def index \n @requests = Request.get_unexpired_requests\n end",
"def getEventsByMounthWithCountAndTag\n count = params[:count].to_i > 0 ?... | [
"0.64698803",
"0.6325127",
"0.58503026",
"0.5794972",
"0.56994176",
"0.5670414",
"0.5638703",
"0.56179947",
"0.56078196",
"0.55663913",
"0.55416286",
"0.55117595",
"0.547948",
"0.54268175",
"0.54169095",
"0.54112905",
"0.54091823",
"0.5398759",
"0.53939927",
"0.5366867",
"0.5... | 0.779481 | 0 |
POST api/events/publish Body should include event_id: number | def publish
@event = Event.find_by_id(params[:event_id].to_i)
if @event != nil && !@event.archived
if !@event.published
@event.published = true
@event.published_date = Time.now
if @event.save
# send push notifications
# send_push_notification_to_members("New Eve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish(event, payload = {})\n exchange.publish(MultiJson.dump(payload), routing_key: event, content_type: 'application/json')\n end",
"def publish(event, payload)\n end",
"def publish_new_blog_event(id:, title:, url:)\n if $eventbridge_client.nil?\n $eventbridge_client = Aws::EventBridge:... | [
"0.7306802",
"0.6797517",
"0.6774349",
"0.6758178",
"0.6688228",
"0.666635",
"0.6665024",
"0.6652343",
"0.6590815",
"0.65731317",
"0.6560695",
"0.6533152",
"0.6474425",
"0.64631414",
"0.643556",
"0.641035",
"0.6403936",
"0.6396179",
"0.6360477",
"0.6290278",
"0.62868685",
"... | 0.7372684 | 0 |
POST api/events/award Body should contain event_id, award_id | def event_award
@event_award = EventAward.where('award_id = ? AND event_id = ?', params[:award_id].to_i, params[:event_id].to_i)
if @event_award != nil
if @event_award.destroy_all
render status: 200, json: { message: 'Event award removed.' }
else
render status: 500, json: { message: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def award_params\n if request.format == 'application/json'\n params.permit(:name, :description, :date, :user_id)\n else\n params.require(:award).permit(:name, :description, :date, :user_id)\n end\n end",
"def create\n @earned_award = EarnedAward.new(params[:earned_award])\n\n ... | [
"0.683485",
"0.6765275",
"0.6658825",
"0.6546462",
"0.648273",
"0.648273",
"0.6438138",
"0.64319813",
"0.63489866",
"0.62001276",
"0.6190255",
"0.61800265",
"0.614869",
"0.6107383",
"0.6107383",
"0.6098969",
"0.6041905",
"0.60375357",
"0.60056543",
"0.6000804",
"0.5951294",
... | 0.76022357 | 0 |
PATCH api/events/briefing Body should contain event_id and briefing object | def event_briefing_update
@briefing = EventBriefing.find_by_id(params[:briefing][:id])
if !@briefing.event.published && true?(params[:briefing][:published])
@briefing.published_when = Time.now
end
if @briefing != nil && !@briefing.event.submitted_for_certification
if @briefing.update(event_b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_debriefing_update\n @debriefing = EventDebriefing.find_by_id(params[:event_id])\n if @debriefing != nil && !@debriefing.event.submitted_for_certification\n if @debriefing.event.is_expired\n if @debriefing.update(event_debriefing_params)\n render status: 200, json: @debriefing\n... | [
"0.6424682",
"0.6118105",
"0.6000918",
"0.5965024",
"0.5905584",
"0.58799005",
"0.58752406",
"0.58673614",
"0.58165854",
"0.58052033",
"0.5797483",
"0.5790339",
"0.5769109",
"0.5761618",
"0.5748086",
"0.5745775",
"0.5745775",
"0.5745181",
"0.57419544",
"0.57396597",
"0.573553... | 0.7698033 | 0 |
PATCH api/events/debriefing Body should contain event_id and debriefing object | def event_debriefing_update
@debriefing = EventDebriefing.find_by_id(params[:event_id])
if @debriefing != nil && !@debriefing.event.submitted_for_certification
if @debriefing.event.is_expired
if @debriefing.update(event_debriefing_params)
render status: 200, json: @debriefing
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.6242343",
"0.60734427",
"0.600282",
"0.5960043",
"0.59167826",
"0.5890764",
"0.58281106",
"0.5825883",
"0.58143324",
"0.57809556",
"0.5779232",
"0.5771253",
"0.5746275",
"0.5739361",
"0.5737012",
"0.5701206",
"0.5701206",
"0.5664927",
"0.56628984",
"0.56569666",
"0.5653384... | 0.70372796 | 0 |
POST api/events/attend Allows an individual user to set their attendence Body should contain event_id and attendence_type_id (1=Attending,2=Not Attending,3=No Response) | def set_attendence
@event = Event.find_by id: params[:event_id].to_i
# Look if the event exists and if it has already been submitted_for_certification
if @event != nil && !@event.submitted_for_certification
if !@event.is_expired
# Look and see if the attendence already exists if so we are just... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attend\n\n @event = Event.find(params[:id])\n if attending?\n @text = \"unattended\"\n else\n @attendee =@event.attendees.create(user_id: current_user.id)\n @text = \"attending\"\n end\n redirect_to event_path(@event)\n end",
"def attend_params... | [
"0.7802619",
"0.74374354",
"0.72685665",
"0.7266117",
"0.72209877",
"0.71878827",
"0.70243275",
"0.700917",
"0.6951501",
"0.68234545",
"0.68083453",
"0.6717326",
"0.66036546",
"0.65865517",
"0.65858704",
"0.6578884",
"0.6555469",
"0.654692",
"0.6537514",
"0.6524597",
"0.65180... | 0.7526582 | 1 |
POST api/events/attend/auto :event_id, :discord_user_ids [string] | def set_auto_attendance
@event = Event.find_by_id(params[:event_id].to_i)
if @event
current_auto_attenders = EventAutoAttendance.where("event_id = ?", params[:event_id]).map(&:user_id) if params[:discord_user_ids].count > 0
# iterate through each user
params[:discord_user_ids].each do |discord... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_attendees!(required, optional = [], resources = [])\n add_attendees(required, optional, resources)\n save!\n end",
"def create\n @users = User.all\n\n @event = current_user.events.build(event_params.except(:invites))\n\n respond_to do |format|\n if @event.save\n\n ... | [
"0.61945736",
"0.6177218",
"0.6110681",
"0.6101142",
"0.60227156",
"0.59763294",
"0.59165615",
"0.58245224",
"0.58236253",
"0.5814148",
"0.5658907",
"0.5637197",
"0.56132185",
"0.561159",
"0.5535124",
"0.551942",
"0.5508638",
"0.5483488",
"0.5468312",
"0.54466254",
"0.5392146... | 0.7357546 | 0 |
GET api/events/:event_id/certify This creates negative attendence objects for all members who did not already create an attendence for the event Body should contain event_id | def certify_event_attendence
@event = Event.find_by_id(params[:event_id].to_i)
if @event != nil && !@event.submitted_for_certification
if @event.is_expired
# the auto attendance array
auto_attendance = []
# populate auto attendance array and mark auto attendances as processed
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def certify_event_attendence_post\n #create approval if create approval selected\n @event = Event.find_by_id(params[:event_id])\n if @event != nil && !@event.submitted_for_certification && !@event.certified && @event.event_certification_request == nil\n # check to make sure debriefing is submitted\n ... | [
"0.6999247",
"0.6369793",
"0.6167895",
"0.59563494",
"0.5853313",
"0.5753485",
"0.5688818",
"0.5666772",
"0.56566447",
"0.5630627",
"0.5596147",
"0.559383",
"0.5591872",
"0.55873084",
"0.55734557",
"0.5563775",
"0.554036",
"0.55160624",
"0.54980105",
"0.54799694",
"0.5444797"... | 0.6880646 | 1 |
POST api/events/:event_id/certify This will initiate the creation of the ECR and close the event Body should contain event_id | def certify_event_attendence_post
#create approval if create approval selected
@event = Event.find_by_id(params[:event_id])
if @event != nil && !@event.submitted_for_certification && !@event.certified && @event.event_certification_request == nil
# check to make sure debriefing is submitted
# TOD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event(event_object)\n\n response = nil\n\n if event_object['parent_event_id']\n # new section in existing event\n\n\n # we need to get the existing data to populate child events\n # lest it delete existing ones when we try to add one!\n request = Net::HTTP::Get.new(... | [
"0.5956896",
"0.58469677",
"0.5816374",
"0.57631",
"0.568978",
"0.5679659",
"0.5660287",
"0.56531584",
"0.56435716",
"0.5635777",
"0.5630251",
"0.562967",
"0.56100994",
"0.559578",
"0.55765015",
"0.5571838",
"0.5569473",
"0.5562399",
"0.55580825",
"0.5519761",
"0.55014586",
... | 0.711882 | 0 |
DELETE /riders/1 DELETE /riders/1.json | def destroy
@rider = Rider.find(params[:id])
@rider.destroy
respond_to do |format|
format.html { redirect_to riders_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n @renter = Renter.find(params[:id])\n @renter.destroy\n\n respond_to do |format|\n format.html { redirect_to renters_url }\n format.json { head :no_content }\n end\n e... | [
"0.7045248",
"0.70193756",
"0.6946694",
"0.69353926",
"0.6879322",
"0.6749363",
"0.6718903",
"0.6688946",
"0.6682761",
"0.66538554",
"0.66515297",
"0.6614401",
"0.6591022",
"0.6559145",
"0.65527046",
"0.6550191",
"0.65187854",
"0.64594775",
"0.6456412",
"0.6438083",
"0.642220... | 0.70730406 | 0 |
dates_dir: path della dir che contiene le cartelle con le date date_dir: ev. nome della cartella con la data desiderata | def initialize(dates_dir)
@dates_dir = dates_dir
@list_dir = File.join(dates_dir, Date.today.strftime("%Y-%m-%d"))
puts @list_dir
FileUtils.mkdir_p(@list_dir) if !Dir.exist?(@list_dir)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_for_day(date)\n\t\tbegin\n\t\tfilename = filename_for_day(date)\n\t\tfilestring = File.read(\"#{@directory}/#{filename}\")\n\t\tCSV.parse(filestring, headers: true)\n\trescue Exception => e\n\t\tputs e\n\tend\n\tend",
"def dates_requiring_data\n collected = Dir.glob(File.join(@config[:data_dir], \"... | [
"0.69682324",
"0.68940246",
"0.6615404",
"0.61664605",
"0.5951622",
"0.5853371",
"0.5808751",
"0.56273025",
"0.5626459",
"0.549417",
"0.5448597",
"0.5433412",
"0.54258555",
"0.5416558",
"0.53904676",
"0.53133416",
"0.53056157",
"0.5300025",
"0.52847224",
"0.5249961",
"0.52433... | 0.7140239 | 0 |
Returns io options to forward to other commands | def io_options
options.select { |k, _| [:append_output, :stdout].include? k }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_options(opts)\n opts[:read] ? opts : opts.merge(:read => @read)\n end",
"def options() end",
"def options; @opts end",
"def common_options(opts)\n opts.separator ''\n opts.separator 'Other options:'\n opts.on('--[no-]color', 'Run without color') do |v|\n ... | [
"0.6632595",
"0.58851755",
"0.5778717",
"0.5770725",
"0.57610303",
"0.5667356",
"0.5599942",
"0.55997866",
"0.55551505",
"0.55535764",
"0.5550036",
"0.5550036",
"0.54453623",
"0.54453623",
"0.54453623",
"0.54453623",
"0.54453623",
"0.54453623",
"0.54453623",
"0.54453623",
"0.... | 0.72581017 | 0 |
rbenv was not working properly when the process is spawned. Because the PATH is already set to work with the current ruby, we need to remove the ruby related PATH segments. This is taken from | def new_path_var(env)
rbenv_root = exec_rbenv_root
return env['PATH'] if rbenv_root.empty?
re = /^#{Regexp.escape rbenv_root}\/(versions|plugins|libexec)\b/
paths = env['PATH'].split(':')
paths.reject! { |p| p =~ re }
paths.join(':')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rbenv_ruby\n `rbenv version`.split(' ').first\n end",
"def set_initial_path\n `echo $PATH`.split(':').each do |path|\n add_env_path path\n end\nend",
"def execute(*args)\n self.class.with_clean_rbenv_environment do\n super\n end\n end",
"def rbenv_exec(command, fail_on_error = tr... | [
"0.6742236",
"0.6572566",
"0.63948077",
"0.63590974",
"0.6144684",
"0.6104221",
"0.60943276",
"0.6074728",
"0.602966",
"0.59518737",
"0.5936495",
"0.59194565",
"0.5892427",
"0.57990634",
"0.5768259",
"0.57643896",
"0.5762291",
"0.5739298",
"0.57192266",
"0.5710466",
"0.569245... | 0.714339 | 0 |
letters that appear more than once in the string. You may assume the string contains only lowercase letters. Count the number of letters that repeat, not the number of times they repeat in the string. Difficulty: hard. | def num_repeats(string)
string = string.gsub(" ", "")
# Get rid of spaces. Also if this contained numbers, symbols, etc would need to delete those too or they will be counted
letters = string.split("")
holder = []
i = 0
count = 0
while i < letters.length
j = i+1
while j < letters.length
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_repeats(string)\n i = 0 \n count = 0\n check = nil\n \n while i < string.length\n letter = string[i]\n i2 = 1 \n while i2 < string.length\n letter2 = string[i2]\n \n if i < i2\n if letter == letter2\n if ... | [
"0.84531283",
"0.84297675",
"0.84023654",
"0.83465415",
"0.8333091",
"0.83200204",
"0.83043253",
"0.8255977",
"0.824344",
"0.817744",
"0.8172908",
"0.81656456",
"0.8147799",
"0.81424713",
"0.8122256",
"0.811135",
"0.8094444",
"0.8070214",
"0.80578816",
"0.80518025",
"0.802758... | 0.8450865 | 1 |
N.B.: important difference between advertisers / segmentss this week/month advertisers shows you advertisers (page names) we FIRST saw this week/month this week/month segments/targets shows you segments/targets that we saw AT ALLL this week/month | def this_week_advertisers_first_seen
ads = Ad.where(lang: @lang)
render json: ads.unscope(:order).where("advertiser is not null").group("advertiser").having("min(created_at) > NOW() - interval '1 week'").order("count_all desc").count.map{|k, v| {advertiser: k, count: v} }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_dailydev_page\n start = Time.now\n items = @page.search('.ddinfo')\n if items.any?\n items.each do |item|\n desc = item.search('.foot').empty\n desc = item.inner_text.strip\n link_el = item.search('a').select { |item| /\\/deviation\\// === item.attributes['href'] }.firs... | [
"0.5784997",
"0.578353",
"0.5678592",
"0.55765396",
"0.547232",
"0.5469187",
"0.545942",
"0.545942",
"0.538684",
"0.53566086",
"0.53566086",
"0.5301078",
"0.5296229",
"0.5295235",
"0.52876836",
"0.528026",
"0.525312",
"0.5248987",
"0.5224266",
"0.5215951",
"0.52134913",
"0.... | 0.58023626 | 0 |
get top left coordinate and offset to map | def top_left
x_shift = 0
y_shift = 0
corner = Point.new(@offset.x + @width / 2, @offset.y + @height / 2)
# move left on the map until we have the starting coordinate and offset
while corner.x.positive?
corner.x -= tile_width
x_shift += 1
end
# move up on the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loc\r\n { x: @mapx,\r\n y: @mapy }\r\n end",
"def cal_pos\n x, y = map_location(@grid_x, @grid_y)\n x += @tile_size/2\n y += @tile_size/2\n [x,y]\n end",
"def get_map_pos(scr_x, scr_y)\n return Vector.new((scr_x + @cam.x) / @tile_size.x, (scr_y + @cam.... | [
"0.74497825",
"0.7048556",
"0.6970917",
"0.6737189",
"0.6574779",
"0.6550209",
"0.6483587",
"0.63742495",
"0.6347088",
"0.62937427",
"0.6269902",
"0.62409383",
"0.6234847",
"0.617933",
"0.6159692",
"0.6149478",
"0.6148983",
"0.6127727",
"0.6111087",
"0.6086431",
"0.6078587",
... | 0.76935375 | 0 |
create a canvas and draw tile images based on their offset onto it | def render
canvas = Vips::Image.grey(@width, @height)
@tiles.each do |tile|
canvas = canvas.insert(tile.image, tile.offset.x, tile.offset.y) # rubocop:disable Style/RedundantSelfAssignment
end
# add attribution image to bottom corner if available & attribution fits into image
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw size, x_offset=0, y_offset=0\n x_offset -= 320 * size / 2\n y_offset -= 250 * size / 2\n x_offset += 6 * size\n y_offset += 15 * size\n # draw background first\n 0.upto(WIDTH - 1) do |x|\n (HEIGHT - 1).downto(0) do |y|\n if @tiles[x + WIDTH * y] == :background\n # ch... | [
"0.7332542",
"0.6742624",
"0.66471",
"0.65437126",
"0.65398914",
"0.6513801",
"0.6471218",
"0.6469514",
"0.6331738",
"0.63035023",
"0.628924",
"0.6271151",
"0.62691617",
"0.62600553",
"0.62387586",
"0.6236524",
"0.6221976",
"0.6208356",
"0.6185993",
"0.61780876",
"0.6175766",... | 0.75716865 | 0 |
GET /recommands/new GET /recommands/new.xml | def new
respond_to do |format|
format.html { render :layout => 'application' }
format.xml { render :xml => @recommand }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @Roc = Roc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @Roc }\n end\n end",
"def new\n @remocao... | [
"0.63031554",
"0.6234343",
"0.6217477",
"0.6205597",
"0.6156205",
"0.60956794",
"0.60430604",
"0.5974119",
"0.596114",
"0.5950497",
"0.5931839",
"0.5920836",
"0.5913915",
"0.5909191",
"0.5904057",
"0.5902674",
"0.5894035",
"0.58920777",
"0.5884872",
"0.5884872",
"0.5884008",
... | 0.6447083 | 0 |
DELETE /recommands/1 DELETE /recommands/1.xml | def destroy
@recommand = Recommand.find(params[:id])
@recommand.destroy
respond_to do |format|
format.html { redirect_to(recommands_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 cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end",
"def delete(com... | [
"0.70126575",
"0.65639716",
"0.6463125",
"0.6426627",
"0.62927276",
"0.61829686",
"0.6066249",
"0.6002971",
"0.59850425",
"0.59790033",
"0.59561497",
"0.5955323",
"0.594556",
"0.5940829",
"0.5939015",
"0.59343576",
"0.59294844",
"0.58422863",
"0.58271676",
"0.58259594",
"0.58... | 0.7060527 | 0 |
redirecting to shoes C video methods | def show; @video.show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forwardvideo\n Pusher['photo-call'].trigger('next-video' , {\n control: \"1\"\n })\n render text: \"ok\"\n end",
"def startPlayback\n end",
"def playvideo\n if(params.has_key?(:id))\n id = params[:id]\n end\n Pusher['photo-call'].trigger('play-video' , {\n control: \"1\", vi... | [
"0.6855856",
"0.63786787",
"0.6313861",
"0.6187037",
"0.6106684",
"0.60868794",
"0.60868794",
"0.60684466",
"0.60516906",
"0.6021204",
"0.6014479",
"0.6014479",
"0.6014479",
"0.6014479",
"0.59683466",
"0.5955256",
"0.5954286",
"0.5948166",
"0.5934665",
"0.5883715",
"0.5874817... | 0.68154806 | 1 |
supports either a generic message handler with the class name "Message" or an endpointspecific handler for example, a generic OKL message is Inbound::MessageHandlers::OKL::Message, while a skuspecifc handler would be Inbound::MessageHandlers::OKL::Sku. | def build_handler(message)
handler_class = "#{Inbound::MessageHandlers}::#{@source.upcase}::#{@data_type.upcase}".safe_constantize ||
"#{Inbound::MessageHandlers}::#{@source.upcase}::Message".constantize
handler_class.new(message, @data_type)
rescue NameError => e
raise unles... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_messages(&handler)\n raise NotImplementedError\n end",
"def handler_base_class; end",
"def handle_message(message,sock)\n if message.nil? or !message.respond_to?(:type)\n Routing.log {|logger| logger.error(self.class) {\"Not a correct message: #{message.to_s}.\"}}\n... | [
"0.7003889",
"0.6389502",
"0.6160345",
"0.6080583",
"0.6051629",
"0.5934698",
"0.5862609",
"0.5828313",
"0.5817716",
"0.5808528",
"0.5732335",
"0.57187617",
"0.56743926",
"0.5652711",
"0.56195605",
"0.55949074",
"0.55484486",
"0.5472805",
"0.5460322",
"0.54504335",
"0.5448205... | 0.64429873 | 1 |
does initialization of worker stuff and invokes create method in user defined worker class | def worker_init
raise "Invalid worker name" if !worker_name
Thread.abort_on_exception = true
# stores the job key of currently running job
Thread.current[:job_key] = nil
initialize_logger
@thread_pool = ThreadPool.new(self,pool_size || 20,@logger)
t_worker_key = worker_option... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(worker)\n @worker = worker\n end",
"def initialize\n @worker = Fetcher::Worker.new\n end",
"def initialize\n @worker = Fetcher::Worker.new\n end",
"def initialize_worker\n nil\n end",
"def worker_factory(&block)\n end",
"def worker_initial_config\n\n end",
... | [
"0.7373245",
"0.7319089",
"0.7319089",
"0.71975046",
"0.69671196",
"0.66821986",
"0.6672648",
"0.6634741",
"0.651724",
"0.64976156",
"0.64480597",
"0.6409316",
"0.63990986",
"0.6393182",
"0.63917303",
"0.63743544",
"0.6334059",
"0.6312177",
"0.63051",
"0.63051",
"0.6283752",
... | 0.742881 | 0 |
Returns the persistent job queue check delay for this worker | def persistent_delay
get_config_value(:persistent_delay, 5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wfs_delay\n (datastore['WfsDelay'] || 0).to_i\n end",
"def queue_lock_timeout\n 3600\n end",
"def delay\n self['Delay'].to_i || 0\n end",
"def get_delay\n\t\t@call_times << Time.now\n\t\tif @call_times.size < 2 then\n\t\t\treturn 0\n\t\telse\n\t\t\t@call_times.shift while @cal... | [
"0.621312",
"0.61272615",
"0.6075493",
"0.60446167",
"0.60237616",
"0.5983212",
"0.5935753",
"0.5901081",
"0.5898624",
"0.58576566",
"0.58554876",
"0.57971984",
"0.5795657",
"0.57874155",
"0.5783573",
"0.5768276",
"0.57625514",
"0.576216",
"0.5759151",
"0.57312053",
"0.572130... | 0.7003725 | 0 |
Returns true if persistent jobs should be run for this worker. | def run_persistent_jobs?
!get_config_value(:persistent_disabled, false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persistent?\n true\n end",
"def persistent?\n\t\treturn true\n\tend",
"def persistent?\n\t\treturn true\n\tend",
"def persistent?\n @persistent\n end",
"def working?\n job_working?\n end",
"def persistent?\n false\n end",
"def persistent?\... | [
"0.7076994",
"0.70721966",
"0.70721966",
"0.7055105",
"0.7000772",
"0.6993119",
"0.69868845",
"0.69490194",
"0.6843002",
"0.6786879",
"0.6716957",
"0.66314965",
"0.6608664",
"0.65283644",
"0.6476148",
"0.64654064",
"0.6433736",
"0.6409397",
"0.6391978",
"0.6386472",
"0.638311... | 0.83951306 | 0 |
return job key from thread global variable | def job_key; Thread.current[:job_key]; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_id\n async && async.job_id\n end",
"def worker_key; worker_options && worker_options[:worker_key]; end",
"def good_job_concurrency_key\n @good_job_concurrency_key || _good_job_concurrency_key\n end",
"def thread_id()\n #This is a stub, used for... | [
"0.6882801",
"0.6839325",
"0.66707873",
"0.66604745",
"0.6613181",
"0.655047",
"0.6528227",
"0.6528227",
"0.6528227",
"0.6528227",
"0.6528227",
"0.6528227",
"0.6528227",
"0.6515179",
"0.6489843",
"0.6474227",
"0.6457941",
"0.6456823",
"0.64044404",
"0.64020735",
"0.6364733",
... | 0.90166324 | 0 |
if worker is running using a worker key, return it | def worker_key; worker_options && worker_options[:worker_key]; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worker\n Worker.find_by_code worker_code\n end",
"def find_worker id\n self.workers.find{ |worker| worker[:id] == id } \n end",
"def worker\n read_attribute(:worker) || extract_worker || ''\n end",
"def worker\n\n @services['s_worker']\n end",
"def job_key; Thread.current... | [
"0.7126838",
"0.678525",
"0.6768625",
"0.6585342",
"0.6554534",
"0.6547819",
"0.64784",
"0.64095217",
"0.6244524",
"0.62422013",
"0.62200785",
"0.620606",
"0.61541104",
"0.60997915",
"0.60795414",
"0.60795414",
"0.6044359",
"0.5977491",
"0.5906982",
"0.5893431",
"0.5889892",
... | 0.79135925 | 0 |
loads workers schedule from options supplied from rails a user may pass trigger arguments to dynamically define the schedule | def load_schedule_from_args
@my_schedule = worker_options[:schedule]
new_load_schedule if @my_schedule
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_load_schedule\n @worker_method_triggers = { }\n @my_schedule.each do |key,value|\n case value[:trigger_args]\n when String\n cron_args = value[:trigger_args] || \"0 0 0 0 0\"\n trigger = BackgrounDRb::CronTrigger.new(cron_args)\n @worker_method_triggers[ke... | [
"0.7040827",
"0.65964466",
"0.637494",
"0.61341363",
"0.6112594",
"0.6056916",
"0.60337025",
"0.60253084",
"0.58818895",
"0.57192385",
"0.5708194",
"0.56833833",
"0.55858713",
"0.558205",
"0.55719787",
"0.55424815",
"0.54773587",
"0.5450865",
"0.5422291",
"0.5407997",
"0.5388... | 0.8270849 | 0 |
send the response back to master process and hence to the client if there is an error while dumping the object, send "invalid_result_dump_check_log" | def send_response input,output,result_flag = "ok"
input[:data] = output
input[:type] = :response
input[:result_flag] = result_flag
begin
send_data(input)
rescue Object => bdrb_error
log_exception(bdrb_error)
input[:data] = "invalid_result_dump_check_log"
inp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump(obj, error = false)\n #\n # Place a temp hold on the object until the client registers it.\n #\n obj.holdBrokerObj if obj.respond_to?(:holdBrokerObj)\n\n return(dump_original(obj, error)) unless obj.kind_of?(MiqDrbReturn)\n begin\n return(dump_original(obj.obj, error))\n ensure\n... | [
"0.62121415",
"0.60880107",
"0.59488386",
"0.5945864",
"0.58362037",
"0.5677289",
"0.56175333",
"0.55726933",
"0.55523336",
"0.55523336",
"0.5515152",
"0.5512149",
"0.5490781",
"0.54742664",
"0.5473281",
"0.5452643",
"0.5449915",
"0.5414431",
"0.5396877",
"0.5377808",
"0.5366... | 0.68778574 | 0 |
Get the next enqueued job | def get_next_task
if worker_key && !worker_key.empty?
BdrbJobQueue.find_next(worker_name.to_s,worker_key.to_s)
else
BdrbJobQueue.find_next(worker_name.to_s)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNextJob()\n\t\t\t\tjob = nil\n\t\t\t\t\n\t\t\t\tThread.exclusive {\n\t\t\t\t\ti = @jobs.index { |j| j.canStart() }\n\t\t\t\t\tjob = @jobs.delete_at( i ) if ( i != nil )\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn job\n\t\t\tend",
"def next_runnable_job(queue)\n tracking_key = get_next_runnable(queue)\n ... | [
"0.7395166",
"0.7289316",
"0.7185262",
"0.70568186",
"0.68642414",
"0.6785282",
"0.67849433",
"0.6599181",
"0.6569668",
"0.65446466",
"0.6532099",
"0.64931786",
"0.64886034",
"0.64510113",
"0.6450295",
"0.644743",
"0.64397883",
"0.64230347",
"0.6408379",
"0.6373953",
"0.63682... | 0.78408575 | 0 |
Check for timer events and invoke scheduled methods in timer and scheduler | def check_for_timer_events
super
return if @worker_method_triggers.nil? or @worker_method_triggers.empty?
@worker_method_triggers.delete_if { |key,value| value[:trigger].respond_to?(:end_time) && value[:trigger].end_time <= Time.now }
@worker_method_triggers.each do |key,value|
time_now... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_periodic_timers; end",
"def start_periodic_timers; end",
"def start_timer\n stop_timer\n @timer = EventMachine::PeriodicTimer.new(1) do\n #puts \"TIMER PROCESS ITERATE\"\n do_timer\n end\n end",
"def check_timer_plugins\n @timer_plugins.each do |plugin|\n begin\n ... | [
"0.7127739",
"0.7127739",
"0.6457467",
"0.64371204",
"0.6263506",
"0.6248357",
"0.61456823",
"0.6115464",
"0.604032",
"0.6025872",
"0.60190517",
"0.5971187",
"0.5910001",
"0.5870756",
"0.5870122",
"0.5869975",
"0.5809724",
"0.57993174",
"0.5788731",
"0.5768109",
"0.5764058",
... | 0.73479706 | 0 |
GET /usesrs GET /usesrs.json | def index
@usesrs = Usesr.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end",
"def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end",
"def us\n render :json => @@us_data\n end",
"def get_skus()\n... | [
"0.60874903",
"0.60151285",
"0.5873878",
"0.5768661",
"0.56787884",
"0.5552514",
"0.55241454",
"0.5511032",
"0.54812765",
"0.547367",
"0.54610455",
"0.5456535",
"0.54137814",
"0.5399409",
"0.5392137",
"0.5383196",
"0.53641033",
"0.5362812",
"0.5352689",
"0.535014",
"0.5348769... | 0.7002671 | 0 |
POST /usesrs POST /usesrs.json | def create
@usesr = Usesr.new(usesr_params)
respond_to do |format|
if @usesr.save
format.html { redirect_to @usesr, notice: 'Usesr was successfully created.' }
format.json { render action: 'show', status: :created, location: @usesr }
else
format.html { render action: 'new' }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @usesrs = Usesr.all\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def os_add_resource_uses(results)\n @results_json = results\n ip_map = @bsync_openstudio_resou... | [
"0.573293",
"0.55961674",
"0.53283393",
"0.5221982",
"0.5215661",
"0.52106017",
"0.5209684",
"0.51932716",
"0.5189126",
"0.517897",
"0.51540035",
"0.5055305",
"0.5053204",
"0.49980608",
"0.4968991",
"0.49499846",
"0.49393344",
"0.4907376",
"0.4897296",
"0.4892562",
"0.487658"... | 0.6400492 | 0 |
DELETE /usesrs/1 DELETE /usesrs/1.json | def destroy
@usesr.destroy
respond_to do |format|
format.html { redirect_to usesrs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\",... | [
"0.6800418",
"0.67485124",
"0.66471326",
"0.6585574",
"0.6580231",
"0.6557406",
"0.6552898",
"0.6525449",
"0.65126526",
"0.65026814",
"0.6499385",
"0.6478528",
"0.6474499",
"0.6460096",
"0.64349306",
"0.6429415",
"0.6414696",
"0.6410096",
"0.6409933",
"0.6395876",
"0.6390859"... | 0.7314853 | 0 |
Sets the attribute git_sources | def git_sources=(_arg0); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sources\n @yaml[:sources].each do |name, path|\n @sources << Yuyi::Source.new(name, path)\n end\n end",
"def set_git_urls\n self.url = git_path if url.blank?\n self.root_url = url if root_url.blank?\n end",
"def sources(sources = nil)\n @sources.assign(... | [
"0.6623315",
"0.65586656",
"0.65573037",
"0.6508255",
"0.6484549",
"0.6309147",
"0.6214641",
"0.6205548",
"0.61826587",
"0.60028654",
"0.59482217",
"0.59065264",
"0.5878187",
"0.5845626",
"0.57585955",
"0.5710112",
"0.569046",
"0.56848264",
"0.5647568",
"0.5639759",
"0.561115... | 0.7703156 | 1 |
GET /galleries/new GET /galleries/new.json | def new
@gallery = Gallery.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @gallery }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @gallery = Gallery.new(:public => true)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end",
"def new\n @gallery = current_user.galleries.build\n\n respond_to do |format|\n format.html # new.html.erb\n... | [
"0.80766994",
"0.80150187",
"0.79661673",
"0.78765625",
"0.7595797",
"0.7558374",
"0.7449871",
"0.74399966",
"0.7438465",
"0.7355877",
"0.7312814",
"0.73054224",
"0.7292722",
"0.7292722",
"0.72842383",
"0.7275395",
"0.7234414",
"0.7234414",
"0.723002",
"0.7206267",
"0.7167480... | 0.81735563 | 0 |
POST /galleries POST /galleries.json | def create
@gallery = Gallery.new(params[:gallery])
respond_to do |format|
if @gallery.save
format.html { redirect_to admin_galleries_path, :notice => 'Gallery was successfully created.' }
format.json { render :json => @gallery, :status => :created, :location => @gallery }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @galleries_gallery = @galleries_album.galleries.new(galleries_gallery_params)\n @galleries_gallery.user = current_user\n respond_to do |format|\n if @galleries_gallery.save\n format.html { redirect_to galleries_album_gallery_path(@galleries_gallery), notice: 'Gallery was successfu... | [
"0.73982763",
"0.7154794",
"0.7150583",
"0.71398413",
"0.71398413",
"0.7106869",
"0.70178217",
"0.7004208",
"0.6927534",
"0.69253844",
"0.68956596",
"0.68942505",
"0.6842925",
"0.6810708",
"0.6801731",
"0.67971355",
"0.6778396",
"0.67272455",
"0.67272455",
"0.67175496",
"0.67... | 0.7458879 | 0 |
PUT /galleries/1 PUT /galleries/1.json | def update
@gallery = Gallery.find(params[:id])
respond_to do |format|
if @gallery.update_attributes(params[:gallery])
format.html { redirect_to admin_galleries_path, :notice => 'Gallery was successfully updated.' }
format.json { head :no_content }
else
format.html { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @gallery = Gallery.find(params[:id])\n @gallery.update_attributes(params[:gallery])\n respond_with(@gallery, :status => :updated)\n end",
"def update\n @gallery = Gallery.find(params[:id])\n respond_to do |format|\n if @gallery.update(gallery_params)\n format.html { redir... | [
"0.7388177",
"0.7159825",
"0.7085751",
"0.7065021",
"0.70411",
"0.70411",
"0.70285064",
"0.70158756",
"0.68515474",
"0.67789084",
"0.67770267",
"0.6770953",
"0.67638475",
"0.67638475",
"0.6762445",
"0.6759658",
"0.6737412",
"0.6725727",
"0.67230207",
"0.6695231",
"0.6693464",... | 0.72164005 | 1 |
set up the hydra for running http requests. Increase concurrency as needed | def hydra
@hydra ||= Typhoeus::Hydra.new(:max_concurrency => 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(opts = {})\n @opts = opts.with_indifferent_access\n @hydra = Typhoeus::Hydra.new(max_concurrency: 80) # hail hydra\n end",
"def hydra\n @hydra ||= begin\n opts = if options[:max_concurrency]\n { :max_concurrency => options[:max_concurrency] }\n end\n\n Typhoeu... | [
"0.6557778",
"0.6419417",
"0.64072675",
"0.6385343",
"0.6362428",
"0.62527937",
"0.622849",
"0.60934496",
"0.60730225",
"0.60244715",
"0.6013239",
"0.59708875",
"0.59590423",
"0.5944513",
"0.587462",
"0.5872023",
"0.5864086",
"0.5833197",
"0.58282626",
"0.5822609",
"0.5750624... | 0.6521237 | 1 |
Include Javascripts on the page options[:include] to an array of strings for javascripts to include options[:exclude] sets an array of strings for javascripts to exclude options[:cache] sets the cache option to javascript_include_tag (only for nonconditional items) Automatically includes javascripts (if they exist on f... | def page_javascripts(options={})
# initialize collection
javascripts = []
conditional_scripts = []
@javascripts_add ||= []
@javascripts_ignore ||= []
# Additional scripts (if requested)
if options[:include]
@javascripts_add = [options[:include]].flatten + @jav... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def js_includes\n end",
"def render_js_includes\n return \"\".html_safe unless respond_to?(:javascript_includes) \n \n javascript_includes.uniq.collect do |args|\n javascript_include_tag(*args)\n end.join(\"\\n\").html_safe\n end",
"def javascripts(options={})\n [\n # include th... | [
"0.7335526",
"0.7229262",
"0.70679",
"0.69939536",
"0.69436544",
"0.6919463",
"0.6917696",
"0.6874165",
"0.6854559",
"0.6834407",
"0.6742082",
"0.6609757",
"0.6557925",
"0.65302134",
"0.65271956",
"0.6505679",
"0.6463808",
"0.64508164",
"0.6450794",
"0.64237076",
"0.64090765"... | 0.79679656 | 0 |
Describes all configuration templates, may optionally pass an ApplicationName filter Note: This is currently an expensive operation requiring multiple API calls due to a lack of a describe configuration templates call in the AWS API. | def all(options={})
application_filter = []
if options.key?('ApplicationName')
application_filter << options['ApplicationName']
end
# Initialize with empty array
data = []
applications = service.describe_applications(application_filter).body['Des... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def templates_configuration\n yield @templates_configuration\n end",
"def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end",
"def application_templates()\n return MicrosoftGraph::ApplicationTemplates::ApplicationTemplatesRequestBuilder.new(@path_par... | [
"0.608925",
"0.5856723",
"0.5669432",
"0.5494791",
"0.54032576",
"0.53703976",
"0.5327483",
"0.5304718",
"0.5304718",
"0.52616704",
"0.5217261",
"0.5213607",
"0.51808584",
"0.5165188",
"0.51492006",
"0.5073773",
"0.50729024",
"0.5047516",
"0.50413287",
"0.49875924",
"0.497369... | 0.64960945 | 0 |
GET /memberapps/1 GET /memberapps/1.xml | def show
@memberapp = Memberapp.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @memberapp }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @app = current_user.apps.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app }\n end\n end",
"def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n na... | [
"0.7026798",
"0.6904488",
"0.6791699",
"0.67546594",
"0.6654355",
"0.6654355",
"0.6608181",
"0.65838385",
"0.6475221",
"0.63615036",
"0.63030684",
"0.628507",
"0.6242099",
"0.6210573",
"0.62080395",
"0.6146259",
"0.6128982",
"0.6123075",
"0.6119818",
"0.60932326",
"0.608551",... | 0.7104436 | 0 |
GET /memberapps/new GET /memberapps/new.xml | def new
@memberapp = Memberapp.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @memberapp }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @app = current_user.apps.new\n @app.app_versions << AppVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end",
"def new\n @app = Mms::App.new\n\n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.74751854",
"0.69656664",
"0.69487804",
"0.69487804",
"0.69487804",
"0.68840927",
"0.6780726",
"0.67060316",
"0.6678156",
"0.6582221",
"0.6567584",
"0.6564291",
"0.65191853",
"0.6512947",
"0.64435464",
"0.6438677",
"0.64208436",
"0.6377247",
"0.63713795",
"0.63713795",
"0.6... | 0.7535424 | 0 |
POST /memberapps POST /memberapps.xml | def create
@memberapp = Memberapp.new(params[:memberapp])
respond_to do |format|
if @memberapp.save
flash[:notice] = 'Online Membership Application has been successfully submitted.'
#send the membership application to the credit union
Emailer.deliver_memberapp_email(@memberapp)
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @app = current_user.apps.new(params[:app])\n\n respond_to do |format|\n if @app.save\n format.html { redirect_to @app, :notice => \"The application app was successfully created\" }\n format.xml { render :xml => @app, :status => :created, :location => @app }\n else\n ... | [
"0.64741343",
"0.63472885",
"0.62738466",
"0.60163754",
"0.6004527",
"0.5970214",
"0.59375167",
"0.59056044",
"0.5900542",
"0.58390856",
"0.58131707",
"0.5809882",
"0.57871854",
"0.5738092",
"0.5738092",
"0.5728644",
"0.5700073",
"0.5650028",
"0.5639469",
"0.5629228",
"0.5563... | 0.6841411 | 0 |
PUT /memberapps/1 PUT /memberapps/1.xml | def update
@memberapp = Memberapp.find(params[:id])
respond_to do |format|
if @memberapp.update_attributes(params[:memberapp])
flash[:notice] = 'Memberapp was successfully updated.'
format.html { redirect_to(@memberapp) }
format.xml { head :ok }
else
format.html { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_app data={}\n put '/app', data\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n put(\"/apps/#{name}\", :app => attribu... | [
"0.6842108",
"0.68032336",
"0.68032336",
"0.66393054",
"0.63989663",
"0.63009596",
"0.62124884",
"0.6210313",
"0.6209285",
"0.6209285",
"0.61099267",
"0.6092107",
"0.60629666",
"0.5991097",
"0.59672457",
"0.59461915",
"0.5945053",
"0.59310305",
"0.5929839",
"0.5902712",
"0.59... | 0.6997798 | 0 |
DELETE /memberapps/1 DELETE /memberapps/1.xml | def destroy
@memberapp = Memberapp.find(params[:id])
@memberapp.destroy
respond_to do |format|
format.html { redirect_to(memberapps_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend",
"def destroy\n @userapp = Userapp.find(params[:id])\n @userapp.destroy\n\n respond_to do |format|\n format.html { redirect_to(userapps_url) }\n format.xml { head :ok }\n e... | [
"0.7015781",
"0.7015781",
"0.68442917",
"0.6773877",
"0.6707047",
"0.662198",
"0.656874",
"0.656874",
"0.656874",
"0.651191",
"0.65057236",
"0.64819473",
"0.6384027",
"0.6363278",
"0.6352964",
"0.63357896",
"0.6334168",
"0.63300437",
"0.632688",
"0.6306997",
"0.6242066",
"0... | 0.7592015 | 0 |
Get a typewright document in the specified format. Requires authorization token | def retrieve
if !check_auth()
render text: { "message" => "401 Unauthorized" }.to_json(), status: :unauthorized
else
uri = params[:uri]
type = params[:type]
doc = Document.find_by_uri(uri)
if doc.present?
case type
when 'gale'
render :text => doc.get_corr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_document_with_format(request)\n data, _status_code, _headers = get_document_with_format_with_http_info(request)\n request_token if _status_code == 401\n data\n end",
"def test_get_document_with_format\n filename = 'test_multi_pages.docx'\n remote_name = 'TestGetDocumentWithFor... | [
"0.6661999",
"0.6221036",
"0.60395795",
"0.5964875",
"0.5913702",
"0.58532447",
"0.58111864",
"0.57674366",
"0.57633334",
"0.5724551",
"0.56371576",
"0.5601987",
"0.55971265",
"0.55738413",
"0.5542068",
"0.5473192",
"0.5435829",
"0.54220355",
"0.53972644",
"0.5384365",
"0.534... | 0.6238871 | 1 |
creates a check_balance method to access the current balance of an account at any time. | def check_balance
return @balance
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checking_account_balance\n return @checking_account_balance\n end",
"def getbalance(account = nil, minconf = 1)\n coind.getbalance account, minconf\n end",
"def get_account_balance\n submit GetAccountBalance.new\n end",
"def balance(known_balances = {})\n known_balances.has_key?(name... | [
"0.75074935",
"0.69713753",
"0.6801453",
"0.6752096",
"0.67338234",
"0.67180556",
"0.6695323",
"0.66938645",
"0.6675713",
"0.66388",
"0.6618579",
"0.6612871",
"0.660813",
"0.6605692",
"0.6595137",
"0.652444",
"0.6509327",
"0.6483187",
"0.6481354",
"0.6447904",
"0.6429051",
... | 0.7765508 | 0 |
gets called by cucumber after all features have completed this is the starting point of all reporting | def after_features(*args)
@scenarios = failed_and_passed
JiraInterface.new.report(formatted_scenarios)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_test_run_finished(event)\n print_cucumber_failures\n end",
"def master_done!\n @done = true\n specification! true\n summarize_performance!\n \t\tsummarize_results! @results\n \t\tcleanup!\n \t\t#Notify.completed @experiment\n\n \t\t#sleep 1\n #DRb.stop_servi... | [
"0.65379846",
"0.63477975",
"0.6222114",
"0.6176162",
"0.61202407",
"0.60965174",
"0.60932237",
"0.6049942",
"0.6049942",
"0.6049942",
"0.6049942",
"0.6049942",
"0.60310084",
"0.6008111",
"0.60026217",
"0.5878821",
"0.58684",
"0.5847567",
"0.5842155",
"0.5821611",
"0.5805312"... | 0.7369607 | 0 |
Formats the match name like so: => 20190630: England V India | def matchname
"#{self.date}: #{self.hometeam.name} V #{self.awayteam.name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_name\n name.observation_name\n end",
"def format_name(name)\n name[2..-2].humanize.downcase.gsub ' | ', ': '\n end",
"def match_name\n \"#{group.name} #{name} #{I18n.t(:match)}\"\n end",
"def innings_name\n \"#{match.matchname}: Batting team: #{self.battingteam}\"\n end",
"de... | [
"0.6901387",
"0.68595415",
"0.67861706",
"0.66687864",
"0.65314776",
"0.6453432",
"0.6440977",
"0.62494254",
"0.6235149",
"0.62069464",
"0.6153533",
"0.61485606",
"0.61485606",
"0.6128993",
"0.61183995",
"0.60858697",
"0.6072796",
"0.60507596",
"0.6050329",
"0.6044644",
"0.60... | 0.754491 | 0 |
full aarchive search endpoints return total contents by day, minute, hour paginated so to get totals across time period passed may need to run more than one call, the stop condition is cursor nil bucket: must be one of [minute, hour, day] | def total_by_time_period(options = {})
response = options[:response] || {}
search_options = {}
search_options[:query] = options[:query] || ''
search_options[:bucket] = options[:bucket] || 'day'
search_options[:fromDate] = Gnip.format_date(options[:date_from]) if options[:date_fro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_export_on_reporting_search\n stream = @service.create_export(\"search index=_internal earliest=-2d | stats count(_raw) by method\")\n results = ResultsReader.new(stream).to_a()\n assert_true(3 <= results.length())\n end",
"def index\n pagination = {}\n query = {}\n\n search_term = par... | [
"0.5632674",
"0.5401346",
"0.5362996",
"0.53563213",
"0.5353507",
"0.5339326",
"0.53273",
"0.53192365",
"0.531761",
"0.5312062",
"0.5284804",
"0.52631164",
"0.52596515",
"0.5256424",
"0.52511066",
"0.52502346",
"0.5244441",
"0.5227929",
"0.52070844",
"0.51946723",
"0.5193737"... | 0.56883997 | 0 |
Override provided file name to include checkout_wizard at the end and allow every NamedBase helpers to use that name | def file_name
@_file_name ||= [@file_name, 'checkout_wizard'].join('_')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_name\n @_file_name ||= [@file_name, 'checkout_step'].join('_')\n end",
"def cfn_template_stub\n @_cfn_template_stub ||= File.join(cfn_template_dir, \"#{class_name}\")\n end",
"def template_path() 'demo/admin/billing.erb' end",
"def base_filename; class_to_filename(name.gsub(/... | [
"0.64460164",
"0.5711711",
"0.55465704",
"0.544684",
"0.54212075",
"0.538437",
"0.5324739",
"0.53177196",
"0.5310466",
"0.5309358",
"0.5305758",
"0.5245845",
"0.52409524",
"0.52320313",
"0.51914716",
"0.5174666",
"0.5151491",
"0.51013404",
"0.5088933",
"0.50872225",
"0.503672... | 0.7197674 | 0 |
This method converts the first order value to a corresponding arel expression if the order value uses either NULLS LAST or NULLS FIRST ordering in raw SQL. TODO: We should stop matching raw literals once we switch to using the Arel methods. | def convert_raw_nulls_order!
order_value = order_values.first
return unless order_value.is_a?(Arel::Nodes::SqlLiteral)
# Detect NULLS LAST or NULLS FIRST ordering by looking at the raw SQL string.
if matches = order_value.match(NULLS_ORDER_REGEX)
return unless table... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asc\n OrderedExpression.new(@expression, false, :nulls=>@nulls)\n end",
"def lob_order_by_expression(klass, order)\n return order if order.nil?\n changed = false\n new_order = order.to_s.strip.split(/, */).map do |order_by_col|\n column_name, asc_desc = order_by_col.... | [
"0.5524062",
"0.5391916",
"0.53728527",
"0.525108",
"0.52263206",
"0.520931",
"0.52041245",
"0.5188299",
"0.5059533",
"0.5053226",
"0.50323856",
"0.49436355",
"0.49389428",
"0.49178016",
"0.4905293",
"0.48852855",
"0.48831722",
"0.4852505",
"0.48386815",
"0.48106334",
"0.4791... | 0.7695068 | 0 |
Method for destroy search keyword | def destory_search_term
current_user.searches.and({:search_term =>params[:searchterm]},{:type=>"question"}).first.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @search_keyword.destroy\n respond_to do |format|\n format.html { redirect_to search_keywords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |format|\n format.html { red... | [
"0.77437794",
"0.73895067",
"0.7299999",
"0.7229739",
"0.7182311",
"0.7182311",
"0.7182128",
"0.7175831",
"0.71003366",
"0.70809543",
"0.7061329",
"0.7050433",
"0.7037636",
"0.7029506",
"0.70289284",
"0.702757",
"0.702757",
"0.702757",
"0.702757",
"0.702757",
"0.7014997",
"... | 0.7664818 | 1 |
Method for save recent search keyword | def create_recent_search
current_user.question_recent_search_term << params[:searchterm]
current_user.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_recent_search(searchterm)\n #Assign searchterm to recent search term\n current_user.recent_search_term << searchterm\n # Save the search term\n current_user.save\n end",
"def save_title_query\n @query = TitleQuery.new(user_id: current_user.try(:id), query: params[:term])\n @quer... | [
"0.7038559",
"0.6633011",
"0.64303476",
"0.63817847",
"0.63817847",
"0.63729614",
"0.6341058",
"0.6300489",
"0.62769663",
"0.6239791",
"0.6155844",
"0.61486113",
"0.6080404",
"0.60133207",
"0.60081226",
"0.59813076",
"0.59650403",
"0.5956185",
"0.5938954",
"0.5908679",
"0.586... | 0.7083484 | 0 |
GET /simnorths GET /simnorths.xml | def index
@simnorths = Simnorth.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @simnorths }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @simnorth = Simnorth.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @simnorth }\n end\n end",
"def new\n @simnorth = Simnorth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { rende... | [
"0.7378518",
"0.63738275",
"0.6253037",
"0.624886",
"0.60568714",
"0.60257703",
"0.5982767",
"0.5840151",
"0.5839267",
"0.5770025",
"0.57378644",
"0.57358474",
"0.5734002",
"0.5653428",
"0.5642533",
"0.55760676",
"0.55746585",
"0.55708295",
"0.55608314",
"0.55471665",
"0.5547... | 0.7495082 | 0 |
GET /simnorths/1 GET /simnorths/1.xml | def show
@simnorth = Simnorth.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @simnorth }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @simnorths = Simnorth.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @simnorths }\n end\n end",
"def new\n @simnorth = Simnorth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => ... | [
"0.7482966",
"0.66082215",
"0.64550835",
"0.63925195",
"0.62538856",
"0.60867476",
"0.60251135",
"0.5963267",
"0.5954565",
"0.58904475",
"0.58677363",
"0.58649987",
"0.586474",
"0.5853106",
"0.5849172",
"0.58464825",
"0.58239716",
"0.58035916",
"0.58011514",
"0.57889926",
"0.... | 0.75302154 | 0 |
GET /simnorths/new GET /simnorths/new.xml | def new
@simnorth = Simnorth.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @simnorth }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @simnorth = Simnorth.new(params[:simnorth])\n\n respond_to do |format|\n if @simnorth.save\n flash[:notice] = 'Simnorth was successfully created.'\n format.html { redirect_to(@simnorth) }\n format.xml { render :xml => @simnorth, :status => :created, :location => @simno... | [
"0.7482602",
"0.7078674",
"0.70253587",
"0.6983736",
"0.69775295",
"0.6850852",
"0.6766502",
"0.674928",
"0.67034084",
"0.6702091",
"0.6603256",
"0.6599457",
"0.6582486",
"0.6569879",
"0.6553278",
"0.651787",
"0.6514858",
"0.6513903",
"0.650968",
"0.649912",
"0.6495986",
"0... | 0.799065 | 0 |
POST /simnorths POST /simnorths.xml | def create
@simnorth = Simnorth.new(params[:simnorth])
respond_to do |format|
if @simnorth.save
flash[:notice] = 'Simnorth was successfully created.'
format.html { redirect_to(@simnorth) }
format.xml { render :xml => @simnorth, :status => :created, :location => @simnorth }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @simnorth = Simnorth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simnorth }\n end\n end",
"def index\n @simnorths = Simnorth.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @... | [
"0.6190479",
"0.5928748",
"0.5866895",
"0.5717377",
"0.5711698",
"0.559345",
"0.5549563",
"0.55399615",
"0.5501477",
"0.54933906",
"0.5490356",
"0.54870635",
"0.5431088",
"0.5368546",
"0.53436965",
"0.5320216",
"0.53094727",
"0.53074944",
"0.5289278",
"0.5253122",
"0.52390206... | 0.7410336 | 0 |
PUT /simnorths/1 PUT /simnorths/1.xml | def update
@simnorth = Simnorth.find(params[:id])
respond_to do |format|
if @simnorth.update_attributes(params[:simnorth])
flash[:notice] = 'Simnorth was successfully updated.'
format.html { redirect_to(@simnorth) }
format.xml { head :ok }
else
format.html { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 create\n @simnorth = Simnorth.new(params[:simnorth])\n\n respond_to do |format|\n if @simnorth.save\n flash[:notice] = 'S... | [
"0.6158444",
"0.6080345",
"0.5864552",
"0.58364666",
"0.5833181",
"0.57904696",
"0.57200944",
"0.56750315",
"0.56337786",
"0.557244",
"0.55362934",
"0.54581696",
"0.54474366",
"0.54267484",
"0.5425705",
"0.54105616",
"0.54023695",
"0.53941905",
"0.5394008",
"0.5389238",
"0.53... | 0.7131456 | 0 |
DELETE /simnorths/1 DELETE /simnorths/1.xml | def destroy
@simnorth = Simnorth.find(params[:id])
@simnorth.destroy
respond_to do |format|
format.html { redirect_to(simnorths_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @simthing = Simthing.find(params[:id])\n @simthing.destroy\n\n respond_to do |format|\n format.html { redirect_to(simthings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @simulation = Simulation.find(params[:id])\n @simulation.destroy\n\n respond_to ... | [
"0.67689973",
"0.6760167",
"0.6661623",
"0.65658695",
"0.64894295",
"0.64766455",
"0.647054",
"0.64622563",
"0.6392586",
"0.63687307",
"0.6363882",
"0.6362909",
"0.6355677",
"0.6335177",
"0.62636125",
"0.6234464",
"0.62135875",
"0.6210885",
"0.62075186",
"0.62021095",
"0.6192... | 0.74120843 | 0 |
Write a method that takes a maximum bound and returns all primes starting with 0 upto and including the maximum bound. For example: prime 11 Should return an array that looks like this: [2,3,5,7,11] Hint:Using a range from 2 to the number's square root should allow you to determine all possible factors. | def get_primes(upper_bound)
primes = []
(2..upper_bound).each do |potential_prime|
is_prime = true #default to true if the below loop doesn't prove it false
(2..(potential_prime - 1)).each do |divisor| #we start from 2 because that is the first number
#that we know is not prime - 1 is there so we don'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(max)\n array = []\n i = 2\n while i < max.abs\n if is_prime?(i)\n array << i\n end\n i += 1\n end\n array\nend",
"def prime_range(lower_bound, higher_bound)\n Prime.each(higher_bound).select {|prime| prime >= lower_bound}\nend",
"def get_primes(limit)\n primes = []\n (2...limit... | [
"0.763137",
"0.75318015",
"0.749286",
"0.73849034",
"0.7315347",
"0.72890127",
"0.72456247",
"0.7210478",
"0.71408087",
"0.71408087",
"0.71408087",
"0.7131529",
"0.7104835",
"0.70834494",
"0.70834494",
"0.70749855",
"0.70305645",
"0.6987965",
"0.69636154",
"0.69636154",
"0.69... | 0.79769796 | 0 |
makes a new board (initializes) with the bombs placed | def make_board
@grid = Array.new(9) { | row | Array.new(9) { | col | Tile.new(self, [row, col]) } }
self.place_bombs
@grid.map.with_index do | row, rowIndx |
row.map.with_index { | tile, colIndx | tile.neighbors_bomb_count if !(self.is_a_bomb?([rowIndx, colIndx])) }
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_board\n make_blank_board\n populate_board\n end",
"def create_board\n (1..(@width * @width).to_i).each do |i|\n values = i <= @amount_mines ? @bomb : @empty\n @board.push({\n value: values,\n revealed?: false\n })\n end\n @... | [
"0.7731087",
"0.763614",
"0.7539567",
"0.7342805",
"0.73421025",
"0.7326028",
"0.7316231",
"0.72671014",
"0.72016436",
"0.7200732",
"0.7176639",
"0.71600586",
"0.7134926",
"0.7131365",
"0.7117906",
"0.7111783",
"0.70974654",
"0.7074236",
"0.705987",
"0.70569026",
"0.70491964"... | 0.81135005 | 0 |
checks a position on the grid to see if the tile is a bomb | def is_a_bomb?(pos)
tile = @grid[pos[0]][pos[1]]
tile.value == BOMB
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_bomb(x,y)\n @board[x,y].is_bomb?\n end",
"def contains_mine?(row, col)\n @board[row][col].has_bomb\n end",
"def if_bomb(row, col, values)\n neighbour = [row + values[0], col + values[1]]\n position_in_board = get_position_in_board(neighbour[0], neighbour[1])\n return unless @board... | [
"0.80369014",
"0.78852344",
"0.768334",
"0.733368",
"0.7111009",
"0.7091322",
"0.7071163",
"0.6985518",
"0.69699514",
"0.69392705",
"0.6937523",
"0.68973076",
"0.68964046",
"0.68682235",
"0.6858016",
"0.6849324",
"0.68243766",
"0.6823628",
"0.68150055",
"0.681469",
"0.678907"... | 0.8524402 | 0 |
Create a new instance of an AbstractDaemon req = the HTTP Request that requests the daemon creation | def initialize(req)
@name = self.class.daemon_name(req)
super("#{self.class}:#{@name}")
@domain = self.class.getDaemonParam(req, :domain)
@config = getTestbedConfig(@domain)
configDefaults(@config)
instances = (@@inst[self.class] ||= {})
if (instances.length >= @config['maxDaemons'])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(req)\n @clientCount = 0\n @img = self.class.getDaemonParamDef(req, :img, nil)\n super(req)\n @@bw = @config['bandwidth']\n @@mcAddr = @config['mcAddress']\n end",
"def create params\n raise_start_server unless Server::node\n new params\n end",
"def build_daemon\n ... | [
"0.5934922",
"0.5875484",
"0.58399594",
"0.5714171",
"0.5638089",
"0.5466849",
"0.54326797",
"0.53797174",
"0.5378097",
"0.53628236",
"0.53565264",
"0.5355888",
"0.5348836",
"0.5318948",
"0.52555037",
"0.5255114",
"0.5216831",
"0.5173255",
"0.5168438",
"0.5163226",
"0.5159626... | 0.7733205 | 0 |
Return a given configuration Hash for this Daemon for a particular testbed domain = name of the testbed to return the config for [Return] a Hash with the configuration parameters | def getTestbedConfig(domain)
if ((dc = @@globalConfig[self.class]['testbed']) == nil)
raise "Missing 'testbed' configuration"
end
config = dc[domain] || dc['default']
if (config == nil)
raise "Missing 'testbed' config for '#{domain}' or 'default'"
end
config['startPort'] ||= DEF_STA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dns_config\n @config[:dns_configs].each do |dns|\n # Convert the symbol from the config into a string for comparison\n return (dns[1].nil? ? {} : dns[1]) if dns[0].to_s == @dns_plugin_name\n end\n\n nil\n end",
"def get_hash()\n\t\t\treturn @config.clon... | [
"0.65207297",
"0.62552595",
"0.6177565",
"0.61462295",
"0.6099899",
"0.6098759",
"0.60384905",
"0.60060054",
"0.60031414",
"0.5995158",
"0.59614056",
"0.5925924",
"0.5911315",
"0.5906839",
"0.5894514",
"0.5878919",
"0.58616954",
"0.5857777",
"0.58398384",
"0.5821884",
"0.5821... | 0.7474776 | 0 |
Execute the command line to run this Daemon. This method forks the current Thread to execute the Daemon, then create a new Thread to monitor the correct termination of this Daemon, and Timer (i.e. essentially another Thread) to monitor Daemon timeout. cmd = the specific command line to run this Daemon | def run(cmd)
@pipe = pipe = IO::pipe
info "Starting #{cmd}"
@running = true
@pid = fork {
# set the process group ID to the pid of the child
# this way, the child and all grandchildren will be in the same process group
# so we can terminate all of them with just one signal to the group... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n # Make sure the desired working directory exists.\n FileUtils.makedirs(@dir) if not File.directory?(@dir)\n # Actually run the command.\n if @log then\n @pid = spawn(@cmd, :chdir => @dir, [:out, :err] => [@log, 'a'])\n else\n @pid = spawn(@cmd, :chdir => @dir, [:out... | [
"0.6399191",
"0.61342525",
"0.5890267",
"0.58478403",
"0.58006877",
"0.57450616",
"0.5740415",
"0.5686523",
"0.5679874",
"0.56648844",
"0.5660186",
"0.56481564",
"0.564747",
"0.56285304",
"0.56269133",
"0.56187415",
"0.5561288",
"0.55366856",
"0.55251515",
"0.55251515",
"0.55... | 0.7429046 | 0 |
Do some cleaning after a Daemon termination | def done()
info "'#{@name}' daemon done"
@running = false
@@inst[self.class].delete(@name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def daemon_clean_up\n TaskQueue.where(id: $daemon[:heartbeat_task_queue_id]).destroy_all\n File.delete($daemon[:pid_file])\nend",
"def daemon_stopped?; end",
"def cleanup\n super\n if(service)\n stop_service()\n print_status(\"Server stopped.\")\n end\n end",
"def cleanUp\n if @runni... | [
"0.7270005",
"0.7003445",
"0.68347955",
"0.6781411",
"0.6738866",
"0.66310614",
"0.66284645",
"0.6626671",
"0.6613218",
"0.6453931",
"0.6424841",
"0.64063025",
"0.63812983",
"0.6360799",
"0.6360799",
"0.6353902",
"0.6351889",
"0.63502324",
"0.63465595",
"0.63413537",
"0.63388... | 0.71465147 | 1 |
Return whether a given class implements (ie overrides) an instance method | def implements_instance_method?(method_name)
instance_method(method_name).owner == self
rescue NameError
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to?(method_name)\n @instance.respond_to?(method_name) || super\n end",
"def respond_to?(meth)\n\t\ttrue\n\tend",
"def instance_method_overridden? m\n self.method_defined?(m) && self.instance_method(m).owner == self && self.ancestors[1..-1].any?{|mod| mod.method_defined?(m)}\n end",
"d... | [
"0.7182832",
"0.7137994",
"0.7047397",
"0.69489557",
"0.69489557",
"0.6914972",
"0.6898415",
"0.6875337",
"0.6867969",
"0.6859429",
"0.6796096",
"0.67815953",
"0.6704119",
"0.66912884",
"0.66689116",
"0.6662735",
"0.6641765",
"0.663343",
"0.6622102",
"0.65818805",
"0.6537564"... | 0.7844412 | 0 |
def auth_ext_id self.auth_ext.id if self.auth_ext.id end | def auth_ext_id=(val)
self.auth_ext = Ecstore::AuthExt.find(val) if val.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_user_id\n auth[:user_id]\n end",
"def external_id; end",
"def auth_id\n params['TxAuthNo']\n end",
"def external_id\n return @external_id\n end",
"def external_id\n return @external_id\n end",
"def external_id\n ... | [
"0.68587375",
"0.6735449",
"0.6601898",
"0.64957196",
"0.64957196",
"0.64957196",
"0.64957196",
"0.63794297",
"0.635281",
"0.6240944",
"0.62359554",
"0.62073785",
"0.62046736",
"0.6175492",
"0.6159366",
"0.61212647",
"0.6116455",
"0.6061187",
"0.60556895",
"0.6047235",
"0.604... | 0.8606871 | 0 |
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge [by myself, with: ]. 1. Pseudocode What is the input? What is the output? (i.e. What should the code return?) What are the steps need... | def mode(array)
frequency = {}
array.each do |item|
if frequency.has_key?(item)
frequency[item] = frequency[item] + 1
else
frequency[item] = 1
end
end
max_value = 0
frequency.each_value do |value|
if value > max_value
max_value = value
end
end
max = []
max_key = ""
max_freqency = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mode(array)\n hash = Hash.new {|hash,key| hash[key] = 0} #creates a default value of 0 for all hash values\n\n array.each {|num| #iterate through the array and count +1 for each value\n hash[num] += 1\n }\n\n\n\n values = [] # Declare array of all values\n hash.each do |key, value|\n values... | [
"0.7839516",
"0.7712892",
"0.77030337",
"0.76906824",
"0.76772845",
"0.7638782",
"0.757862",
"0.7568757",
"0.7535938",
"0.7526803",
"0.74961716",
"0.7443065",
"0.74373674",
"0.7419738",
"0.741176",
"0.7405869",
"0.7393021",
"0.73649836",
"0.7360114",
"0.7333721",
"0.73296577"... | 0.8213133 | 0 |
as a prefix and suffix, swaps the numbers while retaining the word in between. Words in the sentence are delimited from each other by a space. | def swap_nums(string)
words = string.split(" ")
words.each do |word|
word[0], word[word.length - 1] = word[word.length - 1], word[0]
end
return words.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(words)\n swapped = []\n words.split.each do |word|\n word[0], word[-1] = word[-1], word[0]\n swapped << word\n end\n swapped.join(' ')\nend",
"def swap(sentence)\n final = []\n reversed_copy_array = sentence.dup.split.map(&:reverse)\n sentence_array = sentence.split\n zipped = sentence_arr... | [
"0.67697567",
"0.668232",
"0.6634838",
"0.6631595",
"0.6612588",
"0.65878564",
"0.6572375",
"0.6503927",
"0.64967763",
"0.64954084",
"0.64738345",
"0.6461549",
"0.6459261",
"0.645909",
"0.6455987",
"0.6441388",
"0.6429162",
"0.6401587",
"0.63943994",
"0.6338356",
"0.6305033",... | 0.6726059 | 1 |
gets array of IPs from zabbix and adds them to config hash. | def zabbix_get_backup_ips
@config[:groups].each do |group, parameter|
if parameter[:enable]
ips = @zabbix.get_ips_by_group(parameter[:name])
@config[:groups][group.to_sym][:ips] = ips
end
end
return @config
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gather_ip\n\tip=[]\n\t@ip=[] #hold our unique IP found in logs\n\t@ipz=Hash.new #create new hash for storage of ip with associated number of occurances\n\tif not @bin_logz.empty?\n\t\t@bin_logz.each do |log| #Check Binary Logs\n\t\t\tooo = File.stat(file)\n\t\t\toatime=foo.atime #atime before edit\n\t\t\tomtim... | [
"0.63842803",
"0.6356293",
"0.6084628",
"0.60636",
"0.6051841",
"0.6047091",
"0.60363495",
"0.5978068",
"0.5963858",
"0.5956293",
"0.5936717",
"0.59292877",
"0.5903528",
"0.5857556",
"0.58532053",
"0.58442473",
"0.58412594",
"0.5838189",
"0.58243364",
"0.57759666",
"0.5774441... | 0.6735633 | 0 |
Change directory or rescue if not. | def change_dir(dir)
begin
return true if Dir.chdir(dir)
rescue Exception => error
Loggers::Main.log.warn error.message
exit 5
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changePath(path, &block)\n currPath = Dir.pwd\n begin\n Dir.chdir(path)\n result = block.call\n Dir.chdir(currPath)\n result\n rescue\n Dir.chdir(currPath)\n raise $!\n end\nend",
"def change_dir f\n unless File.directory? f\n perror \"#{f} is not a directory, or does not exist.\"\n... | [
"0.6576558",
"0.6484046",
"0.64816344",
"0.6413502",
"0.6124966",
"0.60808843",
"0.6074664",
"0.6074664",
"0.6052998",
"0.6022494",
"0.6019581",
"0.6012018",
"0.60095495",
"0.6003278",
"0.59908587",
"0.59902054",
"0.5944655",
"0.5878126",
"0.58767563",
"0.5869148",
"0.5855972... | 0.7373498 | 0 |
Create directories of groups from config. Returns all directories in backup directory. | def check_or_create_group_dirs
change_dir(@working_directory)
@config[:groups].each do |key, value|
if value[:enable]
Dir.mkdir(value[:name].downcase) unless Dir.exists?(value[:name].downcase)
end
end
return Dir.glob('*').select { |f| File.directory? f }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groups\n g = File.join(@root,'groups')\n FileUtils.mkdir_p g\n Dir.chdir(File.join(@root,'groups')) do\n Dir['*']\n end\n end",
"def create_directories\n begin\n FileUtils.mkdir_p @root unless File.exist? @root\n FileUtils.chmod(0700, @root)\n CHILD_DIR... | [
"0.65638286",
"0.65012515",
"0.6387864",
"0.63415754",
"0.63082564",
"0.6120428",
"0.61056465",
"0.6092226",
"0.60873365",
"0.6080719",
"0.6047126",
"0.59986746",
"0.59560585",
"0.59560585",
"0.59150773",
"0.5906739",
"0.590368",
"0.587886",
"0.58759546",
"0.5875533",
"0.5824... | 0.672273 | 0 |
Create all subdirectories named by host IPs. | def check_or_create_group_ips_dirs
@config[:groups].each do |key, value|
if value[:enable]
change_dir(@working_directory+value[:name])
begin
unless value[:ips] == nil
value[:ips].each do |ip|
Dir.mkdir(ip.gsub(/[.]/, '-')) unless Dir.exists?(ip... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_folders\n shared_folders.each do |_id, options|\n hostpath = Pathname.new(options[:hostpath]).expand_path(@env[:root_path])\n\n next unless !hostpath.directory? && options[:create]\n # Host path doesn't exist, so let's create it.\n @logger.debug(\"Ho... | [
"0.65475446",
"0.6065708",
"0.6065708",
"0.6037723",
"0.6009966",
"0.593445",
"0.5933555",
"0.5917639",
"0.5917639",
"0.5776585",
"0.57746375",
"0.5720049",
"0.5715185",
"0.57081413",
"0.56734085",
"0.55394614",
"0.54891527",
"0.54583335",
"0.5456522",
"0.5454697",
"0.54431",... | 0.62298965 | 1 |
Deletes all files in subfolders of given folder(group). Checks if that filename is older than days variable with is_outdated? method. Deletes only files matching pattern. Works by printing directory structure into arrays. | def delete_older_than(group, days = 14)
change_dir(@working_directory + group.to_s)
dirs = Dir.glob('*').select { |f| File.directory?(f) }
dirs.each do |dir|
if change_dir(dir)
files = Dir.glob('*').select { |f| f =~ /^\d{2}\-\d{2}\-\d{4}\.\w{3,6}/ }
unless files.size == 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean! dir, api\n keep_files = [key(api, :daily), key(api, :monthly)]\n Dir.entries(dir).each do |e|\n ::File.delete(::File.join(dir, e)) unless keep_files.include?(e) || e.match(/\\A\\./)\n end\n end",
"def delete_old_temp_folders\n path = File.join(Dir.tmpdir, STAGIN... | [
"0.61230123",
"0.6067444",
"0.591443",
"0.58392525",
"0.58362156",
"0.58296907",
"0.578636",
"0.56243795",
"0.561848",
"0.55630356",
"0.55595887",
"0.5532708",
"0.55277777",
"0.547332",
"0.54625845",
"0.54262775",
"0.54041916",
"0.53992116",
"0.5339617",
"0.5315764",
"0.53157... | 0.8021701 | 0 |
checks if date in given filename is older past_days ago. | def is_outdated?(days, file)
past = @date - days
return true if (Date.parse(file) < past)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def older_than_config? filename\n File.exists?(filename) && File.ctime(filename) < File.ctime(\"config.yaml\")\nend",
"def is_date_in_past\n if date.nil?\n errors.add(:date, \"cannot be null\")\n else\n if date.past?\n errors.add(:date, \"cannot be in the past\")\n end\n end\n\n ... | [
"0.6267862",
"0.61494255",
"0.60885113",
"0.59810793",
"0.59200364",
"0.5909905",
"0.5909726",
"0.58706135",
"0.5854076",
"0.58422446",
"0.580695",
"0.5797299",
"0.5771527",
"0.56462944",
"0.5641577",
"0.56277615",
"0.5611089",
"0.55674726",
"0.55592084",
"0.5546219",
"0.5545... | 0.7115552 | 0 |
GET /barrels_incomes GET /barrels_incomes.json | def index
@barrels_incomes = BarrelsIncome.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_barrels_income\n @barrels_income = BarrelsIncome.find(params[:id])\n end",
"def index\n @incomes = Income.all\n\n respond_to do |format|\n format.json { render json: @incomes }\n end\n end",
"def index\n @incomes = current_company.incomes.all\n\n respond_to do |format|\n ... | [
"0.6963735",
"0.68345237",
"0.67639565",
"0.6431732",
"0.6282067",
"0.624128",
"0.62329006",
"0.60563517",
"0.60352135",
"0.60261846",
"0.6003226",
"0.599617",
"0.5974352",
"0.59698474",
"0.59592634",
"0.59519404",
"0.59363353",
"0.5904838",
"0.5851961",
"0.58361495",
"0.5827... | 0.76655936 | 0 |
POST /barrels_incomes POST /barrels_incomes.json | def create
@barrels_income = BarrelsIncome.new(barrels_income_params)
respond_to do |format|
if @barrels_income.save
format.html { redirect_to @barrels_income, notice: 'Barrels income was successfully created.' }
format.json { render action: 'show', status: :created, location: @barrels_in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def barrels_income_params\n params.require(:barrels_income).permit(:nro_remit)\n end",
"def set_barrels_income\n @barrels_income = BarrelsIncome.find(params[:id])\n end",
"def index\n @barrels_incomes = BarrelsIncome.all\n end",
"def create\n @income = current_user.incomes.new(params[:... | [
"0.7015474",
"0.6838041",
"0.6599704",
"0.61465245",
"0.6119839",
"0.5900541",
"0.58497596",
"0.5838789",
"0.5783114",
"0.5772572",
"0.57710963",
"0.57649165",
"0.5708656",
"0.5703797",
"0.56986254",
"0.5694148",
"0.56904733",
"0.5680197",
"0.567114",
"0.5640031",
"0.56390554... | 0.7317972 | 0 |
PATCH/PUT /barrels_incomes/1 PATCH/PUT /barrels_incomes/1.json | def update
respond_to do |format|
if @barrels_income.update(barrels_income_params)
format.html { redirect_to @barrels_income, notice: 'Barrels income was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_barrels_income\n @barrels_income = BarrelsIncome.find(params[:id])\n end",
"def update\n @income = current_company.incomes.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(params[:income])\n format.html { redirect_to incomes_path, notice: 'Income was s... | [
"0.6932549",
"0.6567374",
"0.6460813",
"0.63699937",
"0.6278906",
"0.6215836",
"0.6212558",
"0.6054663",
"0.60055083",
"0.59445614",
"0.59432286",
"0.5941398",
"0.5940751",
"0.59291935",
"0.591359",
"0.591359",
"0.58855647",
"0.5884313",
"0.58653724",
"0.5863562",
"0.58623606... | 0.7601044 | 0 |
DELETE /barrels_incomes/1 DELETE /barrels_incomes/1.json | def destroy
@barrels_income.destroy
respond_to do |format|
format.html { redirect_to barrels_incomes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @income = current_company.incomes.find(params[:id])\n @income.destroy\n\n respond_to do |format|\n format.html { redirect_to incomes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @income = Income.find(params[:id])\n @income.destroy\n\n respond... | [
"0.6843482",
"0.6808904",
"0.6575583",
"0.65619427",
"0.65571004",
"0.6543391",
"0.6526966",
"0.64932185",
"0.64752173",
"0.6423816",
"0.6418846",
"0.6363805",
"0.6347157",
"0.63452804",
"0.63391036",
"0.63355947",
"0.633446",
"0.63141686",
"0.63087946",
"0.6307158",
"0.62931... | 0.7735175 | 0 |
Get text from a node; use parent if text does not appear to be complete This is used when scanning for some links that may be in an image or other commonly related node on websites | def getText(txt, node, match=/Apache Software Foundation/i)
parent = nil # debug to show where parent needed to be fetched
if txt !~ match # have we got all the text?
if node.parent.name == 'a' # e.g. whimsical. such parents don't have extra text.
newnode = node.parent.parent
else
newnode = node... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_text_node(node)\n text = nil\n\n if node and node.text\n text = node.text\n end\n\n text\nend",
"def getText(txt, node, match=/Apache Software Foundation/i)\n parent = nil # debug to show where parent needed to be fetched\n if not txt =~ match # have we got all the text?\n if node.parent.name... | [
"0.8144036",
"0.81128067",
"0.7598846",
"0.7596566",
"0.7500164",
"0.7357231",
"0.7357231",
"0.7275129",
"0.72601765",
"0.7101732",
"0.707762",
"0.7007939",
"0.6835038",
"0.68281186",
"0.68260455",
"0.67854923",
"0.67210966",
"0.6713238",
"0.66549516",
"0.6640257",
"0.6613300... | 0.81503737 | 0 |
Do asynchronous work for each robot | def start_work
robots.each {|r| r.async.work} unless Artoo::Robot.is_running?
Artoo::Robot.running!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign(bots=[])\n robots.concat(bots)\n bots.each {|r| r.async.work} if Artoo::Robot.is_running?\n end",
"def continue_work\n robots.each {|r| r.async.continue_work}\n end",
"def continue_work\n robots.each {|r| r.async.continue_work}\n end",
"def fetch_apis_asynchronously \n... | [
"0.6499453",
"0.636173",
"0.636173",
"0.6245278",
"0.6156715",
"0.59760547",
"0.5975905",
"0.5901614",
"0.5901614",
"0.58008677",
"0.58008677",
"0.5706351",
"0.5697947",
"0.5633731",
"0.5616443",
"0.5542878",
"0.55295295",
"0.5516297",
"0.5516297",
"0.55038536",
"0.5494505",
... | 0.66700596 | 0 |
Pause work for each robot | def pause_work
robots.each {|r|
Logger.info "pausing #{r.name}"
r.async.pause_work
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pause\n super\n each_slave{ |instance, iter| instance.framework.pause{ iter.next } }\n true\n end",
"def pause; end",
"def pause\n\n end",
"def pause\n end",
"def pause\n end",
"def pause\n end",
"def pause\n \tsleeper(25)\n end",
"def pause\n \tsleeper(25... | [
"0.665695",
"0.65846664",
"0.649696",
"0.64475167",
"0.64475167",
"0.64475167",
"0.6434228",
"0.6434228",
"0.63845134",
"0.63405275",
"0.63405275",
"0.63320214",
"0.63174427",
"0.63174427",
"0.62998384",
"0.62998384",
"0.6230881",
"0.6209174",
"0.61501217",
"0.61501217",
"0.6... | 0.7972418 | 0 |
Continue work for each robot | def continue_work
robots.each {|r| r.async.continue_work}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pause_work\n robots.each {|r|\n Logger.info \"pausing #{r.name}\"\n r.async.pause_work\n }\n end",
"def pause_work\n robots.each {|r|\n Logger.info \"pausing #{r.name}\"\n r.async.pause_work\n }\n end",
"def start_work\n robots.each {|r| r.async.wo... | [
"0.66167897",
"0.66167897",
"0.65116596",
"0.65116596",
"0.6198576",
"0.6198576",
"0.61263263",
"0.5912403",
"0.5846061",
"0.5835139",
"0.57973933",
"0.5746706",
"0.5726763",
"0.5702272",
"0.5621916",
"0.5620637",
"0.55977184",
"0.5590685",
"0.5567726",
"0.5561989",
"0.554974... | 0.750228 | 0 |
escribir promedio de notas en archivo por cada alumno | def escribir_promedios(array)
#por cada alumno
array.each do |alumno|
#split en cada ,
al = alumno.split(', ').map(&:chomp)
#generar el nombre del archivo del alumno
filename = "#{al[0]}.csv"
#generar el archivo
alumno_file = File.open(filename, "w")
#obtener el promedio final del alumno... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_promedios(arr = [])\n file = File.open('promedios.txt', 'w')\n arr.each do |alumno|\n file.puts \"#{alumno.nombre}, #{alumno.promedios}, #{alumno.inasistencias} inasistencias\"\n end\n file.close\n 'Archivo creado con exito!'\nend",
"def recuperar_dados(arquivo)\n @tools.leitura arquivo\... | [
"0.6293375",
"0.5698187",
"0.55972946",
"0.5482064",
"0.5479439",
"0.540871",
"0.5356219",
"0.52712727",
"0.52115613",
"0.5180905",
"0.51721483",
"0.515341",
"0.5148717",
"0.51439124",
"0.5119987",
"0.5094891",
"0.50766385",
"0.5031997",
"0.5025254",
"0.50169426",
"0.50004846... | 0.59271646 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.