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 |
|---|---|---|---|---|---|---|
HELPER METHODS =========================================== The two drivers have slightly different ways of yielding hashes of results, so this method must be implemented to provide a uniform interface. | def each_hash(result) # :nodoc:
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_result(results = last_results, &block)\n results.each do |result|\n block.call(Hashie::Mash.new(result))\n end\nend",
"def get_db_as_hash()\n db = get_db()\n db.results_as_hash = true \n return db\n end",
"def each_hash(the_query, with_table_names = false, &block)\n b... | [
"0.57877463",
"0.57007825",
"0.56494826",
"0.5632043",
"0.56057423",
"0.56017214",
"0.55607474",
"0.5553489",
"0.555235",
"0.55475515",
"0.5543713",
"0.55344355",
"0.55117965",
"0.54950285",
"0.5489595",
"0.5467286",
"0.5443337",
"0.54361165",
"0.54039854",
"0.53991973",
"0.5... | 0.6416849 | 0 |
Create a new MySQL database with optional :charset and :collation. Charset defaults to utf8mb4. Example: create_database 'charset_test', charset: 'latin1', collation: 'latin1_bin' create_database 'matt_development' create_database 'matt_development', charset: :big5 | def create_database(name, options = {})
if options[:collation]
execute "CREATE DATABASE #{quote_table_name(name)} DEFAULT COLLATE #{quote_table_name(options[:collation])}"
elsif options[:charset]
execute "CREATE DATABASE #{quote_table_name(name)} DEFAULT CHARACTER SET #{quote_table_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_database(name, charset)\n database = ::MySQL::Database.create(name, charset)\n !database.nil?\n end",
"def create_database(name, options = {})\n options = { :encoding => 'utf8' }.merge!(options.symbolize_keys)\n\n option_string = options.sum do |key, value|\n case key\n ... | [
"0.77200854",
"0.7396388",
"0.73807687",
"0.7378632",
"0.7084339",
"0.70706314",
"0.69256747",
"0.69132864",
"0.68258864",
"0.67257595",
"0.67029697",
"0.6700407",
"0.6666678",
"0.66479194",
"0.645953",
"0.6403143",
"0.6230088",
"0.6229342",
"0.6154013",
"0.5953857",
"0.59388... | 0.79103875 | 0 |
Returns the database character set. | def charset
show_variable "character_set_database"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def character_set_name\n @dbi.character_set_name\n end",
"def character_set_name\n @dbi.character_set_name\n end",
"def character_set\n @character_set ||= show_variable('character_set_connection') || 'utf8'\n end",
"def character_set_name\n @charset.... | [
"0.80107063",
"0.80107063",
"0.77831674",
"0.7339106",
"0.7111844",
"0.7111844",
"0.6903564",
"0.6662642",
"0.658275",
"0.65800947",
"0.6554453",
"0.65480626",
"0.6508591",
"0.6502078",
"0.64863807",
"0.6377788",
"0.6307382",
"0.6171894",
"0.6106703",
"0.6077168",
"0.60539293... | 0.8039727 | 0 |
Drops a table from the database. [:force] Set to +:cascade+ to drop dependent objects as well. Defaults to false. [:if_exists] Set to +true+ to only drop the table if it exists. Defaults to false. [:temporary] Set to +true+ to drop temporary table. Defaults to false. Although this command ignores most +options+ and the... | def drop_table(table_name, **options)
schema_cache.clear_data_source_cache!(table_name.to_s)
execute "DROP#{' TEMPORARY' if options[:temporary]} TABLE#{' IF EXISTS' if options[:if_exists]} #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_table_sql(name, options)\n \"DROP TABLE#{' IF EXISTS' if options[:if_exists]} #{quote_schema_table(name)}#{' CASCADE' if options[:cascade]}\"\n end",
"def destroy!\n drop_ddl = tables.map(&:name).map do |t|\n \"drop table if exists #{t};\\n\"\n end.join\n ActiveRecord::Base... | [
"0.70287",
"0.67377406",
"0.64704764",
"0.6361707",
"0.6212682",
"0.6212682",
"0.620601",
"0.6202963",
"0.6191556",
"0.6182046",
"0.6161013",
"0.61244553",
"0.6104909",
"0.59706134",
"0.5953467",
"0.5944827",
"0.59175855",
"0.58875805",
"0.5879335",
"0.58112174",
"0.5781739",... | 0.7411839 | 0 |
Builds a ChangeColumnDefinition object. This definition object contains information about the column change that would occur if the same arguments were passed to change_column. See change_column for information about passing a +table_name+, +column_name+, +type+ and other options that can be passed. | def build_change_column_definition(table_name, column_name, type, **options) # :nodoc:
column = column_for(table_name, column_name)
type ||= column.sql_type
unless options.key?(:default)
options[:default] = column.default
end
unless options.key?(:null)
optio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_column(column_id: nil, validate_data: false, format_pattern: 'NONE', name:, type:, table:)\n column_id ||= table.columns.size\n raise ArgumentError.new('Column ID must be Integer') unless column_id.is_a?(Integer)\n raise ArgumentError.new(\"Column type must be #{ AVAILABLE_COLUMN_TYPES }\") unle... | [
"0.6489515",
"0.6462893",
"0.6026478",
"0.5490518",
"0.5443929",
"0.53347087",
"0.53216994",
"0.53018355",
"0.5295448",
"0.52528685",
"0.5224405",
"0.51864296",
"0.51670146",
"0.51607186",
"0.5155693",
"0.5139097",
"0.5111737",
"0.5058465",
"0.5056207",
"0.50541234",
"0.50538... | 0.842165 | 0 |
SHOW VARIABLES LIKE 'name' | def show_variable(name)
query_value("SELECT @@#{name}", "SCHEMA")
rescue ActiveRecord::StatementInvalid
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_variable(name)\n query('SHOW VARIABLES WHERE `variable_name` = ?', name).first.value rescue nil\n end",
"def descriptor\n ConfigvarsRails.variable_descriptor name\n end",
"def value\n mysql('-NBe', \"show variables like '#{resource[:name]}'\").split(\"\\t\")[1].chomp\n end",
... | [
"0.74665225",
"0.588237",
"0.5671308",
"0.5519296",
"0.538434",
"0.5363477",
"0.53485644",
"0.5341013",
"0.5333825",
"0.52866757",
"0.52866757",
"0.5272169",
"0.5272169",
"0.5208399",
"0.52018386",
"0.5187096",
"0.5184854",
"0.5180399",
"0.5144479",
"0.51115614",
"0.51115614"... | 0.63253236 | 1 |
Make sure we carry over any changes to ActiveRecord.default_timezone that have been made since we established the connection | def sync_timezone_changes(raw_connection)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_timezones\n if new_record?\n self.created_at_timezone ||= Time.zone.name\n else\n if self.deleted?\n self.deleted_at_timezone ||= Time.zone.name\n end\n end\n end",
"def set_timezone\n Time.zone = Time.zone_default\n end",
"def before_setup\n @original_time_z... | [
"0.72063774",
"0.71469",
"0.7085934",
"0.69347745",
"0.69347745",
"0.69347745",
"0.69347745",
"0.69347745",
"0.68296355",
"0.6810101",
"0.6745839",
"0.67003363",
"0.6675422",
"0.66668737",
"0.65338117",
"0.6483802",
"0.6407198",
"0.63957036",
"0.6345897",
"0.6341086",
"0.6336... | 0.74166185 | 0 |
Produces a planet from Stargate. | def planet
fetch('stargate.planets')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_planet(name, mass, year_length, diameter, number_of_moons, distance_from_sun)\n return Planet.new(name, mass, year_length, diameter, number_of_moons, distance_from_sun)\nend",
"def planet\n fetch('dune.planets')\n end",
"def add_planet\n planet = Planet.new(get_planet_name, get_pla... | [
"0.7159391",
"0.6616675",
"0.6404045",
"0.6393684",
"0.6393615",
"0.6393615",
"0.6393615",
"0.6393615",
"0.6393615",
"0.616198",
"0.6131664",
"0.60030705",
"0.59741247",
"0.59675753",
"0.59631085",
"0.594851",
"0.59319174",
"0.5863729",
"0.5756633",
"0.5756148",
"0.57384753",... | 0.7374267 | 0 |
Produces a quote from Stargate. | def quote
fetch('stargate.quotes')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quote\n quote_of_the_day[0...second_to_last_index(quote_of_the_day, \"~\")].gsub(/(\\A[^a-zA-z0-9\"']*|\\s*\\z)/, \"\")\n end",
"def quote\n fetch('final_space.quotes')\n end",
"def quote\n fetch('simpsons.quotes')\n end",
"def quote; end",
"def quote; end",
... | [
"0.6427196",
"0.64128244",
"0.6374833",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
"0.63076824",
... | 0.7703826 | 0 |
Index of provided node in children list | def index_of(child)
children.index(child)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_child_index\n return 0\n end",
"def own_child_index\n return nil if parent.nil? # self is root\n own_index = nil\n parent.children.each_with_index { |c,i|\n if self == c\n own_index = i\n break\n end\n }\n own_index\n end",
"def left_... | [
"0.76742184",
"0.7532127",
"0.7369772",
"0.7337128",
"0.7261996",
"0.72143",
"0.7148654",
"0.7115117",
"0.703771",
"0.70130855",
"0.69766545",
"0.6895524",
"0.6895524",
"0.6849534",
"0.6835928",
"0.6800404",
"0.6752169",
"0.6731827",
"0.6727014",
"0.6716052",
"0.6690258",
"... | 0.794102 | 0 |
Get List of Fax Receipts | def fax_receipt_list
# Prepare query url.
_query_builder = Configuration.base_uri.dup
_query_builder << '/fax/receipts'
_query_url = APIHelper.clean_url _query_builder
# Prepare and execute HttpRequest.
_request = @http_client.get(
_query_url
)
BasicAut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receipts_plist\n plist_virtual_attribute_get(:receipts)\n end",
"def fee_receipts\n unless params[:search].present?\n @start_date=@end_date=FedenaTimeSet.current_time_to_local_time(Time.now).to_date\n else\n @start_date=date_fetch('start_date_as')\n @end_date=date_fetch('end_date_as'... | [
"0.65498495",
"0.6437965",
"0.62711227",
"0.6176253",
"0.5866492",
"0.58204156",
"0.58074254",
"0.571122",
"0.5708426",
"0.5699477",
"0.56959105",
"0.56889147",
"0.56848586",
"0.5673113",
"0.56723094",
"0.56723094",
"0.56682193",
"0.5664647",
"0.562958",
"0.5618523",
"0.55921... | 0.83824164 | 0 |
Get a single fax receipt based on message id. | def get_fax_receipt(message_id)
# Validate required parameters.
validate_parameters(
'message_id' => message_id
)
# Prepare query url.
_query_builder = Configuration.base_uri.dup
_query_builder << '/fax/receipts/{message_id}'
_query_builder = APIHelper.append_ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(id)\n response = Network.get(['Faxes', id])\n Fax.new(response)\n end",
"def sms_receipts_by_message_id_get(message_id, opts = {})\n data, _status_code, _headers = sms_receipts_by_message_id_get_with_http_info(message_id, opts)\n data\n end",
"def get(message_id)\r\n ... | [
"0.6714761",
"0.62932956",
"0.5854769",
"0.5836609",
"0.5661811",
"0.5489899",
"0.5489551",
"0.5484675",
"0.5414108",
"0.5411747",
"0.53724015",
"0.5356397",
"0.5356246",
"0.5341058",
"0.53409344",
"0.5304023",
"0.52745706",
"0.5265222",
"0.5215288",
"0.5210394",
"0.51994467"... | 0.80186594 | 0 |
Get a list of Fax History. | def get_fax_history(date_from = nil,
date_to = nil,
q = nil,
order = nil)
# Prepare query url.
_query_builder = Configuration.base_uri.dup
_query_builder << '/fax/history'
_query_builder = APIHelper.append_url_with_qu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fax_history_get(api_key, opts = {})\n fax_history_get_with_http_info(api_key, opts)\n return nil\n end",
"def filing_history_list(company_number, category = nil, items_per_page = nil, start_index = nil)\n params = {category: category}\n params[:items_per_page] = items_per_page if i... | [
"0.7071993",
"0.6696848",
"0.64732015",
"0.64437896",
"0.64348733",
"0.64341384",
"0.63811946",
"0.6302121",
"0.6215293",
"0.61590374",
"0.61559445",
"0.61515623",
"0.61515623",
"0.61101437",
"0.6091837",
"0.60236305",
"0.60084295",
"0.60033023",
"0.5991136",
"0.59829336",
"0... | 0.72762644 | 0 |
Produces a random university prefix. | def prefix
fetch('university.prefix')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix\n (\"aa\"..\"zz\").to_a.sample(2).to_s\n end",
"def create_name\n prefix = ('A'...'Z').to_a.shuffle[0..1].join('')\n suffix = (100..1000).to_a.sample\n \"#{prefix}#{suffix}\"\n end",
"def name_prefix\n Faker::Name.prefix\n end",
"def name_prefix\n Faker::Name.prefi... | [
"0.67843586",
"0.6739261",
"0.67103356",
"0.67103356",
"0.66755575",
"0.6638696",
"0.6542381",
"0.64919627",
"0.64751035",
"0.6459034",
"0.64587235",
"0.6442107",
"0.6375788",
"0.6367254",
"0.63616246",
"0.6360397",
"0.6352027",
"0.63262033",
"0.6324436",
"0.63027674",
"0.627... | 0.69970393 | 0 |
Produces a random greek organization. | def greek_organization
Array.new(3) { |_| sample(greek_alphabet) }.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greek_organization; end",
"def random_name\n (1..3).map {\"\" << rand(26) + 65}.to_s\n end",
"def rand_brancket\n (rand(2) == 0) ? \"【#{FFaker::Food.meat}】\" : ''\nend",
"def random_string\n (0...100).map { (\"a\"..\"z\").to_a[rand(26)] }.join\n end",
"def random_string\n (0...100).ma... | [
"0.70085377",
"0.63878703",
"0.6242443",
"0.62397784",
"0.62397784",
"0.6221738",
"0.62148243",
"0.61883605",
"0.61774874",
"0.6172007",
"0.61669487",
"0.6163203",
"0.615962",
"0.61050236",
"0.60813075",
"0.60620695",
"0.6050576",
"0.6020023",
"0.6017904",
"0.60037756",
"0.59... | 0.8013974 | 0 |
Private: Parses the payload to UTF. payload the payload string Returns a string. | def crypt_keeper_payload_parse(payload)
payload.encode('UTF-8', 'binary',
invalid: :replace, undef: :replace, replace: '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_payload\n raise EmptyPayloadException.new unless payload\n raise PayloadEncodingException.new unless payload.encoding.to_s == \"UTF-8\"\n raise PayloadFormattingException.new if payload =~ / /\n end",
"def validate_payload_encoding\n\t\t\tif self.opcode == :binary\n\t\t\t\tself.log.debug \... | [
"0.62006783",
"0.58458453",
"0.5787604",
"0.5679404",
"0.5602987",
"0.55685115",
"0.5510762",
"0.54461074",
"0.54351884",
"0.5427805",
"0.5420967",
"0.5415065",
"0.535099",
"0.5347051",
"0.5338113",
"0.53340226",
"0.53127503",
"0.5300515",
"0.52610123",
"0.5240466",
"0.524046... | 0.7363163 | 0 |
Private: Filters the payload. payload the payload string Returns a string. | def crypt_keeper_filter_postgres_log(payload)
payload.gsub(FILTER) do |_|
"#{$~[:operation]}([FILTERED])"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(val)\n raise \"filter requires a String.\" unless val.is_a? String\n @filter = val\n self\n end",
"def filter_string\n\t\treturn self.filter.to_s\n\tend",
"def filter(editable_payload, level, event_name)\n raise NotImplementedError,\n 'You must implement the met... | [
"0.57931453",
"0.5738752",
"0.56381243",
"0.5625995",
"0.55760115",
"0.5547066",
"0.5518767",
"0.5470776",
"0.5434641",
"0.5420411",
"0.5351926",
"0.5351926",
"0.53260195",
"0.5282426",
"0.52692515",
"0.5251239",
"0.52099776",
"0.5193109",
"0.5188539",
"0.5187708",
"0.5187708... | 0.66911334 | 0 |
Sets up this module to make API calls. The first argument is the developer's API key. The other three are the URLs corresponding to the three parts of the api. No API calls will work until this function is called. API objects will only be instantiated for URLs that are passed in. Arguments: api_key The developer's API ... | def initialize(api_key, servers, restaurant_url=nil, user_url=nil, order_url=nil)
@api_key = api_key
if servers!=:custom
unless restaurant_url.nil? and user_url.nil? and order_url.nil?
raise ArgumentError.new("Individual URL parameters can only be set if servers is set to :custom")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(api_url:, api_key:, verbose: false)\n self.api_url = api_url.is_a?(Addressable::URI) ? api_url : Addressable::URI.parse(api_url)\n self.api_key = api_key\n self.verbose = verbose\n end",
"def initialize(api_key:, url_prefix:)\n @api_key = api_key\n @url_prefix = url_pre... | [
"0.66801316",
"0.6490914",
"0.6483077",
"0.6398358",
"0.6366513",
"0.63611907",
"0.636038",
"0.6358908",
"0.6353611",
"0.6291196",
"0.6273451",
"0.62396616",
"0.62153476",
"0.6182823",
"0.6145325",
"0.6129982",
"0.6129982",
"0.6090915",
"0.60746026",
"0.606189",
"0.606037",
... | 0.77412903 | 0 |
GET /keystrokes/1 GET /keystrokes/1.json | def show
@keystroke = Keystroke.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @keystroke }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @keystroke = Keystroke.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @keystroke }\n end\n end",
"def destroy\n @keystroke = Keystroke.find(params[:id])\n @keystroke.destroy\n\n respond_to do |format|\n format.html { redirect_t... | [
"0.6878949",
"0.61304903",
"0.5849774",
"0.57377934",
"0.57247007",
"0.5721642",
"0.5517294",
"0.54333633",
"0.54104704",
"0.53931254",
"0.5384326",
"0.5371188",
"0.5366341",
"0.53542",
"0.5346104",
"0.5280844",
"0.5267479",
"0.5240085",
"0.52262574",
"0.52258515",
"0.5220722... | 0.7360926 | 0 |
GET /keystrokes/new GET /keystrokes/new.json | def new
@keystroke = Keystroke.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @keystroke }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @key = Key.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @key }\n end\n end",
"def create\n @keystroke = Keystroke.new(params[:keystroke])\n\n respond_to do |format|\n if @keystroke.save\n format.html { redirect_to @keystr... | [
"0.68736017",
"0.6770503",
"0.6457825",
"0.6423651",
"0.6397754",
"0.62544847",
"0.6229272",
"0.622481",
"0.6159139",
"0.6154632",
"0.61148155",
"0.6052795",
"0.6015635",
"0.5947372",
"0.59089154",
"0.5897333",
"0.58628786",
"0.58190656",
"0.58084196",
"0.5785126",
"0.5765239... | 0.80335706 | 0 |
POST /keystrokes POST /keystrokes.json | def create
@keystroke = Keystroke.new(params[:keystroke])
respond_to do |format|
if @keystroke.save
format.html { redirect_to @keystroke, notice: 'Keystroke was successfully created.' }
format.json { render json: @keystroke, status: :created, location: @keystroke }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @keystroke = Keystroke.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @keystroke }\n end\n end",
"def key_stroke(keycodeText)\n append_to_script \"key_stroke \\\"#{keycodeText}\\\"\"\n end",
"def keystroke(character, *special_keys)\n ... | [
"0.64852476",
"0.58864564",
"0.56439817",
"0.5606263",
"0.5569623",
"0.54804087",
"0.5454897",
"0.54340047",
"0.54230803",
"0.54145926",
"0.5387479",
"0.53107893",
"0.5290351",
"0.521464",
"0.5178139",
"0.517775",
"0.5176327",
"0.5139103",
"0.5129177",
"0.51184237",
"0.509775... | 0.67166984 | 0 |
PUT /keystrokes/1 PUT /keystrokes/1.json | def update
@keystroke = Keystroke.find(params[:id])
respond_to do |format|
if @keystroke.update_attributes(params[:keystroke])
format.html { redirect_to @keystroke, notice: 'Keystroke was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @key.update(key_params)\n render json: @key\n else\n render json: @key.errors, status: :unprocessable_entity\n end\n end",
"def update\n @key = Key.find(params[:id])\n\n respond_to do |format|\n if @key.update_attributes(params[:key])\n format.html { redirect... | [
"0.6206077",
"0.6018809",
"0.5901821",
"0.58911437",
"0.5871408",
"0.5773485",
"0.57012445",
"0.5536976",
"0.55151796",
"0.5501271",
"0.5458104",
"0.54576004",
"0.54575896",
"0.5456714",
"0.5422416",
"0.5420822",
"0.54191434",
"0.54185015",
"0.5417782",
"0.54141974",
"0.54088... | 0.6978473 | 0 |
DELETE /keystrokes/1 DELETE /keystrokes/1.json | def destroy
@keystroke = Keystroke.find(params[:id])
@keystroke.destroy
respond_to do |format|
format.html { redirect_to keystrokes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @key = Key.find(params[:id])\n @key.destroy\n\n respond_to do |format|\n format.html { redirect_to keys_url }\n format.json { head :no_content }\n end\n end",
"def delete(key)\n\n end",
"def delete(key); end",
"def delete(key); end",
"def delete(key); end",
"def de... | [
"0.653288",
"0.64250773",
"0.62421864",
"0.62421864",
"0.62421864",
"0.62421864",
"0.62421864",
"0.6230025",
"0.6228251",
"0.6226594",
"0.6204302",
"0.62005967",
"0.61666894",
"0.6131496",
"0.6129134",
"0.61017936",
"0.6052575",
"0.6027302",
"0.60168105",
"0.5990207",
"0.5968... | 0.76622117 | 0 |
Recursively searches a hash for the passed key and returns the value (if there is one). | def recursive_find_by_key(key)
# Create a stack of hashes to search through for the needle which
# is initially this hash
stack = [ self ]
# So long as there are more haystacks to search...
while (to_search = stack.pop)
# ...keep searching for this particular key...
to_search.each do |k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(key)\n if @root.nil?\n return nil\n elsif @root.key == key\n return @root.value\n else\n find_helper(@root, key)\n end\n end",
"def nested_hash_value(obj, key)\n if obj.respond_to?(:key?) && obj.key?(key)\n obj[key]\n elsif obj.respond_to?(:each)\n r =... | [
"0.70975167",
"0.7043736",
"0.70150083",
"0.6986737",
"0.6805482",
"0.67907053",
"0.6748154",
"0.6737833",
"0.67356384",
"0.6659147",
"0.66122466",
"0.6604083",
"0.6591171",
"0.65721726",
"0.6565527",
"0.6554034",
"0.65409863",
"0.6517451",
"0.65037924",
"0.6502858",
"0.64837... | 0.71257895 | 0 |
Same as _deep_transform_keys_in_object, but destructively alters the original Object. | def _deep_transform_keys_in_object!(object, &block)
case object
when Hash
object.keys.each do |key|
value = object.delete(key)
object[yield(key)] = _deep_transform_keys_in_object!(value, &block)
end
object
when Array
object.map! { |e| _deep_transform_keys_in_object!(e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deep_transform_keys_in_object!(object, &block)\n case object\n when Hash\n object.keys.each do |key|\n value = object.delete(key)\n object[yield(key)] = _deep_transform_keys_in_object!(value, &block)\n end\n object\n when Array\n object.map! {|e| _deep_transform_keys... | [
"0.78892326",
"0.77043843",
"0.77043843",
"0.77043843",
"0.77043843",
"0.76552725",
"0.75506014",
"0.75368303",
"0.7516592",
"0.7516592",
"0.7516585",
"0.74636364",
"0.7456295",
"0.7442446",
"0.7335532",
"0.73181593",
"0.73181593",
"0.72149193",
"0.7202065",
"0.71459836",
"0.... | 0.7855041 | 1 |
Subclass inherites superclass's fields. | def inherited(subclass)
subclass.instance_variable_set(:@__ignore_identities__, @__ignore_identities__.clone)
subclass.instance_variable_set(:@fields, @fields.clone)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inherited(subclass)\n super\n subclass.fields = fields.dup\n end",
"def inherited(subclass)\n subclass.instance_variable_set(\"@fields\", fields.dup)\n subclass.instance_variable_set(\"@relations\", relations.dup)\n end",
"def inherited(subclass)\n super\n... | [
"0.82873887",
"0.78663033",
"0.7751325",
"0.7615113",
"0.7586807",
"0.732785",
"0.7183797",
"0.71493727",
"0.70992875",
"0.69389707",
"0.69261026",
"0.69217896",
"0.69180936",
"0.68682444",
"0.68166894",
"0.67152816",
"0.6712096",
"0.6712096",
"0.67065984",
"0.6606857",
"0.65... | 0.80845064 | 1 |
For the example flag its run metadata to true | def flag_example!
example.metadata[:run] = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_example?\n false\n end",
"def example_started(example)\n end",
"def rspec_example_metadata(cmd, stdout, stderr)\n return unless @example\n @example.metadata[:command] = cmd\n @example.metadata[:stdout] = stdout\n @example.metadata[:stderr] = stderr\n end"... | [
"0.6471989",
"0.64002866",
"0.6301712",
"0.60915303",
"0.59801346",
"0.5842643",
"0.58282197",
"0.58263654",
"0.57864195",
"0.5754388",
"0.5732268",
"0.5706813",
"0.5692208",
"0.5649717",
"0.5630308",
"0.5586831",
"0.55422276",
"0.5537149",
"0.551475",
"0.54888767",
"0.548815... | 0.8983358 | 0 |
++ Callback for when a new row from the model is created. Logs the action, the instance and the linked user, if available. | def after_create(record)
contents = to_sql_insert(record)
to_logfile(contents)
# Send a notification to the admin, if requested:
if @email_on_create
AgexMailer.action_notify_mail(
record.respond_to?(:user) ? record.user : nil,
"#{@table_name} row CREATED",
contents
).... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_create\n if self.class.name == 'ParticipantsSportEntry'\n model = self.sport_entry\n action = 'UPDATE'\n else\n model = self\n action = 'CREATE'\n end\n\n ModelAuditJob.perform_now(model, action, audit_user_id)\n end",
"def on_creating_entry(state, event, *event_args)\n ... | [
"0.62272257",
"0.5960874",
"0.5947744",
"0.5945002",
"0.5897008",
"0.58801216",
"0.58084255",
"0.58036363",
"0.5776784",
"0.5671715",
"0.5650066",
"0.5642452",
"0.5640213",
"0.5640213",
"0.5626831",
"0.55788386",
"0.55644894",
"0.5503497",
"0.5462635",
"0.5462394",
"0.5462149... | 0.6346749 | 0 |
++ Appends the specified contents on logfile. | def to_logfile(contents)
File.open(@log_filename, 'a') { |f| f.puts contents } unless contents.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_log_file(str)\n append_file(@log_file, str)\n end",
"def add_in_logfile(date, adresse, utilisateur_id, description)\n fichier = \"app/../log/logs.txt\"\n if File.exist?(fichier)\n mode = 'a'\n check_logfile_size(fichier)\n else\n mode = 'w'\n end\n open(fichier, mode)... | [
"0.73818517",
"0.72938806",
"0.7093818",
"0.70292366",
"0.6922759",
"0.67276776",
"0.66566414",
"0.6652661",
"0.6609772",
"0.6551964",
"0.6502007",
"0.6463983",
"0.6455916",
"0.6449679",
"0.6423964",
"0.63783777",
"0.6368556",
"0.63674796",
"0.6358892",
"0.6338118",
"0.630324... | 0.7897593 | 0 |
TLSv1.3 reuse is always on | def test_off_tls1_3
skip 'TLSv1.3 unavailable' unless Puma::MiniSSL::HAS_TLS1_3 && CLIENT_HAS_TLS1_3
reused = run_session 'nil'
assert reused, 'TLSv1.3 session was not reused'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_tlsv1_1; end",
"def no_tlsv1; end",
"def tls?; end",
"def bad_tlsv1_3?; end",
"def start_tls(host, ssl_socket_class, ssl_context); end",
"def starttls_always?; end",
"def starttls_auto?; end",
"def starttls?; end",
"def use_dtls\n @MySocket = MySocket.new\n @MySocket.socket_type = ... | [
"0.70453817",
"0.69870096",
"0.69190705",
"0.6842957",
"0.68168056",
"0.66559935",
"0.66394794",
"0.6622664",
"0.65920067",
"0.6552831",
"0.6531199",
"0.64529127",
"0.6402497",
"0.6349706",
"0.6304761",
"0.6294923",
"0.6268668",
"0.6232452",
"0.62277454",
"0.62243193",
"0.613... | 0.7328142 | 0 |
MYITASA list myItasa shows | def myitasa_shows
raise APIError, 'not logged in' if @authcode.nil?
res = call(
'myitasa/shows',
'authcode' => @authcode
)
res.body['Itasa_Rest2_Server_Myitasa']['shows']['shows'].values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @akis = Aki.all\n end",
"def show\n @itens = @genero.itens.group(\"itens.id\").paginate(page: params[:page], :per_page => 30)\n end",
"def index\n @the_loai_saches = TheLoaiSach.all\n end",
"def index\n @avis = Avi.all\n end",
"def index\n @anuphats = Anuphat.all\n end",
"... | [
"0.6459813",
"0.6303081",
"0.6282277",
"0.6268951",
"0.6257568",
"0.6251671",
"0.6229449",
"0.6201208",
"0.61699325",
"0.6157011",
"0.6130558",
"0.60957867",
"0.6086649",
"0.60738844",
"0.6072564",
"0.606",
"0.60546863",
"0.6054395",
"0.60202044",
"0.601346",
"0.6007974",
"... | 0.6962708 | 0 |
show last myItasa subtitles | def myitasa_last_subtitles(page = nil)
raise APIError, 'not logged in' if @authcode.nil?
res = call(
'myitasa/lastsubtitles',
'authcode' => @authcode,
'page' => page
)
res.body['Itasa_Rest2_Server_Myitasa']['lastsubtitles']['subtitles'].values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtitle\n {}\n end",
"def full_title subtitle\n\n\t\tbase = \"Codewatch.pl\"\n\n\t\tif not @company.nil?\n\t\t\tbase = @company.name + \" :: \" + base\n\t\tend\n\n\t\tif not @project.nil? and !@project.new_record?\n\t\t\tbase = @project.name + \" :: \" + base\n\t\tend\n\n\t\tif subtitle.blank?\n\t\t\tba... | [
"0.63475686",
"0.6194585",
"0.61317194",
"0.60926104",
"0.6050513",
"0.60283554",
"0.5932728",
"0.592458",
"0.58801436",
"0.5863749",
"0.5824886",
"0.5820066",
"0.58137244",
"0.58023244",
"0.5790305",
"0.5775616",
"0.57693094",
"0.57647765",
"0.5764667",
"0.57557064",
"0.5692... | 0.7237585 | 0 |
remove a show from myItasa | def myitasa_remove_show(show_id, version)
raise APIError, 'not logged in' if @authcode.nil?
res = call(
'myitasa/removeShowFromPref',
'authcode' => @authcode,
'show_id' => show_id,
'version' => version
)
res.body['Itasa_Rest2_Server_Myitasa']['removeShowFromPref'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfavorite_a_show(show_id)\n previous_clicks = Interest.where('user_id' => self.id,\n 'show_id' => show_id).all\n for elt in previous_clicks\n elt.destroy\n end\n end",
"def del\n\t\t#methode ruft show auf ==> !?! ==> err aber funktioniert\n\tend",
"def re... | [
"0.6954534",
"0.68472123",
"0.6779288",
"0.6446025",
"0.62399924",
"0.6151446",
"0.603143",
"0.603143",
"0.601403",
"0.5996378",
"0.58847344",
"0.5853025",
"0.5851104",
"0.5849674",
"0.58006966",
"0.58006966",
"0.58006966",
"0.58006966",
"0.5791528",
"0.5767778",
"0.574896",
... | 0.7420498 | 0 |
Initialise with a lexicon directory | def initialize(lexicon_dir = nil)
@tagparser = USASTools::SemTag::Parser.new(USASTools::SemTag::Taxonomy.new(TAXONOMY_FILE))
@lexicons = load_lexicons(lexicon_dir) if lexicon_dir
@valid_languages = Dir.glob(File.join(TEMPLATE_DIR, LANGUAGE_REF_DIR, '*.erb')).map{ |x| File.basename(x).gsub(/\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @lexicons = Hash.new {|hash, k| hash[k] = []}\n File.open(lexicon_path, 'r').each do |line|\n line = line.split\n @lexicons[line.shift] = line\n end\n end",
"def initialize(ngrams_path, lexicon_path, interpolations = nil)\n @ngrams_path = File.expan... | [
"0.72203845",
"0.68922275",
"0.64483106",
"0.6238303",
"0.61230874",
"0.5960258",
"0.59430695",
"0.5938836",
"0.59134763",
"0.5860554",
"0.5860554",
"0.5776075",
"0.57745945",
"0.57355803",
"0.57236266",
"0.57194513",
"0.56809",
"0.56761885",
"0.56683415",
"0.56601095",
"0.56... | 0.71702266 | 1 |
Is the action valid at this time? | def valid?(action)
self.respond_to?(action.to_sym) && VALID_ACTIONS.include?(action)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n return false if @action.nil?\n return false if @repeat.nil?\n true\n end",
"def valid?\n \n \n if @action.nil?\n return false\n end\n\n \n \n allowed_values = [\"DELETE\", \"EXPORT\"]\n if @action && !allowed_values.include?(@action)\n... | [
"0.820898",
"0.7990239",
"0.77358377",
"0.7545089",
"0.75231314",
"0.7410604",
"0.734058",
"0.7271474",
"0.72609496",
"0.71714884",
"0.7143502",
"0.7086672",
"0.7085747",
"0.708552",
"0.70381063",
"0.7034114",
"0.6981208",
"0.6935682",
"0.692516",
"0.6924839",
"0.6924839",
... | 0.8120907 | 1 |
Check if a worker has done a word before | def check_worker_id(args)
# Load params
worker = args['worker'].to_s.strip
word = args['word'].to_s.strip.downcase
# Load hash of who has done what
worker_words = YAML::Store.new(AMT_WORKER_WORD_LIST)
previous_work = worker_words.transaction do (worker_words[worker] && worker_words[worke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_worker_word(worker, word)\n # puts \"######### #{worker} ######## #{word}\"\n\n # Load hash of who has done what\n worker_words = YAML::Store.new(AMT_WORKER_WORD_LIST)\n worker_words.transaction do\n # Set to array if she be not exist and add the word to the list\n worker_words[wo... | [
"0.6134283",
"0.61342525",
"0.5825287",
"0.58099174",
"0.56204337",
"0.5619865",
"0.56002283",
"0.5587403",
"0.5570429",
"0.5555913",
"0.54384136",
"0.54368955",
"0.5432886",
"0.54173166",
"0.54097795",
"0.540072",
"0.5383527",
"0.53751",
"0.53508466",
"0.5345757",
"0.5342739... | 0.67582035 | 0 |
Load all lexicons from a directory and return them indexed by basename | def load_lexicons(dir)
require 'usastools/lexicon'
puts "Loading lexicons from #{dir}..."
pl = USASTools::Lexicon::Parser.new(
{semtag_parser: USASTools::SemTag::Parser.new(true, lambda{|*_| return true}, lambda{|*_| return true})},
{},
{
case_sensitive: false,
error_cb:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @lexicons = Hash.new {|hash, k| hash[k] = []}\n File.open(lexicon_path, 'r').each do |line|\n line = line.split\n @lexicons[line.shift] = line\n end\n end",
"def parse_lexicon!\n read(lexicon_path) do |values|\n values.compact!\n\n word, w... | [
"0.6495603",
"0.5862242",
"0.58618087",
"0.5815387",
"0.5785531",
"0.5778278",
"0.57340676",
"0.56956303",
"0.5683282",
"0.5580797",
"0.5575757",
"0.552552",
"0.5474527",
"0.547444",
"0.5452975",
"0.5448757",
"0.5446009",
"0.5418177",
"0.5397736",
"0.53865564",
"0.53850037",
... | 0.7640452 | 0 |
Parse JSON from the selection form. Ensures that the json is internallyconsistent, and strips all of the data out into a new, ordered, list of tags in descending order of preference. | def parse_tag_JSON(json)
obj = JSON.parse(json)
# Each tag should have
#
# prefix: prefix,
# name: name,
# positive: positive
#
# and each input json should have
# { order: [ prefix, prefix...]
# selection: { prefix: {tag as above},
# prefix: {tag ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selected_tags=(data)\n self.tags.clear\n data.split('tag').each { |id| self.tags << Tag.find(id) if id.length > 0 }\n end",
"def parse_json(json)\n ::JSON.parse(json, :create_additions => false)\n end",
"def parse json; return JSON.parse File.read json end",
"def parse json; return JSON.pa... | [
"0.5351482",
"0.5288361",
"0.5216189",
"0.5216189",
"0.5092325",
"0.50148124",
"0.5013826",
"0.4950033",
"0.4943052",
"0.49019614",
"0.48892185",
"0.48752514",
"0.48743552",
"0.4853825",
"0.48045588",
"0.48043972",
"0.48008823",
"0.48008823",
"0.47211853",
"0.46948326",
"0.46... | 0.718916 | 0 |
Check if a worker has done a word before | def set_worker_word(worker, word)
# puts "######### #{worker} ######## #{word}"
# Load hash of who has done what
worker_words = YAML::Store.new(AMT_WORKER_WORD_LIST)
worker_words.transaction do
# Set to array if she be not exist and add the word to the list
worker_words[worker] = [] unl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_worker_id(args)\n \n # Load params\n worker = args['worker'].to_s.strip\n word = args['word'].to_s.strip.downcase\n\n # Load hash of who has done what\n worker_words = YAML::Store.new(AMT_WORKER_WORD_LIST)\n previous_work = worker_words.transaction do (worker_words[worker] && worke... | [
"0.67582035",
"0.61342525",
"0.5825287",
"0.58099174",
"0.56204337",
"0.5619865",
"0.56002283",
"0.5587403",
"0.5570429",
"0.5555913",
"0.54384136",
"0.54368955",
"0.5432886",
"0.54173166",
"0.54097795",
"0.540072",
"0.5383527",
"0.53751",
"0.53508466",
"0.5345757",
"0.534273... | 0.6134283 | 1 |
Functions for handling band_musician HABTM management GET /bands/1/addmusician | def add_musician
@band = Band.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_band_albums\n @band_album = BandAlbum.find(params[:id])\n end",
"def create\n @band = Band.find(params[:band_id])\n @album = Band.find(params[:band_id]).albums.build(album_params)\n\n respond_to do |format|\n if @album.save\n format.html { redirect_to new_band_album_song_path... | [
"0.61438066",
"0.6006179",
"0.5877538",
"0.57935894",
"0.56938714",
"0.56598675",
"0.5617073",
"0.548602",
"0.54144955",
"0.54003686",
"0.5387357",
"0.5370931",
"0.5330105",
"0.5323411",
"0.5299777",
"0.52876997",
"0.522167",
"0.52166724",
"0.5203303",
"0.5203303",
"0.5203303... | 0.7605662 | 0 |
Sets the devise scope to be used in the controller. If you have custom routes, you are required to call this method (also aliased as :as) in order to specify to which controller it is targeted. as :user do get "sign_in", to: "devise/sessionsnew" end Notice you cannot have two scopes mapping to the same URL. And remembe... | def devise_scope(scope)
constraint = lambda do |request|
request.env["devise.mapping"] = Devise.mappings[scope]
true
end
constraints(constraint) do
yield
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def devise_scope(scope); end",
"def scope_path\n opts = {}\n route = :\"new_#{scope}_session_path\"\n alt_route = :\"new_#{scope}_ichain_session_path\"\n opts[:format] = request_format unless skip_format?\n\n config = Rails.application.config\n opts[:script_name] = (config.relative_url_root if... | [
"0.63038975",
"0.60145664",
"0.56660396",
"0.5660806",
"0.55076504",
"0.5474653",
"0.54698837",
"0.5284277",
"0.52402264",
"0.52402264",
"0.5200738",
"0.5157306",
"0.5135411",
"0.5102347",
"0.5083151",
"0.5047014",
"0.50278544",
"0.50278544",
"0.50207245",
"0.5019525",
"0.498... | 0.650471 | 0 |
Set resonable defaults for a new schedule disposition update event | def set_defaults
super
self.disposition_year ||= current_planning_year_year
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_defaults\n super\n self.disposition_type ||= transam_asset.disposition_updates.last.try(:disposition_type)\n self.asset_event_type ||= AssetEventType.find_by_class_name(self.name)\n end",
"def set_defaults\n if self.state.blank?\n self.state ||= :unsubmitted\n end\n if self.priori... | [
"0.6756056",
"0.6198075",
"0.6195358",
"0.6011378",
"0.59645414",
"0.5936624",
"0.5936624",
"0.5924654",
"0.58832496",
"0.587119",
"0.5857892",
"0.5774789",
"0.5774789",
"0.5762118",
"0.5725462",
"0.56899446",
"0.5659203",
"0.5640756",
"0.5635095",
"0.5630209",
"0.5629499",
... | 0.6576574 | 1 |
DELETE /faqs/1 DELETE /faqs/1.json | def destroy
@faq = Helpdesk::Faq.find(params[:id])
@faq.destroy
respond_to do |format|
format.html { redirect_to admin_faqs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @faq = Faq.find(params[:id])\n @faq.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_faqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_faq.destroy\n respond_to do |format|\n format.html { redirect_to admin_faqs_ur... | [
"0.71004444",
"0.68754107",
"0.6869112",
"0.6863694",
"0.68629193",
"0.68523794",
"0.68523794",
"0.67636675",
"0.67228574",
"0.67146635",
"0.66786647",
"0.6674779",
"0.66706693",
"0.6658279",
"0.66508406",
"0.66394943",
"0.6626388",
"0.6615939",
"0.6615246",
"0.65891176",
"0.... | 0.7021236 | 1 |
GET /lookup_pettracers/1 GET /lookup_pettracers/1.xml | def show
@lookup_pettracer = LookupPettracer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @lookup_pettracer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_pettracer }\n end\n end",
"def new\n @lookup_pettracer = LookupPettracer.new\n\n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.617898",
"0.6178828",
"0.5629938",
"0.56234324",
"0.5599871",
"0.55295986",
"0.5497101",
"0.5496962",
"0.5491627",
"0.5441498",
"0.5411596",
"0.5232296",
"0.5232296",
"0.51972854",
"0.5173034",
"0.51612353",
"0.51506937",
"0.51472586",
"0.5144232",
"0.5136531",
"0.5100024"... | 0.70403606 | 0 |
GET /lookup_pettracers/new GET /lookup_pettracers/new.xml | def new
@lookup_pettracer = LookupPettracer.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @lookup_pettracer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @lookup_pettracer = LookupPettracer.new(params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :xml => @lookup_pettracer,... | [
"0.6986458",
"0.6785958",
"0.6715071",
"0.663035",
"0.6353197",
"0.62890637",
"0.6262899",
"0.6211364",
"0.6172767",
"0.6135101",
"0.61207235",
"0.6089706",
"0.60735816",
"0.6056022",
"0.6056022",
"0.60174274",
"0.5950391",
"0.59489316",
"0.59164035",
"0.591276",
"0.58937114"... | 0.77304757 | 1 |
POST /lookup_pettracers POST /lookup_pettracers.xml | def create
@lookup_pettracer = LookupPettracer.new(params[:lookup_pettracer])
respond_to do |format|
if @lookup_pettracer.save
format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }
format.xml { render :xml => @lookup_pettracer, :status =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @lookup_pettracer = LookupPettracer.new(lookup_pettracer_params)#params[:lookup_pettracer])\n\n respond_to do |format|\n if @lookup_pettracer.save\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully created.') }\n format.xml { render :... | [
"0.66099983",
"0.6114222",
"0.61133844",
"0.5912088",
"0.5912088",
"0.5796141",
"0.5335628",
"0.5335628",
"0.518648",
"0.5173311",
"0.5116872",
"0.4898803",
"0.48800823",
"0.48636475",
"0.4845849",
"0.4825261",
"0.48101485",
"0.48078805",
"0.477831",
"0.47346777",
"0.472848",... | 0.6679185 | 0 |
PUT /lookup_pettracers/1 PUT /lookup_pettracers/1.xml | def update
@lookup_pettracer = LookupPettracer.find(params[:id])
respond_to do |format|
if @lookup_pettracer.update_attributes(params[:lookup_pettracer])
format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully updated.') }
format.xml { head :ok }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @lookup_pettracer = LookupPettracer.find(params[:id])\n\n respond_to do |format|\n if @lookup_pettracer.update(lookup_pettracer_params)#params[:lookup_pettracer], :without_protection => true)\n format.html { redirect_to(@lookup_pettracer, :notice => 'Lookup pettracer was successfully... | [
"0.6480511",
"0.60778826",
"0.5935224",
"0.57746637",
"0.57746637",
"0.5695609",
"0.5695609",
"0.55353755",
"0.55346435",
"0.55152076",
"0.55112356",
"0.5393598",
"0.5340134",
"0.5339657",
"0.53219825",
"0.53199166",
"0.52830756",
"0.52445287",
"0.5166773",
"0.5159707",
"0.51... | 0.7107689 | 0 |
DELETE /lookup_pettracers/1 DELETE /lookup_pettracers/1.xml | def destroy
@lookup_pettracer = LookupPettracer.find(params[:id])
@lookup_pettracer.destroy
respond_to do |format|
format.html { redirect_to(lookup_pettracers_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @lookup_set = LookupSet.find(params[:id])\n @lookup_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sets_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pdig = Pdig.find(params[:id])\n @pdig.destroy\n\n respond_to do |format|... | [
"0.65213794",
"0.6422062",
"0.63901067",
"0.6331035",
"0.624117",
"0.62286836",
"0.6227409",
"0.6223926",
"0.6162956",
"0.6149925",
"0.61464643",
"0.6143414",
"0.61240757",
"0.61084324",
"0.61003464",
"0.6093439",
"0.6068151",
"0.6063949",
"0.60539997",
"0.6052828",
"0.605142... | 0.7397508 | 0 |
GET /vehicle_fines GET /vehicle_fines.json | def index
@vehicle_fines = VehicleFine.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end",
"def index\n @fines = Fine.all\n end",
"def venue\n \t@events = Event.where(:venue => params[:venue])\n\n \trespond_to do |format|\n ... | [
"0.70188123",
"0.62482",
"0.5703264",
"0.5691642",
"0.56804585",
"0.5654685",
"0.5621919",
"0.5603099",
"0.5540101",
"0.55395526",
"0.54882604",
"0.5485835",
"0.546986",
"0.54606533",
"0.5452128",
"0.54468244",
"0.54337066",
"0.5429024",
"0.5425933",
"0.54215693",
"0.5420562"... | 0.7248065 | 0 |
POST /vehicle_fines POST /vehicle_fines.json | def create
@vehicle_fine = VehicleFine.new(vehicle_fine_params)
respond_to do |format|
if @vehicle_fine.save
format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully created.' }
format.json { render :show, status: :created, location: @vehicle_fine }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end",
"def vehicle_fine_params\n params.require(:vehicle_fine).permit(:vehicle_id, :fine_id)\n end",
"def index\n @vehicle_fines = Veh... | [
"0.66059697",
"0.63605464",
"0.6159991",
"0.5707541",
"0.5568644",
"0.5464221",
"0.54442924",
"0.5434772",
"0.5395799",
"0.5382774",
"0.5341945",
"0.53278255",
"0.53195584",
"0.5309192",
"0.5276832",
"0.52435696",
"0.52389073",
"0.52357733",
"0.52343714",
"0.52343714",
"0.523... | 0.6491171 | 1 |
PATCH/PUT /vehicle_fines/1 PATCH/PUT /vehicle_fines/1.json | def update
respond_to do |format|
if @vehicle_fine.update(vehicle_fine_params)
format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully updated.' }
format.json { render :show, status: :ok, location: @vehicle_fine }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n... | [
"0.6476595",
"0.63793296",
"0.6365856",
"0.6321504",
"0.63096505",
"0.6265638",
"0.6265638",
"0.6163199",
"0.6122666",
"0.6122666",
"0.6122666",
"0.60961986",
"0.60857534",
"0.6013301",
"0.599916",
"0.59777886",
"0.5956239",
"0.59495074",
"0.59427565",
"0.5925206",
"0.5907818... | 0.6601508 | 0 |
DELETE /vehicle_fines/1 DELETE /vehicle_fines/1.json | def destroy
@vehicle_fine.destroy
respond_to do |format|
format.html { redirect_to vehicle_fines_url, notice: 'Vehicle fine was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |forma... | [
"0.6989613",
"0.69515395",
"0.69515395",
"0.69145066",
"0.6827327",
"0.6756159",
"0.67259556",
"0.6725226",
"0.67032343",
"0.6690313",
"0.6686954",
"0.6668574",
"0.66641843",
"0.66581887",
"0.6649907",
"0.6649907",
"0.6628465",
"0.66247714",
"0.66247714",
"0.66244024",
"0.662... | 0.7003625 | 0 |
constructs a uri for a capture screen with the necesary params and embeds it in an iframe in the page. | def embed_screen(params = {})
@iframe_src = screen_uri(params)
render "iframe"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_uri(params = {}, sn = screen_name)\n uri = URI(\"https://\" + app.captureui_addr)\n uri.path = \"/oauth/#{sn}\"\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end",
"def captureScreen(filename=nil, hidePatientDetails=false)\n screenCaptureBtn = Element.new(\"Capture Screen Butt... | [
"0.68570787",
"0.57051253",
"0.56397533",
"0.54838306",
"0.544183",
"0.54017854",
"0.53970087",
"0.5389497",
"0.53653485",
"0.53134775",
"0.53134775",
"0.5308929",
"0.52701604",
"0.52701604",
"0.52700263",
"0.5243266",
"0.52056426",
"0.51905924",
"0.51839465",
"0.5167935",
"0... | 0.7436474 | 0 |
constructs the uri of a capture_screen from params | def screen_uri(params = {}, sn = screen_name)
uri = URI("https://" + app.captureui_addr)
uri.path = "/oauth/#{sn}"
uri.query = URI.encode_www_form(params)
uri.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_uri\n square_params\n uri\n end",
"def build_retrieve_url(args)\n url_type = args[type]\n url_device_id = args[device_id]\n url_sensor_type = args[sensot_type]\n url_retrieve_type = args[retrieve_type]\n\n complete_url = \"/data/#{url_type}/#{url_device_id}/#{... | [
"0.5898366",
"0.5666568",
"0.5663937",
"0.55912805",
"0.5581854",
"0.5522475",
"0.5512769",
"0.5498587",
"0.5417829",
"0.53507",
"0.5332685",
"0.5330718",
"0.5330597",
"0.5329763",
"0.5302307",
"0.5286036",
"0.52647424",
"0.52646154",
"0.5259118",
"0.5256418",
"0.5235528",
... | 0.8084606 | 0 |
dispatcher is the action that get called for /:app_name/:screen_name routes. Turns screen into an action, and calls it. If it can't find an action it will remove suffixes until it can, or until it decides to call a generic handler. note that all actions will go through here, so rails will default to rendering /demo/dis... | def dispatcher
screen = screen_name
# continuosly remove tokens seperated by '_', starting from the end
# until there are no more tokens, or we find one that we respond to
begin
if self.respond_to?(screen.to_sym)
self.method(screen).call
return
end
tokens = screen.spli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatcher(session,context,dispatch_destination = nil)\n @myclass.Dispatcher.dispatch(session,context,dispatch_destination)\n end",
"def dispatch_to(dispatcher)\n @jr_method_args.each { |args|\n # copy args so original is preserved\n handler_method, jr_methods =\n extract_... | [
"0.6072325",
"0.5977636",
"0.5609077",
"0.55966645",
"0.5523472",
"0.5400321",
"0.5369532",
"0.5354395",
"0.5312287",
"0.5298134",
"0.5272304",
"0.524332",
"0.5194301",
"0.5178822",
"0.5178822",
"0.51294446",
"0.50959474",
"0.5073871",
"0.5067447",
"0.5044979",
"0.5040055",
... | 0.730287 | 0 |
Create n sample posts | def create_samples(n)
n.times do |i|
Post.create(title: "New Post #{i}", body: "Body of post #{i}", created_at: Time.now)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seed_posts(count)\n (1..count).map do\n post = Post.create!(title: Faker::Lorem.words(number: rand(2..10)).join(' '),\n content: Faker::Lorem.paragraphs(number: rand(2..8)).join(' '),\n user: User.create!(login: Faker::Name.unique.last_name))\n ... | [
"0.7760789",
"0.7468684",
"0.71601",
"0.6980279",
"0.6676278",
"0.6434332",
"0.6426591",
"0.63799375",
"0.6373876",
"0.6356503",
"0.6356503",
"0.6323924",
"0.6311269",
"0.62499684",
"0.62360156",
"0.62043643",
"0.61530966",
"0.61039674",
"0.60942537",
"0.59117395",
"0.5889075... | 0.8585263 | 0 |
GET /drawables GET /drawables.json | def index
@drawables = Drawable.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @drawables }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @drawable = Drawable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @drawable }\n end\n end",
"def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { ... | [
"0.5707991",
"0.56121224",
"0.5445468",
"0.54172033",
"0.5362379",
"0.53444016",
"0.53135693",
"0.52198774",
"0.514454",
"0.5032679",
"0.5013118",
"0.50037205",
"0.49812412",
"0.49798182",
"0.49472016",
"0.49451435",
"0.49378833",
"0.4908923",
"0.48770866",
"0.48752898",
"0.4... | 0.76883763 | 0 |
GET /drawables/1 GET /drawables/1.json | def show
@drawable = Drawable.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @drawable }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end",
"def show\n @drawing = Drawing.find(params[:id])\n\n render json: @drawing\n end",
"def destroy\n @drawable = Drawable.find(param... | [
"0.7439337",
"0.5921452",
"0.5917683",
"0.57408315",
"0.5487863",
"0.54113376",
"0.526407",
"0.5232786",
"0.5197832",
"0.5087014",
"0.50849587",
"0.5082376",
"0.5079196",
"0.50362116",
"0.5022915",
"0.5018479",
"0.49898526",
"0.49810594",
"0.4975394",
"0.49750707",
"0.4960267... | 0.6102062 | 1 |
GET /drawables/new GET /drawables/new.json | def new
@drawable = Drawable.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @drawable }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @draw = Draw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @draw }\n end\n end",
"def new\n @drawing = Drawing.new\n\n render json: @drawing\n end",
"def create\n @drawable = Drawable.new(params[:drawable])\n\n respond_to do ... | [
"0.66811454",
"0.65393215",
"0.6338831",
"0.62122405",
"0.5990946",
"0.58282304",
"0.57941514",
"0.5732265",
"0.57302177",
"0.5720544",
"0.57129544",
"0.56501657",
"0.5633856",
"0.56319046",
"0.5626325",
"0.56226295",
"0.56220925",
"0.5618016",
"0.5613935",
"0.5610757",
"0.56... | 0.680307 | 0 |
POST /drawables POST /drawables.json | def create
@drawable = Drawable.new(params[:drawable])
respond_to do |format|
if @drawable.save
format.html { redirect_to @drawable, notice: 'Drawable was successfully created.' }
format.json { render json: @drawable, status: :created, location: @drawable }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end",
"def drawing_params\n params.require(:drawing).permit(:name, :leds, :user_id, :leds => [])\n end",
"def create\n @drawing = Draw... | [
"0.6536369",
"0.5879714",
"0.57173353",
"0.56031364",
"0.55733466",
"0.55604565",
"0.5257709",
"0.51588225",
"0.5120784",
"0.4947977",
"0.49430686",
"0.48951083",
"0.48821902",
"0.48548877",
"0.48295486",
"0.48210588",
"0.47879502",
"0.4786748",
"0.478391",
"0.47566026",
"0.4... | 0.59568775 | 1 |
PUT /drawables/1 PUT /drawables/1.json | def update
@drawable = Drawable.find(params[:id])
respond_to do |format|
if @drawable.update_attributes(params[:drawable])
format.html { redirect_to @drawable, notice: 'Drawable was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end",
"def update\n @drawing = Drawing.find(params[:id])\n\n if @drawing.update_attributes(params[:drawing])\n head :no_content\n els... | [
"0.5866623",
"0.58017206",
"0.5777124",
"0.5737231",
"0.5647263",
"0.55356985",
"0.5415297",
"0.5352123",
"0.5254152",
"0.52277166",
"0.5183401",
"0.5179659",
"0.5168513",
"0.5163592",
"0.5102437",
"0.5083342",
"0.50663334",
"0.5063533",
"0.5050877",
"0.5048667",
"0.50395226"... | 0.64346766 | 0 |
DELETE /drawables/1 DELETE /drawables/1.json | def destroy
@drawable = Drawable.find(params[:id])
@drawable.destroy
respond_to do |format|
format.html { redirect_to drawables_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @draw = Draw.find(params[:id])\n @draw.destroy\n\n respond_to do |format|\n format.html { redirect_to draws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @draw.destroy\n respond_to do |format|\n format.html { redirect_to draws_url, notice: '... | [
"0.6709174",
"0.6492926",
"0.6446323",
"0.61876327",
"0.60467523",
"0.6036098",
"0.59882545",
"0.59378135",
"0.5921157",
"0.5892541",
"0.58924985",
"0.58770925",
"0.58700407",
"0.5868044",
"0.58358884",
"0.5828177",
"0.5805022",
"0.5800439",
"0.5795041",
"0.57838845",
"0.5783... | 0.76286787 | 0 |
Returns the conjugate of _obj_ q which is the quaternion q = a b_i_ c_j_ d_k_. | def conjugate
Quaternion.new(@a, -1 * @b, -1 * @c, -1 * @d)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conjugate\r\n quaternion.conjugate!\r\n end",
"def conjugate\n\t\t\tself.class.new( -@elem[0], -@elem[1], -@elem[2], @elem[3] )\n\t\tend",
"def conjugate\n Complex(@real, -@image)\n end",
"def conjugate\n self\n end",
"def conjugate!\r\n set(@axis.mirror,@real)\r\n end",
"def ... | [
"0.71933794",
"0.5804909",
"0.5800573",
"0.5717437",
"0.5548184",
"0.55300075",
"0.5492936",
"0.5445048",
"0.54141617",
"0.5387543",
"0.53554666",
"0.53186464",
"0.52169544",
"0.519719",
"0.519719",
"0.5138542",
"0.5034089",
"0.48333374",
"0.4812672",
"0.47285125",
"0.4718216... | 0.713598 | 1 |
Returns the norm of this Quaternion. | def norm
Math.sqrt((@a**2) + (@b**2) + (@c**2) + (@d**2))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def norm\r\n (@real * @real) + @axis.modulus\r\n end",
"def norm\n m = mag\n @x /= m\n @y /= m\n self\n end",
"def norm\n Math::sqrt(data.values.inject(0) { |m,v| m+v**2})\n end",
"def normalize\n self / self.norm\n end",
"def normalize\n f = 1.0 / length\n ... | [
"0.7424701",
"0.69205356",
"0.6828851",
"0.66731066",
"0.6608091",
"0.63745207",
"0.6243272",
"0.6227756",
"0.6162305",
"0.6065019",
"0.5958431",
"0.5948012",
"0.58266836",
"0.57888806",
"0.57573503",
"0.57524544",
"0.5740608",
"0.57361263",
"0.5725177",
"0.5651427",
"0.56322... | 0.70567596 | 1 |
Returns the versor of this Quaternion | def versor
self / norm
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rotation\n return @rotation\n end",
"def inverse\n result = UnitQuaternion.new\n result.set(@beta0, *(-1*@beta_s))\n return result\n end",
"def v4_3\n return @v4_3\n end",
"def v4_0_3\n return @v4_0_3\n end",
"def newton_version\... | [
"0.5861304",
"0.58144236",
"0.57364124",
"0.56396675",
"0.56191534",
"0.5575057",
"0.5555586",
"0.5527554",
"0.55040705",
"0.5497734",
"0.54316986",
"0.5414937",
"0.53658736",
"0.5351508",
"0.5323392",
"0.5296935",
"0.52861214",
"0.5277911",
"0.5277911",
"0.52749354",
"0.5260... | 0.7034304 | 0 |
Add a new node to the start of the list | def prepend( value )
new_node = Node.new value
# Whatever node was at the start of the list, it
# is now the 'next' node for our newly created node
new_node.next = @head
# The new head of the list is set to be the new
# node that we just created
@head = new_node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepend(value)\n new_node = create_node(value)\n new_node.next_node = head\n self.head = new_node\n self.size += 1\n end",
"def add_first(data)\n\n new_node = Node.new(data) # create a new node\n new_node.next = @head # assign the new node's NEXT to the @head\n @head = new_node # assign... | [
"0.73379487",
"0.7329455",
"0.73108834",
"0.73108834",
"0.73108834",
"0.7293695",
"0.7276967",
"0.7273252",
"0.72594947",
"0.7253602",
"0.7242728",
"0.72347844",
"0.7224525",
"0.72144526",
"0.7166542",
"0.7166542",
"0.71650815",
"0.7162736",
"0.7160902",
"0.7158707",
"0.71455... | 0.7728383 | 1 |
Helper to set date values. Converts dates, in Date or String format, to a RDF::Literal. | def date_setter(name, d)
case d.class.name
when 'RDF::Literal::Date', 'NilClass'
value = d
when 'String'
begin
if d.empty?
value = nil
else
value = ::RDF::Literal.new(Date.parse(d))
end
rescue
raise ArgumentError, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_datetime\n ))\n end",
"def set_date(*fields)\n fields.each do |field|\n next unless self.respond_to?(field) && self[field].is_a?(String)\n ... | [
"0.61408395",
"0.6054538",
"0.6045261",
"0.6020434",
"0.5935131",
"0.5876302",
"0.5873125",
"0.5766013",
"0.57497317",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5747136",
"0.5725321",
"0.57109386",
"0.57109386",
"0.57109386",
"0.57109386... | 0.7216855 | 0 |
log runtime via dumping or curling it into the runtime log location | def record_test_runtime(mode, results, log)
data = results.map { |test, time| "#{test}:#{time.round(2)}" }.join("\n") << "\n"
case mode
when 'simple'
File.write(log, data)
when 'amend'
if id = ENV["BUILDKITE_JOB_ID"]
slug = ENV.fetch("BUILDKITE_ORG_SLUG") + "-" + ENV.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end",
"def debug_log(msg)\n Chef::Log.info(\"easybib_deploy_manager: #{msg}\")\nend",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end"... | [
"0.66599214",
"0.62891406",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.62763715",
"0.6120447",
"0.6100217",
"0.60659903",
"0.59829795",
"0.59028375",
"0.58917505",
"0.58807623",
"0.5876165",
"0.5876165",
"0.5829135",
"... | 0.63583314 | 1 |
This forces Rails to load all fixtures, then prevents it from "deleting and reinserting all fixtures" when a new connection is used (forked). | def preload_fixtures
return if @options.fetch(:no_fixtures)
fixtures = (ActiveSupport::VERSION::MAJOR == 3 ? ActiveRecord::Fixtures : ActiveRecord::FixtureSet)
# reuse our pre-loaded fixtures even if we have a different connection
fixtures_eigenclass = class << fixtures; self; end
fixtur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_fixtures\n # fixtures = ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(File.dirname(__FILE__), 'test', 'fixtures', '*.{yml,csv}')) \n fixtures = [ 'active_sources', 'semantic_relations', 'semantic_properties' 'data_records']\n fixtures.reverse.each { |f| ActiveReco... | [
"0.7689433",
"0.7288067",
"0.721409",
"0.7108288",
"0.69748354",
"0.6583475",
"0.6563983",
"0.6537219",
"0.6426591",
"0.6383931",
"0.62575036",
"0.6167778",
"0.6166913",
"0.6128",
"0.6100864",
"0.59841317",
"0.59573853",
"0.5943862",
"0.5943862",
"0.5937712",
"0.58950555",
... | 0.7744954 | 0 |
POST /voxels POST /voxels.json | def create
@method = 'create'
@voxel = Voxel.new(voxel_params)
respond_to do |format|
if @voxel.save
flash[:notice] = '作成されました!'
format.html { redirect_to action: 'index' }
format.json { render action: 'show', status: :created, location: @voxel }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @voxel = Voxel.new(params[:voxel])\n \n respond_to do |format|\n if @voxel.save\n format.html { redirect_to @voxel, notice: 'Voxel was successfully created.' }\n format.json { render json: @voxel, status: :created, location: @voxel }\n else\n format.... | [
"0.5641265",
"0.56377167",
"0.5620466",
"0.5576917",
"0.5454755",
"0.54493076",
"0.54357016",
"0.5418508",
"0.5385171",
"0.5365114",
"0.5326564",
"0.53097767",
"0.53066945",
"0.53062725",
"0.52811444",
"0.526124",
"0.52591765",
"0.5254248",
"0.52470416",
"0.5246799",
"0.52428... | 0.5674255 | 0 |
DELETE /voxels/1 DELETE /voxels/1.json | def destroy
@voxel.destroy
respond_to do |format|
format.html { redirect_to voxels_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @voxel = Voxel.find(params[:id])\n @voxel.destroy\n \n respond_to do |format|\n format.html { redirect_to voxels_url }\n format.json { head :no_content }\n end\... | [
"0.71933347",
"0.7154275",
"0.7107153",
"0.7030319",
"0.69848806",
"0.6978392",
"0.6940445",
"0.6940276",
"0.6939857",
"0.6932891",
"0.69180393",
"0.689091",
"0.68542767",
"0.68395835",
"0.6806176",
"0.6806176",
"0.68018675",
"0.679401",
"0.67928416",
"0.6771822",
"0.67640436... | 0.7312526 | 0 |
Populate the Hit objects with their instances. This is invoked the first time any hit has its instance requested, and all hits are loaded as a batch. | def populate_hits(session)
id_hit_hash = Hash.new { |h, k| h[k] = {} }
hits.each do |hit|
id_hit_hash[hit.class_name][hit.primary_key] = hit
end
id_hit_hash.each_pair do |class_name, hits|
hits_for_class = id_hit_hash[class_name]
hits.each do |... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_hits #:nodoc:\n id_hit_hash = Hash.new { |h, k| h[k] = {} }\n hits.each do |hit|\n id_hit_hash[hit.class_name][hit.primary_key] = hit\n end\n id_hit_hash.each_pair do |class_name, hits|\n ids = hits.map { |id, hit| hit.primary_key }\n data_accesso... | [
"0.7027469",
"0.6118545",
"0.58107525",
"0.57028615",
"0.56853884",
"0.55229694",
"0.5508691",
"0.54597586",
"0.53999543",
"0.5390241",
"0.53761035",
"0.52861804",
"0.52699184",
"0.52337414",
"0.5215823",
"0.5207029",
"0.5189272",
"0.5151213",
"0.51362836",
"0.510706",
"0.508... | 0.6334193 | 1 |
run through using each method def reverse_each_word(string) string_to_array = string.split reverse_array = [] string_to_array.each do |word| reverse_array << word.reverse end each reverse_array.join(' ') end run through exchanging .each for .collect | def reverse_each_word(string)
string_to_array = string.split
reverse_array = []
string_to_array.collect do |word|
reverse_array << word.reverse
end #each
reverse_array.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_each_word(string)\n p string.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(string)\n string_array = string.split(' ')\n string_array.collect do |word|\n word.reverse!\n end\n string_array.join(\" \")\nend",
"def reverse_each_word(string)\n step_one = string... | [
"0.89264756",
"0.8916797",
"0.8912639",
"0.88888675",
"0.888038",
"0.8879262",
"0.8874255",
"0.8870094",
"0.88672286",
"0.8867065",
"0.88666356",
"0.8863131",
"0.8854156",
"0.8854056",
"0.8839098",
"0.88384265",
"0.8831874",
"0.8826323",
"0.8820421",
"0.8819315",
"0.8816487",... | 0.89209235 | 1 |
Format file with magic numbers. | def format_file(file)
out = ''
file.magic_numbers.each do |num|
if @color
val = red(num.value)
line = yellow(num.line)
path = pink(file.path)
else
val = num.value
line = num.line
path = file.path
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(file, format:); end",
"def write_magic_number(outf)\n outf.write([0xA115ca1e].pack(\"l\"))\nend",
"def write_magic_number(outf)\n outf.write([0xA115ca1e].pack(\"l\"))\nend",
"def filemagic\n @filemagic ||= FileMagic.new(FileMagic::MAGIC_MIME_TYPE)\n end",
"def filemagic\n ... | [
"0.6281752",
"0.6070471",
"0.6070471",
"0.5853411",
"0.58094966",
"0.5755361",
"0.57475156",
"0.5623054",
"0.55696744",
"0.55370533",
"0.5481274",
"0.5449468",
"0.5421163",
"0.53226775",
"0.52861476",
"0.51784503",
"0.5133529",
"0.5104572",
"0.5101763",
"0.50919616",
"0.50752... | 0.80021256 | 0 |
GET /route_lines/1 GET /route_lines/1.xml | def show
@route_line = RouteLine.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @route_line }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @route_line = RouteLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_line }\n end\n end",
"def show\n @line = Line.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :... | [
"0.67667043",
"0.65672505",
"0.6559145",
"0.64495134",
"0.63750297",
"0.63661855",
"0.6302329",
"0.6302329",
"0.6294172",
"0.62933385",
"0.62933385",
"0.6284217",
"0.6225611",
"0.6225611",
"0.6225611",
"0.6220611",
"0.6149663",
"0.61359984",
"0.60800207",
"0.5990889",
"0.5967... | 0.7364143 | 0 |
GET /route_lines/new GET /route_lines/new.xml | def new
@route_line = RouteLine.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @route_line }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n ... | [
"0.69570416",
"0.69570416",
"0.68748254",
"0.67634356",
"0.6761244",
"0.67308766",
"0.67308766",
"0.6653637",
"0.66255766",
"0.654666",
"0.6496977",
"0.64524895",
"0.6439039",
"0.6406683",
"0.63371944",
"0.63088495",
"0.62760556",
"0.6266011",
"0.625445",
"0.6241583",
"0.6170... | 0.77483696 | 0 |
POST /route_lines POST /route_lines.xml | def create
@route_line = RouteLine.new(params[:route_line])
respond_to do |format|
if @route_line.save
format.html { redirect_to(@route_line, :notice => t('record_created')) }
format.xml { render :xml => @route_line, :status => :created, :location => @route_line }
else
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_route(route, message)\n raise TypeError unless route.is_a? Route\n @changeset = @api.create_changeset(message, tags={'created_by'=>'ITCR'})\n ways_list = []\n nodes_list = create_node_list(route.path)\n\n until nodes_list.empty? # For node's maximum limit of a way\n way_nodes = nodes_l... | [
"0.6794016",
"0.62879074",
"0.60445315",
"0.60086155",
"0.5927529",
"0.5893402",
"0.5819869",
"0.5786194",
"0.576726",
"0.57605153",
"0.57406336",
"0.5728971",
"0.57221913",
"0.5695683",
"0.5691606",
"0.5689479",
"0.5686326",
"0.56781805",
"0.56763124",
"0.5656182",
"0.564734... | 0.7107329 | 0 |
PUT /route_lines/1 PUT /route_lines/1.xml | def update
@route_line = RouteLine.find(params[:id])
respond_to do |format|
if @route_line.update_attributes(params[:route_line])
format.html { redirect_to(@route_line, :notice => t('record_updated')) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_xml\n self.xml= dumpRouteAsXml\n self.save\n end",
"def update\n @line = Line.find(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to(@line, :notice => 'Line was successfully updated.') }\n format.xml { head ... | [
"0.6523446",
"0.6482837",
"0.62196237",
"0.6185141",
"0.6171954",
"0.6167397",
"0.61073893",
"0.60962695",
"0.6029012",
"0.6027949",
"0.5994899",
"0.59879035",
"0.5985117",
"0.5948219",
"0.59443486",
"0.5871491",
"0.58647555",
"0.58647555",
"0.5829382",
"0.58127433",
"0.57970... | 0.7276072 | 0 |
DELETE /route_lines/1 DELETE /route_lines/1.xml | def destroy
@route_line = RouteLine.find(params[:id])
@route_line.destroy
respond_to do |format|
format.html { redirect_to(route_lines_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @linea = Linea.find(params[:id])\n @linea.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @service_line = ServiceLine.find(params[:id])\n @service_line.destroy\n\n respond_to do |for... | [
"0.69276166",
"0.68328714",
"0.68106467",
"0.67409015",
"0.66668594",
"0.66668594",
"0.6594451",
"0.65884703",
"0.6550613",
"0.64880764",
"0.6476469",
"0.64514494",
"0.6430788",
"0.6422718",
"0.64226633",
"0.6415043",
"0.6412264",
"0.63918084",
"0.63886774",
"0.63743454",
"0.... | 0.77140987 | 0 |
Compose libcurl header string from key and value. Also replaces null bytes, because libcurl will complain otherwise. | def compose_header(key, value)
Util.escape_zero_byte("#{key}: #{value}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def safe_append_header(key, value)\n resp_headers[key] = value.to_s\n end",
"def encode_header(s); s; end",
"def parse_headers(headers_hash)\n header_string = \"\"\n for header in headers_hash.select { |k,v| k.match(\"^HTTP.*\") } do\n header_string += header[0]+\":\"+header[1]+\"|\... | [
"0.6261589",
"0.6067391",
"0.5937041",
"0.57820547",
"0.5747294",
"0.57390136",
"0.57161534",
"0.5712725",
"0.56487375",
"0.5642438",
"0.56402147",
"0.558702",
"0.5536527",
"0.55331653",
"0.55216986",
"0.5513828",
"0.55009437",
"0.5489248",
"0.5456789",
"0.54553056",
"0.54326... | 0.74180245 | 0 |
def has_player_1_won?(player_1.weapon_choice,player_2.weapon_choice) RULES[:rock][:paper] end | def draw?
player_1.weapon_choice == player_2.weapon_choice
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def if_player_1_wins?\n\t($p1 == \"scissors\" && $p2 == \"paper\") || ($p1 == \"rock\" && $p2 == \"scissors\") || ($p1 == \"paper\" && $p2 == \"rock\") || ($p1 == \"rock\" && $p2 == \"lizard\") || ($p1 == \"spock\" && $p2 == \"scissors\") || ($p1 == \"scissors\" && $p2 == \"lizard\") || ($p1 == \"spock\" && $p2 ==... | [
"0.79259664",
"0.7843955",
"0.7677486",
"0.75423276",
"0.74861884",
"0.74719155",
"0.7442633",
"0.7417577",
"0.7301638",
"0.7237985",
"0.7236357",
"0.7223398",
"0.7199837",
"0.7144517",
"0.71330255",
"0.7095467",
"0.7061443",
"0.69324934",
"0.68711644",
"0.6870875",
"0.681175... | 0.7870847 | 1 |
Get the contents of a a directory as relative pathnames (without the root dir prepended) | def relative_dir_files(directory)
files = Dir["#{file_root(directory)}/**/*"]
files.map! { |file| file.gsub(/#{file_root}/, '') }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end",
"def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end",
"def GetDirectoryPa... | [
"0.73436093",
"0.72702956",
"0.7028072",
"0.66749",
"0.6666142",
"0.6632963",
"0.66088873",
"0.66040266",
"0.6506285",
"0.64781827",
"0.64737064",
"0.64565885",
"0.6375378",
"0.6330453",
"0.6306326",
"0.62641954",
"0.62636685",
"0.6248289",
"0.6239016",
"0.6228213",
"0.621682... | 0.7274677 | 1 |
Generate the repository dists | def generate_dists(pkg_hash)
pkg_hash.each do |origin_name, dists|
dists.each do |dist_name, dist_args|
dist_args[:components].each do |component_name, arches|
packages = arches.values.flatten.compact.map(&:values).flatten.compact.map(&:values).flatten.compact
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_dir; end",
"def repositories\n # TODO : merge with current data\n load_repos\n end",
"def get_repo (repoName='ComputerScience_test')\n puts \"get_repo\"\n set_repository repoName\n puts \"set_repository #{@repository}\"\n result = @repository.query.perform \"select ?s ?p ?o {?... | [
"0.58840704",
"0.5864802",
"0.57742053",
"0.57647485",
"0.57647485",
"0.57647485",
"0.57647485",
"0.5701553",
"0.5689896",
"0.5676539",
"0.5675987",
"0.56477207",
"0.56251127",
"0.557836",
"0.54690534",
"0.54528403",
"0.5433646",
"0.543322",
"0.5426511",
"0.5426511",
"0.54172... | 0.678255 | 0 |
Sign file if configured for signing | def sign_file_if_setup(opts = nil)
path = yield
if signer && options[:sign]
signer.file(path, nil, opts)
end
path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_signing\n if sign_file?\n @appearance = @stamper.getSignatureAppearance().to_java(Java::ComLowagieTextPdf::PdfSignatureAppearance)\n @appearance.setCrypto(@private_key, @cert_chain, nil, Java::ComLowagieTextPdf::PdfSignatureAppearance::WINCER_SIGNED)\n end\n end",
"def sign_file?\... | [
"0.7127565",
"0.6965597",
"0.6798428",
"0.6522074",
"0.648155",
"0.6389011",
"0.6235015",
"0.61595416",
"0.59772587",
"0.5942872",
"0.58809495",
"0.5870212",
"0.5870208",
"0.58613706",
"0.5851695",
"0.5768608",
"0.5758111",
"0.57299125",
"0.5698023",
"0.56455684",
"0.56163305... | 0.78094 | 0 |
Attempt to bind to active directory, time out after N seconds, return true or false | def bind
return false unless !@connection.nil?
begin
Timeout::timeout(10) do
return (@connection.bind) ? true : false
end
rescue
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind\n conn = Net::LDAP.new :host => @config[:server],\n :port => @config[:port],\n :base => @config[:base]\n if @config[:encryption]\n conn.encryption @config[:encryption]\n end\n \n ... | [
"0.60290295",
"0.59892845",
"0.5983772",
"0.5972752",
"0.5920659",
"0.57814956",
"0.57298326",
"0.57287616",
"0.5686326",
"0.56467944",
"0.5625104",
"0.55779064",
"0.5575127",
"0.556209",
"0.5547961",
"0.55463666",
"0.5534322",
"0.55124956",
"0.54762",
"0.54749876",
"0.547044... | 0.67869484 | 0 |
Build user distinguished name for active directory account | def ldap_distinguished_name(user)
distinguished_name = "cn=#{user.human_name},"
if user.is_staff
if !user.masters_program.blank? && organization_units.include?(user.masters_program)
distinguished_name += "ou=" + user.masters_program + ",ou=Staff,"
else
distinguished_name += "ou=Staf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dn_for username\n \"uid=#{username},#{@dn_suffix}\"\n end",
"def base_distinguished_name\n base_name = \"\"\n AD_DOMAIN.split('.').each do |item|\n base_name+=\"dc=#{item},\"\n end\n base_name.chop\n end",
"def dn_from_login(login)\n \"cn=#{login},#{user_root_dn}\"\n end",
"... | [
"0.7708891",
"0.69992936",
"0.68062884",
"0.65035427",
"0.6493364",
"0.64712983",
"0.6456602",
"0.6441083",
"0.63279724",
"0.6324164",
"0.63120276",
"0.6270766",
"0.62604505",
"0.6229162",
"0.6192431",
"0.61550665",
"0.61402726",
"0.6117044",
"0.6091688",
"0.60821605",
"0.606... | 0.7804183 | 0 |
Create base distinguished name from the active directory domain name | def base_distinguished_name
base_name = ""
AD_DOMAIN.split('.').each do |item|
base_name+="dc=#{item},"
end
base_name.chop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_domain_name(env)\n config = env[:machine].provider_config\n domain_name =\n if config.default_prefix.nil?\n env[:root_path].basename.to_s.dup.concat('_')\n elsif config.default_prefix.empty?\n # don't have any prefix, not even \"_\"\n ... | [
"0.69623166",
"0.69332075",
"0.68167883",
"0.68031317",
"0.67725503",
"0.6702379",
"0.6697446",
"0.662761",
"0.65517074",
"0.6493758",
"0.6452573",
"0.64260846",
"0.639004",
"0.6364065",
"0.6303645",
"0.6279439",
"0.62763864",
"0.62599784",
"0.62599784",
"0.6228976",
"0.62075... | 0.84027666 | 0 |
Convert password to unicode format | def password_encode(password)
result = ""
password = "\"" + password + "\""
password.length.times { |i| result+= "#{password[i..i]}\000" }
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized_password\n URI.encode(CGI.unescape(password), ENCODE_PASSWORD).force_encoding(Encoding::UTF_8) if password\n end",
"def ios_password(length = 1)\n 8226.chr('UTF-8') * length\n end",
"def to_s\n %[#<password safe>]\n end",
"def to_s\n %[#<password safe>]\n end",
"def e... | [
"0.70082265",
"0.6750396",
"0.6590168",
"0.6590168",
"0.65554684",
"0.63409925",
"0.63168037",
"0.6295069",
"0.6282027",
"0.6265489",
"0.6260444",
"0.62466705",
"0.62118137",
"0.61934644",
"0.61910933",
"0.6093912",
"0.6019688",
"0.6009712",
"0.5974416",
"0.5966306",
"0.59642... | 0.68760425 | 1 |
Format email with a active directory domain | def format_email_to_ad_domain(email)
return "#{email.split('@')[0]}@#{AD_DOMAIN}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatted_email(contact)\n \"#{contact.username} <#{contact.email}>\"\n end",
"def format_email!\n @email.gsub!(/@/, \"%40\")\n end",
"def return_email_domain \n return \"@\" + self.email.split('@')[1]\n end",
"def formatted_email\n \"#{@name} <#{@email}>\"\n end",
"def formatte... | [
"0.7114175",
"0.68831956",
"0.6870422",
"0.67671585",
"0.67034656",
"0.6591368",
"0.65578055",
"0.6530331",
"0.6523774",
"0.64464784",
"0.637136",
"0.63576686",
"0.63514507",
"0.63215506",
"0.6312877",
"0.6284144",
"0.6280981",
"0.62184435",
"0.6203389",
"0.6162383",
"0.61382... | 0.7599525 | 0 |
Return names of organization units | def organization_units
if bind
units = []
AdOrganizationUnit.find_each do |local_entry|
name = local_entry.distinguishedname.split(',')[0]
units.push(name[3..name.length])
end
return units
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization_list(organizations)\n organizations or return \"\"\n \n organizations.inject([]) do |s, unit|\n s << \"#{unit.aff_fullname}(#{unit.sta_fullname}\"\n end\n s.join(\", \")\n end",
"def organization_names\n organizations.pluck(:name).join(', ')\n end",
"def organiz... | [
"0.7330597",
"0.7176635",
"0.7176635",
"0.67003053",
"0.66386664",
"0.66180265",
"0.6484635",
"0.6367569",
"0.6340659",
"0.63251317",
"0.6202311",
"0.6157472",
"0.6123293",
"0.6071357",
"0.6071357",
"0.60418946",
"0.6025729",
"0.6022584",
"0.6005756",
"0.5990255",
"0.5961872"... | 0.76113105 | 0 |
Update organization units cache table if records are more than one day old | def update_organization_units
oldest_update = AdOrganizationUnit.order('created_at').last
if bind && (oldest_update.nil? || oldest_update.created_at<1.day.ago)
filter = Net::LDAP::Filter.eq("objectClass", "organizationalunit")
results = @connection.search(:base =>"ou=Sync,"+base_distinguished_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_cache_up_to_date\n self.last_update_timestamp = self.redis.get(\"bluster:last_update_timestamp\").to_i\n if self.last_update_timestamp.nil?\n update_object_cache\n elsif self.last_update_timestamp != File.new(self.objects_path).mtime.to_i\n update_object_cache\n end\n end",
"def... | [
"0.65389925",
"0.5998826",
"0.59296227",
"0.58927786",
"0.5843088",
"0.5821534",
"0.5800259",
"0.57780844",
"0.5773702",
"0.5752574",
"0.5702364",
"0.5694461",
"0.5660184",
"0.5660184",
"0.5646122",
"0.5642932",
"0.56049985",
"0.5601751",
"0.5578578",
"0.5576554",
"0.5576554"... | 0.6226122 | 1 |
Public: Initialize a new instance of DatedBranchCreator branch_type Name of the type of branch (e.g., staging or deployable) pull_request_id The pull request id to use for the merge options hash of options post_comment whether or not to post a comment on the pullrequest | def initialize(branch_type, pull_request_id, options={})
self.branch_type = branch_type
self.pull_request_id = pull_request_id
self.options = options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pull_request\n self.pull_request = GitHub::PullRequest.create config.github_repo, pull_request_attributes\n end",
"def create_pull_request(token, branch, repo, body, assignee)\n payload = {:title => branch, :base => base_branch, :head => branch, :body => body}.to_json\n say \... | [
"0.62407976",
"0.59501207",
"0.57885426",
"0.5736911",
"0.56472105",
"0.5541213",
"0.55151194",
"0.54179764",
"0.5415709",
"0.5390938",
"0.5278701",
"0.5260954",
"0.5251768",
"0.5231606",
"0.5203846",
"0.52030385",
"0.5193117",
"0.51239496",
"0.50823104",
"0.5078143",
"0.5061... | 0.7657075 | 0 |
Public: Merge the pull request's branch into the checkedout branch | def merge_pull_request
git.merge pull_request.branch
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_pr_totarget(upstream, pr_branch, repo)\n goto_prj_dir(repo)\n # check that we are in a git dir\n check_git_dir\n `git checkout #{upstream}`\n `git remote update`\n `git fetch`\n `git pull origin #{upstream}`\n `git checkout -b PR-#{pr_branch} origin/#{pr_branch}`\n puts `git br... | [
"0.71203786",
"0.7008041",
"0.6932472",
"0.69051576",
"0.68981373",
"0.6897138",
"0.67153704",
"0.67148423",
"0.6636399",
"0.65673876",
"0.65562963",
"0.65534484",
"0.65391034",
"0.64154947",
"0.6294101",
"0.62899154",
"0.6285311",
"0.62278134",
"0.62205446",
"0.61613804",
"0... | 0.86005884 | 0 |
Public: Comment that the pull request was merged into the branch | def comment_about_merge
pull_request.write_comment comment_body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_pull_request\n git.merge pull_request.branch\n end",
"def comment_body\n body = \"Merged into #{branch_to_merge_into}.\"\n if options[:user_notifications]\n body << \" /cc #{options[:user_notifications].map {|name| \"@#{name}\"}.join(' ')}\"\n end\n body\n end",
... | [
"0.7409496",
"0.63568985",
"0.6161169",
"0.61583644",
"0.6150832",
"0.6143341",
"0.6127195",
"0.60721743",
"0.60589993",
"0.60483885",
"0.59628236",
"0.5961935",
"0.5938742",
"0.592906",
"0.5871834",
"0.5865231",
"0.58555573",
"0.5844824",
"0.57922125",
"0.5788477",
"0.574324... | 0.80927455 | 0 |
Public: The content of the comment to post when merged Returns a String | def comment_body
body = "Merged into #{branch_to_merge_into}."
if options[:user_notifications]
body << " /cc #{options[:user_notifications].map {|name| "@#{name}"}.join(' ')}"
end
body
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments_text\n return self.comments.inject(\"\") do |string, comment| \n string + \n (string.empty? ? \"\" : \"\\n\") +\n comment.email +\n \": \" +\n comment.message\n end\n end",
"def workflow_comment_content(comment)\n comment.comment.gsub(/\\r?\\n/, '<br>').h... | [
"0.7035852",
"0.6770592",
"0.6544364",
"0.63454217",
"0.62512326",
"0.61885184",
"0.614223",
"0.6141876",
"0.61340946",
"0.60679317",
"0.6042618",
"0.6042618",
"0.60395515",
"0.60209167",
"0.60157984",
"0.5981822",
"0.59584504",
"0.5925789",
"0.58902425",
"0.58479965",
"0.582... | 0.69074804 | 1 |
Public: Find the pull request Returns a GitHub::PullRequest | def pull_request
@pull_request ||= GitHub::PullRequest.new config.github_repo, pull_request_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pull_request(repo_full_name, pull_request_id)\n @client.pull_request(repo_full_name, pull_request_id)\n end",
"def pull_request\n @pull_request ||= ApiFactory.new 'Repos::PullRequest'\n end",
"def get_pull_request(project_id_or_key, repository_id_or_name, pull_request_number)\n get(\... | [
"0.7682807",
"0.72812897",
"0.71012455",
"0.6961377",
"0.69427884",
"0.6885304",
"0.6835581",
"0.6813103",
"0.6801041",
"0.67362016",
"0.6704051",
"0.6514978",
"0.63600606",
"0.6350393",
"0.6336136",
"0.6326449",
"0.6315208",
"0.6272912",
"0.6262028",
"0.6237632",
"0.61724895... | 0.76471967 | 1 |
Check with the rubygems api to see if this gem name is available. | def gem_is_available?
@thor.say("Check if #{@name} is available as a gem name.", :yellow)
uri = URI.parse("https://rubygems.org/api/v1/gems/#{@name}.json")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gem_available?(name)\n Gem::Specification.find_by_name(name)\nrescue Gem::LoadError\n false\nend",
"def gem_exists? gem_name\n @swift.object_info @gems_container, gem_name\n end",
"def have_gem? name\n Gem::Specification.find_by_name name.to_s\n rescue Gem::LoadError\n false\n end",
"def ... | [
"0.7941232",
"0.79386425",
"0.78808427",
"0.78281",
"0.7597584",
"0.7515734",
"0.7476582",
"0.7438265",
"0.73793375",
"0.7360166",
"0.7358794",
"0.7334754",
"0.7325193",
"0.7290394",
"0.7261353",
"0.72375816",
"0.7133084",
"0.7105013",
"0.70745856",
"0.69979054",
"0.69392866"... | 0.8387787 | 0 |
convert the current line to a rect | def rect()
Rect.new(p1, p2)
.stroke(stroke)
.fill(fill)
.fill_phase(fill_phase)
.line_width(line_width)
.line_dash(line_dash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rect=(rectangle); end",
"def rect_to_lines(rect)\n x = rect[:x]\n y = rect[:y]\n x2 = rect[:x] + rect[:w]\n y2 = rect[:y] + rect[:h]\n [{ x: x, y: y, x2: x2, y2: y },\n { x: x, y: y, x2: x, y2: y2 },\n { x: x2, y: y, x2: x2, y2: y2 },\n { x: x, y: y2, x2: x2, y2: y2 }]\n end",
"... | [
"0.64261436",
"0.6387364",
"0.63859695",
"0.635032",
"0.62375915",
"0.62375915",
"0.6219545",
"0.613082",
"0.6117877",
"0.60674816",
"0.60300297",
"0.6009661",
"0.6001778",
"0.5998152",
"0.59886545",
"0.5928466",
"0.58829683",
"0.5880495",
"0.5825702",
"0.581181",
"0.5788006"... | 0.6715803 | 1 |
validate that the given publisher alpha id exists used in conjunction with plugin settings page, where client ID is set | def checkPublisherID
begin
publisher = Publisher.find_by(alpha_id: params[:publisher_alpha_id], verified: true) # grab publisher from clientID
logger.info "publisher url: #{params['publisher_url']}"
publisher_url = params['publisher_url']
publisher_domain = URI(publisher_url).host
@val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_client_id\n return if service_provider\n errors.add(\n :client_id, t('openid_connect.authorization.errors.bad_client_id'),\n type: :bad_client_id\n )\n end",
"def validates_hosting_provider_id( record, attr, value )\n\t\tunless VideoContentHostingProvider.exists?( value )\n\t\t\t... | [
"0.61100537",
"0.5675433",
"0.5486031",
"0.545148",
"0.5445086",
"0.5383651",
"0.5382042",
"0.53204054",
"0.5279149",
"0.5242503",
"0.5235117",
"0.52338165",
"0.5226792",
"0.5206909",
"0.51909196",
"0.51903045",
"0.51898336",
"0.51821",
"0.518202",
"0.5179139",
"0.51777375",
... | 0.6940588 | 0 |
creates a new mentorship relationship paramters from JSON: name, pdSupervisor, pdInstitution, pdStartYear, pdEndYear currently assumes that all parameters are not nil not sure if we should render as json | def create
Rails.logger.info(params)
if params.has_key?(:name) && params.has_key?(:pdSupervisor) && params.has_key?(:pdInstitution) && params.has_key?(:pdStartYear) && params.has_key(:pdEndYear)
# need to find the person, supervisor, and institution IDs first
name_id = Person.find_person_id(params[:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_relations_data(personality)\n new_relations_data = {}\n new_relations_data[:personality_id] = personality.id\n new_relations_data[:related_content_data] = personality.content\n new_relations_data\n end",
"def create \n @mentorship = Mentorship.new(params[:mentorship])\n \n # REFA... | [
"0.6167884",
"0.6143598",
"0.6023628",
"0.60101247",
"0.593652",
"0.59189564",
"0.5885262",
"0.58489144",
"0.5755231",
"0.57241064",
"0.5699846",
"0.56985736",
"0.5669499",
"0.56311494",
"0.56311494",
"0.56311494",
"0.5629569",
"0.5614089",
"0.5593516",
"0.55847037",
"0.55840... | 0.7405176 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.