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 |
|---|---|---|---|---|---|---|
DELETE /bar30s/1 or /bar30s/1.json | def destroy
@bar30.destroy
respond_to do |format|
format.html { redirect_to bar30s_url, notice: "Bar30 was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bar74.destroy\n respond_to do |format|\n format.html { redirect_to bar74s_url, notice: \"Bar74 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.... | [
"0.65113854",
"0.65094066",
"0.65093637",
"0.65007603",
"0.64969295",
"0.64954764",
"0.64812535",
"0.64603496",
"0.6450135",
"0.6442424",
"0.6435786",
"0.64172083",
"0.6408118",
"0.64072424",
"0.64065045",
"0.6400616",
"0.6394783",
"0.63933384",
"0.6390168",
"0.63805884",
"0.... | 0.66059524 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_bar30
@bar30 = Bar30.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 bar30_params
params.require(:bar30).permit(:foo1, :foo2, :foo3, :foo4, :foo5)
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 |
Creates a new AddressBook. It requires the source module file and extends AddressBook with the source module | def initialize(source)
source = source.sub('.rb', '')
require source
@module_name = pascalize(File.basename(source))
extend self.class.module_eval(@module_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_address_book(principal_uri, url, properties)\n end",
"def create_address\n create_resource :address, {}\n end",
"def create\n @address_book = AddressBook.new(params[:address_book])\n\n respond_to do |format|\n if @address_book.save\n flash[:notice] = :address_boo... | [
"0.63180155",
"0.6162422",
"0.5923657",
"0.5707854",
"0.5633968",
"0.56142473",
"0.5579288",
"0.55733776",
"0.5552372",
"0.54936546",
"0.54936546",
"0.54936546",
"0.54861075",
"0.5444951",
"0.5429834",
"0.5411035",
"0.5377286",
"0.52910805",
"0.52831596",
"0.52718186",
"0.524... | 0.0 | -1 |
The source module can override the address source title, print_summary and print_all methods. If the methods are not overridden the default methods are invoked. The source module has to provide a lookup method. If the lookup method is not available "method missing" will be thrown | def method_missing(method, *args, &block)
case method
when :title
@module_name
when :print_summary
args.each do |contact|
puts "\n"
contact.each do |k,v|
if block_given?
yield(k, v)
else
unless SUMMARY.index(k).nil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n if respond_to_missing?(method)\n source_object.send(method, *args, &block)\n else\n super\n end\n end",
"def method_missing(method, *args, &block)\n @source.send(method, *args, &block)\n end",
"def source(override);... | [
"0.653643",
"0.62793016",
"0.6232089",
"0.5968449",
"0.56851417",
"0.56580245",
"0.56452644",
"0.5633644",
"0.56039673",
"0.5566666",
"0.54821205",
"0.5448157",
"0.5422661",
"0.5412137",
"0.5411437",
"0.5378613",
"0.53510493",
"0.53415555",
"0.5340769",
"0.53303176",
"0.53268... | 0.6180253 | 3 |
Pascalizes/camalizes a string as address_source to AddressSource | def pascalize(string)
(string.split('_').map { |word| word.capitalize }).join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_string(original_source); end",
"def normalize_address(address)\n normalize(address).split(' ').map { |word| StreetAbbrevs[word] || word }.join(' ')\n end",
"def to_source; \"* = $#{@addr.to_s(16)}\"; end",
"def nat_source_address\n super\n end",
"def split_address(address)\n a... | [
"0.62859654",
"0.6041412",
"0.59383434",
"0.5893722",
"0.58671844",
"0.58064634",
"0.5793804",
"0.5793804",
"0.5747874",
"0.57234585",
"0.5681407",
"0.56758666",
"0.5637922",
"0.56208324",
"0.5574269",
"0.55488175",
"0.55407184",
"0.5465244",
"0.544802",
"0.54422843",
"0.5424... | 0.0 | -1 |
GET /explore NB custom resource path for collections | def index
@categories = collections_config.values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collections_path; end",
"def explore\n get('explore').body\n end",
"def collection_url\n super_url(with_chain(resource_class))\n end",
"def collection_uri\n super + uuid + '/'\n end",
"def list\n get('/')\n end",
"def collection_path\n @prefix + '/' + @res... | [
"0.72519356",
"0.70414823",
"0.6924338",
"0.66862816",
"0.6372963",
"0.635935",
"0.6321712",
"0.63059443",
"0.63003767",
"0.62925726",
"0.6281628",
"0.6253135",
"0.62058824",
"0.6199285",
"0.61939955",
"0.61652297",
"0.6125953",
"0.61254805",
"0.6091154",
"0.60903424",
"0.605... | 0.0 | -1 |
GET /explore/:category_id NB custom resource path for collections | def show
# Render 404 if category_id not valid
raise(ActionController::RoutingError, 'not found') unless collections_config[params[:category_id].to_sym]
# If category_id is valid look up any additional solr parameters
@category = send params[:category_id].to_sym
facet_name = @category.use_queries ?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @category_collection = CategoryCollection.find(params[:id])\n session[:current_location] = categories_path\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category_collection }\n end\n end",
"def test_show\n get '/category/1'\n end",
... | [
"0.6794905",
"0.65864974",
"0.65196675",
"0.6439715",
"0.6439464",
"0.631128",
"0.62056476",
"0.61985344",
"0.6157689",
"0.61570877",
"0.614772",
"0.61005867",
"0.6091785",
"0.6085246",
"0.6039662",
"0.6027687",
"0.60176504",
"0.59824187",
"0.5954331",
"0.59528536",
"0.594392... | 0.6166492 | 8 |
skills Object Initialization actor_id : actor ID | def initialize(actor_id)
super()
setup(actor_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_actor_skills(actor)\n return actor.skills.clone\n end",
"def set_skill\n @skill = @character.skills.find(params[:id])\n end",
"def find_skills\n @user = User.find(params[:id])\n @user_skill = UserSkill.where(\"user_id = @user.id\")\n end",
"def set_skill\n ... | [
"0.6984724",
"0.67697877",
"0.6676195",
"0.6526073",
"0.6507048",
"0.65029323",
"0.64914113",
"0.64888155",
"0.64773184",
"0.64773184",
"0.64773184",
"0.64773184",
"0.64773184",
"0.64773184",
"0.64773184",
"0.6445508",
"0.64182603",
"0.64007163",
"0.6345995",
"0.6315657",
"0.... | 0.5659542 | 73 |
Setup actor_id : actor ID | def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.wea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_actor\n @actor = Actor.find(params[:id])\n end",
"def set_actor\n @actor = Actor.find(params[:id])\n end",
"def set_actor\n @actor = Actor.find(params[:id])\n end",
"def set_actor\n @actor = Actor.find(params[:id])\n end",
"def setup(actor_id)\r\n actor = $data_actors... | [
"0.78272784",
"0.78272784",
"0.78272784",
"0.7792141",
"0.7762007",
"0.7392807",
"0.72947824",
"0.72739935",
"0.70976025",
"0.6998182",
"0.698861",
"0.6987016",
"0.6840557",
"0.66850674",
"0.663495",
"0.66159135",
"0.6338093",
"0.63380224",
"0.6293176",
"0.6247436",
"0.623909... | 0.5939013 | 36 |
Get Element Revision Value element_id : element ID | def element_rate(element_id)
# Get values corresponding to element effectiveness
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# If this element is protected by armor, then it's reduced by half
for i in [@armor1_id, @armor2_id, @armor3_id, @armo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_element id\n @elements[id.to_s]\n end",
"def find_element_value(element, element_link, client)\n element_id = element.match(/\\?id=(\\d+)/)[1]\n\n result = client.get(element_link + \"/?id=#{element_id}\")\n items = result['attributeElements']['elements']\n if items.empty?\n return \"ERROR_NOT... | [
"0.6551448",
"0.61332405",
"0.61086047",
"0.60864264",
"0.606278",
"0.59489393",
"0.5919844",
"0.5905338",
"0.59006685",
"0.58540773",
"0.58233905",
"0.5752385",
"0.5734746",
"0.567924",
"0.56724906",
"0.56692946",
"0.56566894",
"0.5618815",
"0.55826205",
"0.5565992",
"0.5555... | 0.0 | -1 |
Determine State Guard state_id : state ID | def state_guard?(state_id)
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_state_id(state)\n state_id = @db.get_first_value(\"SELECT id FROM states WHERE name = ?\", state)\n end",
"def death_state_id\r\n return 1\r\n end",
"def state_guard?(state_id)\n return false\n end",
"def game_state(game_id)\n\n end",
"def state_code\n end",
"def state_code... | [
"0.7849504",
"0.6632471",
"0.64654136",
"0.64412904",
"0.640836",
"0.6396621",
"0.6348174",
"0.63222885",
"0.62957054",
"0.627274",
"0.627274",
"0.62004566",
"0.61774004",
"0.6148109",
"0.6119831",
"0.60879743",
"0.607843",
"0.6037444",
"0.6032292",
"0.6031005",
"0.6025869",
... | 0.5932202 | 26 |
Get Normal Attack Element | def element_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.element_set : []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_attack_type\n read_attribute(:attack_type)\n end",
"def base_atk\n return $data_enemies[@enemy_id].atk\n end",
"def attack_technique\n return @attack_technique\n end",
"def attack()\n return @level + rand(3) - rand(3)\n end",
"def attack_effect_element_corr... | [
"0.58822644",
"0.58294135",
"0.57241774",
"0.5642711",
"0.5609767",
"0.552643",
"0.5501813",
"0.5488388",
"0.54811716",
"0.5403287",
"0.5357837",
"0.5307423",
"0.5301397",
"0.5301033",
"0.5296499",
"0.5272384",
"0.52501",
"0.52329457",
"0.52329457",
"0.52329457",
"0.51411474"... | 0.4780623 | 67 |
Get Normal Attack State Change (+) | def plus_state_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.plus_state_set : []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attack() stat(:attack) end",
"def enchant_state\n @enchant_state || 0\n end",
"def state\n %w{ OFF ON }[params.valve.cmd]\n end",
"def atk_action_lmt\n return 0 if (b=battler).nil?\n b.attack_action_lmt + atk_lmt_equip_mod\n end",
"def attack()\n return @level + rand(3) - rand(3)\n ... | [
"0.62039334",
"0.58742183",
"0.58089054",
"0.5777745",
"0.5752088",
"0.5639592",
"0.5619665",
"0.55982804",
"0.55982804",
"0.55982804",
"0.55982804",
"0.5597745",
"0.5581484",
"0.55691665",
"0.5560482",
"0.5510243",
"0.54844344",
"0.54844344",
"0.54844344",
"0.54844344",
"0.5... | 0.0 | -1 |
Get Normal Attack State Change () | def minus_state_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.minus_state_set : []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state\n %w{ OFF ON }[params.valve.cmd]\n end",
"def attack() stat(:attack) end",
"def enchant_state\n @enchant_state || 0\n end",
"def game_state\n end",
"def effect\n state[\"effect\"]\n end",
"def state()\n info[:state]\n end",
"def get_state\n return self.state ... | [
"0.63034433",
"0.6169834",
"0.60711944",
"0.60252196",
"0.597853",
"0.58895814",
"0.5889273",
"0.5857061",
"0.5849086",
"0.5831561",
"0.5813013",
"0.5807783",
"0.58055896",
"0.5798912",
"0.57924336",
"0.57880706",
"0.5760274",
"0.57503545",
"0.5744004",
"0.5728909",
"0.572890... | 0.0 | -1 |
Get Basic Maximum HP | def base_maxhp
return $data_actors[@actor_id].parameters[0, @level]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_maxhp\n return $data_enemies[@enemy_id].maxhp\n end",
"def native_maxhp\n actor.parameters[0, @level] + @maxhp_plus\n end",
"def base_maxhp\n return enemy.maxhp\n end",
"def get_max()\n end",
"def max_health(level)\n (self.health + self.health*0.1*(level-1)).to_i\n end",
"de... | [
"0.7742643",
"0.76376176",
"0.7554158",
"0.71854436",
"0.715582",
"0.71488655",
"0.712599",
"0.7070318",
"0.7061318",
"0.70431805",
"0.69652545",
"0.6864245",
"0.6864245",
"0.68532014",
"0.68532014",
"0.68424535",
"0.68261623",
"0.6813145",
"0.67982703",
"0.67982703",
"0.6794... | 0.71716774 | 4 |
Get Basic Maximum SP | def base_maxsp
return $data_actors[@actor_id].parameters[1, @level]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max()\n end",
"def get_max\n @max\n end",
"def get_max\n\t\t@max.last\n\tend",
"def find_max()\r\n self.max\r\n end",
"def max; end",
"def max; end",
"def max\n end",
"def max\n end",
"def get_max\n @max ||= calculate_max\n end",
"def native_maxmp\n actor.parameters[1,... | [
"0.7391935",
"0.7022868",
"0.692642",
"0.6921298",
"0.6856911",
"0.6856911",
"0.6841548",
"0.6841548",
"0.68155545",
"0.67843753",
"0.6605195",
"0.6595834",
"0.6593663",
"0.6593663",
"0.6588043",
"0.65590185",
"0.6550869",
"0.65334505",
"0.6501078",
"0.6455348",
"0.6441624",
... | 0.6680802 | 10 |
Get Basic Attack Power | def base_atk
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.atk : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attack(weapon)\n rand(10) + weapon.power\n end",
"def power\r\n return @access >> 26\r\n end",
"def attack()\r\n\t\tweaponPower = @weapon.offensiveWeapon()\r\n\t\tif(@weapon.name == \"Shield\")\r\n\t\t\treturn (weaponPower*@strength)/2\r\n\t\telse\r\n\t\t\treturn weaponPower*@strength\r\n\... | [
"0.6830873",
"0.6760588",
"0.6638149",
"0.65903914",
"0.65889585",
"0.658519",
"0.6570022",
"0.6500188",
"0.6475727",
"0.63986063",
"0.6379584",
"0.6276981",
"0.62667686",
"0.6152722",
"0.6143754",
"0.60736907",
"0.6061249",
"0.6038086",
"0.5998981",
"0.5992804",
"0.5988758",... | 0.5703334 | 46 |
Get Basic Physical Defense | def base_pdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
pdef1 = weapon != nil ? weapon.pdef : 0
pdef2 = armor1 != nil ? armor1.pdef : 0
pdef3 = armor2 != nil ?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defense\n total_for(:defense)\n end",
"def health_benefit; end",
"def debt_service\n property.net_operating_income / debt_payment\n end",
"def energy\n combatant.maximum_energy\n end",
"def index\n @defenses = Defense.all\n end",
"def spirit_defense\n defense_bonus = calc... | [
"0.68368655",
"0.58271605",
"0.5782619",
"0.577957",
"0.57764125",
"0.57440114",
"0.5712988",
"0.5701252",
"0.56680584",
"0.5645118",
"0.5618615",
"0.5602101",
"0.55541784",
"0.5541827",
"0.55349445",
"0.55349445",
"0.5511633",
"0.5494517",
"0.5491395",
"0.54898715",
"0.54889... | 0.5327265 | 32 |
Get Basic Magic Defense | def base_mdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
mdef1 = weapon != nil ? weapon.mdef : 0
mdef2 = armor1 != nil ? armor1.mdef : 0
mdef3 = armor2 != nil ?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def defense\n total_for(:defense)\n end",
"def damage\n @damage ||= [(@power * (rand + 0.5)).to_i - @defender.toughness, 0].max\n end",
"def determine_damage\n if Random.rand(100) < critical_rate\n [fighter_attack * 2, FightEvent.attack_types['critical']]\n else\n [fighter_attack, Fight... | [
"0.6607412",
"0.646403",
"0.61876935",
"0.6056294",
"0.6036127",
"0.60202295",
"0.59829354",
"0.59801114",
"0.59688365",
"0.59545213",
"0.59366345",
"0.5903551",
"0.5889759",
"0.585976",
"0.5837217",
"0.58178914",
"0.58089256",
"0.57922685",
"0.57807595",
"0.57787603",
"0.577... | 0.59793764 | 8 |
Get Basic Evasion Correction | def base_eva
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
eva1 = armor1 != nil ? armor1.eva : 0
eva2 = armor2 != nil ? armor2.eva : 0
eva3 = armor3 != nil ? armor3.eva : 0
eva4 = armor4 != nil ? ar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_effs\n @eff_x = (Math.cos(@angle*(Math::PI/180.0))*@length).round(2)\n @eff_y = (Math.sin(@angle*(Math::PI/180.0))*@length).round(2)\n\n @eff_x_width = (Math.cos((@angle-90.0)*(Math::PI/180.0))*(@width/2.0)).round(2)\n @eff_y_width = (Math.sin((@angle-90.0)*(Math::PI/18... | [
"0.5801478",
"0.5577373",
"0.5442216",
"0.54212266",
"0.53656214",
"0.5309718",
"0.51215434",
"0.511893",
"0.511893",
"0.51014596",
"0.5053679",
"0.50423986",
"0.5026891",
"0.500633",
"0.49990818",
"0.49945113",
"0.49666363",
"0.4939316",
"0.49365065",
"0.4926202",
"0.4925403... | 0.0 | -1 |
Get Offensive Animation ID for Normal Attacks | def animation1_id
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.animation1_id : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def animation1_id\n return $data_enemies[@enemy_id].animation1_id\n end",
"def animation2_id\n return $data_enemies[@enemy_id].animation2_id\n end",
"def guts_animation_id\n if actor?\n self.actor.guts_animation\n else\n self.enemy.guts_animation\n end\n end",
"def attack_skill_id... | [
"0.6918191",
"0.6678183",
"0.66486",
"0.6290423",
"0.61751944",
"0.61175996",
"0.5770017",
"0.570915",
"0.570915",
"0.5708411",
"0.5596237",
"0.55397147",
"0.5480347",
"0.5463056",
"0.54252124",
"0.53881603",
"0.5354428",
"0.5330882",
"0.53126013",
"0.5310483",
"0.52774775",
... | 0.638782 | 3 |
Get Target Animation ID for Normal Attacks | def animation2_id
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.animation2_id : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guts_animation_id\n if actor?\n self.actor.guts_animation\n else\n self.enemy.guts_animation\n end\n end",
"def animation1_id\n return $data_enemies[@enemy_id].animation1_id\n end",
"def animation2_id\n return $data_enemies[@enemy_id].animation2_id\n end",
"def animation1_id\n... | [
"0.7181227",
"0.7068033",
"0.70382166",
"0.6508841",
"0.63457745",
"0.61798406",
"0.61798406",
"0.6109011",
"0.6051399",
"0.59292424",
"0.5927213",
"0.58903074",
"0.57875425",
"0.5774987",
"0.57622904",
"0.5719707",
"0.5675788",
"0.565744",
"0.56407726",
"0.5624871",
"0.56048... | 0.65738815 | 3 |
Get Next Level EXP String | def next_exp_s
return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : "-------"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_rest_exp_s\n return @exp_list[@level+1] > 0 ?\n (@exp_list[@level+1] - @exp).to_s : \"-------\"\n end",
"def full_next_exp\n return (@exp_list[@level+1] > 0 ? @exp_list[@level+1] : 0)\n end",
"def next_exp\n lvl * 100\n end",
"def exp_text\n @exp.to_s\n end",
"def next_exp... | [
"0.78923017",
"0.7087616",
"0.6997609",
"0.6728509",
"0.6707369",
"0.6595985",
"0.6595985",
"0.6595985",
"0.6595985",
"0.6579043",
"0.65377355",
"0.64788395",
"0.6016778",
"0.5991891",
"0.59864587",
"0.5969712",
"0.5917959",
"0.5917509",
"0.589485",
"0.5875773",
"0.5875773",
... | 0.8153381 | 0 |
Get Until Next Level EXP String | def next_rest_exp_s
return @exp_list[@level+1] > 0 ?
(@exp_list[@level+1] - @exp).to_s : "-------"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_exp_s\n return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : \"-------\"\n end",
"def full_next_exp\n return (@exp_list[@level+1] > 0 ? @exp_list[@level+1] : 0)\n end",
"def next_exp\n lvl * 100\n end",
"def next_exp\n return (@exp_list[@level+1] > 0 ? @exp_list[@level+1]-@exp_... | [
"0.7781043",
"0.7098947",
"0.6759615",
"0.66495705",
"0.6549921",
"0.6549921",
"0.6549921",
"0.6549921",
"0.6393687",
"0.6392276",
"0.57439744",
"0.5706462",
"0.56350726",
"0.5610311",
"0.56085354",
"0.5585899",
"0.5576273",
"0.5564268",
"0.55583274",
"0.5490222",
"0.5490222"... | 0.7616374 | 1 |
Update Auto State old_armor : unequipped armor new_armor : equipped armor | def update_auto_state(old_armor, new_armor)
# Forcefully remove unequipped armor's auto state
if old_armor != nil and old_armor.auto_state_id != 0
remove_state(old_armor.auto_state_id, true)
end
# Forcefully add unequipped armor's auto state
if new_armor != nil and new_armor.auto_state_id != 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unequip_item\n\t\tself.equiped = false\n\t\tself.save\n\tend",
"def equip(equip_type, id)\n case equip_type\n when 0 # Weapon\n if id == 0 or $game_party.weapon_number(id) > 0\n $game_party.gain_weapon(@weapon_id, 1)\n @weapon_id = id\n $game_party.lose_weapon(id, 1)\n e... | [
"0.62611586",
"0.6155783",
"0.61212885",
"0.5985645",
"0.59593016",
"0.5944349",
"0.5892705",
"0.58357257",
"0.57440937",
"0.5729526",
"0.57008857",
"0.56697047",
"0.55271846",
"0.5521553",
"0.55060357",
"0.5475477",
"0.54568",
"0.54543674",
"0.5454236",
"0.5452172",
"0.54514... | 0.8532263 | 0 |
Determine Fixed Equipment equip_type : type of equipment | def equip_fix?(equip_type)
case equip_type
when 0 # Weapon
return $data_actors[@actor_id].weapon_fix
when 1 # Shield
return $data_actors[@actor_id].armor1_fix
when 2 # Head
return $data_actors[@actor_id].armor2_fix
when 3 # Body
return $data_actors[@actor_id].armor3_fix
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equip_type_fixed?(etype_id)\r\n features_set(FEATURE_EQUIP_FIX).include?(etype_id)\r\n end",
"def equip_type=(equip_type)\n if equip_type == 1 and @actor.two_swords_style\n equip_type = 0 # Change shield to weapon\n end\n @equip_type = equip_type\n end",
"def... | [
"0.7097516",
"0.70699936",
"0.67757463",
"0.6684048",
"0.66618156",
"0.6216389",
"0.61395115",
"0.6032124",
"0.60172236",
"0.60079896",
"0.5945853",
"0.59297544",
"0.5862433",
"0.5859494",
"0.5843177",
"0.5833744",
"0.5813489",
"0.57800007",
"0.574834",
"0.571485",
"0.5700800... | 0.7307465 | 0 |
Change Equipment equip_type : type of equipment id : weapon or armor ID (If 0, remove equipment) | def equip(equip_type, id)
case equip_type
when 0 # Weapon
if id == 0 or $game_party.weapon_number(id) > 0
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
when 1 # Shield
if id == 0 or $game_party.armor_number(id) > 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equip_type=(equip_type)\n if equip_type == 1 and @actor.two_swords_style\n equip_type = 0 # Change shield to weapon\n end\n @equip_type = equip_type\n end",
"def set_equip_type\n @equip_type = EquipType.find(params[:id])\n end",
"def set_equip(is_weapon, ... | [
"0.8069311",
"0.75366366",
"0.70531726",
"0.7026703",
"0.68261206",
"0.664771",
"0.6626608",
"0.658422",
"0.6583291",
"0.6474481",
"0.638983",
"0.63637906",
"0.63579667",
"0.62501085",
"0.62177545",
"0.61835617",
"0.61835617",
"0.61355",
"0.61052924",
"0.60993254",
"0.6098528... | 0.70928955 | 2 |
Determine if Equippable item : item | def equippable?(item)
# If weapon
if item.is_a?(RPG::Weapon)
# If included among equippable weapons in current class
if $data_classes[@class_id].weapon_set.include?(item.id)
return true
end
end
# If armor
if item.is_a?(RPG::Armor)
# If included among equippable armor ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equippable?(item)\n # If weapon\n if item.is_a?(RPG::Weapon)\n style = get_style(0, item.id)\n # If included among equippable weapons in current class\n if $data_classes[@class_id].weapon_set.include?(item.id)\n if style == nil or @job_current == Unemployed\n return true\n ... | [
"0.80907655",
"0.78334576",
"0.7825789",
"0.770718",
"0.75983083",
"0.74758464",
"0.7467189",
"0.7455395",
"0.74318844",
"0.73767686",
"0.7269674",
"0.71919805",
"0.7181985",
"0.7114584",
"0.7076291",
"0.7065671",
"0.7055298",
"0.6955338",
"0.69203544",
"0.6911316",
"0.691001... | 0.79370725 | 1 |
Change EXP exp : new EXP | def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# Level up
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
# Learn skill
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exp(v); Math.exp(v); end",
"def exp=(v)\n @exp = v.to_i\n exp_lvl = self.exp_lvl\n if exp_lvl >= @exp\n exp_last = GameData::EXP_TABLE[exp_type][@level]\n delta = exp_lvl - exp_last\n current = exp - exp_last\n @exp_rate = (delta == 0 ? 1 : current / delta.to_f)\n ... | [
"0.71096474",
"0.7087458",
"0.7037991",
"0.7025281",
"0.6822927",
"0.67813104",
"0.6665678",
"0.6582954",
"0.6504124",
"0.64324903",
"0.6408748",
"0.6399938",
"0.6399938",
"0.63728064",
"0.6367618",
"0.63496244",
"0.6342044",
"0.6338663",
"0.6336527",
"0.6332907",
"0.62990266... | 0.5974876 | 42 |
Change Level level : new level | def level=(level)
# Check up and down limits
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
# Change EXP
self.exp = @exp_list[level]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_level\n if Group::LEVEL_TITLES.include?(params[:level])\n params[:level] = Group::LEVELS[Group::LEVEL_TITLES.index(params[:level])]\n end\n unless Group::LEVELS.include?(params[:level])\n flash[:notice] = 'invalid level'\n render(:update) do |page|\n update_flash(page, fla... | [
"0.80370146",
"0.79561687",
"0.793918",
"0.793918",
"0.7920046",
"0.78366303",
"0.7676065",
"0.7587691",
"0.7468349",
"0.7432094",
"0.73899007",
"0.7377023",
"0.7377023",
"0.7323325",
"0.73224634",
"0.731528",
"0.7304838",
"0.7291297",
"0.7285575",
"0.7285575",
"0.7281642",
... | 0.76253957 | 7 |
Learn Skill skill_id : skill ID | def learn_skill(skill_id)
if skill_id > 0 and not skill_learn?(skill_id)
@skills.push(skill_id)
@skills.sort!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_learnable_skill\n @learnable_skill = LearnableSkill.find(params[:id])\n end",
"def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end",
"def set_skill\n @skill = Skill.friendly.find(params[:id])\n end",
"def set_skill\n @skill = Skill.all.find(params[:id])\n end"... | [
"0.7433112",
"0.73026955",
"0.72441566",
"0.70339304",
"0.6989894",
"0.69881797",
"0.69881797",
"0.69881797",
"0.69881797",
"0.69881797",
"0.69881797",
"0.69881797",
"0.6967192",
"0.69622815",
"0.6954776",
"0.69177336",
"0.6838403",
"0.6801504",
"0.67585796",
"0.66462266",
"0... | 0.77969366 | 0 |
Forget Skill skill_id : skill ID | def forget_skill(skill_id)
@skills.delete(skill_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(skillName)\n\n end",
"def forget_skill_persist(class_id, skill_id)\n $game_persistent_skills[class_id].delete(skill_id) if !$game_persistent_skills[class_id].nil?\n end",
"def set_skill(skill_id)\n @kind = 1\n @skill_id = skill_id\n end",
"def destroy\n @skill = current_user.ski... | [
"0.71700454",
"0.6927097",
"0.6903518",
"0.67839044",
"0.67691123",
"0.6719212",
"0.6596932",
"0.6590979",
"0.65563244",
"0.6536769",
"0.6536769",
"0.6536769",
"0.6536769",
"0.6536769",
"0.6536769",
"0.6536769",
"0.65278596",
"0.6521243",
"0.6479685",
"0.64638835",
"0.6437853... | 0.7994939 | 0 |
Determine if Finished Learning Skill skill_id : skill ID | def skill_learn?(skill_id)
return @skills.include?(skill_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skill_sealed?(skill_id)\r\n features_set(FEATURE_SKILL_SEAL).include?(skill_id)\r\n end",
"def skill_learn_persist?(class_id, skill)\n skill.is_a?(RPG::Skill) && !$game_persistent_skills[class_id].nil? && $game_persistent_skills[class_id].include?(skill.id)\n end",
"def check_new_skills\n la... | [
"0.67191094",
"0.64805263",
"0.6468424",
"0.63449526",
"0.6311429",
"0.6177034",
"0.61741024",
"0.608361",
"0.6067645",
"0.60362107",
"0.59857655",
"0.5965366",
"0.59433496",
"0.58432996",
"0.569926",
"0.5695615",
"0.56893456",
"0.5686082",
"0.56595284",
"0.5545342",
"0.55339... | 0.7234288 | 0 |
Determine if Skill can be Used skill_id : skill ID | def skill_can_use?(skill_id)
if not skill_learn?(skill_id)
return false
end
return super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skill_learn?(skill_id)\n return @skills.include?(skill_id)\n end",
"def skill_can_use?(skill_id)\n if Combination_Skill['Union'] != nil and Combination_Skill['Union'].is_a?(Hash) and\n Combination_Skill['Union'].keys.include?(['Enemy', skill_id])\n union = Combination_Skill['Union'][['Enemy... | [
"0.8014005",
"0.7930835",
"0.75835097",
"0.7420771",
"0.7292769",
"0.72255236",
"0.72248065",
"0.7090728",
"0.7063189",
"0.6851292",
"0.6849251",
"0.6837798",
"0.682506",
"0.67661667",
"0.667831",
"0.6668562",
"0.65976804",
"0.6590184",
"0.65895367",
"0.6526853",
"0.65072227"... | 0.8194655 | 0 |
Change Name name : new name | def name=(name)
@name = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_name(new_name)\n @name = new_name\n end",
"def rename new_name\n @name = new_name.to_sym\n end",
"def rename new_name\n @name = new_name.to_sym\n end",
"def change_name(name)\n self.change_all_attribute(name, 'name')\n end",
"def name=(name)\n\t\t@new_name = name\n\ten... | [
"0.8497087",
"0.82969123",
"0.82969123",
"0.8191724",
"0.8071712",
"0.8002645",
"0.7923986",
"0.7877987",
"0.7845728",
"0.7840992",
"0.7840992",
"0.7811436",
"0.78072333",
"0.7800118",
"0.77985424",
"0.7776585",
"0.7747456",
"0.7737538",
"0.7678658",
"0.7678658",
"0.76763016"... | 0.0 | -1 |
Change Class ID class_id : new class ID | def class_id=(class_id)
if $data_classes[class_id] != nil
@class_id = class_id
# Remove items that are no longer equippable
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id_class\n @id_class ? @id_class : nil\n end",
"def set_class\n @class = Class.find(params[:id])\n end",
"def change_class(domain, key, new_class)\n dmid = get_dmid(domain)\n classid = get_classid(domain, new_class)\n sql = \"UPDATE file SET classid = #{classid} WHERE dmid = #{dmid... | [
"0.7174497",
"0.7054256",
"0.68025947",
"0.6789816",
"0.67326707",
"0.6658626",
"0.6564718",
"0.65357494",
"0.64999026",
"0.6448024",
"0.6378928",
"0.6378928",
"0.63389736",
"0.63291574",
"0.63291574",
"0.6302316",
"0.625292",
"0.6250642",
"0.6238283",
"0.62310374",
"0.621851... | 0.0 | -1 |
Change Graphics character_name : new character file name character_hue : new character hue battler_name : new battler file name battler_hue : new battler hue | def set_graphic(character_name, character_hue, battler_name, battler_hue)
@character_name = character_name
@character_hue = character_hue
@battler_name = battler_name
@battler_hue = battler_hue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_graphic(character_name, character_hue, battler_name, battler_hue)\r\n @character_name = character_name\r\n @character_hue = character_hue\r\n @battler_name = battler_name\r\n @battler_hue = battler_hue\r\n end",
"def set_graphic(character_name)\n @tile_id = 0\n @character_name = charac... | [
"0.7385175",
"0.693029",
"0.68678105",
"0.6770848",
"0.6262598",
"0.6187932",
"0.61814475",
"0.6123725",
"0.59929633",
"0.597417",
"0.59451896",
"0.5929174",
"0.5916003",
"0.5854931",
"0.57908475",
"0.57500046",
"0.5744943",
"0.57119715",
"0.5701896",
"0.56977147",
"0.5691332... | 0.735873 | 1 |
Get Battle Screen XCoordinate | def screen_x
# Return after calculating x-coordinate by order of members in party
if self.index != nil
return self.index * 160 + 80
else
return 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_x\n x = (@real_x - $game_map.display_x + 3) / 4\n return x\n end",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)+16\n return x\n end",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)\n return x\n end",
"def screen_x\n x = ((@real_x - $game_map.... | [
"0.8323634",
"0.83181906",
"0.8305357",
"0.8305357",
"0.82942414",
"0.82109123",
"0.8105615",
"0.79443485",
"0.7889534",
"0.7880283",
"0.78567576",
"0.77439415",
"0.77439415",
"0.7677418",
"0.76581293",
"0.7608564",
"0.7549986",
"0.74187505",
"0.7387054",
"0.7382043",
"0.7322... | 0.79681283 | 7 |
Get Battle Screen YCoordinate | def screen_y
return 464
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_y\n if $game_temp.enemies_position[self.index] != nil\n return $game_temp.enemies_position[self.index][1]\n else\n return $data_troops[@troop_id].members[@member_index].y + Enemy_Position_AdjustY\n end\n end",
"def screen_y\n y = ((@real_y - $game_map.display_y + 3) / 4 )+16\n ... | [
"0.83931154",
"0.82202584",
"0.82057524",
"0.82018405",
"0.8183105",
"0.8183105",
"0.81134117",
"0.81102467",
"0.7992247",
"0.79247093",
"0.7857582",
"0.7773692",
"0.7727843",
"0.7720623",
"0.7720623",
"0.75123763",
"0.73991954",
"0.7342428",
"0.7326338",
"0.73142546",
"0.731... | 0.73714626 | 17 |
Get Battle Screen ZCoordinate | def screen_z
# Return after calculating z-coordinate by order of members in party
if self.index != nil
return 4 - self.index
else
return 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_z\n return screen_y\n end",
"def screen_z\n return screen_y\n end",
"def screen_z_formula\n @shadow_point.screen_y + additional_z\n # Real Y position (without jumping) + Additional Z value\n end",
"def screen_z(height = 0)\n\n return 0 if @below2\n return 1 if @below\n retu... | [
"0.78315145",
"0.78315145",
"0.7683055",
"0.73411655",
"0.72503805",
"0.67651194",
"0.673346",
"0.6542432",
"0.6516978",
"0.6471383",
"0.6471383",
"0.6430626",
"0.6427607",
"0.635854",
"0.6350543",
"0.6310139",
"0.6191794",
"0.61596256",
"0.6146512",
"0.6139527",
"0.6112791",... | 0.74454165 | 3 |
poss = position in line | def average poss
'%.2f' % ( @stat_data.map{|n| n[poss].to_f}.reduce(:+) / @stat_data.length )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line(pos=pos)\n lines[line_index(pos)]\n end",
"def line(pos=pos())\n lines[line_index(pos)]\n end",
"def get_line_pos(pos)\n lpos = @line_ends.bsearch_index { |x... | [
"0.6981246",
"0.6981246",
"0.6981246",
"0.66683227",
"0.6643158",
"0.66374886",
"0.65851945",
"0.63849217",
"0.6149321",
"0.6076649",
"0.60599864",
"0.60531723",
"0.6047302",
"0.59735495",
"0.59130573",
"0.58470523",
"0.5843315",
"0.58418816",
"0.57852244",
"0.5775305",
"0.57... | 0.0 | -1 |
but methods defined within the class override inherited methods of the same name | def speak
"#{self.name} says arf!"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overrides; end",
"def special\n override\n end",
"def super_method; end",
"def methods\n super + DELEGATED_METHODS\n end",
"def inherited(base); end",
"def inherited_meths(opts = T.unsafe(nil)); end",
"def inherited(klass); end",
"def inherited(klass); end",
"def instance_method... | [
"0.78834486",
"0.7686796",
"0.7609528",
"0.7373308",
"0.7361398",
"0.724692",
"0.72112685",
"0.72112685",
"0.71250284",
"0.7091176",
"0.706171",
"0.7057559",
"0.69803214",
"0.6943547",
"0.69312465",
"0.69286036",
"0.6910698",
"0.68701434",
"0.68661594",
"0.68542325",
"0.68542... | 0.0 | -1 |
'password' is a virtual attribute | def password=(password)
@password = password
if password.present?
generate_salt
self.hashed_password = self.class.encrypt_password(password, salt)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password\n \t\t return password_virtual_attr\n end",
"def password\n\t\tPassword.new( attribute_get(:password) )\n\tend",
"def password_field\n self.password\n end",
"def password\n @attributes[:password]\n end",
"def password\n @attributes[:password]\n end",
"def password\n ... | [
"0.8923515",
"0.82171404",
"0.81790924",
"0.81615293",
"0.81615293",
"0.8124509",
"0.8069165",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
"0.80647916",
... | 0.0 | -1 |
SCORING SYSTEM moved to lib/cm_scores.rb Luke end SCORING SYSTEM FORM HANDLING | def issues=(issue_ids)
Issue.find(issue_ids).each do |issue|
issues << issue unless issues.include?(issue)
#review_issue = ReviewIssue.new(:issue_id => issue_id, :review => )
#review_issue.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\tputs self.score_status_modif\n\t\tif self.score_status_modif\n\t\t\tputs 1\n\t\t\tcase score_status\n\t\t\t\n\t\t\t#unregistered\n\t\t\twhen SCORE_STATUS[0]\n\t\t\t\tputs 2\n\t\t\t\tself.score_component=[score_admin=Sigmoid.new,\n\t\t\t\t\t score_response=Sigmoid.new,\n\t\t\t\t\t score_connecte... | [
"0.63671434",
"0.61426187",
"0.60406643",
"0.599684",
"0.58927155",
"0.584391",
"0.58404595",
"0.5834461",
"0.5833629",
"0.5803168",
"0.58025277",
"0.57567346",
"0.5751221",
"0.5749112",
"0.57348937",
"0.57021",
"0.56973785",
"0.56917477",
"0.56518984",
"0.5627493",
"0.560885... | 0.0 | -1 |
GET /tweets GET /tweets.json | def index
number_tweets = if params["count"] then params["count"].to_i else 10 end
tweet_ids = []
if @user.interests
for i in 1..number_tweets
interest = @user.interests.sample
tweet = Rails.application.config.twitter_client.search("#{interest[:hashtag]}", count: 1).take(1)
twe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweets\n user = User.find(params[:id])\n render json: user.list_tweets, status: :ok\n end",
"def index\n @tweets = @user.tweets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tweets }\n end\n end",
"def show_user_tweets\n @user_twee... | [
"0.8115453",
"0.7980129",
"0.786006",
"0.77100396",
"0.76598233",
"0.75170803",
"0.74347824",
"0.74107563",
"0.7409217",
"0.73619074",
"0.73584616",
"0.7300687",
"0.7241951",
"0.7181157",
"0.7123983",
"0.7104852",
"0.7096105",
"0.70944136",
"0.70827305",
"0.70827305",
"0.7082... | 0.6763872 | 51 |
if no pod is given from the command line then we will unregister the pod from the registered links if a pod name is given from the command line then we will unlink the given pod from the project | def run
unless @pod.nil?
Pod::Command::Links.unlink @pod
else
Pod::Command::Links.unregister
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_pods\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'master'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => '... | [
"0.6295626",
"0.5861184",
"0.56772155",
"0.5550004",
"0.55087143",
"0.54562557",
"0.5429376",
"0.54265493",
"0.54265493",
"0.54263514",
"0.5411467",
"0.53842384",
"0.5381987",
"0.53470504",
"0.53462654",
"0.52980536",
"0.52970606",
"0.5268147",
"0.5239541",
"0.5236988",
"0.52... | 0.83354455 | 0 |
Verify that a dashboard exists | def dashboard_exists?(id)
saved_object_exists?("dashboard", id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dashboard_sanity(dashboard_options)\n dashboard_source_file = find_dashboard_source_file dashboard_options\n unless dashboard_source_file\n checked_paths = lookup_paths(dashboard_options).join(', ')\n if dashboard_options[:path]\n err_msg_prt = \"#{dashboard_options[:path]} pat... | [
"0.7139893",
"0.692327",
"0.67378443",
"0.6648664",
"0.64697605",
"0.6274022",
"0.6149472",
"0.61075604",
"0.5901678",
"0.58908737",
"0.58760256",
"0.58502495",
"0.58502495",
"0.58502495",
"0.58502495",
"0.58502495",
"0.5847127",
"0.5835353",
"0.5775269",
"0.5775269",
"0.5727... | 0.7828593 | 0 |
Creates a Kibana dashboard | def create_dashboard(params, id = "", space_id = "")
create_saved_object(params, "dashboard", id, space_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dashboard(title, description, graphs, template_variables = nil, read_only = false)\n @dash_service.create_dashboard(title, description, graphs, template_variables, read_only)\n end",
"def create_dashboard(body, opts = {})\n data, _status_code, _headers = create_dashboard_with_http_info(bo... | [
"0.6782721",
"0.650914",
"0.6331507",
"0.6320371",
"0.6320371",
"0.6320371",
"0.63091636",
"0.62587756",
"0.6234709",
"0.6160494",
"0.6044887",
"0.60087013",
"0.59468263",
"0.5870024",
"0.58497137",
"0.5820769",
"0.58005226",
"0.57954425",
"0.57836103",
"0.57836103",
"0.57680... | 0.6527139 | 1 |
Updates a Kibana dashboard | def update_dashboard(params, id, space_id = "")
update_saved_object(params, "dashboard", id, space_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n respond_to do |format|\n if @dashboard.update(dashboard_params )\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @dashboard }\n else\n format.html { render :edit }\n ... | [
"0.6583123",
"0.6440183",
"0.6365841",
"0.6365841",
"0.6365841",
"0.6365841",
"0.6365841",
"0.6315233",
"0.62789506",
"0.6219415",
"0.6162258",
"0.5921991",
"0.5895544",
"0.5895544",
"0.5895544",
"0.5895544",
"0.5895544",
"0.5895544",
"0.5895544",
"0.5862469",
"0.58475935",
... | 0.64495003 | 1 |
Crossplatform way of finding an executable in the $PATH. | def which(cmd)
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
exts.each { |ext|
exe = File.join(path, "#{cmd}#{ext}")
return exe if File.executable?(exe) && !File.directory?(exe)
}
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_executable_in_path(command_name)\n ENV['PATH'].split(/;|:/).each do |dir|\n path = File.join(dir, command_name)\n return path if File.executable?(path)\n end\n return nil\n end",
"def find_executable_in_path(command_name)\n ENV['PATH'].split(/;|:/).each... | [
"0.7967338",
"0.7967338",
"0.7946233",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.78689295",
"0.7848837",
"0.7811889",
"0.77983356",
"... | 0.7778697 | 33 |
GET /checkin_backgrounds GET /checkin_backgrounds.json | def index
@checkin_backgrounds = CheckinBackground.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_checkin_background\n @checkin_background = CheckinBackground.find(params[:id])\n end",
"def details(background_check_id)\n API::request(:get, \"background_checks/#{background_check_id}\")\n end",
"def create\n @checkin_background = CheckinBackground.new(checkin_background_params)... | [
"0.69357204",
"0.63146675",
"0.6287336",
"0.603859",
"0.5760375",
"0.5669632",
"0.56044024",
"0.55862606",
"0.5484425",
"0.54648244",
"0.52606845",
"0.5259045",
"0.5225793",
"0.5193798",
"0.5180768",
"0.5159029",
"0.51073515",
"0.5096318",
"0.50666803",
"0.50549036",
"0.49862... | 0.77109843 | 0 |
GET /checkin_backgrounds/1 GET /checkin_backgrounds/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @checkin_backgrounds = CheckinBackground.all\n end",
"def set_checkin_background\n @checkin_background = CheckinBackground.find(params[:id])\n end",
"def details(background_check_id)\n API::request(:get, \"background_checks/#{background_check_id}\")\n end",
"def create\n ... | [
"0.7537232",
"0.71559536",
"0.6726276",
"0.6673031",
"0.62825453",
"0.60622656",
"0.5720406",
"0.5661291",
"0.5640333",
"0.5521597",
"0.539585",
"0.5380683",
"0.5301651",
"0.52901846",
"0.52171004",
"0.51849514",
"0.51567143",
"0.505691",
"0.5041784",
"0.4969206",
"0.49218148... | 0.0 | -1 |
POST /checkin_backgrounds POST /checkin_backgrounds.json | def create
@checkin_background = CheckinBackground.new(checkin_background_params)
respond_to do |format|
if @checkin_background.save
format.html { redirect_to @checkin_background, notice: 'Checkin background was successfully created.' }
format.json { render action: 'show', status: :create... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_checkin_background\n @checkin_background = CheckinBackground.find(params[:id])\n end",
"def index\n @checkin_backgrounds = CheckinBackground.all\n end",
"def create(options)\n API::request(:post, 'background_checks', options)\n end",
"def checkin_background_params\n param... | [
"0.68763685",
"0.6755561",
"0.65825325",
"0.6105568",
"0.6036347",
"0.58200866",
"0.5796747",
"0.57635015",
"0.57245576",
"0.5663277",
"0.53005457",
"0.5287163",
"0.5265128",
"0.51310694",
"0.5127238",
"0.502028",
"0.5007326",
"0.49880892",
"0.49813703",
"0.49421683",
"0.4907... | 0.6880339 | 0 |
PATCH/PUT /checkin_backgrounds/1 PATCH/PUT /checkin_backgrounds/1.json | def update
respond_to do |format|
if @checkin_background.update(checkin_background_params)
format.html { redirect_to @checkin_background, notice: 'Checkin background was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_checkin_background\n @checkin_background = CheckinBackground.find(params[:id])\n end",
"def create\n @checkin_background = CheckinBackground.new(checkin_background_params)\n\n respond_to do |format|\n if @checkin_background.save\n format.html { redirect_to @checkin_background, n... | [
"0.7180167",
"0.6564765",
"0.6267457",
"0.6183628",
"0.6095946",
"0.5729196",
"0.5697504",
"0.56956387",
"0.54172504",
"0.54078996",
"0.5361619",
"0.52611136",
"0.524711",
"0.52461094",
"0.52461094",
"0.52195317",
"0.52172464",
"0.521023",
"0.5207828",
"0.52022856",
"0.519711... | 0.7510523 | 0 |
DELETE /checkin_backgrounds/1 DELETE /checkin_backgrounds/1.json | def destroy
@checkin_background.destroy
respond_to do |format|
format.html { redirect_to checkin_backgrounds_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bg_check.destroy\n respond_to do |format|\n format.html { redirect_to bg_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @background.destroy\n respond_to do |format|\n format.html { redirect_to backgrounds_url, notice: 'Background was suc... | [
"0.6557181",
"0.6479672",
"0.6386987",
"0.62154526",
"0.62153685",
"0.60313845",
"0.6003196",
"0.59800607",
"0.5956425",
"0.5950011",
"0.58206683",
"0.58137906",
"0.5781895",
"0.5758896",
"0.5753982",
"0.5753323",
"0.5749818",
"0.57328784",
"0.57328784",
"0.57213163",
"0.5702... | 0.80679023 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_checkin_background
@checkin_background = CheckinBackground.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def checkin_background_params
params.require(:checkin_background).permit(:name, :graphic)
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 |
replace this with your score function | def generate_score(other_user)
time_correlation = self.featureVector(:schedule).inner_product other_user.featureVector(:schedule)
skill_correlation = 5 - (self.featureVector(:skill_set).inner_product other_user.featureVector(:skill_set))
#return time_correlation - skill_correlation
return Vector[ti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score\n end",
"def score; end",
"def assign_score; end",
"def game_score(score)\n end",
"def render_score; end",
"def score3\r\n score1ot\r\n end",
"def score=(_); end",
"def score3() score1et; end",
"def score!\n \"#{self.class}Scorer\".constantize.new(self).score_all!\n end",... | [
"0.858419",
"0.85170096",
"0.8101186",
"0.7909012",
"0.7857187",
"0.7835906",
"0.78104544",
"0.77895844",
"0.76884866",
"0.7685075",
"0.7657561",
"0.76559407",
"0.75567454",
"0.7530253",
"0.7509134",
"0.7504806",
"0.749779",
"0.7489145",
"0.7436915",
"0.7401363",
"0.73670435"... | 0.0 | -1 |
This scrip runs stress on the unit until the state of charge is 65%. It then configures the unit to perform battery internal impedance measurements at every power before shutting down You must manually turn the unit on, connect it to a charger, and monitor 818 registers BA and BB for the measurement/ calculation to be ... | def initialize()
@reg_path = '/sys/kernel/debug/regmap/sunxi-rsb-3a3/registers'
# Any specific first steps here
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\t\n\t\tbegin\n\n\t\t\toutput = %x[acpi].split(\", \")\n\n\t\t\t# Battery id\n\t\t\tfsec = output[0]\n\t\t\t@id = fsec.match(/^.*\\s([0-9]+).*$/)[1]\n\n\t\t\t# Battery state\n\t\t\tdcraw = fsec.match(/^.*:\\s(.*)$/)[1]\n\t\t\t# If full sets to charging state for the correct icon\n\t\t\t@dc = (dcraw =... | [
"0.62535626",
"0.5907619",
"0.5831231",
"0.5799073",
"0.5721515",
"0.5697222",
"0.5600264",
"0.55790925",
"0.5566156",
"0.55361205",
"0.5532884",
"0.5517464",
"0.5463512",
"0.54572666",
"0.54459846",
"0.54372394",
"0.54371566",
"0.5433425",
"0.54006225",
"0.5318344",
"0.52979... | 0.0 | -1 |
Override the directory where uploaded files will be stored. | def store_dir
File.join(OpenInvoice.config.dir_prefix,
model.class.to_s.underscore,
mounted_as.to_s,
model&.id.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_dir\n 'file_uploads'\n end",
"def store_dir\n 'uploads'\n end",
"def store_dir\n \"uploads\"\n end",
"def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end",
"def store_dir\n \"uploads/\"\n ... | [
"0.7992477",
"0.7737353",
"0.7732477",
"0.7637168",
"0.75621146",
"0.75621146",
"0.75621146",
"0.74223",
"0.73538774",
"0.7319404",
"0.731887",
"0.7304938",
"0.7282087",
"0.72789246",
"0.7272874",
"0.7265028",
"0.72640795",
"0.7233383",
"0.7220581",
"0.72188616",
"0.72019714"... | 0.0 | -1 |
If you have extra params to permit, append them to the sanitizer. | def configure_sign_up_params
devise_parameter_sanitizer
.permit(:sign_up,
keys:
%i[first_name
last_name
affiliation
training_status_id
timezone])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat... | [
"0.6905034",
"0.683687",
"0.68280804",
"0.67889357",
"0.6674015",
"0.66522104",
"0.66448265",
"0.6595933",
"0.65606564",
"0.64921725",
"0.6489163",
"0.64781183",
"0.64483696",
"0.64394945",
"0.6419598",
"0.6419251",
"0.63999707",
"0.63977224",
"0.63977224",
"0.63934815",
"0.6... | 0.0 | -1 |
If you have extra params to permit, append them to the sanitizer. | def configure_account_update_params
devise_parameter_sanitizer
.permit(:account_update,
keys:
%i[first_name
last_name
affiliation
training_status_id
timezone])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat... | [
"0.6905034",
"0.683687",
"0.68280804",
"0.67889357",
"0.6674015",
"0.66522104",
"0.66448265",
"0.6595933",
"0.65606564",
"0.64921725",
"0.6489163",
"0.64781183",
"0.64483696",
"0.64394945",
"0.6419598",
"0.6419251",
"0.63999707",
"0.63977224",
"0.63977224",
"0.63934815",
"0.6... | 0.0 | -1 |
The path used after sign up. | def after_sign_up_path_for(_resource)
new_participant_session_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n root? ? boot_path : user_path\n end",
"def path\n root? ? boot_path : user_path\n end",
"def client_signed_up_path\n path_from_cookie(:after_account_signed_up_path) || path_from_cookie(:after_client_signed_up_path) || edit_user_client_path(current_user)\n end",
"def after_sign_... | [
"0.74486095",
"0.74486095",
"0.7348926",
"0.72428125",
"0.71978325",
"0.7191859",
"0.71229225",
"0.71229225",
"0.7114739",
"0.7110063",
"0.71050537",
"0.70890594",
"0.7078605",
"0.70710707",
"0.7039824",
"0.69836",
"0.69836",
"0.69836",
"0.69836",
"0.69687116",
"0.69687116",
... | 0.6849449 | 43 |
The path used after sign up for inactive accounts. | def after_inactive_sign_up_path_for(_resource)
new_participant_session_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_inactive_sign_up_path_for(resource)\n respond_to?(:root_path) ? root_path : \"/\"\n end",
"def after_inactive_sign_up_path_for(resource)\n respond_to?(:root_path) ? root_path : \"/\"\n end",
"def after_inactive_sign_up_path_for(resource)\n respond_to?(:root_path) ? root_path : \"/\"\n ... | [
"0.7342214",
"0.7208575",
"0.7208575",
"0.7208575",
"0.7208575",
"0.7208575",
"0.72034144",
"0.7187855",
"0.71851933",
"0.71851933",
"0.7151745",
"0.7103472",
"0.7103472",
"0.71002626",
"0.71002626",
"0.7090088",
"0.70668596",
"0.70622385",
"0.70227474",
"0.701897",
"0.699565... | 0.6970644 | 37 |
Overrides Orders are meant to be accessed primarily via their id_in_frame. However, new orders don't have one yet, so they use their regular ID. | def to_param
new? ? id.to_s : id_in_frame.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id\n order_id\n end",
"def order_id\n hash[\"OrderId\"]\n end",
"def order_id\n order.global_e_id\n end",
"def create_order_id\n self.order_id = \"GO%.5d\" % self.id\n self.save\n end",
"def order(order_id)\n Order.find(order_id)\n end",
"def order_sessi... | [
"0.67949516",
"0.62817144",
"0.62165296",
"0.5949988",
"0.58880806",
"0.58215094",
"0.57628393",
"0.5756385",
"0.5747902",
"0.5738798",
"0.57383823",
"0.5669893",
"0.56577194",
"0.56545085",
"0.56316566",
"0.56263834",
"0.5625813",
"0.55906886",
"0.55806655",
"0.5575158",
"0.... | 0.0 | -1 |
Methods Manage a "courtesy" ID column that is set only for nonnew orders and only looks at other orders in the frame. | def set_id_in_frame!
last_in_frame = Order.where( "orders.frame_id = ? AND orders.id_in_frame IS NOT NULL", frame.id )
.order( "orders.id_in_frame DESC" )
.first
if last_in_frame
self.id_in_frame = last_in_frame.id_in_frame + 1
save
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount_id=(val, no_dirty = false)\n self.id = val\n end",
"def court_id\n court.id\n end",
"def id\n @__candy_id\n end",
"def draw_id(col)\n _draw_head(col){ @f.text_field('_id', @options[:default][:integer]) }\n end",
"def quoted_id\n id\n end",
"def id_... | [
"0.56083894",
"0.5470486",
"0.5341422",
"0.5134629",
"0.50743765",
"0.5069919",
"0.5057505",
"0.50451213",
"0.5036416",
"0.5036095",
"0.5020175",
"0.49596474",
"0.4936369",
"0.4930911",
"0.4928647",
"0.4920416",
"0.4910654",
"0.4900409",
"0.48972127",
"0.48969314",
"0.4890319... | 0.45506564 | 80 |
Used primarily by the LineItemsController. Initializes and return a new line item in the order using a variant ID. | def line_item_from( variant_id = nil, options = {} )
variant_id ? initialize_line_item_with_variant( variant_id, options ) : line_items.build
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_line_item_with_variant( variant_id, options = {} )\n init_quantity = options[ :quantity ].to_i\n init_quantity = 1 if init_quantity == 0\n \n duplicate_line_item = line_items.where( variant_id: variant_id ).first\n duplicate_line_item.quantity += init_quantity and return dup... | [
"0.7956922",
"0.7572079",
"0.72996736",
"0.7288382",
"0.7209194",
"0.7201288",
"0.710304",
"0.70820415",
"0.69560885",
"0.6947975",
"0.6947975",
"0.6947975",
"0.6947975",
"0.6947975",
"0.6947975",
"0.6947975",
"0.6947975",
"0.6947975",
"0.6947975",
"0.6947975",
"0.6947975",
... | 0.81711084 | 0 |
Return the order total before any adjustments have been calculated for itself or its line items. | def unadjusted_total
total = Money.new( 0, 'USD' )
for line_item in line_items
total += ( line_item.price * line_item.quantity )
end
total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_items_total\n\t\ttotal = 0\n\t\tfor item in self.order_line_items\n\t\t\ttotal += item.total\n\t\tend\n\t\treturn total\n\tend",
"def total\n @total = items.inject(0.0) { |sum, order_line_item| sum + order_line_item.subtotal }\n end",
"def grand_total\n order_lines.inject(Money.new(0)) { |grand... | [
"0.74958",
"0.7371352",
"0.7288684",
"0.7130508",
"0.7095148",
"0.70064706",
"0.6929264",
"0.68537164",
"0.6812021",
"0.68075955",
"0.67960995",
"0.67763126",
"0.6744063",
"0.67438364",
"0.672085",
"0.67094165",
"0.67094165",
"0.6700973",
"0.669863",
"0.66950035",
"0.6694626"... | 0.71377695 | 3 |
Return the final order total after line item prices have been calculated and adjustments have been made. | def adjusted_total
total = unadjusted_total
for adjustment in adjustments
total += adjustment.amount
end
total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total\n @total = items.inject(0.0) { |sum, order_line_item| sum + order_line_item.subtotal }\n end",
"def grand_total\n order_lines.inject(Money.new(0)) { |grand_total, line| grand_total + line.total_price }\n end",
"def total\n total = 0\n line_items.each do |line_item|\n total += line_... | [
"0.7568527",
"0.73170614",
"0.7316968",
"0.7301357",
"0.7288709",
"0.7278199",
"0.7275994",
"0.7254818",
"0.7206659",
"0.7177765",
"0.71408963",
"0.71311474",
"0.71141595",
"0.7103999",
"0.7095674",
"0.7066325",
"0.70491034",
"0.70186085",
"0.70180464",
"0.7012945",
"0.699155... | 0.6459604 | 88 |
Determine what proportion of an order's line items are fulfilled. | def fulfillment_status
return "Not Fulfilled" if line_items.fulfilled.count == 0
return "Fulfilled" if line_items.fulfilled.count == line_items.count
return "Partially Fulfilled" if line_items.fulfilled.count < line_items.count and line_items.fulfilled.count != 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_portions(order)\n amount = order.total.to_f\n ret = []\n\n portions_number = preferred_max_portion\n minimum_value = preferred_minimum_value.to_f\n tax = preferred_tax_value.to_f\n\n ret.push({portion: 1, value: amount, total: amount, tax_message: :komerci_without_tax})\n\n (2..p... | [
"0.6698248",
"0.6555982",
"0.6514486",
"0.6483914",
"0.64166206",
"0.62880844",
"0.622708",
"0.622708",
"0.62254924",
"0.61997503",
"0.61997503",
"0.6158301",
"0.6107431",
"0.60840446",
"0.6063885",
"0.6047493",
"0.60331374",
"0.60198957",
"0.6018002",
"0.601403",
"0.6013654"... | 0.56751794 | 54 |
Determine if an order has any promotions applied. | def has_promotion?
adjustments.where( promotion: true ).any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkout_promotions?\n !checkout_promotions.empty?\n end",
"def pending_promotions?\n !pending_promotions.empty?\n end",
"def existing_promotions?\n !existing_promotions.empty?\n end",
"def related_promotions?\n !related_promotions.empty?\n end",
"def new_promotions?\n !new_p... | [
"0.7392296",
"0.7307061",
"0.72911745",
"0.72586495",
"0.67289346",
"0.6726907",
"0.6531957",
"0.62708575",
"0.61976445",
"0.618791",
"0.6045194",
"0.60414135",
"0.5941229",
"0.5876451",
"0.5874335",
"0.58200634",
"0.5811742",
"0.5797002",
"0.57712907",
"0.5769374",
"0.576305... | 0.629863 | 7 |
Applies a promotion by creating an adjustment of the proper class on itself and flagging it as a promotion. | def apply_promotion( promotion )
unless has_promotion?
promotion.adjustment_class.create! adjustable: self,
basis: promotion.discount_amount,
message: "Promotional Code: #{ promotion.promotional_code }",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promotion\r\n\r\n end",
"def promotion\n @promotion ||= Interface::Promotion.new(self)\n end",
"def promotion(class_name)\n unless needs_promotion? && [\"rook\", \"knight\", \"elephant\", \"queen\"].include?(class_name.downcase)\n raise InvalidMove, \"Invalid promotion\"\n end\n ... | [
"0.6704332",
"0.641314",
"0.628012",
"0.6085586",
"0.5777705",
"0.5644645",
"0.56440985",
"0.561742",
"0.55813926",
"0.5494941",
"0.54920167",
"0.5474532",
"0.5424936",
"0.5418358",
"0.5313003",
"0.52915365",
"0.5289525",
"0.52494097",
"0.52116877",
"0.5163233",
"0.51599586",... | 0.81216705 | 0 |
Returns all its promotions. | def promotions
adjustments.where( promotion: true )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def promotions\n @promotions ||= order.promotions\n end",
"def existing_promotions\n @existing_promotions ||= []\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @promotions = Promotion.all\n end",
"def index\n @... | [
"0.78533703",
"0.6840263",
"0.6815064",
"0.6815064",
"0.6815064",
"0.6709071",
"0.6668357",
"0.6655454",
"0.6601557",
"0.65350753",
"0.6320788",
"0.6043383",
"0.5991691",
"0.5972723",
"0.5947137",
"0.59167033",
"0.588912",
"0.5863941",
"0.5845197",
"0.58089185",
"0.5750651",
... | 0.6160634 | 11 |
Address Management If an address exists with all the same attributes as an existing address, we should use that address instead. | def shipping_address=( address )
return unless address and address.is_a? Address
duplicate_address = Address.where( frame_id: address.frame_id,
first_name: address.first_name,
last_name: address.last_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_or_create_address(attributes)\n if attributes[:id]\n # TODO: Delete this part of the IF? It never gets called during tests.\n address = Spree::Address.find(attributes[:id])\n if address.editable?\n address.update_attributes(attributes)\n else\n address.errors.add(:ba... | [
"0.7017732",
"0.6637837",
"0.65274733",
"0.651827",
"0.6508721",
"0.65018487",
"0.6475662",
"0.6455287",
"0.64304435",
"0.6416431",
"0.6407937",
"0.64034057",
"0.6402577",
"0.6363181",
"0.63495904",
"0.6333944",
"0.6302127",
"0.6301888",
"0.6278651",
"0.62742674",
"0.6258201"... | 0.6587167 | 2 |
If an address exists with all the same attributes as an existing address, we should use that address instead. | def billing_address=( address )
return unless address and address.is_a? Address
duplicate_address = Address.where( frame_id: address.frame_id,
first_name: address.first_name,
last_name: address.last_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_or_create_address(attributes)\n if attributes[:id]\n # TODO: Delete this part of the IF? It never gets called during tests.\n address = Spree::Address.find(attributes[:id])\n if address.editable?\n address.update_attributes(attributes)\n else\n address.errors.add(:ba... | [
"0.65272504",
"0.64184654",
"0.6378798",
"0.63389236",
"0.6271138",
"0.62600446",
"0.6223868",
"0.62071526",
"0.61727554",
"0.6124529",
"0.61161524",
"0.60845673",
"0.6025901",
"0.60026056",
"0.5974503",
"0.5964362",
"0.5962311",
"0.5937293",
"0.59242",
"0.5916076",
"0.590348... | 0.6241191 | 6 |
Check if a line item already exists with the given variant ID. If so, just return that line item with an incremented quantity. Otherwise, initialize a new one. | def initialize_line_item_with_variant( variant_id, options = {} )
init_quantity = options[ :quantity ].to_i
init_quantity = 1 if init_quantity == 0
duplicate_line_item = line_items.where( variant_id: variant_id ).first
duplicate_line_item.quantity += init_quantity and return duplicate_lin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_line_item_to_order( variant )\n duplicate_line_item = line_item_exists?( variant )\n duplicate_line_item.quantity += 1 and return duplicate_line_item if duplicate_line_item\n\n line_items.build :name => variant.good.name, \n :price => variant.price, \n ... | [
"0.7707809",
"0.7059313",
"0.7055946",
"0.7034018",
"0.6949188",
"0.67314506",
"0.66733956",
"0.66467446",
"0.6620043",
"0.65791",
"0.654865",
"0.6490187",
"0.64767736",
"0.6471539",
"0.6462321",
"0.64147973",
"0.6335487",
"0.63214517",
"0.62999815",
"0.62763005",
"0.6220725"... | 0.81455594 | 0 |
Find or create a patron based on their EMail, and associate any order addresses with that patron. | def associate_patron
self.patron = Patron.find_or_create_by_email( email: email,
first_name: billing_address.first_name,
last_name: billing_address.last_name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_author_emails(people)\n people.each do |person|\n user = User.find_or_initialize_by(email: person[:email])\n user.save(validate: false) if user.new_record?\n record = AuthorPublication.find_or_initialize_by(email: person[:email], publication: self)\n record.attributes = person\n ... | [
"0.5619655",
"0.54527867",
"0.5371033",
"0.5320014",
"0.53019863",
"0.5226146",
"0.4972188",
"0.49659637",
"0.49659637",
"0.49487448",
"0.48987818",
"0.48888108",
"0.4882063",
"0.48783666",
"0.48781106",
"0.48771924",
"0.48616022",
"0.4832556",
"0.482928",
"0.48121163",
"0.48... | 0.75591433 | 0 |
Set the completed at time to the current time. | def set_completed_at_time
self.update_attributes completed_at: Time.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_completed_at\n self.completed_at = self.completed? ? Time.now.utc : nil\n end",
"def complete!\n @completed_at = Time.now\n end",
"def complete!\n @completed_at = Time.now\n end",
"def completed_date_time=(value)\n @completed_date_time = value\n end",
"... | [
"0.7974058",
"0.79678065",
"0.79678065",
"0.7703861",
"0.7703861",
"0.7703861",
"0.7703861",
"0.7703861",
"0.7703861",
"0.7533986",
"0.7501009",
"0.72039366",
"0.71959436",
"0.7137605",
"0.71262693",
"0.70383626",
"0.6975183",
"0.6949994",
"0.6949994",
"0.6920126",
"0.6920126... | 0.78025407 | 3 |
allows for use of SSE and concurrency (web socket) | def watrcoolr
@room = Room.find(params[:id])
@user_id = current_user.id.to_i
@messages = Message.where(room_id: @room.id)
@text_message = Message.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def msc2108_sync_sse(since: nil, **params, &on_data)\n raise ArgumentError, 'Must be given a block accepting two args - data and { event:, id: }' \\\n unless on_data.is_a?(Proc) && on_data.arity == 2\n raise 'Needs to be logged in' unless access_token # TODO: Better error\n\n query = params.select do... | [
"0.6948373",
"0.6540925",
"0.6493499",
"0.6395683",
"0.6304674",
"0.6304674",
"0.62337184",
"0.6173673",
"0.61477333",
"0.6116942",
"0.61160773",
"0.6044642",
"0.60159016",
"0.59995484",
"0.5965227",
"0.5951625",
"0.59022194",
"0.58602095",
"0.5837696",
"0.5831021",
"0.583102... | 0.0 | -1 |
Controls all redis subscriptions to each room | def events
response.headers['Content-Type'] = 'text/event-stream' # Starts a Redis event stream (thread)
room_id = params[:room_id]
sse = Streamer::SSE.new(response.stream) # Opens server sent event stream
redis ||= Redis.new # If the user doesn't already have a thread open, creates a new redis thread
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions\n @subscriptions ||= {}\n end",
"def subscriptions!\n @subscriptions = nil\n subscriptions\n end",
"def subscriptions\n @subscriptions ||= get_roster || {}\n end",
"def subsc... | [
"0.66915524",
"0.66915524",
"0.66915524",
"0.6548931",
"0.6483515",
"0.6397292",
"0.639275",
"0.6280451",
"0.6177043",
"0.5993686",
"0.5984107",
"0.593667",
"0.589866",
"0.58610886",
"0.58581024",
"0.58341885",
"0.5728367",
"0.5722104",
"0.56863576",
"0.56301415",
"0.5599303"... | 0.5779398 | 16 |
This method is automatically when the user goes to the signup page. It creates a global variable to be populated by the form in the corresponding view. The data is validated and written to the database in the create method. | def new
@user = User.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user_signup = User.new\n @is_signup = true\n end",
"def signup\n @user = User.new\n end",
"def signup\n @user = User.new\n end",
"def signup!(params)\n self.email = params[:user][:email]\n self.name = params[:user][:name]\n self.password = params[:user][:password]\n ... | [
"0.7020483",
"0.69643",
"0.69643",
"0.6923224",
"0.6896394",
"0.68808305",
"0.68610764",
"0.68543476",
"0.68543476",
"0.68490016",
"0.68451273",
"0.68451273",
"0.6814716",
"0.6808725",
"0.6740331",
"0.67364246",
"0.67212194",
"0.67191064",
"0.666785",
"0.6665614",
"0.6640689"... | 0.0 | -1 |
sql = <<SQL SELECT genres.name FROM genres INNER JOIN directors_genres ON genres.id = directors_genres.genre_id WHERE directors.id = ? SQL DB[:conn].exedcute(sql, self.id) | def initialize(attributes = {})
self.class.set_attrb_accessors
#cheeto = Student.new(name: "cheeto", grade: 6)
attributes.each do |property, value|
#interpolation converts symbol to string
self.send("#{property}=", value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_name_and_series_subgenres_of_authors\n \"SELECT authors.name, subgenres.name FROM authors INNER JOIN series ON authors.id=series.author_id INNER JOIN subgenres ON series.subgenre_id = subgenres.id; \"\nend",
"def select_name_and_series_subgenres_of_authors\n \"SELECT authors.name, subgenres.name\n ... | [
"0.7128247",
"0.70078576",
"0.68874556",
"0.6807115",
"0.6789032",
"0.67292774",
"0.6725658",
"0.67176974",
"0.6686305",
"0.6667907",
"0.6597873",
"0.6581816",
"0.6555537",
"0.65465534",
"0.6528302",
"0.65027183",
"0.6492859",
"0.64925855",
"0.64792657",
"0.6468569",
"0.64208... | 0.0 | -1 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Update Transfer Origin Rectangle ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def update_src_rect
@sap_frame_count %= @sap_time_interval
if @sap_frame_count == 0
@sap_current_frame += 1
@sap_current_frame = 0 if self.bitmap.width < (@sap_current_frame + 1)*@sap_frame_width
sx = @sap_current_frame*@sap_frame_width
self.src_rect.set(sx, 0, @sap_frame_width, self.bit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_origin\n if bitmap\n unless @battler && @battler.data_battler.use_sprite\n self.ox = bitmap.width / 2\n self.oy = bitmap.height / 2\n else\n if @anim_cell != @battler.anim_cell\n @anim_cell = @battler.anim_cell\n src_rect.y = (@anim_cell / MaxCol) * he... | [
"0.6054942",
"0.6007603",
"0.59135604",
"0.5874379",
"0.58735293",
"0.58688813",
"0.58674455",
"0.58583593",
"0.5856621",
"0.5856621",
"0.58171666",
"0.58017987",
"0.5773113",
"0.5748314",
"0.5735442",
"0.5727943",
"0.57109904",
"0.5671046",
"0.5667391",
"0.5640481",
"0.55920... | 0.0 | -1 |
GET /generators GET /generators.json | def index
@generators = Generator.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @generator = Generator.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generator }\n end\n end",
"def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json ... | [
"0.7455515",
"0.7041137",
"0.6979071",
"0.6938136",
"0.6772317",
"0.67200524",
"0.6637946",
"0.6597043",
"0.6423016",
"0.6423016",
"0.6396585",
"0.62145597",
"0.61641365",
"0.61641365",
"0.61556405",
"0.6153433",
"0.6098253",
"0.607357",
"0.6068736",
"0.59986216",
"0.5953093"... | 0.6905038 | 4 |
GET /generators/1 GET /generators/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @generator = Generator.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @generator }\n end\n end",
"def show\n @generator = Generator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json ... | [
"0.7322083",
"0.73209894",
"0.7038852",
"0.70345974",
"0.68313503",
"0.67126906",
"0.6676029",
"0.6643071",
"0.644232",
"0.64024854",
"0.6335321",
"0.6331268",
"0.63232964",
"0.62905383",
"0.616887",
"0.61465013",
"0.61463755",
"0.6112881",
"0.60979664",
"0.6039964",
"0.60367... | 0.0 | -1 |
POST /generators POST /generators.json | def create
@generator = Generator.new(generator_params)
respond_to do |format|
if @generator.save
format.html { redirect_to @generator, notice: 'Generator was successfully created.' }
format.json { render :show, status: :created, location: @generator }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @generator = Generator.new(params[:generator])\n \n respond_to do |format|\n if @generator.save\n format.html { redirect_to admin_generator_path(@generator.id), notice: 'Generator was successfully created.' }\n format.json { render json: @generator, status: :created, location... | [
"0.70615095",
"0.66491866",
"0.6526719",
"0.63337255",
"0.6301588",
"0.6294546",
"0.6290464",
"0.6260779",
"0.6209358",
"0.60677654",
"0.60257536",
"0.6001833",
"0.59646964",
"0.59415203",
"0.5849518",
"0.58194095",
"0.5799598",
"0.5775631",
"0.57423216",
"0.57273674",
"0.569... | 0.7167161 | 0 |
PATCH/PUT /generators/1 PATCH/PUT /generators/1.json | def update
respond_to do |format|
if @generator.update(generator_params)
format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }
format.json { render :show, status: :ok, location: @generator }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @generator.update(generator_params)\n format.html { redirect_to @generator, notice: 'Generator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json... | [
"0.6732239",
"0.64605105",
"0.63801134",
"0.6203367",
"0.6203367",
"0.61379987",
"0.6036752",
"0.60334575",
"0.60291827",
"0.6022369",
"0.5981247",
"0.5968595",
"0.59233975",
"0.58993495",
"0.58528507",
"0.5851852",
"0.58489555",
"0.58475393",
"0.5826299",
"0.58229184",
"0.57... | 0.6580757 | 2 |
DELETE /generators/1 DELETE /generators/1.json | def destroy
@generator.destroy
respond_to do |format|
format.html { redirect_to generators_url, notice: 'Generator was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n Generator.where(id: params[:id] ).first.destroy\n respond_to do |format|\n format.html { redirect_to generators_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_generator = SmallGenerator.find(params[:id])\n @small_generator.destroy\n\n respo... | [
"0.7819657",
"0.7262334",
"0.7163828",
"0.6997897",
"0.68873066",
"0.6766238",
"0.666771",
"0.663755",
"0.66305447",
"0.6629966",
"0.64833575",
"0.6453325",
"0.64383596",
"0.6299671",
"0.6282557",
"0.6271074",
"0.62688506",
"0.62688506",
"0.62688506",
"0.62688506",
"0.6265384... | 0.7489204 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_generator
@generator = Generator.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def generator_params
params.require(:generator).permit(:userid, :guid, :csvfile, :csvcount, :processedcount, :status)
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 |
Formats a run backtrace. | def format_backtrace(backtrace)
safe_join(backtrace.to_a, tag.br)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_trace(args)\n if args.size > 1 && args.first.is_a?(String)\n format(\"%s: %p\\n\", args.shift, args.size == 1 ? args.first : args)\n elsif args.size == 1 && args.first.is_a?(String)\n \"#{args.first}\\n\"\n else\n format(\"%p\\n\", args.size == 1 ? args.first : args)\n end\n ... | [
"0.68225694",
"0.6501836",
"0.64702475",
"0.64094925",
"0.63059133",
"0.61692935",
"0.6158257",
"0.61405563",
"0.6117733",
"0.6084746",
"0.60174257",
"0.601125",
"0.599812",
"0.59928125",
"0.5989147",
"0.598891",
"0.5953739",
"0.5917492",
"0.591664",
"0.58812326",
"0.5815623"... | 0.69660276 | 0 |
Renders the progress bar. The style of the progress tag depends on the Run status. It also renders an infinite progress when a Run is active but there is no total information to estimate completion. | def progress(run)
return unless run.started?
progress = Progress.new(run)
progress_bar = tag.progress(
value: progress.value,
max: progress.max,
class: ["progress"] + STATUS_COLOURS.fetch(run.status)
)
progress_text = tag.p(tag.i(progress.text))
tag.div(prog... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_progress passed, total\n\t\n\t\ts = '<div class=\"progress bar\">';\n\t\t(passed).times do\n\t\t\ts << '<span class=\"p\"></span>'\n\t\tend\n\t\ts<< '<span class=\"c\"></span>'\n\t\t(total-passed-1).times do\n\t\t\ts << '<span class=\"r\"></span>'\n\t\tend\n\t\ts << '</div>'\n\t\t\n\t\treturn s.html_saf... | [
"0.7461783",
"0.69544053",
"0.688662",
"0.68202996",
"0.68042976",
"0.65752476",
"0.65550625",
"0.6418837",
"0.63812983",
"0.63589776",
"0.632455",
"0.62929326",
"0.6226677",
"0.6218346",
"0.61670387",
"0.6124396",
"0.6106991",
"0.6106991",
"0.6106991",
"0.6106991",
"0.610699... | 0.8170109 | 0 |
Renders a span with a Run's status, with the corresponding tag class attached. | def status_tag(status)
tag.span(status.capitalize, class: ["tag"] + STATUS_COLOURS.fetch(status))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status (job)\n content_tag :span, :class => (case job.status when 1 then 'label label-important' when 2 then 'label label-success' when 3 then 'label' end) do\n case job.status\n when 1 \n 'No Publicado'\n when 2\n 'Publicado'\n when 3\n 'Finalizado'\n ... | [
"0.65018797",
"0.63620996",
"0.6356431",
"0.6300268",
"0.6270848",
"0.6215139",
"0.6132809",
"0.611195",
"0.606529",
"0.60170084",
"0.6016505",
"0.59839636",
"0.59839636",
"0.5957019",
"0.59354496",
"0.59229416",
"0.59053254",
"0.58869773",
"0.58722",
"0.5773967",
"0.57133394... | 0.65818095 | 0 |
Reports the approximate elapsed time a Run has been processed so far based on the Run's time running attribute. | def time_running_in_words(run)
distance_of_time_in_words(0, run.time_running, include_seconds: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_run_time\n if self.end_time \n return run_time_or_time_elapsed.gmtime.strftime('%R:%S')\n else\n return \"Run has not completed.\"\n end\n end",
"def pdf_total_time\n runs.sum(:finish)\n end",
"def running_time\n rt = @item_attributes.first.running... | [
"0.72039753",
"0.6963172",
"0.69374096",
"0.688605",
"0.68852454",
"0.6814038",
"0.6776618",
"0.6666455",
"0.666339",
"0.6648048",
"0.65172684",
"0.6513557",
"0.6488483",
"0.648435",
"0.6466703",
"0.6449927",
"0.63818014",
"0.6349536",
"0.63481504",
"0.6332615",
"0.6323517",
... | 0.6774636 | 7 |
Very simple syntax highlighter based on Ripper. It returns the same code except identifiers, keywords, etc. are wrapped in ++ tags with CSS classes that match the types returned by Ripper.lex. | def highlight_code(code)
tokens = Ripper.lex(code).map do |(_position, type, content, _state)|
case type
when :on_nl, :on_sp, :on_ignored_nl
content
else
tag.span(content, class: type.to_s.sub("on_", "ruby-").dasherize)
end
end
safe_join(tokens)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def syntax_highlight(html)\n line_numbers = config.line_numbers ? :table : nil\n opts = { css: :style, wrap: nil, line_numbers: line_numbers }\n html.gsub(/\\<code class=\"(.+?)\"\\>(.+?)\\<\\/code\\>/m) do\n lang, code = $1, $2\n code = CGI.unescapeHTML code\n CodeRay.scan(code... | [
"0.699717",
"0.69504726",
"0.6930942",
"0.6930942",
"0.6866836",
"0.68459076",
"0.68197757",
"0.6790417",
"0.67823285",
"0.6748583",
"0.6748583",
"0.66396815",
"0.66249585",
"0.66000396",
"0.6553321",
"0.6468966",
"0.6455698",
"0.64519924",
"0.6430365",
"0.6430365",
"0.643036... | 0.6800074 | 7 |
Returns a download link for a Run's CSV attachment | def csv_file_download_path(run)
Rails.application.routes.url_helpers.rails_blob_path(
run.csv_file,
only_path: true
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def csv_download\n @stats = Hyrax::WorkUsage.new(params[:id])\n filename = params[:id] + \"_stats.csv\"\n #This is an example that worked\n #send_data @stats.to_csv, :type => 'text/csv; charset=utf-8; header=present', :disposition => 'attachment; filename=payments.csv'\n target = \"attachm... | [
"0.68700236",
"0.66382295",
"0.64307505",
"0.64079285",
"0.6366441",
"0.6366441",
"0.635658",
"0.63477814",
"0.63039523",
"0.62340426",
"0.6212901",
"0.61795074",
"0.6164873",
"0.61484903",
"0.6142208",
"0.6141911",
"0.6084005",
"0.6073725",
"0.606821",
"0.6055135",
"0.603166... | 0.799031 | 0 |
Returns a new empty DirectedAdjacencyGraph which has as its edgelist class the given class. The default edgelist class is Set, to ensure set semantics for edges and vertices. If other graphs are passed as parameters their vertices and edges are added to the new graph. | def initialize
@forward_edges_with_info = IdentityHash.new
@backward_edges = IdentityHash.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize (edgelist_class = Set, *other_graphs)\n @edgelist_class = edgelist_class\n @vertice_dict = Hash.new\n other_graphs.each do |g|\n g.each_vertex {|v| add_vertex v}\n g.each_edge {|v,w| add_edge v,w}\n end\n end",
"def to_undirected\n return self unless dir... | [
"0.6266138",
"0.58922213",
"0.57299596",
"0.5457611",
"0.5309364",
"0.5280825",
"0.5237097",
"0.5233478",
"0.522407",
"0.51377594",
"0.51248956",
"0.5006858",
"0.500615",
"0.49696043",
"0.49679697",
"0.4961475",
"0.492827",
"0.49018106",
"0.4900231",
"0.48875594",
"0.4884805"... | 0.0 | -1 |
Make sure that self and source share identical hashes when possible | def dedupe(source)
all_identical = (@forward_edges_with_info.size ==
source.forward_edges_with_info.size)
# Use #keys.each instead of #each_key as we are modifying in-place
@forward_edges_with_info.keys.each do |v| # rubocop:disable Style/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ (target.hash+1); end",
"def hash() source.hash ^ target.hash; end",
"def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end",
"def hash\n source.hash ^ target.hash\n end",
"def rehash... | [
"0.71032256",
"0.71032256",
"0.68983597",
"0.6835631",
"0.6722684",
"0.61322457",
"0.6087233",
"0.60591877",
"0.6041",
"0.6041",
"0.6041",
"0.6041",
"0.6041",
"0.6041",
"0.6041",
"0.5991329",
"0.5929631",
"0.59276235",
"0.59141314",
"0.59037125",
"0.5882863",
"0.58774596",
... | 0.5637646 | 35 |
Iterator for the keys of the vertices list hash. | def each_vertex(&b)
@forward_edges_with_info.each_key(&b)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keys\n keys = []\n each_pair {|k,v| keys << k}\n keys\n end",
"def keys\n @hash.keys\n end",
"def keys\n @hash.keys\n end",
"def keys\n @hash.keys\n end",
"def vertices\n @vertices.keys\n end",
"def keys\n @hash.keys\n end",
"def keys\... | [
"0.7049629",
"0.6918649",
"0.6918649",
"0.6918649",
"0.69149166",
"0.68999296",
"0.68999296",
"0.68902147",
"0.68647134",
"0.6827542",
"0.6793419",
"0.6786765",
"0.6770501",
"0.67507696",
"0.6742906",
"0.67130697",
"0.670038",
"0.66888756",
"0.66054845",
"0.65710187",
"0.6550... | 0.6162234 | 46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.