query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Update properties of this object | def update!(**args)
@data_source_id = args[:data_source_id] if args.key?(:data_source_id)
@destination_dataset_id = args[:destination_dataset_id] if args.key?(:destination_dataset_id)
@email_preferences = args[:email_preferences] if args.key?(:email_preferences)
@end_time = args[:end_time] if args.key?(:end_time)
@error_status = args[:error_status] if args.key?(:error_status)
@name = args[:name] if args.key?(:name)
@notification_pubsub_topic = args[:notification_pubsub_topic] if args.key?(:notification_pubsub_topic)
@params = args[:params] if args.key?(:params)
@run_time = args[:run_time] if args.key?(:run_time)
@schedule = args[:schedule] if args.key?(:schedule)
@schedule_time = args[:schedule_time] if args.key?(:schedule_time)
@start_time = args[:start_time] if args.key?(:start_time)
@state = args[:state] if args.key?(:state)
@update_time = args[:update_time] if args.key?(:update_time)
@user_id = args[:user_id] if args.key?(:user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.70124525",
"0.69187176",
"0.69187176",
"0.69187176",
"0.69187176",
"0.69187176",
"0.6738901",
"0.67084897",
"0.67084897",
"0.66983044",
"0.66983044",
"0.66983044",
"0.66983044",
"0.66188794",
"0.6571416",
"0.6538292",
"0.65194744",
"0.63953435",
"0.63903284",
"0.63903284",
... | 0.0 | -1 |
Update properties of this object | def update!(**args)
@email = args[:email] if args.key?(:email)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end",
"def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n ... | [
"0.7012263",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.69181895",
"0.67403597",
"0.6709326",
"0.6709326",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6696149",
"0.6618882",
"0.6571848",
"0.65386343",
"0.65178275",
"0.6394807",
"0.6389745",
"0.6389745",
"0.63328... | 0.0 | -1 |
+false+ is blank: false.blank? => true | def blank?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n true\n end",
"def blank?\n true\n end",
"def blank?\n ... | [
"0.87850034",
"0.87850034",
"0.8702937",
"0.8667318",
"0.8667318",
"0.8667318",
"0.8644546",
"0.8567929",
"0.8177368",
"0.80763835",
"0.8075611",
"0.8069542",
"0.8059156",
"0.80185467",
"0.80126923",
"0.7978013",
"0.79225576",
"0.7908251",
"0.78779536",
"0.7876693",
"0.787652... | 0.8558307 | 9 |
Verify initiates an OTB (Open To Buy) request | def build_verify_request(credit_card, options)
timestamp = new_timestamp
xml = Builder::XmlMarkup.new indent: 2
xml.tag! 'request', 'timestamp' => timestamp, 'type' => 'otb' do
add_merchant_details(xml, options)
xml.tag! 'orderid', sanitize_order_id(options[:order_id])
add_card(xml, credit_card)
add_comments(xml, options)
add_signed_digest(xml, timestamp, @options[:login], sanitize_order_id(options[:order_id]), credit_card.number)
end
xml.target!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_purchase_and_void_for_check\n assert purchase = @gateway.purchase(1000, @check, @options)\n assert_success purchase\n assert_approved purchase\n \n assert void = @gateway.void(purchase.authorization, @options)\n assert_success void\n assert_approved void\n end",
"def test_purchase_... | [
"0.6254768",
"0.6082567",
"0.6053607",
"0.60367775",
"0.59646964",
"0.5937461",
"0.59014326",
"0.5829643",
"0.58101565",
"0.5809986",
"0.578018",
"0.5762376",
"0.5718947",
"0.56751347",
"0.567493",
"0.567193",
"0.56247675",
"0.5607977",
"0.55994844",
"0.5577947",
"0.5568904",... | 0.0 | -1 |
Create a nested OpenStruct, such that all subhashes added to the table also become OpenStruct objects. | def nested(data=nil)
o = new
o.nested!(true)
o.update!(data) if data
o
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_ostruct_from_hash(hash)\n ret = OpenStruct.new(hash)\n hash.each do |key, value|\n if value.is_a?(Hash)\n ret.send(\"#{key}=\", create_ostruct_from_hash(value))\n elsif value.is_a?(Array)\n ret.send(\"#{key}=\", create_ostruct_array(value))\n end\n end\n ret\nend",
"def store!(k... | [
"0.66759557",
"0.6573493",
"0.6367067",
"0.6180123",
"0.6180123",
"0.60945314",
"0.6031478",
"0.5998468",
"0.58985204",
"0.5749736",
"0.57067525",
"0.5693243",
"0.5681242",
"0.5672903",
"0.5651274",
"0.56319577",
"0.55302566",
"0.55241627",
"0.55225444",
"0.54697",
"0.5437878... | 0.5883278 | 9 |
Constructor that is both autovivified and nested. | def cascade(data=nil)
o = renew
o.nested!(true)
o.update!(data) if data
o
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(first, parent = T.unsafe(nil)); end",
"def initialize(parent = T.unsafe(nil)); end",
"def initialize(first, second = T.unsafe(nil), parent = T.unsafe(nil)); end",
"def constructor; end",
"def initialize(obj); end",
"def initialize(constructor = {}, root = nil)\n @_delegate_hash = {}\n... | [
"0.7136978",
"0.7051888",
"0.6514573",
"0.6300668",
"0.62334156",
"0.62200534",
"0.6213353",
"0.6191112",
"0.61839515",
"0.6147193",
"0.6139559",
"0.6137576",
"0.6078021",
"0.60666287",
"0.60666287",
"0.60666287",
"0.60666287",
"0.60666287",
"0.60464215",
"0.6040237",
"0.5962... | 0.0 | -1 |
Initialize new instance of OpenStruct. | def initialize(data=nil, &block)
@table = ::Hash.new(&block)
update!(data || {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @config = OpenStruct.new\n end",
"def initialize(options) #:nodoc:\n self.config = OpenStruct.new(options)\n end",
"def initialize(config = {})\n @config = OpenStruct.new(config)\n validate_config!\n end",
"def initialize\n self.imap = OpenStruct.new\... | [
"0.77727705",
"0.7448098",
"0.7066031",
"0.69336003",
"0.6808831",
"0.643302",
"0.6394118",
"0.6372422",
"0.6326319",
"0.628851",
"0.6271874",
"0.6200422",
"0.6199778",
"0.6199778",
"0.6199778",
"0.6199778",
"0.6199778",
"0.6175419",
"0.61645967",
"0.6152196",
"0.6128472",
... | 0.0 | -1 |
Because there is no means of getting the class via a BasicObject instance, we define such a method manually. | def __class__
OpenStruct2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class\n __getobj__.class\n end",
"def class_obj\n self.class\n end",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{sel... | [
"0.77118284",
"0.7624681",
"0.7577401",
"0.7577401",
"0.7458778",
"0.7400929",
"0.72558385",
"0.72464436",
"0.7238084",
"0.7238003",
"0.7204249",
"0.7145265",
"0.71246356",
"0.71246356",
"0.70946574",
"0.7038387",
"0.7014537",
"0.6958605",
"0.6938018",
"0.6925835",
"0.6925835... | 0.0 | -1 |
Duplicate underlying table when OpenStruct is duplicated or cloned. | def initialize_copy(original)
super
@table = @table.dup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_copy(orig)\n super\n @__table__ = @__table__.dup\n end",
"def initialize_copy(orig)\n super\n @table = @table.dup\n end",
"def _clone(*_)\n new_inst = _klass_new(_fn_name, *_fn_args)\n new_inst._data.replace(__hashish[\n @table.map { |_key, _value|\n if _k... | [
"0.68593657",
"0.68032324",
"0.6569473",
"0.65506077",
"0.6459358",
"0.63797605",
"0.6345265",
"0.61102915",
"0.6106479",
"0.6084783",
"0.60298187",
"0.5973599",
"0.5961",
"0.5950045",
"0.591033",
"0.589985",
"0.5897402",
"0.5868126",
"0.5867543",
"0.58612686",
"0.58525324",
... | 0.6831622 | 1 |
Dispatch unrecognized member calls. | def method_missing(sym, *args, &blk)
str = sym.to_s
type = str[-1,1]
name = str.chomp('=').chomp('!').chomp('?')
case type
when '!'
# TODO: Probably should have an indirect interface to ensure proper
# functonality in all cases.
@table.public_send(name, *args, &blk)
when '='
new_ostruct_member(name)
store!(name, args.first)
when '?'
new_ostruct_member(name)
key?(name)
else
new_ostruct_member(name)
read!(name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch\n raise NotImplementedError\n end",
"def dispatch(*_arg0); end",
"def non_index_dispatch\n if binary?\n run(Binary)\n return\n elsif unary?\n run(Unary)\n return\n end\n regular_dispatch\n end",
"def method_missing(unde... | [
"0.6155088",
"0.6102928",
"0.60363436",
"0.59764016",
"0.58773184",
"0.58326364",
"0.5830302",
"0.5755057",
"0.57539195",
"0.5733471",
"0.5726069",
"0.57041013",
"0.57013386",
"0.5638937",
"0.56366897",
"0.5626089",
"0.56252307",
"0.5602234",
"0.55868053",
"0.5565256",
"0.555... | 0.0 | -1 |
CRUD method for listing all keys. | def keys!
@table.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_keys()\n # TODO\n end",
"def all_keys\n @cluster.client.list_keys(@name)\n end",
"def list_api_keys(opts = {})\n @transporter.read(:GET, '/1/keys', {}, opts)\n end",
"def list\n @keychain.keys\n end",
"def index\n @key_sets = KeySet.all\n end",
"def index\... | [
"0.7555959",
"0.7472145",
"0.71525234",
"0.70560294",
"0.69745076",
"0.6941038",
"0.6895926",
"0.68509346",
"0.6848772",
"0.68449676",
"0.68249434",
"0.681108",
"0.67805725",
"0.67805725",
"0.675586",
"0.67461264",
"0.673087",
"0.6728465",
"0.6718963",
"0.6704799",
"0.667135"... | 0.0 | -1 |
Also a CRUD method like read!, but for checking for the existence of a key. | def key?(key)
@table.key?(key.to_sym)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end",
"def has_key?(key); end",
"def has_key?(key); end",
"def has_key? key; key? key; end",
"def exist?(key)\n\n end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
"def key?(key); end",
... | [
"0.78772205",
"0.75415194",
"0.75415194",
"0.74715066",
"0.7276478",
"0.7242052",
"0.7242052",
"0.7242052",
"0.7242052",
"0.7242052",
"0.7242052",
"0.71487623",
"0.7146235",
"0.7146235",
"0.71323776",
"0.70975864",
"0.7080983",
"0.70750767",
"0.7072684",
"0.70381165",
"0.7035... | 0.6340939 | 86 |
The CRUD method for read. | def read!(key)
@table[key.to_sym]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row\n @record = find_if_allowed(params[:id], :read)\n respond_to_action(:row)\n end",
"def set_read\n @read = Read.find(params[:id])\n end",
"def read_todo\n update\n end",
"def crud *args\n @crud = args.first if args.size > 0\n end",
"def read\n super\n\... | [
"0.6681119",
"0.662243",
"0.64992857",
"0.6391451",
"0.6292462",
"0.62714493",
"0.6252685",
"0.61405337",
"0.6110801",
"0.6075154",
"0.60655034",
"0.6006291",
"0.59694076",
"0.5932711",
"0.5924489",
"0.5915601",
"0.5893109",
"0.5884345",
"0.586076",
"0.5797691",
"0.57943875",... | 0.0 | -1 |
The CRUD method for create and update. | def store!(key, value)
if @nested && Hash === value # value.respond_to?(:to_hash)
value = OpenStruct2.new(value)
end
#new_ostruct_member(key) # this is here only for speed bump
@table[key.to_sym] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n update\n end",
"def update\n create\n end",
"def update\n create\n end",
"def create\n update\n end",
"def update\n create\n end",
"def update\n create\n end",
"def save\r\n new? ? create : update\r\n end",
"def create\n ... | [
"0.7813967",
"0.7604371",
"0.75492084",
"0.7517737",
"0.737727",
"0.737727",
"0.6725285",
"0.667987",
"0.6584176",
"0.6584176",
"0.6584176",
"0.6557322",
"0.6502714",
"0.64567655",
"0.64540184",
"0.64481646",
"0.64188004",
"0.64188004",
"0.63816524",
"0.63583964",
"0.63583964... | 0.0 | -1 |
The CRUD method for destroy. | def delete!(key)
@table.delete(key.to_sym)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\r\n end",
"def destroy\r\n\r\n end",
"def delete\n destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\n end",
"def destroy\r\n end",
"def destroy\r\n end",
"def destroy; delete end",
"... | [
"0.7837561",
"0.77394795",
"0.7730291",
"0.7719497",
"0.7719497",
"0.7719497",
"0.7719497",
"0.7719497",
"0.7704295",
"0.7704295",
"0.7672396",
"0.76595765",
"0.76595765",
"0.76516384",
"0.7608896",
"0.7586135",
"0.7586135",
"0.7545908",
"0.7545908",
"0.7545908",
"0.7545908",... | 0.0 | -1 |
Same as `delete!`. This method provides compatibility with the original OpenStruct class. | def delete_field(key)
@table.delete(key.to_sym)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(obj) ; end",
"def delete(object); end",
"def delete!\n delete( nil, true ) \n end",
"def delete(_spec)\n raise NotImplementedError, not_implemented_msg(:delete)\n end",
"def delete(o); removeObject o end",
"def delete\n NotImplemented\n end",
"def delete\n NotImp... | [
"0.7251308",
"0.6956473",
"0.69302255",
"0.6850544",
"0.68320084",
"0.6680585",
"0.6680585",
"0.6667947",
"0.66427904",
"0.66235524",
"0.6477377",
"0.64734286",
"0.6454753",
"0.64530385",
"0.64181405",
"0.64181405",
"0.64160985",
"0.6407099",
"0.63583964",
"0.63326466",
"0.63... | 0.0 | -1 |
Merge this OpenStruct with another OpenStruct or Hash object returning a new OpenStruct instance. IMPORTANT! This method does not act inplace like `Hashmerge!`, rather it works like `Hashmerge`. | def merge!(other)
o = dup
other.each do |k,v|
o.store!(k,v)
end
o
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge!( other )\n\t\t\tcase other\n\t\t\twhen Hash\n\t\t\t\t@hash = self.to_h.merge( other,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen ConfigStruct\n\t\t\t\t@hash = self.to_h.merge( other.to_h,\n\t\t\t\t\t&HashMergeFunction )\n\n\t\t\twhen Arrow::Config\n\t\t\t\t@hash = self.to_h.merge( other.struct.to_h,\n... | [
"0.77517265",
"0.7082207",
"0.70508945",
"0.69744617",
"0.6943111",
"0.6847997",
"0.68381506",
"0.66483843",
"0.66106963",
"0.66037697",
"0.64850116",
"0.64713126",
"0.63833255",
"0.63762534",
"0.6363829",
"0.6363016",
"0.63620716",
"0.63339067",
"0.6333791",
"0.63199484",
"0... | 0.5818622 | 98 |
Get a duplicate of the underlying table. | def to_h
@table.dup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy\n result = HashTablet.new(@table.size)\n each {|element| result.insert(element) }\n return result\n end",
"def dup\n duped_rows = rows.map(&:dup)\n self.class.new(duped_rows)\n end",
"def dup\n other = super\n %w{tables table_alias unique_alias where tables key_value_t... | [
"0.74288404",
"0.73790216",
"0.70681274",
"0.6883358",
"0.66663337",
"0.6583027",
"0.65611506",
"0.65455395",
"0.65279907",
"0.6424239",
"0.6424239",
"0.6424239",
"0.64204115",
"0.6402175",
"0.63907206",
"0.6321653",
"0.6301223",
"0.6236129",
"0.6233999",
"0.62304825",
"0.621... | 0.5966058 | 45 |
TODO: Should OpenStruct2 support to_hash ? alias :to_hash :to_h Create an enumerator based on `each!`. | def to_enum(methname=:each!)
# Why has Ruby 2 deprecated this form?
#::Enumerator.new(self, methname)
::Enumerator.new do |y|
__send__(methname) do |*a|
y.yield *a
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block)\n to_h.each(&block)\n end",
"def each(&blk)\n to_h.each(&blk)\n end",
"def each\n self.to_hash.each\n end",
"def each_hash\n if block_given?\n while row = next_hash\n yield row\n end\n else\n self.enum_for(:each_hash)\n end\n end",
"d... | [
"0.6940512",
"0.69024974",
"0.67601156",
"0.65915114",
"0.65010214",
"0.64992464",
"0.64917105",
"0.62673455",
"0.61414164",
"0.6105258",
"0.6105258",
"0.6105258",
"0.6105258",
"0.6096157",
"0.60916126",
"0.6046219",
"0.6031621",
"0.6024084",
"0.5987481",
"0.5987481",
"0.5947... | 0.5749021 | 54 |
Is the OpenStruct instance frozen? | def frozen?
@table.frozen?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frozen?() end",
"def frozen?() end",
"def frozen?\n @attributes.frozen?\n end",
"def frozen?\n @attributes.frozen?\n end",
"def frozen?\n @attributes.frozen?\n end",
"def frozen?\n @frozen\n end",
"def frozen?\n @frozen\n end",
"def frozen?\n true\n end... | [
"0.7536829",
"0.7536829",
"0.7390689",
"0.7390689",
"0.7390689",
"0.7362908",
"0.7353042",
"0.73066247",
"0.7267572",
"0.7050422",
"0.6852889",
"0.6750952",
"0.66789526",
"0.6669021",
"0.64821494",
"0.6469455",
"0.64513123",
"0.6421969",
"0.64070344",
"0.636914",
"0.6222742",... | 0.6607275 | 14 |
Is the OpenStruct void of entries? | def empty?
@table.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def struct?\n is_struct\n end",
"def record?\n type == \"RECORD\" || type == \"STRUCT\"\n end",
"def _rh_struct_changing_ok?(result, key, data)\n return true unless [Array, Hash].include?(data[key].class) ||\n [Array, Hash].include?(result[key].class)\n\n ... | [
"0.61902076",
"0.60318637",
"0.5858741",
"0.57617694",
"0.56618524",
"0.5648251",
"0.56193864",
"0.5518154",
"0.5501217",
"0.5436818",
"0.54151493",
"0.5414562",
"0.5376465",
"0.53686726",
"0.5365158",
"0.53529996",
"0.53336716",
"0.5330013",
"0.53024656",
"0.5302391",
"0.529... | 0.0 | -1 |
Two OpenStructs are equal if they are the same class and their underlying tables are equal. | def eql?(other)
return false unless(other.kind_of?(__class__))
return @table == other.table #to_h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n return false unless(other.kind_of?(OpenStruct))\n return @__table__ == other.table\n end",
"def ==(other)\n return false unless other.kind_of?(OpenStruct)\n @table == other.table\n end",
"def eql?(other)\n return false unless other.kind_of?(OpenStruct)\n @table.eql?(other.ta... | [
"0.76104766",
"0.7567616",
"0.7403301",
"0.64618784",
"0.61663723",
"0.5961068",
"0.5952073",
"0.5893045",
"0.58796304",
"0.5873959",
"0.5873959",
"0.58504134",
"0.58202946",
"0.58157176",
"0.5813757",
"0.5806541",
"0.57774997",
"0.5773605",
"0.57570875",
"0.57518107",
"0.575... | 0.62231433 | 4 |
Two OpenStructs are equal if they are the same class and their underlying tables are equal. TODO: Why not equal for other hash types, e.g. via to_h? | def ==(other)
return false unless(other.kind_of?(__class__))
return @table == other.table #to_h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n return false unless(other.kind_of?(OpenStruct))\n return @__table__ == other.table\n end",
"def ==(other)\n return false unless other.kind_of?(OpenStruct)\n @table == other.table\n end",
"def eql?(other)\n return false unless other.kind_of?(OpenStruct)\n @table.eql?(other.ta... | [
"0.74287903",
"0.7335508",
"0.7214028",
"0.6960794",
"0.651261",
"0.6507931",
"0.64382476",
"0.62664163",
"0.62421346",
"0.62397486",
"0.6229188",
"0.61240077",
"0.61128396",
"0.61069256",
"0.61002886",
"0.61002886",
"0.60622305",
"0.6059794",
"0.6059203",
"0.6037187",
"0.600... | 0.6465549 | 6 |
format = '"Text with yyyy/mm/dd"yyyy[aa.bb][cc.dd.ee][ff]mmdd"Text with [aa.bb]"[]' format_parts(format) => [ '"Text with yyyy/mm/dd"', 'yyyy', '[aa.bb]', '[cc.dd.ee][ff]mmdd', '"Text with [aa.bb]"', '[', '', ']' ] | def format_parts(format)
# Separate format to array
formats = []
split_formats = format.split(/"/)
split_formats.each_with_index do |sf, i|
sf = %("#{sf}") if i % 2 == 1
formats << sf
end
formats.collect! do |f|
if f =~ /"/
f
else
f.gsub!(/(#+)/,'|\1|')
f.split('|')
end
end
# Remove array in formats
formats.flatten!
formats.collect! do |f|
if f =~ /"|#/
f
else
f.gsub!(/(\[[\w]+.[\w]+\])/,'|\1|')
f.split('|')
end
end
# Remove array in formats
formats.flatten!
# Remove empty formats
formats.delete('')
# Return
formats
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_format(path)\n # format appears after the last period.\n remainder, dot, format = path.rpartition('.')\n return [path, ''] if dot.empty?\n return [remainder, format]\n end",
"def split(parts); end",
"def _process_format(format); end",
"def _process_format(format); end",
"de... | [
"0.67150545",
"0.60502195",
"0.5724073",
"0.5724073",
"0.5637958",
"0.5620289",
"0.5610066",
"0.55777824",
"0.55194247",
"0.55191123",
"0.5513906",
"0.55050284",
"0.54896235",
"0.54811573",
"0.5458997",
"0.5433693",
"0.54069597",
"0.536396",
"0.53546613",
"0.5336816",
"0.5324... | 0.794051 | 0 |
CustomFields::AutoNumbering.increase(Integer) > String Get the next string CustomFields::AutoNumbering.increase(custom_field_id) => 10Text15120143 | def increase(custom_field_id, cells)
ActiveRecord::Base.transaction do
custom_field = CustomFields::AutoNumbering.find(custom_field_id)
if self.unset_cells(custom_field, cells).empty?
value = format_value(custom_field, cells)
key_hash = AutoNumberRunning.key_hash(custom_field.format_key, value)
auto_number_running = custom_field.auto_number_runnings.find(:first,
:conditions => {
:auto_number_runnings => { :key_hash => key_hash }
}
)
auto_number_running ||= AutoNumberRunning.new(
:key_hash => key_hash,
:current => (custom_field.start_value - custom_field.increment)
)
custom_field.auto_number_runnings << auto_number_running if auto_number_running.new_record?
auto_number_running.current = auto_number_running.current + custom_field.increment
auto_number_running.save
format_value(auto_number_running, cells)
end
end.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def up_number\n unless number\n if Invoice.count == 0\n self.number = '001'\n else\n last_invoice = Invoice.order(:number).last\n self.number = last_invoice.number.succ\n end\n end\n end",
"def custom_attribute_field_id\n @ca_field_id ||= 0\n @ca_field_id += 1\n\n... | [
"0.6313153",
"0.626972",
"0.6189276",
"0.61273783",
"0.60978633",
"0.60512966",
"0.6033119",
"0.6012774",
"0.5972744",
"0.5963771",
"0.5963771",
"0.5963771",
"0.5956725",
"0.59532183",
"0.5952783",
"0.595243",
"0.59191203",
"0.5902649",
"0.5855905",
"0.58193666",
"0.5815659",... | 0.73044413 | 0 |
custom_field = CustomFields::AutoNumbering.new custom_field.format = 'yyyy/mm/dd' custom_field.has_date? => true custom_field.format = '"Text with yyyy/mm/dd"' custom_field.has_date? => false custom_field.format = '[yy.mm]' custom_field.has_date? => false | def has_date?
format = self.format.gsub(/("[^"]*"|#|\[[\w.]+\])/,'')
!(format =~ /[ymdwhq]/).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template\n if self.style == 'mmyy'\n 'date_field_mmyy'\n else\n 'date_field'\n end\n end",
"def formatted_date(field)\n self.send(field).strftime('%b %d, %Y') if self.send(field).present?\n end",
"def date_field(field, options = {})\n append_class_option(options, \"date_field\")\... | [
"0.63547283",
"0.62148106",
"0.60195345",
"0.5851265",
"0.56757474",
"0.567182",
"0.56124127",
"0.56004804",
"0.55629665",
"0.5489983",
"0.54718244",
"0.54544765",
"0.54295635",
"0.5412986",
"0.5408248",
"0.5404578",
"0.5386523",
"0.53690904",
"0.5363813",
"0.5362959",
"0.534... | 0.0 | -1 |
custom_field.format_key > string Get format key custom_field.format_key => "yymmdd" | def format_key
formats = CustomFields::AutoNumbering.format_parts(self.format)
formats.select{|f| (f =~ /("|#)/).nil? }.join('-')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_format(field)\n @formatted_key[field] ||= JSONAPI.configuration\n .key_formatter\n .format(resource_key_for(field))\n .to_sym\n end",
"def format(value, key = nil, model = nil)\n if !key.nil?\n if key.to_s.ends_with?('_at')\n l(value.to_date... | [
"0.6988146",
"0.6979394",
"0.6971839",
"0.6855248",
"0.6465034",
"0.64554995",
"0.62444687",
"0.61550605",
"0.61434186",
"0.6141597",
"0.61248356",
"0.6122676",
"0.5986273",
"0.59589183",
"0.59386146",
"0.5897729",
"0.5897417",
"0.58601105",
"0.5854681",
"0.5850038",
"0.58435... | 0.76499903 | 0 |
cutom_field.reference_custom_field_ids > an array Get reference custom field ids custom_field.reference_custom_field_ids => [10,11,12,13] | def reference_custom_field_ids
self[:value] ||= {}
self[:value][:custom_field_ids] ||= []
@custom_field_ids ||= self[:value][:custom_field_ids].collect{|cf_id| cf_id.to_i if CustomField.exists?(cf_id) }.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reference_custom_fields\n reference_custom_field_ids.collect{|cf_id| CustomFields::Reference.find(cf_id) }\n end",
"def custom_fields\n field_values = @client.account_details.custom_field_values\n\n fields = []\n\n 3.times do |i|\n n = i+1\n\n if send(:\"field#{n}_value_i... | [
"0.82706416",
"0.62558174",
"0.6199382",
"0.60171694",
"0.6004322",
"0.59667856",
"0.59193647",
"0.5727874",
"0.5708435",
"0.56372553",
"0.55993074",
"0.55993074",
"0.5564795",
"0.555203",
"0.5534277",
"0.55329764",
"0.552238",
"0.5492505",
"0.54437894",
"0.5438593",
"0.54049... | 0.8533863 | 0 |
cutom_field.reference_custom_fields > an array Get reference custom fields custom_field.reference_custom_fields => [CustomFields::Reference,CustomFields::Reference,CustomFields::Reference,CustomFields::Reference] | def reference_custom_fields
reference_custom_field_ids.collect{|cf_id| CustomFields::Reference.find(cf_id) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reference_custom_field_ids\n self[:value] ||= {}\n self[:value][:custom_field_ids] ||= []\n \n @custom_field_ids ||= self[:value][:custom_field_ids].collect{|cf_id| cf_id.to_i if CustomField.exists?(cf_id) }.compact\n end",
"def custom_fields\n field_values = @client.account_detai... | [
"0.7628164",
"0.6554916",
"0.6377768",
"0.63773763",
"0.6209855",
"0.6170273",
"0.61499184",
"0.61368376",
"0.6105796",
"0.6061481",
"0.60173017",
"0.5999315",
"0.58081925",
"0.5783502",
"0.5762397",
"0.5715312",
"0.5715312",
"0.56559294",
"0.5623446",
"0.5610104",
"0.5526577... | 0.8362868 | 0 |
metodo que por defecto presenta el string | def to_s
"#{nombres} #{paterno}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string?; end",
"def string() end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string; end",
"def string\n @string\n end",
"def string\n @string\n end",
"def string... | [
"0.74515164",
"0.73246247",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7225491",
"0.7170139",
"0.7170139",
"0.6994524",
"0.69842976",
"0.69842976",
"0.69842976",
"0.69474274",
"0.6898626",
"0.6889612",
"0.6889612... | 0.0 | -1 |
Consultor del titulo, devuelve nil ya que solo las calles tienen titulo | def titulo
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asignar_titulo_propiedad()\n \n end",
"def titulo_guia\n titulo = []\n\n t = Especie.find(params[:especie_id])\n a = t.adicional\n\n tipo_region = params[:tipo_region] == \"anp\" ? \"ANP \" : \"Municipio de \"\n \n if a.nombre_comun_principal.present?\n titulo[0] = \"Guía... | [
"0.6372878",
"0.6333957",
"0.6325835",
"0.6239822",
"0.60625803",
"0.6023917",
"0.60175425",
"0.5932207",
"0.5886024",
"0.585017",
"0.582606",
"0.5805335",
"0.57674766",
"0.5748658",
"0.5712684",
"0.56854683",
"0.5675048",
"0.5662179",
"0.56564146",
"0.5652772",
"0.56351566",... | 0.7745368 | 1 |
Comprueba si la casilla es edificable, devuelve false porque solo las calles lo son | def soy_edificable
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edificar_casa (titulo)\n edificada = false\n \n if (puedo_edificar_casa(titulo))\n coste_edificar_casa = titulo.precio_edificar\n if (tengo_saldo(coste_edificar_casa))\n titulo.edificar_casa\n modificar_saldo (-coste_edificar_casa)\n edificada... | [
"0.7485318",
"0.6895932",
"0.6827735",
"0.6723027",
"0.6675051",
"0.6655748",
"0.6613349",
"0.65563655",
"0.65446043",
"0.65325665",
"0.6491451",
"0.641164",
"0.6387168",
"0.63699794",
"0.63634354",
"0.63634354",
"0.6314135",
"0.6292197",
"0.627821",
"0.6246649",
"0.6221682",... | 0.6498832 | 11 |
GET /draft_investments/1 GET /draft_investments/1.xml | def show
@draft_investment = DraftInvestment.find(params[:id])
respond_to do |format|
format.xml { render :xml => @draft_investment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @draft_investment = DraftInvestment.new\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end",
"def show\n @invest = Invest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @in... | [
"0.7332301",
"0.7167561",
"0.6709937",
"0.6649071",
"0.6569686",
"0.65380096",
"0.6527645",
"0.6504869",
"0.6488592",
"0.64177066",
"0.6391856",
"0.6375843",
"0.6279832",
"0.62487864",
"0.62323475",
"0.6164607",
"0.6135705",
"0.61334616",
"0.6111598",
"0.6111598",
"0.6111598"... | 0.7968183 | 0 |
GET /draft_investments/new GET /draft_investments/new.xml | def new
@draft_investment = DraftInvestment.new
respond_to do |format|
format.xml { render :xml => @draft_investment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @fixed_deposit = FixedDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end",
"def new\n @invest = Invest.new\n @invest.seq = get_next_seq(Invest)\n respond_to do |format|\n format.html # new.htm... | [
"0.72021484",
"0.7185856",
"0.71423906",
"0.70694804",
"0.7049854",
"0.70109576",
"0.69804657",
"0.6924873",
"0.6898461",
"0.68829817",
"0.68815154",
"0.68684196",
"0.6858502",
"0.6840151",
"0.6827573",
"0.6824441",
"0.6824441",
"0.6798169",
"0.67973655",
"0.6790792",
"0.6790... | 0.81029046 | 0 |
POST /draft_investments POST /draft_investments.xml | def create
@data = params[:investment]
@investment= DraftInvestment.find(:all, :conditions => ["company_id = ? AND funding_type = ?",@data[:company_id], @data[:funding_type]])
if @investment.to_s != ""
@invest = DraftInvestment.find(@investment[0][:id])
@invest.update_attributes({"agency" => @investment[0]["agency"] + ", " + @data[:agency],"funding_amount" => (@data["funding_amount"].to_i + @investment[0]["funding_amount"]).to_s})
respond_to do |format|
format.xml
end
else
@investment = DraftInvestment.new(params[:investment])
respond_to do |format|
if @investment.save
flash[:notice] = 'Investment was successfully created.'
format.xml { render :xml => @investment, :status => :created, :location => @investment }
else
format.xml { render :xml => @investment.errors, :status => :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @draft_investment = DraftInvestment.new\n\n respond_to do |format|\n\n format.xml { render :xml => @draft_investment }\n end\n end",
"def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[... | [
"0.67654425",
"0.66616166",
"0.6652693",
"0.6417311",
"0.6376922",
"0.6326423",
"0.63087755",
"0.6239985",
"0.6235383",
"0.6144707",
"0.6135099",
"0.613039",
"0.60580343",
"0.6007412",
"0.5957032",
"0.5957032",
"0.5955793",
"0.59285504",
"0.5925527",
"0.5859661",
"0.58588856"... | 0.6572378 | 3 |
PUT /draft_investments/1 PUT /draft_investments/1.xml | def update
@draft_investment = DraftInvestment.find(params[:id])
respond_to do |format|
if @draft_investment.update_attributes(params[:investment])
format.xml
else
format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @invest = Invest.find(params[:id])\n\n respond_to do |format|\n if @invest.update_attributes(params[:invest])\n format.html { redirect_to(@invest, :notice => 'Invest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \... | [
"0.7177903",
"0.68185717",
"0.67332476",
"0.6634273",
"0.6590446",
"0.6556295",
"0.65534264",
"0.65534264",
"0.65513444",
"0.6547284",
"0.6453545",
"0.6422345",
"0.63840234",
"0.6367753",
"0.6352475",
"0.6352475",
"0.634028",
"0.633478",
"0.6331328",
"0.6317676",
"0.63150215"... | 0.7863944 | 0 |
DELETE /draft_investments/1 DELETE /draft_investments/1.xml | def destroy
@draft_investment = DraftInvestment.find(params[:id])
@draft_investment.destroy
respond_to do |format|
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @invest = Invest.find(params[:id])\n @invest.destroy\n\n respond_to do |format|\n format.html { redirect_to(invests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @investigation = Investigation.find(params[:id])\n @investigation.destroy\n\n respond_to... | [
"0.7325162",
"0.6885616",
"0.68521565",
"0.68063796",
"0.6720497",
"0.66675067",
"0.6581549",
"0.657877",
"0.657877",
"0.6574228",
"0.655173",
"0.6549124",
"0.6544644",
"0.6521697",
"0.6502779",
"0.6489537",
"0.6445264",
"0.6442577",
"0.643813",
"0.64325726",
"0.6432013",
"... | 0.79728395 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_booking
@booking = Booking.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
GET /relatives GET /relatives.json | def index
@relatives = Relative.includes(:organizations, :representative)
.group_by { |relative| relative.representative }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path(*args)\n return call_ancestry_method(:path) if use_ancestry?\n\n Relationship.resources(path_rels(*args)) # TODO: Prevent preload of self which is in the list\n end",
"def add_relatives(relatives,min_distance,max_distance,relationship)\n min_distance.upto(max_distance) do |distance|\n ... | [
"0.59531796",
"0.5941671",
"0.57423955",
"0.56898934",
"0.5578644",
"0.55052364",
"0.5496592",
"0.5490209",
"0.5455474",
"0.54151464",
"0.5390504",
"0.53170204",
"0.5308653",
"0.52572894",
"0.52275693",
"0.52261436",
"0.52238655",
"0.51975673",
"0.51880985",
"0.5168235",
"0.5... | 0.6495635 | 0 |
GET /relatives/1 GET /relatives/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @relatives = Relative.includes(:organizations, :representative)\n .group_by { |relative| relative.representative }\n end",
"def path(*args)\n return call_ancestry_method(:path) if use_ancestry?\n\n Relationship.resources(path_rels(*args)) # TODO: Prevent preload of s... | [
"0.6307115",
"0.60586995",
"0.5969806",
"0.5698729",
"0.56570244",
"0.56097126",
"0.5608365",
"0.55217624",
"0.5472127",
"0.53498554",
"0.5349347",
"0.5341495",
"0.5327132",
"0.5284667",
"0.5284667",
"0.52558774",
"0.5255536",
"0.5255536",
"0.5245706",
"0.52353317",
"0.522114... | 0.0 | -1 |
POST /relatives POST /relatives.json | def create
@relative = Relative.new(relative_params)
respond_to do |format|
if @relative.save
format.html { redirect_to [:admin, @relative], notice: 'Relative was successfully created.' }
format.json { render :show, status: :created, location: @relative }
else
format.html { render :new }
format.json { render json: @relative.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @relatory = Relatory.new(relatory_params)\n\n respond_to do |format|\n if @relatory.save\n format.html { redirect_to @relatory, notice: 'Relatório Salvo.' }\n format.json { render :show, status: :created, location: @relatory }\n else\n format.html { render :new }\n... | [
"0.64449376",
"0.61134684",
"0.6084945",
"0.5859393",
"0.58260524",
"0.54997855",
"0.5465198",
"0.54432344",
"0.5345139",
"0.5303838",
"0.52967906",
"0.525849",
"0.5246864",
"0.5206786",
"0.5200933",
"0.5194986",
"0.5124349",
"0.5117807",
"0.51080775",
"0.510206",
"0.5101751"... | 0.60831225 | 3 |
PATCH/PUT /relatives/1 PATCH/PUT /relatives/1.json | def update
respond_to do |format|
if @relative.update(relative_params)
format.html { redirect_to [:admin, @relative], notice: 'Relative was successfully updated.' }
format.json { render :show, status: :ok, location: @relative }
else
format.html { render :edit }
format.json { render json: @relative.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @relatory.update(relatory_params)\n format.html { redirect_to @relatory, notice: 'Relatório atualizado.' }\n format.json { render :show, status: :ok, location: @relatory }\n else\n format.html { render :edit }\n format.json { render ... | [
"0.63427764",
"0.63061845",
"0.61638796",
"0.6162443",
"0.6121891",
"0.5970408",
"0.5970408",
"0.5935698",
"0.5860946",
"0.585707",
"0.5831847",
"0.5793702",
"0.5767282",
"0.576302",
"0.5761221",
"0.57491714",
"0.5692404",
"0.5692404",
"0.5691393",
"0.5691393",
"0.568664",
... | 0.6024745 | 5 |
DELETE /relatives/1 DELETE /relatives/1.json | def destroy
@relative.destroy
respond_to do |format|
format.html { redirect_to [:admin, :relatives], notice: 'Relative was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @relatory.destroy\n respond_to do |format|\n format.html { redirect_to relatories_url, notice: 'Relatório deletado.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def ... | [
"0.6867178",
"0.6731767",
"0.6679621",
"0.66419244",
"0.6641555",
"0.6560886",
"0.6531206",
"0.65192753",
"0.65192753",
"0.64699703",
"0.64286506",
"0.6426314",
"0.64173937",
"0.64156896",
"0.64134645",
"0.64024055",
"0.63852704",
"0.63792837",
"0.6366503",
"0.6362228",
"0.63... | 0.7204016 | 0 |
Generates a Ruby Hash containing a configuration compatible with ExtJS Buttonwidget definition, to be used inside an items list of a panel container. Works similarly to ApplicationHelper::create_extjs_button_config, but instead of returning a parsable Javascript string, the result is a plain Ruby Hash. == Params: action_title_i19n_sym => Symbol for the I18n title for the button. The method assumes also that a tooltip symbol is defined with a "_tooltip" appended on the title symbol action_title_i19n_scope_sym => Symbol for the I18n scope of the localization; it can be nil for using the default global scope image_name => file name for the image to be used in the button, searched under "/images/icons" | def create_button_config( action_title_i19n_sym, action_title_i19n_scope_sym, image_name = "cog.png" )
action_text = I18n.t( action_title_i19n_sym.to_sym, {:scope => [action_title_i19n_scope_sym ? action_title_i19n_scope_sym.to_sym : nil]} )
tooltip_text = I18n.t( "#{action_title_i19n_sym}_tooltip".to_sym, {:scope => [action_title_i19n_scope_sym ? action_title_i19n_scope_sym.to_sym : nil]} )
{
:xtype => 'button',
:id => action_title_i19n_sym.to_s,
:name => action_title_i19n_sym.to_s,
:icon => "/images/icons/#{ image_name }",
:text => "#{ action_text }",
:tooltip => "#{ tooltip_text }",
:margin => '0 3 3 3'
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integrated_slat_action_button_component_options\n { theme: (theme || :secondary),\n traits: traits,\n as: :a,\n confirm: confirm,\n disable_with: disable_with,\n href: href,\n method: send(:method),\n remote: ... | [
"0.5712615",
"0.5438926",
"0.53248334",
"0.5288526",
"0.5206415",
"0.5156668",
"0.50238985",
"0.49551955",
"0.49250045",
"0.49193814",
"0.49146566",
"0.48829538",
"0.48395914",
"0.48334154",
"0.48087484",
"0.480182",
"0.4778795",
"0.47403705",
"0.4709297",
"0.46431372",
"0.46... | 0.8323124 | 0 |
The method should mutate the given array by replacing elements with their corresponding values in the hash. The method should return the given array. Note: this method must MUTATE the input array. This means that the object_id of the input array should be identical to the object_id of the returned array. The exact object_ids you get back don't matter. We just want the ids to be the same before and after calling your method. | def ele_replace!(array, hash)
array.map! do |ele| #go through the array
if hash.has_key?(ele) #hash contains a key thats also in the array arr = [4,2,0,2] vs hash = {2=>two, 0 => zero}
hash[ele] #convert array values with corresponding hash values -> [ ... ,two,zero,two]
else
ele #if array value doesnt correspond with hash key, place array index back to original position -> [ 4,...,...,...]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def element_replace(array, hash)\n new_array = []\n\n array.each do |ele|\n if hash.keys.include?(ele)\n new_array << hash[ele]\n else\n new_array << ele\n end\n end\n\n new_array\nend",
"def mutate(arr)\n arr.uniq!\nend",
"def element_replace(arr, hash)\n new_arr = []\n\n arr.each ... | [
"0.653968",
"0.63620627",
"0.63458717",
"0.60115594",
"0.6002978",
"0.5959449",
"0.5938209",
"0.58660126",
"0.5831873",
"0.58262515",
"0.5797022",
"0.57001776",
"0.56677926",
"0.56462127",
"0.56319356",
"0.56319356",
"0.56319356",
"0.56248444",
"0.5600751",
"0.5587469",
"0.55... | 0.64846176 | 1 |
envia la notificaciones de los usuarios en tiempo real | def perform(notification)
notification_count = Notification.for_user(notification.user_id) #cuanta cuantas notificaiones no vistas tiene el usuario contando la nueva notificacion
ActionCable.server.broadcast "notifications.#{notification.user_id}",
{action: "new_notification", message: notification_count}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_usuario\n \n end",
"def current_users\n @title = \"Usuarios actuales\"\n @current_users = GetCurrentUsers.call(@previa_group)\n end",
"def set_users\n\n end",
"def usuario_actual\n \t#se guarda al usuario actual que esta loggeado por cuestion de eficiencia\n \t#para no accesar a la b... | [
"0.6580915",
"0.64378095",
"0.61713266",
"0.609065",
"0.5987785",
"0.59645265",
"0.59378725",
"0.5929107",
"0.5852287",
"0.58365834",
"0.58226925",
"0.5790702",
"0.5785199",
"0.57517105",
"0.57447064",
"0.57376325",
"0.572983",
"0.5727012",
"0.5723294",
"0.5720212",
"0.571588... | 0.0 | -1 |
return if idx2 >= arr.size block.call(arr[idx1], arr[idx2]) each_cons(arr, idx1 + 1, idx2 + 1, &block) end | def each_cons(arr, &block)
arr.size < 2 ? return : block.call(arr[0, 2])
each_cons(arr.drop(1), &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_cons(arr)\n first = 0\n second = 1\n loop do\n break if second >= arr.size\n yield(arr[first], arr[second])\n first += 1\n second += 1\n end\n nil\nend",
"def each_cons(array)\n index1 = 0\n index2 = 1\n while index1 < array.size\n yield(index1, index2)\n index1 += 2\n index... | [
"0.7513829",
"0.744859",
"0.7363853",
"0.7146757",
"0.7092168",
"0.70180184",
"0.68389475",
"0.66824883",
"0.6497901",
"0.64506173",
"0.6392409",
"0.6355082",
"0.63120294",
"0.62711823",
"0.62602246",
"0.6240947",
"0.62398815",
"0.6193741",
"0.6148433",
"0.61179006",
"0.60856... | 0.78848267 | 0 |
Salforce Lead cteating from CherApp | def salesforce_lead_create
user = User.select("first_name, last_name").last
SalesforceLeadJob.perform_later(email) if (user.last_name).present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform\n begin\n binding = RForce::Binding.new KEYS['salesforce']['base']\n binding.login KEYS['salesforce']['username'], KEYS['salesforce']['password'] + KEYS['salesforce']['token']\n\n sl = SellerListing.find(seller_listing_id)\n\n # User, address and phone info must be here to create... | [
"0.58402675",
"0.54787123",
"0.5441732",
"0.53502727",
"0.5282773",
"0.5223048",
"0.5213377",
"0.51754093",
"0.51754093",
"0.516375",
"0.50824755",
"0.5067873",
"0.50645804",
"0.5064154",
"0.5056645",
"0.50542265",
"0.5032653",
"0.50259787",
"0.49986178",
"0.49951443",
"0.498... | 0.0 | -1 |
Reads messages and learns about the content | def learn(message)
@eyes.process_message(message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read()\n\tloop {\n\t\t#puts (\"read list in : #{$reading}\")\n\t\trs, ws, es = IO.select($reading, nil, nil, 1)\n\t\tif (rs != nil)\n\t\t\trs.each { |r|\n\t\t\t\tmsg = r.gets\n\t\t\t\t#only reads in messages sent from a socket\n\t\t\t\tif (!(msg == nil))\n\t\t\t\t\tmsg_info = msg.split(\" \")\n\t\t\t\t\t#if ms... | [
"0.65857923",
"0.6436185",
"0.63443696",
"0.6333778",
"0.63244945",
"0.6284904",
"0.62402105",
"0.61956984",
"0.6189301",
"0.61259496",
"0.611394",
"0.61094016",
"0.60908365",
"0.6055796",
"0.6047328",
"0.60243976",
"0.60149765",
"0.60127395",
"0.60090536",
"0.598371",
"0.597... | 0.0 | -1 |
Says something (either in a reply to a message, or makes it up) | def speak(message = '', context = [])
return @mouth.construct_sentence(message,context)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reply\n end",
"def say(message)\n if message\n @previous_message = message\n @previous_nickname = @botname\n @responded = true\n message\n end\n end",
"def reply(event)\n msg = event.message['text']\n mk_reply(msg)\nend",
"def reply msg\n\t\t# get message from ... | [
"0.6727514",
"0.66516227",
"0.659719",
"0.654193",
"0.6504054",
"0.6437574",
"0.6423626",
"0.6380119",
"0.63628507",
"0.63567334",
"0.6344196",
"0.6315652",
"0.62935716",
"0.62877226",
"0.62636393",
"0.6243579",
"0.6216271",
"0.62034297",
"0.61675274",
"0.61648",
"0.61647224"... | 0.0 | -1 |
Remembers something and lets it be randomized by recall | def remember(message)
return @ears.add_quote(message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomize!\n self.replace(self.randomize)\n end",
"def reset\n\t\tself.gen = Random.new(SEED)\n\tend",
"def reset\n\t\tself.gen = Random.new(SEED)\n\tend",
"def regenerate\n self.token = UUIDTools::UUID.random_create.to_s\n reset_timer\n self.token\n end",
"def new_random\n @ra... | [
"0.6929218",
"0.67182285",
"0.67182285",
"0.6680889",
"0.6501639",
"0.64126927",
"0.6408858",
"0.63748956",
"0.6355788",
"0.63425905",
"0.6333779",
"0.6333779",
"0.6322858",
"0.629976",
"0.629976",
"0.6291005",
"0.6291005",
"0.6259043",
"0.61850536",
"0.6148462",
"0.61461073"... | 0.0 | -1 |
Pulls a random string out of Rheya's memory | def recall(id)
if id =~ /^[-+]?[0-9]*\.?[0-9]+$/
return @ears.specific_quote(id)
end
return @ears.random_quote
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_string(length); random_bytes(length / 2).unpack(\"H*\")[0] end",
"def ran_str_maker\r\n length = 10\r\n ran_str = rand(36**length).to_s(36)\r\n return ran_str\r\nend",
"def rl\n letters = \"ABCDEFGHIJKLMNOPQRSTUWXYZ\"\n r = rand 0..24\n return letters[r]\nend",
"def fuzz_str()\n\t\tret... | [
"0.7544916",
"0.73620236",
"0.7191349",
"0.7144324",
"0.7065664",
"0.7028334",
"0.699179",
"0.6988207",
"0.6811577",
"0.6730084",
"0.66825986",
"0.6657708",
"0.6652681",
"0.6652681",
"0.66451055",
"0.66008985",
"0.66001916",
"0.6596531",
"0.6579768",
"0.6575298",
"0.65722847"... | 0.0 | -1 |
Fetches last mentions from Twitter and returns an array of strings | def last_mentions
return @mouth.last_mentioned
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mentions(twitter, options = {})\n if last_id = last_id(:mentions)\n options[:since_id] = last_id\n end\n mentions = twitter.mentions(options)\n last_id(:mentions, mentions.first.id) unless mentions.empty?\n mentions\nend",
"def fetch_mentions_timeline\n statuses = @twitter_account.client.mentions_... | [
"0.7204152",
"0.68303937",
"0.6758731",
"0.66735995",
"0.6672289",
"0.66312593",
"0.64736485",
"0.6446804",
"0.63791776",
"0.62575144",
"0.6168763",
"0.61526024",
"0.61457366",
"0.6128873",
"0.6107029",
"0.60959816",
"0.6094221",
"0.6082616",
"0.60766625",
"0.6063906",
"0.603... | 0.6684723 | 3 |
Follows users on Twitter | def follow_user(user)
return @mouth.follow(user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def follow\n\t\t@twitter = Twitter::Client.new(\n\t\t\t:oauth_token => @bot.tw_token,\n\t\t\t:oauth_token_secret => @bot.tw_secret\n\t\t)\n\n\t\t@tweet = Tweet.find(params[:tweet])\n\n\t\t@twitter.follow(@tweet.tw_usuario)\n\t\t@tweet.estado = 1\n\t\t@tweet.save\n\n\t\tmensaje = \"Se sigue a \" + @tweet.tw_usuario... | [
"0.8070372",
"0.7942243",
"0.7854016",
"0.7549703",
"0.75438106",
"0.73731023",
"0.70769006",
"0.7017432",
"0.69774675",
"0.69727206",
"0.69550186",
"0.69544196",
"0.6949877",
"0.6943777",
"0.6925627",
"0.6898264",
"0.68873864",
"0.6887212",
"0.68680674",
"0.6804813",
"0.6804... | 0.6752843 | 26 |
Replies to the last mention on Twitter | def reply(message)
return @mouth.reply(message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_mention(tweet)\n txt = tweet.text.split[1..-1].join(' ')\n response = MODEL.make_response(txt, 100)\n reply(tweet, response)\n end",
"def mentions(twitter, options = {})\n if last_id = last_id(:mentions)\n options[:since_id] = last_id\n end\n mentions = twitter.mentions(options)\n last_id... | [
"0.73789096",
"0.7342273",
"0.6994378",
"0.69280684",
"0.67880267",
"0.6738451",
"0.6700124",
"0.65768623",
"0.6412383",
"0.6289378",
"0.6237289",
"0.62344366",
"0.62262565",
"0.6212145",
"0.6211834",
"0.6179769",
"0.6177353",
"0.61770296",
"0.6142823",
"0.609692",
"0.6093315... | 0.0 | -1 |
convert ip addresses. convert strings to ints | def clean_row(row)
row = row.to_hash
row['raw_ip_incoming'] = IPAddr.new(row['raw_ip_incoming']).to_i
row['raw_ip_outgoing'] = IPAddr.new(row['raw_ip_outgoing']).to_i
%w[port_incoming port_outgoing protocol num_packets_incoming
size_packets_incoming num_packets_outgoing size_packets_outgoing].each do |col|
row[col] = row[col].to_i
end
row
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ip_to_int32(ip)\n ip = ip.split('.')\n result = 0\n ip.reverse.each_with_index do |i, index|\n result += i.to_i*2**(8*(index))\n end\n return result\nend",
"def ToInteger(ip)\n # FIXME: Check4, also to Compute*\n l = Builtins.maplist(Builtins.splitstring(ip, \".\")) do |e|\n Builtins.... | [
"0.71787417",
"0.71732455",
"0.71136904",
"0.6882757",
"0.6868919",
"0.6793419",
"0.67600214",
"0.6749769",
"0.67351824",
"0.67351824",
"0.67044795",
"0.66637635",
"0.663616",
"0.6389581",
"0.63715035",
"0.63715035",
"0.63497484",
"0.6286986",
"0.61913276",
"0.61735284",
"0.6... | 0.0 | -1 |
keep only those values in a hash that the particular model can hold | def remove_extras(hash, model)
hash.reject do |key,value|
# puts !(model.column_names.include?(key.to_s))
!(model.column_names.include?(key.to_s))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanse\n select { |_k, v| v }\n end",
"def trim_params(params)\n Hash[*(params.select { |k,v| new.attributes.keys.include? k.to_s}.flatten)] \n end",
"def clean_unwanted_keys(hash)\r\n ignored_keys = [:only_path, :use_route]\r\n hash.dup.delete_if{|key,value| ignored_keys.inc... | [
"0.65138555",
"0.6250353",
"0.6091582",
"0.60621876",
"0.6036989",
"0.6012394",
"0.5995255",
"0.5985245",
"0.5964224",
"0.59614027",
"0.5920211",
"0.591813",
"0.59164935",
"0.59141177",
"0.5912165",
"0.5894061",
"0.5875437",
"0.5849526",
"0.58455145",
"0.58175856",
"0.5817585... | 0.69985276 | 0 |
checks if a stream contains the same values as a row | def same_stream(row,stream)
stream && row['raw_ip_incoming'] == stream.raw_ip_incoming && row['raw_ip_outgoing'] == stream.raw_ip_outgoing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def victory_row?(row_values)\n unique_values = row_values.uniq\n one_unique_value?(unique_values)\nend",
"def compare_by_row_vectors(rows)\n my_rows = @rows\n sz = my_rows.size \n return false unless sz == rows.size\n \n for i in 0..sz-1 do\n return false unless my_rows[i] == rows[i]\n e... | [
"0.6977281",
"0.6673285",
"0.64837277",
"0.6466026",
"0.6462633",
"0.6322916",
"0.62861496",
"0.6259263",
"0.6230632",
"0.61884433",
"0.61884433",
"0.61713946",
"0.61272645",
"0.61162",
"0.60725456",
"0.606138",
"0.6039915",
"0.60231626",
"0.59984165",
"0.5993717",
"0.5983723... | 0.7295439 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_testplan
@testplan = Testplan.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def testplan_params
params.require(:testplan).permit(:application_id, :testplan_name, :pid)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Solution for Challenge 122 [Easy] | def root(i)
z = i.to_s.split('')
if z.size > 1
z.collect!{|x| x.to_i}
a = z.inject(0){|sum,y| sum+=y}
root a
else
puts i
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :... | [
"0.6831983",
"0.65106994",
"0.6392877",
"0.6388171",
"0.6386431",
"0.6382194",
"0.63649565",
"0.6354049",
"0.63486177",
"0.6345058",
"0.63345295",
"0.62888",
"0.62423277",
"0.6210549",
"0.62018454",
"0.6191842",
"0.61618936",
"0.615998",
"0.6149369",
"0.61284465",
"0.6119261"... | 0.0 | -1 |
Introducing the game. We'll run this first. | def start_greetings
puts "This is the castle of the Ice King. At the end of the corridor there are two doors"
puts "Thau shall choose to go through one door, the Fire Door or the Snow Door"
puts "Press 1 for Fire Door. Press 2 for Snow Door"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_game\n begin\n @game_text.intro\n\n # Run the tutorial\n ActionDirector.new(@world, @player).call({command: :talk, target: :jerry})\n\n # The main game\n while @player.alive? && @world.has_hostiles?\n @player.in_battle? ? battle_loop : game_loop\n end\n\n @pla... | [
"0.7562603",
"0.75318813",
"0.72865975",
"0.7203937",
"0.7170718",
"0.7128318",
"0.71109194",
"0.70586556",
"0.7020886",
"0.6925756",
"0.6887054",
"0.6836804",
"0.6834697",
"0.6805265",
"0.6793125",
"0.6749174",
"0.6720256",
"0.669988",
"0.6672581",
"0.66719687",
"0.66598237"... | 0.0 | -1 |
This is how the game starts. We'll run this second. | def start_game
fire_door = {
name: "Fire Door",
character: "Gunter, the Evil Penguin of Tech Support",
character_action: "He has casket full of tech support tickets",
decision_one: "Take the a casket and destroy the tickets",
outcome_one: "Well done! You are now the king of Tech Support",
decision_two: "Slap that creepy penguin",
outcome_two: "You fool. The curse of tech support is on you. You will have to fix every ticket for the Eternity!"
}
snow_door = {
name: "Snow Door",
character: "Princess Bubblegum, the Beautiful Princess of Sainsbury deliveries",
character_action: "She has a bucket full of BelaVita biscuits",
decision_one: "Eat the buscuits",
outcome_one: "You fool! Neusha will tell Eamon and he will fire you!",
decision_two: "Save them for Shakes",
outcome_two: "The force runs strong with this one. You have saved Shakes from starvation!"
}
doors = {
"1" => fire_door,
"2" => snow_door
}
print "> "
door_num = $stdin.gets.chomp
chosen_door = doors[door_num]
puts "____________________________"
game(chosen_door)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_... | [
"0.7944154",
"0.7541788",
"0.7485979",
"0.74028623",
"0.7390051",
"0.7365701",
"0.73612267",
"0.7321418",
"0.72948456",
"0.7286699",
"0.72639126",
"0.7132753",
"0.7120022",
"0.7079249",
"0.7069635",
"0.7034763",
"0.70211715",
"0.70211715",
"0.70211715",
"0.70211715",
"0.70211... | 0.0 | -1 |
This is the game's set up. We'll be calling this method when we start the game, after the user has made their first decision. | def game(chosen_door)
if chosen_door
puts "You have entered the #{chosen_door[:name]}"
puts "You now have to face #{chosen_door[:character]}"
puts "#{chosen_door[:character_action]}"
puts "What are you going to do?"
puts "1. #{chosen_door[:decision_one].upcase}"
puts "2. #{chosen_door[:decision_two].upcase}"
print "> "
decision = $stdin.gets.chomp
puts "_________________________"
if decision == "1"
puts chosen_door[:outcome_one].upcase
elsif decision == "2"
puts chosen_door[:outcome_two].upcase
else
handle_typos(chosen_door)
end
else
handle_typos(chosen_door)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_setup\n end",
"def game_set_up\n if mode == HUMAN\n disp_game_instructions\n # get computer generated solution\n @solution_obj.solution\n else\n # get solution player enters if valid\n @human_solution_obj.human_solution(@turn_obj)\n end\n end",
"def game_setup\n\t... | [
"0.82782227",
"0.74895287",
"0.74733734",
"0.7144431",
"0.698938",
"0.6906279",
"0.6761768",
"0.6755468",
"0.67312187",
"0.6729468",
"0.6684074",
"0.66727537",
"0.66326344",
"0.6575657",
"0.6544687",
"0.6525043",
"0.65006346",
"0.64955086",
"0.64681125",
"0.6453982",
"0.64108... | 0.0 | -1 |
We'll use this method to handle any answers that are not "1" or "2" | def handle_typos(chosen_door)
puts "Man you should take a proper decision or learn how to type!"
puts "If you want to restart the game, press 1"
puts "If you want to try again, press 2"
puts "If you happen to be a coward, press 3 and quit this stupid game now. No regrets"
decision = $stdin.gets.chomp
if decision == "1"
puts "Hooray! Let's start from scratch"
start_greetings
start_game
elsif decision == "2"
puts "OK, let's try again. You can do this!"
# Skipping the greetings
start_game
elsif decision == "3"
puts "Quiting is sad man. But, hey, your game, your rules! Bye bye"
else
handle_typos(chosen_door)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def questionOne(frustration)\n if frustration == \"Yes\"\n return 3\n end \n \n if frustration == \"Not at all\"\n return 1\n end \n \n if frustration == \"I can't tell\"\n return 2\n end\nend",
"def question_and_answer(with_error, zero_or_one, mistery_num)\n message... | [
"0.6275669",
"0.62343705",
"0.6145033",
"0.61047614",
"0.6084657",
"0.6076481",
"0.6065198",
"0.60359216",
"0.594145",
"0.59165066",
"0.5896758",
"0.5877638",
"0.58671016",
"0.58657104",
"0.58563393",
"0.5799323",
"0.5789484",
"0.5787912",
"0.5787571",
"0.5784834",
"0.5765741... | 0.0 | -1 |
GET /portfolio_sections or /portfolio_sections.json | def index
@portfolio_sections = PortfolioSection.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n ... | [
"0.7078329",
"0.6507914",
"0.6155657",
"0.6155657",
"0.6141313",
"0.61217445",
"0.60782117",
"0.6019916",
"0.59749746",
"0.59729964",
"0.59427726",
"0.5920429",
"0.59004426",
"0.58665156",
"0.5824857",
"0.5822177",
"0.57960844",
"0.57933074",
"0.57933074",
"0.57933074",
"0.57... | 0.6794938 | 1 |
GET /portfolio_sections/1 or /portfolio_sections/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def index\n @portfolio_sections = PortfolioSection.all\n end",
"def ... | [
"0.6827582",
"0.68197966",
"0.6416012",
"0.6389479",
"0.6385065",
"0.6010069",
"0.5974914",
"0.59709513",
"0.5967757",
"0.59487927",
"0.5946998",
"0.5943211",
"0.58570683",
"0.58529305",
"0.5842768",
"0.5842768",
"0.5842768",
"0.5816457",
"0.57705015",
"0.57692367",
"0.576182... | 0.0 | -1 |
POST /portfolio_sections or /portfolio_sections.json | def create
@portfolio_section = PortfolioSection.new(portfolio_section_params)
respond_to do |format|
if @portfolio_section.save
format.html { redirect_to @portfolio_section, notice: "Portfolio section was successfully created." }
format.json { render :show, status: :created, location: @portfolio_section }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def portfolio_section_params\n params.require(:portfolio_section).permit(:section_id, :description)\n end",
"def update\n respond_to do |format|\n if @portfolio_section.update(portfolio_section_params)\n format.html { redirect_to @portfolio_section, notice: \"Portfolio section was successf... | [
"0.60431874",
"0.5990474",
"0.5899722",
"0.57596093",
"0.5750639",
"0.5725831",
"0.57105815",
"0.56725",
"0.56526077",
"0.5643183",
"0.56402206",
"0.5634459",
"0.5610074",
"0.5608394",
"0.5567733",
"0.55623496",
"0.5501148",
"0.54992104",
"0.5463102",
"0.5457635",
"0.5453343"... | 0.67352015 | 0 |
PATCH/PUT /portfolio_sections/1 or /portfolio_sections/1.json | def update
respond_to do |format|
if @portfolio_section.update(portfolio_section_params)
format.html { redirect_to @portfolio_section, notice: "Portfolio section was successfully updated." }
format.json { render :show, status: :ok, location: @portfolio_section }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @portfolio_section.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @portfolio.update(portfolio_params)\n format.html { redirect_to portfolios_path, notice: 'Portfolio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render... | [
"0.6760475",
"0.6745794",
"0.6541424",
"0.65223616",
"0.6522224",
"0.6475697",
"0.647009",
"0.6319075",
"0.6313279",
"0.6299481",
"0.6241893",
"0.6223241",
"0.6188944",
"0.6185844",
"0.6148391",
"0.6128615",
"0.6113522",
"0.61014324",
"0.60972816",
"0.6095056",
"0.6086648",
... | 0.75231564 | 0 |
DELETE /portfolio_sections/1 or /portfolio_sections/1.json | def destroy
@portfolio_section.destroy
respond_to do |format|
format.html { redirect_to portfolio_sections_url, notice: "Portfolio section was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @portfolio.destroy\n respond_to do |format|\n format.html { redirect_to portfolios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n ... | [
"0.7024811",
"0.68701804",
"0.68602204",
"0.68602204",
"0.68563086",
"0.6772851",
"0.6762478",
"0.6718766",
"0.6718766",
"0.6718766",
"0.6718766",
"0.67173123",
"0.6711294",
"0.6711294",
"0.6698228",
"0.6698228",
"0.66063607",
"0.6601907",
"0.65477306",
"0.65272635",
"0.65224... | 0.7480284 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_portfolio_section
@portfolio_section = PortfolioSection.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def portfolio_section_params
params.require(:portfolio_section).permit(:section_id, :description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Provides for mapping model attributes to attributes of the returned amazonecs result object. An optional parameter allows for certain attributes which may occur multiple times (eg. the authors of a book) to be returned as a single string joined with a provided parameter eg. maps_to_amazon_attribute :authorlist => 'authors', :combine => ';' maps_to_amazon_attribute :title => 'product_name' maps_to_amazon_attribute :isbn => 'asin' | def maps_to_amazon_attribute(args = {})
if @amazon_mappings.nil?
@amazon_mappings = Hash.new
@amazon_join_mappings = Hash.new
end
joiner = args.delete(:combine) if args[:combine]
args.each do |key, value|
if joiner
@amazon_join_mappings[key] = [value, joiner]
else
@amazon_mappings[key] = value
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributor(attributes)\n inject_s(attributes) {|key, value| \" #{key.to_s}=\\\"#{value.to_s}\\\"\"}\n end",
"def attribute(*args)\n if args.first.is_a?(Hash)\n args.first.each_pair { |k,v| self.attribute(k, :as => v) }\n else # array of attributes\n options = args.extract_opti... | [
"0.58226246",
"0.57816154",
"0.5633592",
"0.5604154",
"0.55828434",
"0.554471",
"0.5435935",
"0.5433353",
"0.5425095",
"0.53514314",
"0.53451556",
"0.5337609",
"0.5330308",
"0.5328944",
"0.530573",
"0.5286945",
"0.5262937",
"0.52565056",
"0.52436113",
"0.5238925",
"0.523477",... | 0.6848314 | 0 |
Model.load_from_amazon!(asin_value, dev_key, associates_id) will load the model from an amazon result (or return empty if the product couldn't be found) and call the save method on the model object. | def load_from_amazon!(asin_value, dev_key = '1MZTQGBA4YWAFHSTG4R2', associates_id = 'thirddayweb-20')
result = self.load_from_amazon(asin_value, dev_key, associates_id)
if result
result.save
return result
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_spree\n ::Product.save_from_amazon({\n :attributes =>{\n :amazon_id => self.id,\n :sku => self.id,\n :name => self.name,... | [
"0.62749094",
"0.6029529",
"0.55829054",
"0.5578833",
"0.54520476",
"0.54130673",
"0.5380609",
"0.5309279",
"0.52557606",
"0.51518077",
"0.5074921",
"0.50407237",
"0.5018755",
"0.5006323",
"0.5001743",
"0.49675694",
"0.49513745",
"0.4931584",
"0.49025086",
"0.48906144",
"0.48... | 0.8468291 | 0 |
Write an already marshalled sample. +data+ is supposed to be a typelibmarshalled value of the stream type | def write_raw(rt, lg, data)
logfile.write_data_block(self, rt, lg, data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(data)\n end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(data); end",
"def write(*data); end",
"def write(data)\n @handle.writeData(data)\n end",
"def write(data)\n @data << data\n end",
"def write(data)\n # black hole, b... | [
"0.677972",
"0.6653572",
"0.6653572",
"0.6653572",
"0.6653572",
"0.65887475",
"0.6586595",
"0.6469189",
"0.62490296",
"0.62341",
"0.6225124",
"0.6205195",
"0.6116818",
"0.5838499",
"0.5817549",
"0.5816593",
"0.5802049",
"0.5759799",
"0.5749977",
"0.5745314",
"0.5707644",
"0... | 0.0 | -1 |
Short and quick log statistics Return list of selected files. | def selected_files
Dir["#{ARGV.first}*.log"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files\n page = get_page\n offset = PER_PAGE * page\n get_run_logs(:limit => PER_PAGE, :offset => offset)\n end",
"def index\n\n if current_user.is_admin?\n @search = LogFile.search(params[:q])\n @log_files = @search.result(distinct: true).includes(:runtime_statistics)\n else... | [
"0.6985811",
"0.6693486",
"0.64204526",
"0.638672",
"0.6271665",
"0.62374353",
"0.61918247",
"0.615548",
"0.6149364",
"0.6007789",
"0.591411",
"0.58968085",
"0.58726776",
"0.5870168",
"0.5833882",
"0.58304113",
"0.5830102",
"0.5822955",
"0.58196354",
"0.5801161",
"0.5774163",... | 0.6669592 | 2 |
Init some internal vars | def init
@by_day = {}
if File.exist?('result.txt')
File.readlines('result.txt').each do |line|
a = line.chomp.split("\t")
@by_day[a.first] = a
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def custom_initialize_instance_variables\n @open_selector_bracket_detected = false\n @open_function_detected = false\n @open_include_detected = false\n @parents_stash = []\n @root_selectors = []\n ... | [
"0.7499535",
"0.7499535",
"0.7499535",
"0.7499535",
"0.7403267",
"0.73084354",
"0.73083335",
"0.73083335",
"0.73083335",
"0.71712893",
"0.6974953",
"0.69629866",
"0.69508725",
"0.69495636",
"0.69443905",
"0.6892308",
"0.6850722",
"0.6816745",
"0.68156314",
"0.68055683",
"0.67... | 0.0 | -1 |
Collects total number of requests and respond time for calculating average response time. | def response_by_days
selected_files.each do |file_name|
key = file_name[0,6]
next if @by_day[key]
result = [key, 0, 0, 0]
File.readlines(file_name).each do |line|
next unless line.match 'Completed 200 OK in'
time = $'.split('ms').first.strip.to_i
result[1] += 1
result[2] += time
end
# average
result[3] += result[2]/result[1]
p result
@by_day[key] = result
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_times\n times = []\n start_time = Time.now\n final_time = Time.now + @max_time\n counter = 1\n while Time.now < final_time do\n times << @request_builder.call(@url, counter)\n sleep(@sleep_time)\n counter += 1\n end\n times\n end",
"def average_response_time\n ... | [
"0.74801856",
"0.7026983",
"0.66251844",
"0.6567912",
"0.6481149",
"0.64467406",
"0.6206925",
"0.62051684",
"0.6179116",
"0.6161156",
"0.6160014",
"0.6118688",
"0.6092785",
"0.60572064",
"0.6044486",
"0.5978203",
"0.5978184",
"0.59713954",
"0.5950833",
"0.59348035",
"0.590341... | 0.55189025 | 51 |
Prints links which resultet in 404 error. | def analyze_404
selected_files.each do |file_name|
result = [file_name[0,6], 0, 0]
url = ''
File.readlines(file_name).each do |line|
if m = /Started(.*?)for/.match(line)
url = m[1]
end
if m = /404/.match(line)
p url.gsub('"','')
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_404 error='', target=''\n show_error \"Page \\\"#{target}\\\" Not Found\", :not_found\n end",
"def show_404\n show_error 'Page Not Found', :not_found\n end",
"def error_404\n error_layout 404, '404 Not Found', %[\n <p>\n The requested URL <code>#{h(request.REQUEST_URI)... | [
"0.7106146",
"0.70636886",
"0.6668664",
"0.6630374",
"0.6603528",
"0.6591183",
"0.6588572",
"0.65689796",
"0.6511051",
"0.64935327",
"0.6471278",
"0.6431427",
"0.6385634",
"0.6377854",
"0.6347115",
"0.6287983",
"0.6250355",
"0.6229473",
"0.62150854",
"0.6205698",
"0.62027305"... | 0.6544341 | 8 |
GET /holiday_exceptions GET /holiday_exceptions.json | def index
@holiday_exceptions = HolidayException.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def calendar_service_exceptions(service_id)\n get \"/gtfs/calendarDate/serviceId/#{service_id}\"\n end",
"def handle_response(response)\n case response.code.to_i\n when 200\n JSON.parse(response.body)['holidays']\n ... | [
"0.755907",
"0.6884884",
"0.64303064",
"0.6386149",
"0.6309451",
"0.6216709",
"0.61845356",
"0.6161303",
"0.60819626",
"0.60589796",
"0.59875226",
"0.5916819",
"0.5898217",
"0.5874412",
"0.5815764",
"0.5810869",
"0.5794554",
"0.5761122",
"0.5714819",
"0.5707645",
"0.57006437"... | 0.76140076 | 0 |
GET /holiday_exceptions/1 GET /holiday_exceptions/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @holiday_exceptions = HolidayException.all\n end",
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def calendar_service_exceptions(service_id)\n get \"/gtfs/calendarDate/serviceId/#{service_id}\"\n end",
"def index\n #Get the event\n @event = Event.find(para... | [
"0.75456697",
"0.7276394",
"0.67768484",
"0.652367",
"0.6458206",
"0.6340638",
"0.6324775",
"0.63114595",
"0.61729664",
"0.6057226",
"0.60384023",
"0.6007452",
"0.5923895",
"0.5920864",
"0.58761567",
"0.58277744",
"0.58118975",
"0.5796585",
"0.576613",
"0.5763417",
"0.5761554... | 0.0 | -1 |
POST /holiday_exceptions POST /holiday_exceptions.json | def create
@holiday_exception = HolidayException.new(holiday_exception_params)
@project = Project.find holiday_exception_params[:project_id]
@customer = Customer.find(@project.customer_id)
@users_on_project = User.joins("LEFT OUTER JOIN projects_users ON users.id = projects_users.user_id AND projects_users.project_id = #{@project.id}").select("users.email,first_name,email,users.id id,user_id, projects_users.project_id, projects_users.active,project_id")
respond_to do |format|
if @holiday_exception.save
@holiday_exceptions = @project.holiday_exceptions
customer_holiday_ids = CustomersHoliday.where(customer_id: @holiday_exception.customer_id).pluck(:holiday_id)
@holidays = Holiday.where(global:true).or(Holiday.where(id: customer_holiday_ids))
@holiday_exception = HolidayException.new
format.js
#format.html { redirect_to @holiday_exception, notice: 'Holiday exception was successfully created.' }
format.json { render :show, status: :created, location: @holiday_exception }
else
format.html { render :new }
format.json { render json: @holiday_exception.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def holiday_exception_params\n params.require(:holiday_exception).permit(:user_id, :project_id, :customer_id, :holiday_ids => [])\n end",
"def index\n @holiday_exceptions = HolidayException.all\n end",
"def calendar_exceptions\n get '/gtfs/calendarDate'\n end",
"def set_holiday_exception\... | [
"0.6857052",
"0.66587925",
"0.64760387",
"0.6408504",
"0.62489325",
"0.6170495",
"0.6165304",
"0.61534625",
"0.6128376",
"0.59260494",
"0.59206617",
"0.5898576",
"0.58143544",
"0.5801346",
"0.5798304",
"0.5754728",
"0.5744671",
"0.5731647",
"0.5697546",
"0.5697295",
"0.568621... | 0.6024993 | 9 |
PATCH/PUT /holiday_exceptions/1 PATCH/PUT /holiday_exceptions/1.json | def update
respond_to do |format|
begin
status = @holiday_exception.update(holiday_exception_params)
rescue => e
status = false
customer_holiday_ids = CustomersHoliday.where(customer_id: @holiday_exception.customer_id).pluck(:holiday_id)
@holidays = Holiday.where(global:true).or(Holiday.where(id: customer_holiday_ids))
logger.debug"UPDATE #{e.inspect} , STATUS #{status}"
end
if status
format.html { redirect_to edit_holiday_exception_path(@holiday_exception), notice: 'Holiday exception was successfully updated.' }
format.json { render :show, status: :ok, location: @holiday_exception }
else
format.html { render :edit }
format.json { render json: @holiday_exception.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @extra_holiday.update(extra_holiday_params)\n format.html { redirect_to @extra_holiday, notice: 'Extra holiday was successfully updated.' }\n format.json { render :show, status: :ok, location: @extra_holiday }\n else\n format.html { render ... | [
"0.66124696",
"0.6513476",
"0.6476268",
"0.63946867",
"0.6384276",
"0.6287663",
"0.6247102",
"0.61614746",
"0.6155098",
"0.6103232",
"0.6100695",
"0.60963273",
"0.6084834",
"0.6074538",
"0.58965045",
"0.5814902",
"0.58013284",
"0.57657105",
"0.5750159",
"0.5733447",
"0.573297... | 0.72125435 | 0 |
DELETE /holiday_exceptions/1 DELETE /holiday_exceptions/1.json | def destroy
@holiday_exception.destroy
respond_to do |format|
format.html { redirect_to projects_url, notice: 'Holiday exception was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @holiday.destroy\n respond_to do |format|\n format.html { redirect_to holidays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extra_holiday.destroy\n respond_to do |format|\n format.html { redirect_to extra_holidays_url, notice: 'Extra holiday ... | [
"0.7002371",
"0.68797535",
"0.6859485",
"0.6815075",
"0.6803325",
"0.67865103",
"0.6731",
"0.6698058",
"0.6689843",
"0.6626396",
"0.66021675",
"0.6595427",
"0.6402482",
"0.63887775",
"0.6379769",
"0.63430214",
"0.63414776",
"0.63273454",
"0.6326809",
"0.63128775",
"0.6305207"... | 0.7129668 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_holiday_exception
@holiday_exception = HolidayException.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def holiday_exception_params
params.require(:holiday_exception).permit(:user_id, :project_id, :customer_id, :holiday_ids => [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
num The roof of the faqtorial. sum The sum of the faqtorial. Examples faq(5) => 120 Returns the sum of the faq | def faq(num)
i = 1
sum = 1
while i <= num
sum = sum * i
i = i + 1
end
return sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum(n)\n end",
"def summation(num)\r\n puts 1.upto(num).reduce(0, :+)\r\nend",
"def sum(num, total) => total += num",
"def total\n # Each square has 1 << (n-1) grains of rice, one more than all squares\n # before it combined. The total number of grains on a chess board can\n # thus be calculat... | [
"0.68030584",
"0.64271843",
"0.6421403",
"0.6338028",
"0.6333191",
"0.6317147",
"0.62949866",
"0.6287474",
"0.62454236",
"0.6236907",
"0.62135524",
"0.6204225",
"0.6193907",
"0.617802",
"0.6168739",
"0.61653197",
"0.6117427",
"0.61142194",
"0.6112384",
"0.61071986",
"0.608571... | 0.63582855 | 3 |
extract into new structure | def sign_in(email, password)
visit '/sessions/new'
fill_in :email, with: email
fill_in :password, with: password
click_button 'Sign in'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_metadata; end",
"def extract\n extract_all\n extract_ccs\n end",
"def extract\n nil\n end",
"def extract_meta\n end",
"def extract\n # assume records are active until we discover a deprecation attribute\n self.active = true if attributes.key?('active') && attributes[... | [
"0.61241126",
"0.606426",
"0.6060183",
"0.60367936",
"0.5855847",
"0.5822673",
"0.5767442",
"0.5712888",
"0.56870574",
"0.55156505",
"0.55156505",
"0.5473919",
"0.5472822",
"0.546262",
"0.5453069",
"0.5453069",
"0.5414861",
"0.54120433",
"0.540159",
"0.539407",
"0.5376462",
... | 0.0 | -1 |
converts a name and quote id into the desired format. (Ex: author: Noah Finberg quote_id: 1 => 'NF1') | def unique_tag
##collect transforms given array into the new array abbr
abbr = self.author.split(" ").collect do |sub_string|
sub_string[0] #puts first letter of each substring into intials array
end
return abbr.join + '#' + self.id.to_s ##join concatenates an array into a string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highwire_author_format(name)\n if name.include? ','\n name.split(',').reverse.join(' ').strip\n else\n name\n end\n end",
"def normalize_author_name(auth_toks)\n return '' if auth_toks.empty?\n str = auth_toks.join(\" \")\n if str =~ /(.+),\\s*(.+)/\n str = \"#{$1} #{$2}\"\n... | [
"0.66060776",
"0.65178853",
"0.6461776",
"0.6262212",
"0.6262212",
"0.6089769",
"0.60794055",
"0.6031379",
"0.58920485",
"0.5870832",
"0.5861802",
"0.5856684",
"0.58513814",
"0.5825163",
"0.5793458",
"0.5782591",
"0.5750283",
"0.5742723",
"0.5736744",
"0.57201636",
"0.5689037... | 0.0 | -1 |
Preview this email at | def Job_application
AccountCreatedMailer.Job_application
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end",
"def preview_email\r... | [
"0.71475905",
"0.71186084",
"0.70552814",
"0.6985626",
"0.6848472",
"0.6848472",
"0.6832406",
"0.6663229",
"0.64324814",
"0.631654",
"0.6304366",
"0.6181875",
"0.6167911",
"0.61338973",
"0.61305445",
"0.6115152",
"0.61100966",
"0.61100966",
"0.60882556",
"0.60132533",
"0.5982... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_sectoral_share7
@sectoral_share7 = SectoralShare7.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def sectoral_share7_params
params.require(:sectoral_share7).permit(:State, :'2013-14', :'2014-15', :'2015-16', :Indicator)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Generate video for a slide by combining the image and audio | def video_gen(slide)
term = slide['term']
kind = slide['kind']
index = slide['index']
audio = slide['audio']
image = slide['image']
raise "audio is required fof #{term}" unless audio
raise "image is required fof #{term}" unless image
file_name = file_name_gen(slide, ".mpg")
audio = command_arg(slide['audio'])
image = command_arg(slide['image'])
video = command_arg(file_name)
`ffmpeg -loop 1 -y -i #{image} -i #{audio} -acodec libmp3lame -vcodec mpeg4 -shortest -qscale:v 1 #{video}`
slide['video'] = file_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combine_video(presentation)\n term = presentation['term']\n args = []\n for slide in presentation['slides']\n args.push command_arg(slide['video'])\n end\n args = args.join(' ')\n combined_arg = command_arg(\"#{BUILD_DIR}/#{term}/#{term}-combined.mpg\")\n final = \"#{DIST_DIR}/#{term}/#{term}.avi\"\n... | [
"0.6927799",
"0.6225185",
"0.6198179",
"0.6175752",
"0.61704004",
"0.60580444",
"0.6045214",
"0.6028644",
"0.5981926",
"0.5957051",
"0.5941192",
"0.5835128",
"0.58052325",
"0.5803109",
"0.5773791",
"0.56421083",
"0.5614227",
"0.55597156",
"0.5538567",
"0.5537054",
"0.5532856"... | 0.78131044 | 0 |
Concatenate slide videos together into one video | def combine_video(presentation)
term = presentation['term']
args = []
for slide in presentation['slides']
args.push command_arg(slide['video'])
end
args = args.join(' ')
combined_arg = command_arg("#{BUILD_DIR}/#{term}/#{term}-combined.mpg")
final = "#{DIST_DIR}/#{term}/#{term}.avi"
final_arg = command_arg(final)
`cat #{args} > #{combined_arg}`
`ffmpeg -y -i #{combined_arg} -r 25 -qscale:v 1 #{final_arg}`
presentation['video'] = final
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergeVideos()\n pathToIntermediates=\"#{$PATHTOGENERATEINTERMEDIATES}/#{@meetingData.meetingId}\"\n vidList=\"#{pathToIntermediates}/vidList.txt\"\n # Create a txt file with the lists of all videos to concatenate\n system \"echo >#{vidList}\"\n (0...@objects.length).each do |... | [
"0.73224336",
"0.7141569",
"0.6384308",
"0.62886745",
"0.60178113",
"0.59477186",
"0.5943647",
"0.5934862",
"0.5877982",
"0.58245325",
"0.57119554",
"0.56690454",
"0.5609804",
"0.5609109",
"0.5550787",
"0.5529381",
"0.55183834",
"0.55170727",
"0.55033576",
"0.5500784",
"0.545... | 0.776836 | 0 |
Gets a collection of available promotions | def list(from_date: nil, to_date: nil, continuation_token: nil, headers: {})
payload = {
fromDate: from_date,
toDate: to_date,
continuationtoken: continuation_token
}.select { |_, v| !v.nil? }
@client.rest_get_with_token('/promotions', payload, headers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promotions\n @promotions ||= order.promotions\n end",
"def pending_promotions\n @pending_promotions ||= []\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def new_promotions\n @new_promotions ||= []\n end",
"def api_promotions_get(params, opts = {})\n data, ... | [
"0.7514177",
"0.74915934",
"0.74653226",
"0.70019376",
"0.6686318",
"0.6671471",
"0.658188",
"0.6534694",
"0.6534694",
"0.6534694",
"0.6451523",
"0.6208908",
"0.6132559",
"0.6059759",
"0.5972661",
"0.5970665",
"0.59209746",
"0.59192353",
"0.5913861",
"0.5838913",
"0.58188444"... | 0.5901234 | 19 |
Basecamp helper method returns an instance specific basecamp object if valid connection credentials exist. Otherwise, returns nil. | def basecamp
return nil unless establish_connection!
@basecamp ||= Basecamp.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basecamp_connection\n return unless establish_connection!\n Basecamp.connection\n end",
"def establish_connection!\n return if [app_path, username, password].select{|f| f.blank? }.length > 0\n Basecamp.establish_connection!(app_path, username, password, true) unless @connection_established\n ... | [
"0.7672671",
"0.59911245",
"0.5626143",
"0.51805216",
"0.517009",
"0.5117425",
"0.5108495",
"0.5108495",
"0.50839883",
"0.5073246",
"0.5069892",
"0.5067903",
"0.5064274",
"0.5042828",
"0.5038577",
"0.5032745",
"0.50205684",
"0.49857393",
"0.49834186",
"0.4960603",
"0.4952047"... | 0.8374647 | 0 |
Estbalished a connection to basecamp using the configured account details. Returns nil if any of the account details is missing. | def establish_connection!
return if [app_path, username, password].select{|f| f.blank? }.length > 0
Basecamp.establish_connection!(app_path, username, password, true) unless @connection_established
@connection_established = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basecamp_connection\n return unless establish_connection!\n Basecamp.connection\n end",
"def basecamp\n return nil unless establish_connection!\n @basecamp ||= Basecamp.new\n end",
"def account\n @account ||= Harvest::API::Account.new(credentials)\n end",
"def setupCoinbase\n if EN... | [
"0.6976862",
"0.6860208",
"0.5943242",
"0.57305324",
"0.55482745",
"0.549334",
"0.5433841",
"0.5402015",
"0.53892326",
"0.5338543",
"0.5319351",
"0.5318238",
"0.528531",
"0.52840114",
"0.52208185",
"0.5201174",
"0.51998717",
"0.51969326",
"0.51912296",
"0.51912296",
"0.519122... | 0.6769966 | 2 |
Returns a basecamp connection object. Ensures that a connection is established first, otherwise returns nil | def basecamp_connection
return unless establish_connection!
Basecamp.connection
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basecamp\n return nil unless establish_connection!\n @basecamp ||= Basecamp.new\n end",
"def connection\n @connection ||= make_connection\n end",
"def connection\n @connection ||= build_connection\n end",
"def connection\n raise ConnectionNotEstablished unless @@connection\n ... | [
"0.83089864",
"0.6855643",
"0.6799865",
"0.6796116",
"0.6792206",
"0.67111826",
"0.66553694",
"0.6612947",
"0.6587227",
"0.6542022",
"0.64816594",
"0.64416236",
"0.64188665",
"0.63282216",
"0.6296006",
"0.62567365",
"0.6251459",
"0.61888725",
"0.6172135",
"0.6167632",
"0.6153... | 0.8500907 | 0 |
Returns a list of companies for the given account | def companies
return [] unless basecamp
@companies ||= basecamp.companies
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @account_companies = Account::Company.all\n end",
"def all\n endpoint = 'Companies'\n response = JSON.parse(@client.get(endpoint).body)\n companies = response.key?('Items') ? response['Items'] : []\n companies.map { |attributes| Unleashed::Company.new(@client, attributes) }\n ... | [
"0.7457216",
"0.7338584",
"0.68966895",
"0.68879056",
"0.6848547",
"0.67665553",
"0.6718682",
"0.66369927",
"0.6603573",
"0.655943",
"0.6526628",
"0.64747506",
"0.64237154",
"0.6416138",
"0.63980734",
"0.63814276",
"0.6356874",
"0.6324887",
"0.63061035",
"0.63015676",
"0.6281... | 0.68722683 | 4 |
Returns a list of people for the given account | def people
return [] if company_id.blank? || !basecamp
@people ||= basecamp.people(company_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_users_by_account(accountId, options={}) path = \"/api/v2/accounts/#{accountId}/users\"\n get(path, options, AvaTax::VERSION) end",
"def users\n user_arr = []\n accounts.each do |s|\n user_arr << User.find(s.user.id)\n end\n user_arr\n end",
"def scrape_people\n pe... | [
"0.6486989",
"0.6377817",
"0.6348578",
"0.63434523",
"0.63434523",
"0.63380414",
"0.6305658",
"0.6301055",
"0.62170017",
"0.6181082",
"0.617207",
"0.6159096",
"0.61541176",
"0.61496466",
"0.6146521",
"0.6133326",
"0.6130597",
"0.61137235",
"0.6099743",
"0.6027982",
"0.6027908... | 0.6113757 | 17 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.