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 |
|---|---|---|---|---|---|---|
Return all query keywords, such as DEFE, win, D:22 | def keywords
my_nodes_tagged(:querykeywordexpr)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keyword_query_string\n processed_terms = []\n self.search_terms.each do |search_val|\n # spaces or dashes (-) need to be quoted to be treated as single values\n term = search_val.match?(/[\\s-]/) ? \"\\\"#{search_val}\\\"\" : search_val\n processed_terms << term\n end\n processed_ter... | [
"0.70299137",
"0.68532974",
"0.67525566",
"0.67525566",
"0.6749294",
"0.65981364",
"0.6568399",
"0.6500182",
"0.64452523",
"0.6383042",
"0.63823557",
"0.63120294",
"0.6305623",
"0.62751216",
"0.62612396",
"0.6243464",
"0.6238134",
"0.6209284",
"0.61792314",
"0.61675704",
"0.6... | 0.6991753 | 2 |
Returns a node's text, or nil if the node is nil | def node_text(node)
node && node.text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_text(node)\n return nil if node.nil?\n\n return node.text()\n end",
"def node_text(node)\n return nil if node.nil?\n \n return node.text()\n end",
"def get_text_node(node)\n text = nil\n\n if node and node.text\n text = node.text\n end\n\n text\nend",
"def text\... | [
"0.9071618",
"0.90230465",
"0.8662516",
"0.78896016",
"0.7672712",
"0.76587826",
"0.7609525",
"0.7609525",
"0.73861647",
"0.7325594",
"0.72782296",
"0.7179193",
"0.7168946",
"0.7126829",
"0.70903397",
"0.6922646",
"0.6905112",
"0.6791553",
"0.67553055",
"0.6740246",
"0.673813... | 0.86895865 | 2 |
Returns the first node with the given tag in this query, i.e. not in subqueries. | def my_node_tagged(tag, options={})
my_nodes_tagged(tag, options)[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_nodes_tagged(tag, options={})\n options = options.dup\n options[:exclude_descent] = :subquery\n nodes_tagged(tag, options)\n end",
"def my_nodes_tagged(tag, options={})\n options = options.dup\n options[:exclude_descent] = :subquery\n nodes_tagged(tag, options)\n end",
... | [
"0.63370275",
"0.63370275",
"0.5885409",
"0.5885409",
"0.5456442",
"0.5376499",
"0.5376499",
"0.53358734",
"0.53358734",
"0.5216276",
"0.5156044",
"0.51366025",
"0.50535214",
"0.5034842",
"0.5029129",
"0.50189734",
"0.50142235",
"0.49127403",
"0.4843005",
"0.4792815",
"0.4786... | 0.59585536 | 3 |
Returns all nodes with the given tag in this query, i.e. not in subqueres. | def my_nodes_tagged(tag, options={})
options = options.dup
options[:exclude_descent] = :subquery
nodes_tagged(tag, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes_tagged(tag, options={})\n found_nodes = []\n @elements.each do |e|\n if node_included?(e, options) && !node_excluded?(e, options)\n found_nodes << e if e.tag == tag\n unless options[:exclude_match] || node_descent_excluded?(e, options)\n found_nodes += e.node... | [
"0.62248397",
"0.62248397",
"0.57945865",
"0.56470203",
"0.53974617",
"0.53714526",
"0.5356897",
"0.52509505",
"0.5249747",
"0.5215177",
"0.51321",
"0.5120238",
"0.5090224",
"0.5051501",
"0.5003706",
"0.5002045",
"0.49710888",
"0.49710888",
"0.49430084",
"0.49381724",
"0.4917... | 0.65753335 | 1 |
Retrieves the first node with the given tag, searching recursively. | def node_tagged(tag, options={})
nodes_tagged(tag, options)[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find( tag = nil )\n tag = Tag.new( tag, Tag.WILDCARD_NS ) unless tag.nil? || tag.is_a?( Tag )\n if block_given?\n children.find do |c|\n c.element? && ( tag.nil? || c.tag == tag ) && yield( c )\n end\n else\n first_element( tag )\n end\n end",
"def my_node... | [
"0.7475323",
"0.68695",
"0.68695",
"0.6670553",
"0.6593235",
"0.65824914",
"0.6558489",
"0.6442515",
"0.64131135",
"0.6319523",
"0.62511283",
"0.6164414",
"0.6157338",
"0.6140582",
"0.6079157",
"0.6067083",
"0.60642546",
"0.6063643",
"0.6061781",
"0.605036",
"0.6050085",
"0... | 0.6918273 | 2 |
Retrieves all nodes with the given tag, searching recursively. | def nodes_tagged(tag, options={})
found_nodes = []
@elements.each do |e|
if node_included?(e, options) && !node_excluded?(e, options)
found_nodes << e if e.tag == tag
unless options[:exclude_match] || node_descent_excluded?(e, options)
found_nodes += e.nodes_tagged(ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nodes_by_tag(tag, includeme=true, options={})\n options = {\n :search_string => tag,\n :include_me => includeme,\n :order => [:tag],\n :safe_deref => nil,\n :current_node => nil,\n :one_or_all => :all\n }.merge(options)\n opsit_search(options)\n end",
"def retrieve... | [
"0.7331132",
"0.6544301",
"0.65160596",
"0.63503444",
"0.63503444",
"0.60367113",
"0.5985838",
"0.59410137",
"0.5894241",
"0.5891826",
"0.587635",
"0.58301014",
"0.58196646",
"0.5800264",
"0.5783298",
"0.5782457",
"0.5773003",
"0.57658124",
"0.57658124",
"0.576017",
"0.573954... | 0.7095399 | 2 |
def selected_city user user.present? ? (user.city.present? ? user.city.id : nil) : nil end | def country_options
Country.all.map{|country| [country.title, country.id]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_city\n @user_city = UserCity.find(params[:id])\n end",
"def set_mobile_user_city\n @mobile_user_city = MobileUserCity.find(params[:id])\n end",
"def set_city\n @city ||= City.find(params[:id])\n end",
"def current_city\n if @city \n @city.name\n elsif @in... | [
"0.73974663",
"0.6967483",
"0.6918816",
"0.6850684",
"0.68345046",
"0.6817359",
"0.6667367",
"0.6643792",
"0.66327184",
"0.66327184",
"0.66327184",
"0.66327184",
"0.66327184",
"0.66327184",
"0.66327184",
"0.65030295",
"0.65030295",
"0.65030295",
"0.65030295",
"0.65030295",
"0... | 0.0 | -1 |
The constructor, loading the configuration from the configuration file. | def initialize()
@config = YAML.load_file('config.yaml')
@puppetdb = @config['puppetdb']
@servicenow = @config['servicenoe']
@syslog = @config['syslog']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @config = config_from_file || empty_config\n end",
"def initialize\n create_config unless File.exists?(config_file)\n load_settings\n set_domain\n end",
"def initialize\n\n # Set some defaults\n self.auth_location = 'usa'\n self.use_service_net = 'false... | [
"0.87353575",
"0.8187456",
"0.79901135",
"0.7952765",
"0.79486454",
"0.79200023",
"0.7874495",
"0.7841211",
"0.7781696",
"0.77248156",
"0.77248156",
"0.76666695",
"0.7593994",
"0.7590698",
"0.7581305",
"0.75762516",
"0.75474805",
"0.745345",
"0.73699665",
"0.7342001",
"0.7309... | 0.7694158 | 11 |
validates :username, uniqueness: true Wasn't showing the flash message | def password
@password ||= Password.new(password_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def username_must_be_unique\n errors.add(:username, :taken) if username.present? && User.where(username: username).where.not(id: model.id).exists?\n end",
"def validate\n errors.add(:username, \"already exists.\") if Player.get_player(username) != nil\n end",
"def validate_username\n if User.where(e... | [
"0.8228003",
"0.79985535",
"0.78162265",
"0.78162265",
"0.7813665",
"0.7522129",
"0.7515132",
"0.7357766",
"0.71497214",
"0.7148102",
"0.7139465",
"0.71358544",
"0.70819736",
"0.6976689",
"0.69670385",
"0.6928848",
"0.6897571",
"0.6870565",
"0.68659014",
"0.6787865",
"0.67589... | 0.0 | -1 |
Methods Duplicate this Newsletter Bloc model. | def duplicate!(bloc_owner = self.newsletter)
duplicated_bloc = bloc_owner.blocs.build({
position: self.position,
type: self.type,
content: self.content
})
if self.image?
duplicated_bloc.remote_image_url = self.image.url
end
duplicated_bloc.save
duplicated_bloc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dup\n h = super\n h.fields = @fields.dup\n h.mbox_from = @mbox_from\n h\n end",
"def clone\n super\n end",
"def dup\n new_object = super\n new_object.send :initialize_attributes, @attributes\n new_object\n end",
"def clone\n super\n end",
"de... | [
"0.65293056",
"0.63637733",
"0.6269463",
"0.61977166",
"0.6107015",
"0.5965374",
"0.59424967",
"0.58976996",
"0.5881764",
"0.58602166",
"0.5830355",
"0.5791526",
"0.5751834",
"0.57057333",
"0.56782603",
"0.5676633",
"0.5675732",
"0.5628831",
"0.5617967",
"0.55954504",
"0.5576... | 0.5683318 | 14 |
Set the default position. | def set_default_position
if self.position.nil?
self.position = newsletter.blocs.count + 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_position\n self.position ||= (get_object_for_position_counter.count.to_i + 1)\n true\n end",
"def set_default_position\n if position.nil?\n self.position = (question.present? ? question.answers.count + 1 : 0)\n end\n end",
"def set_default_position\n if positio... | [
"0.76765585",
"0.74323374",
"0.7415341",
"0.70272887",
"0.6973073",
"0.69339484",
"0.6890234",
"0.6725265",
"0.6660718",
"0.6660718",
"0.6635383",
"0.65766793",
"0.65766793",
"0.65417874",
"0.6537612",
"0.6533438",
"0.6520982",
"0.65125716",
"0.6512221",
"0.6509937",
"0.64800... | 0.7562181 | 1 |
Initialize Deck class attributes. | def initialize(cards)
@cards = cards
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initalize\n @deck = Deck.new\n @player = Player.new\n @dealer = Dealer.new\n end",
"def init_deck\n @deck = Deck.new\nend",
"def initialize()\n @sides = DEFAULTS[:sides]\n @num_dice = DEFAULTS[:num_dice]\n @players = DEFAULTS[:players]\n @speed = DEFAULTS[:speed]\n ... | [
"0.73984164",
"0.6967621",
"0.68550867",
"0.6842127",
"0.6738235",
"0.6730476",
"0.66989386",
"0.66086966",
"0.65788734",
"0.65623313",
"0.6549013",
"0.6530856",
"0.6484114",
"0.6483423",
"0.6452376",
"0.64456135",
"0.64345735",
"0.64232385",
"0.64153206",
"0.64153206",
"0.64... | 0.0 | -1 |
count returns the size of the cards array parameter. | def count
@cards.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n return cards.length \n end",
"def count\n @cards.length\n end",
"def count\n @cards.length\n end",
"def count\n @cards.count\n end",
"def no_of_cards\n @cards.length\n end",
"def length\n cards.length\n end",
"def length\n\t\treturn @cards.length\n\tend... | [
"0.86749816",
"0.8628118",
"0.84448963",
"0.8388943",
"0.8246222",
"0.81206906",
"0.802305",
"0.8015731",
"0.80116886",
"0.79746294",
"0.79746294",
"0.79746294",
"0.79564494",
"0.79564494",
"0.7911792",
"0.79082996",
"0.7888988",
"0.7888988",
"0.78690016",
"0.78690016",
"0.78... | 0.8432944 | 4 |
cards_in_category returns an array of cards from selected category. | def cards_in_category(sel_category)
@cards.select do |card|
card.category == sel_category
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cards_in_category(category)\n # Accumulate cards that match the input category using\n @cards.find_all do |card|\n card.category == category\n end\n end",
"def retrieve_cards(category)\n self.unused_cards = Card.where(category: Category.find_by(name: category)).where.not... | [
"0.8100934",
"0.76042604",
"0.7300537",
"0.7076758",
"0.69413877",
"0.6801465",
"0.59134585",
"0.5908474",
"0.58075464",
"0.5669724",
"0.5577744",
"0.55697393",
"0.5552722",
"0.555217",
"0.5546734",
"0.54895777",
"0.54793644",
"0.54702634",
"0.54170287",
"0.53895926",
"0.5365... | 0.78877985 | 1 |
read input from standard I/O | def read_input()
@board = []
(1..9).each do
@board << gets.scan(/./).map(&:to_i)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_input\n $stdin.gets.strip\n rescue NoMethodError\n abort \"\\nInput aborted at user request.\"\n end",
"def read_input\n end",
"def read_input()\n print \"> \"\n $stdout.flush\n gets\n end",
"def read_input; end",
"def read_stdin\n open_connection\n $... | [
"0.754095",
"0.74742335",
"0.74186796",
"0.7388208",
"0.7368041",
"0.7226285",
"0.7202279",
"0.71562135",
"0.71000546",
"0.7046338",
"0.70129114",
"0.6960925",
"0.69432485",
"0.69331044",
"0.6888934",
"0.6796155",
"0.6796155",
"0.6718632",
"0.6711198",
"0.6711198",
"0.6711198... | 0.0 | -1 |
ruby's upcase method handles Unicode characters | def normalize
input.upcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unicode_upcase\n UnicodeUtils.upcase(self)\n end",
"def upcase() end",
"def upcase(input); end",
"def upcase; end",
"def upcase!() end",
"def downcase() end",
"def fupcase\n upcase.cupcase\n end",
"def upcase\n return @word.upcase\n end",
"def char_upcase(char)\n Rus3::Char.u... | [
"0.8312674",
"0.7879098",
"0.7735442",
"0.7588801",
"0.7535919",
"0.75047207",
"0.74229234",
"0.7417871",
"0.74058074",
"0.7405259",
"0.73861873",
"0.731827",
"0.72931045",
"0.7277666",
"0.7088029",
"0.7052617",
"0.7026943",
"0.6993729",
"0.6947579",
"0.69445664",
"0.68799204... | 0.6481006 | 43 |
$prompt.select("You did it. You beat the game. Wow.") do |menu| menu.choice "Stats" enu.choice "Exit" end end | def win_game_choice
puts "You win. Very impressive."
# case win_game_menu()
# when "Stats"
# stats_menu_choice_endgame()
# when "Exit"
exit!
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_menu\n prompt = TTY::Prompt.new(\n active_color: :red,\n symbols: {marker: \"⮊\"},\n quiet: true\n )\n\n puts \"\"\n menu_selection = prompt.select(\"Select an option:\") do |menu|\n menu.choice \"➊ Start a new game\", 1\n menu.choice \"➋ How to play\", 2\n ... | [
"0.7935496",
"0.7931734",
"0.7921692",
"0.79024166",
"0.7897027",
"0.78921145",
"0.7873563",
"0.7777789",
"0.77664924",
"0.7725034",
"0.7707317",
"0.7700145",
"0.7695629",
"0.76602674",
"0.7648147",
"0.7646996",
"0.7635999",
"0.75627977",
"0.75191003",
"0.7514682",
"0.7513976... | 0.7272333 | 32 |
Use callbacks to share common setup or constraints between actions. | def set_seeker_profile
@seeker_profile = SeekerProfile.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def seeker_profile_params
params.permit(:title,:location,:current_salary,:user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7122858",
"0.70540553",
"0.69476545",
"0.6902004",
"0.6735809",
"0.671776",
"0.668886",
"0.66776645",
"0.66611695",
"0.6555913",
"0.6527077",
"0.64584446",
"0.64516115",
"0.64500964",
"0.64474493",
"0.6435065",
"0.6413185",
"0.6413185",
"0.6391701",
"0.6380101",
"0.6380101... | 0.0 | -1 |
GET /galactic_clusters GET /galactic_clusters.json | def index
@galactic_clusters = GalacticCluster.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_clusters(opts = {})\n @transporter.read(:GET, '/1/clusters', {}, opts)\n end",
"def clusters\n begin\n clusters = PermissionsManager.get_family_clusters(current_user, clusters_params[:family_group_id])\n rescue\n render json: {}, status: 403\n r... | [
"0.72557515",
"0.7166299",
"0.7021452",
"0.695932",
"0.6704656",
"0.6629315",
"0.6626712",
"0.6605559",
"0.6597318",
"0.6483793",
"0.6469415",
"0.6444361",
"0.6393687",
"0.6323995",
"0.630312",
"0.6267575",
"0.62314177",
"0.6209394",
"0.6200914",
"0.61934835",
"0.6153237",
... | 0.7773202 | 0 |
GET /galactic_clusters/1 GET /galactic_clusters/1.json | def show
@galactic_cluster = GalacticCluster.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @galactic_clusters = GalacticCluster.all\n end",
"def index\n @clusters = current_account.clusters\n end",
"def show\n @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cluster }\n end\n end",
"d... | [
"0.7617633",
"0.68590736",
"0.68467426",
"0.6742688",
"0.6681422",
"0.665526",
"0.65559095",
"0.6489304",
"0.64441085",
"0.6391945",
"0.63021195",
"0.63016576",
"0.6288158",
"0.62684244",
"0.62623674",
"0.6191991",
"0.61893785",
"0.61511004",
"0.60987943",
"0.6082154",
"0.605... | 0.74351245 | 1 |
POST /galactic_clusters POST /galactic_clusters.json | def create
@galactic_cluster = GalacticCluster.new(galactic_cluster_params)
respond_to do |format|
if @galactic_cluster.save
format.html { redirect_to @galactic_cluster, notice: 'Galactic cluster was successfully created.' }
format.json { render :show, status: :created, location: @galacti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @cluster = Cluster.new(params[:cluster])\n\n respond_to do |format|\n if @cluster.save\n format.html { redirect_to @cluster, notice: 'Cluster was successfully created.' }\n format.json { render json: @cluster, status: :created, location: @cluster }\n else\n format.... | [
"0.665269",
"0.65679723",
"0.6413209",
"0.6365464",
"0.6253965",
"0.61985844",
"0.6179023",
"0.6152787",
"0.60845846",
"0.60784036",
"0.5978638",
"0.5922671",
"0.5888323",
"0.5879201",
"0.5861646",
"0.5815409",
"0.5786011",
"0.5755179",
"0.57276314",
"0.5720806",
"0.57035244"... | 0.7390381 | 0 |
PATCH/PUT /galactic_clusters/1 PATCH/PUT /galactic_clusters/1.json | def update
respond_to do |format|
if @galactic_cluster.update(galactic_cluster_params)
format.html { redirect_to @galactic_cluster, notice: 'Galactic cluster was successfully updated.' }
format.json { render :show, status: :ok, location: @galactic_cluster }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n if @cluster.update_attributes(params[:cluster])\n format.html { redirect_to @cluster, notice: 'Cluster was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"... | [
"0.708083",
"0.6886035",
"0.6886035",
"0.6593582",
"0.65050817",
"0.6389735",
"0.6336254",
"0.6243017",
"0.6161945",
"0.6112012",
"0.61062384",
"0.6020545",
"0.6004098",
"0.59755397",
"0.5974685",
"0.59418064",
"0.59234524",
"0.5922022",
"0.590884",
"0.590884",
"0.58999026",
... | 0.7440143 | 0 |
DELETE /galactic_clusters/1 DELETE /galactic_clusters/1.json | def destroy
@galactic_cluster.destroy
respond_to do |format|
format.html { redirect_to galactic_clusters_url, notice: 'Galactic cluster was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cluster = Cluster.find(params[:id])\n @cluster.destroy\n\n respond_to do |format|\n format.html { redirect_to clusters_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cluster = Cluster.find(params[:id])\n @cluster.destroy\n\n respond_to do |format|\n ... | [
"0.7534368",
"0.7250021",
"0.70330435",
"0.68805933",
"0.6866848",
"0.68329984",
"0.6696805",
"0.6686032",
"0.66022235",
"0.65905386",
"0.6550556",
"0.64834005",
"0.6366462",
"0.6329003",
"0.63066345",
"0.6292856",
"0.6287321",
"0.62869704",
"0.62819284",
"0.6280632",
"0.6272... | 0.78751767 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_galactic_cluster
@galactic_cluster = GalacticCluster.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 galactic_cluster_params
params.fetch(:galactic_cluster, {})
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 |
This extension of update_attributes allows for the direct updating of associated objects | def update_attributes(attributes)
if attributes["tracking_elements"]
attributes["tracking_elements"].each do |key,value|
@element=TrackingElement.find(key)
@element.visibility="hide"
@element.update_attributes(value)
end
end
attributes.delete("tracking_elements")
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nested_attributes_update_attributes(meta, obj, attributes)\n nested_attributes_check_key_modifications(meta, obj) do\n nested_attributes_set_attributes(meta, obj, attributes)\n end\n end",
"def nested_attributes_update(meta, obj, attributes)\n nested_attributes_up... | [
"0.74580634",
"0.7274484",
"0.7268134",
"0.72129506",
"0.71571696",
"0.70978796",
"0.7060046",
"0.7030433",
"0.7027356",
"0.69342405",
"0.6917377",
"0.6900648",
"0.687212",
"0.6853818",
"0.684829",
"0.684829",
"0.684829",
"0.684829",
"0.67671466",
"0.6762203",
"0.6749844",
... | 0.0 | -1 |
testk laksdfj klasj df | def test
log 'test'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def df\n DFHack\nend",
"def df\n DFHack\nend",
"def data_complextest(db); end",
"def data_righttest_label_bad(db); end",
"def onColumn_dnase(num_ops)\n dnase = (num_ops) * 10#ul\n rdd = (num_ops) * 70#ul\n tot_vol = dnase + rdd\n arr = ['DNase', 'RDD']\n headers = a... | [
"0.5984699",
"0.5984699",
"0.58340675",
"0.57374465",
"0.55638677",
"0.5535728",
"0.5388564",
"0.5358298",
"0.5234",
"0.5228893",
"0.52102786",
"0.51347744",
"0.50797886",
"0.5051786",
"0.5048165",
"0.5042778",
"0.5011721",
"0.50069535",
"0.49973643",
"0.49140826",
"0.4899937... | 0.0 | -1 |
Returns the current JWT auth object if it exists | def current_jwt_token
@jwt_auth ||= session[:jwt_auth] ? JwtToken.where(id: session[:jwt_auth]).first : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_jwt_auth\n #\n @jwt_auth ||= (defined? session and session[:jwt_auth]) ? JwtToken.where(id: session[:jwt_auth]).first : nil\n end",
"def current_jwt_user\n #\n @jwt_user ||= (defined? session and session[:jwt_user]) ? JwtUser.where(id: session[:jwt_user]).first : nil\n end",... | [
"0.8239943",
"0.73956215",
"0.7047347",
"0.69678956",
"0.69396836",
"0.6928084",
"0.6782307",
"0.67623556",
"0.67366594",
"0.6633942",
"0.662469",
"0.66240823",
"0.6594451",
"0.65708023",
"0.6563136",
"0.6558502",
"0.654927",
"0.6535689",
"0.65276396",
"0.6513193",
"0.6500560... | 0.7852938 | 1 |
Sets the current JWT auth object | def current_jwt_token=(jwt_auth)
session[:jwt_auth] = jwt_auth.nil? ? nil : jwt_auth.id
@jwt_auth = jwt_auth
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_jwt_auth=(jwt_auth)\n session[:jwt_auth] = jwt_auth.nil? ? nil : jwt_auth.id\n @jwt_auth = jwt_auth\n end",
"def set_auth_token\n @auth_token = AuthToken.find(params[:id])\n end",
"def set_auth_token\n @auth_token = AuthToken.find(params[:id])\n end",
"def set_auth_to... | [
"0.74634737",
"0.6918316",
"0.6918316",
"0.691187",
"0.6905828",
"0.67428374",
"0.6688882",
"0.6659341",
"0.6561572",
"0.6561572",
"0.6549618",
"0.65375173",
"0.653687",
"0.6529293",
"0.65226257",
"0.6506269",
"0.6479367",
"0.64585376",
"0.64520043",
"0.64245677",
"0.64160246... | 0.720916 | 1 |
Returns the current JWT context if it exists | def current_jwt_context
@jwt_context ||= session[:jwt_context]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_jwt_token\n @jwt_auth ||= session[:jwt_auth] ? JwtToken.where(id: session[:jwt_auth]).first : nil\n end",
"def current_jwt_auth\n #\n @jwt_auth ||= (defined? session and session[:jwt_auth]) ? JwtToken.where(id: session[:jwt_auth]).first : nil\n end",
"def current_jwt_user\n ... | [
"0.78691983",
"0.7750739",
"0.73397565",
"0.6824239",
"0.67738485",
"0.66523874",
"0.6515846",
"0.6497664",
"0.64652663",
"0.643572",
"0.64104086",
"0.64084405",
"0.64084405",
"0.63368535",
"0.6313459",
"0.62696534",
"0.62666947",
"0.6249201",
"0.62205714",
"0.619141",
"0.618... | 0.88238394 | 0 |
Sets the current JWT context | def current_jwt_context=(jwt_context)
session[:jwt_context] = jwt_context
@jwt_context = jwt_context
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_jwt_context\n @jwt_context ||= session[:jwt_context]\n end",
"def current_jwt_token=(jwt_auth)\n session[:jwt_auth] = jwt_auth.nil? ? nil : jwt_auth.id\n @jwt_auth = jwt_auth\n end",
"def context\n { current_user: current_user, token: token }\n end",
"def current_jwt_auth... | [
"0.7854172",
"0.69496286",
"0.68630534",
"0.6854389",
"0.68065184",
"0.66430163",
"0.6603999",
"0.6362343",
"0.6330013",
"0.6312216",
"0.6309178",
"0.6252359",
"0.6237102",
"0.61999977",
"0.6188224",
"0.61862826",
"0.61595523",
"0.61595523",
"0.6142494",
"0.612311",
"0.608149... | 0.8202447 | 0 |
Returns the current JWT account_id if it exists | def current_account_id
@account_id ||= session[:account_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_account_id\n if user\n return user.get_account_id\n end\n end",
"def current_user_id\n if request.headers && request.headers['Authorization']\n token = request.headers['Authorization'].split(' ')[1] #[Bearer <token>]\n begin\n decoded_token = JWT.decode(token, 'this should... | [
"0.75664324",
"0.7235754",
"0.70407724",
"0.7033659",
"0.6841175",
"0.67544454",
"0.6638061",
"0.660236",
"0.660236",
"0.6541787",
"0.6414212",
"0.6408278",
"0.6348228",
"0.63239276",
"0.63035524",
"0.6288506",
"0.6286944",
"0.62839425",
"0.6271465",
"0.6243856",
"0.6226023",... | 0.70983183 | 2 |
Sets the current JWT account_id | def current_account_id=(account_id)
session[:account_id] = account_id
@account_id = account_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_account_id\n params[:account_id] = params[:id]\n end",
"def assign_account(account_id)\n self.account_id = account_id\n end",
"def current_jwt_auth=(jwt_auth)\n session[:jwt_auth] = jwt_auth.nil? ? nil : jwt_auth.id\n @jwt_auth = jwt_auth\n end",
"def set_account\n @... | [
"0.729405",
"0.6726643",
"0.66669595",
"0.66363704",
"0.66363704",
"0.66085273",
"0.6601564",
"0.6568056",
"0.65590245",
"0.65590245",
"0.65022624",
"0.64971715",
"0.6445883",
"0.640774",
"0.640288",
"0.6393412",
"0.63369113",
"0.63306504",
"0.6330224",
"0.63116866",
"0.62882... | 0.6936169 | 1 |
set the edit anchor inside the ethernetswitching stanza we will need to 'upout' when making changes to the unit information, like description | def xml_at_element_top( xml, name )
xml.interface {
xml.name name
xml.unit {
xml.name '0'
return xml
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchor=(value)\n @anchor = value\n end",
"def set_ethernet\n @ethernet = Ethernet.find(params[:id])\n end",
"def netdev_resxml_edit( xml )\n xml.family { \n xml.send(:'ethernet-switching') {\n return xml\n }\n }\n end",
"def set_address\n end",
... | [
"0.56514525",
"0.5546782",
"0.5545603",
"0.5397807",
"0.53797054",
"0.53589636",
"0.5334391",
"0.5301406",
"0.5237094",
"0.520687",
"0.5186815",
"0.51557064",
"0.5150404",
"0.5134779",
"0.51024526",
"0.50981957",
"0.50632507",
"0.50598896",
"0.5034382",
"0.50053096",
"0.49992... | 0.0 | -1 |
XML on_create, on_delete handlers overload the xml_on_delete method since we may need to do some cleanup work in the [edit vlans] stanza | def xml_on_delete( xml )
return unless @under_vlans
return if @under_vlans.empty?
_xml_rm_under_vlans( xml, @under_vlans )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml_callbacks\n @xmlcbs\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def on_tag_create( node )\n\t\t\tself.log.debug \"unhandled on_node_destroy for %p\" % [ node ]\n\t\tend",
"def n... | [
"0.55587196",
"0.5526719",
"0.54302526",
"0.5278304",
"0.52402514",
"0.51959705",
"0.5108823",
"0.49978247",
"0.49968842",
"0.49875155",
"0.49354896",
"0.49011138",
"0.48492002",
"0.48253453",
"0.48105675",
"0.4790581",
"0.4773264",
"0.473674",
"0.47251716",
"0.47119755",
"0.... | 0.5678755 | 0 |
:description overload default method since we need to "upout" of the ethernetswitching stanza | def xml_change_description( xml )
unit = xml.parent.xpath('ancestor::unit')[0]
Nokogiri::XML::Builder.with( unit ){ |x|
xml_set_or_delete( x, 'description', @should[:description] )
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default(name)\n configure [\"interface #{name}\", 'default switchport']\n end",
"def initialize(eth_type: nil, ipv4_destination: nil, ipv4_source: nil,\n ipv6_source: nil, ipv6_destination: nil, ipv6_flabel: nil,\n ipv6_ext_header: nil, ethernet_destination: nil, ethernet_source: nil,\n... | [
"0.5909288",
"0.58925366",
"0.586593",
"0.58010703",
"0.58010703",
"0.5798149",
"0.570106",
"0.5700382",
"0.5689704",
"0.5689704",
"0.5689704",
"0.5689704",
"0.5689704",
"0.5689704",
"0.5653229",
"0.56085503",
"0.5582046",
"0.55800605",
"0.55579084",
"0.5545306",
"0.554334",
... | 0.0 | -1 |
Default method, subclasses must override this | def run
super
uri = _get_entity_name
begin
_log "Browser Navigating to #{uri}"
c = Intrigue::ChromeBrowser.new
browser_response = c.navigate_and_capture(uri)
rescue Errno::ECONNREFUSED => e
_log_error "Unable to connect to chrome browser. Is it running on :9222?"
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overrides; end",
"def custom; end",
"def custom; end",
"def default; end",
"def default; end",
"def private; end",
"def special\n override\n end",
"def defaults\n super\n end",
"def implementation; end",
"def implementation; end",
"def default\n end",
"def defaults; end",
... | [
"0.7415348",
"0.73554313",
"0.73554313",
"0.6991004",
"0.6991004",
"0.69613177",
"0.69572926",
"0.6824949",
"0.6801543",
"0.6801543",
"0.67361915",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0... | 0.0 | -1 |
Provide either a Rack::Request or a Hash containing :key, :signature, :body, and :content_type (optional) | def initialize(request, client = Pusher)
@client = client
# For Rack::Request and ActionDispatch::Request
if request.respond_to?(:env) && request.respond_to?(:content_type)
@key = request.env['HTTP_X_PUSHER_KEY']
@signature = request.env["HTTP_X_PUSHER_SIGNATURE"]
@content_type... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_params_from_request(rack_request)\n # Prevent cache bypass DOS attacks by only permitting :sig and :q\n bail(400, 'Query strings are not supported') if rack_request.params.any?\n\n # Take the last two path components of the request URI.\n # The second-to-last is the Base64-encoded image req... | [
"0.63822895",
"0.6196044",
"0.61555797",
"0.6141284",
"0.6132307",
"0.6104205",
"0.61022645",
"0.6076138",
"0.60426664",
"0.60426664",
"0.60426664",
"0.60426664",
"0.6040137",
"0.60300505",
"0.6017698",
"0.59955794",
"0.59259397",
"0.5912872",
"0.58675003",
"0.5863868",
"0.58... | 0.6628911 | 0 |
Returns whether the WebHook is valid by checking that the signature matches the configured key & secret. In the case that the webhook is invalid, the reason is logged | def valid?(extra_tokens = nil)
extra_tokens = [extra_tokens] if extra_tokens.kind_of?(Hash)
if @key == @client.key
return check_signature(@client.secret)
elsif extra_tokens
extra_tokens.each do |token|
return check_signature(token[:secret]) if @key == token[:key]
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_signature(secret)\n digest = OpenSSL::Digest::SHA256.new\n expected = OpenSSL::HMAC.hexdigest(digest, secret, @body)\n if @signature == expected\n return true\n else\n Pusher.logger.warn \"Received WebHook with invalid signature: got #{@signature}, expected #{expected}\"... | [
"0.795589",
"0.728996",
"0.70743465",
"0.7028746",
"0.6905803",
"0.68883795",
"0.67129713",
"0.6683727",
"0.66800946",
"0.6646894",
"0.66397774",
"0.6626931",
"0.6571266",
"0.65317047",
"0.65317047",
"0.649243",
"0.64401853",
"0.6432534",
"0.64211303",
"0.6365642",
"0.6344335... | 0.7507732 | 1 |
Array of events (as Hashes) contained inside the webhook | def events
data["events"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n @events ||= Array(context[:events]).reverse.map { |event| Concierge::SafeAccessHash.new(event) }\n end",
"def events\n @events ||= []\n @events\n end",
"def events\n @events ||= parsed_json.map do |json_record|\n VoyagerUpdater::Event.new(json_record)\n ... | [
"0.7361707",
"0.73104435",
"0.7211573",
"0.71704525",
"0.7079823",
"0.6933145",
"0.6836914",
"0.68254006",
"0.681514",
"0.67963177",
"0.67909193",
"0.6788646",
"0.6649178",
"0.66000575",
"0.65948856",
"0.65650594",
"0.65626657",
"0.6557001",
"0.65551955",
"0.6525441",
"0.6470... | 0.7490247 | 0 |
The time at which the WebHook was initially triggered by Pusher, i.e. when the event occurred | def time
Time.at(data["time_ms"].to_f/1000)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def this_event_time\n @event[\"server_gmt\"].to_i\n end",
"def event_date_time\n return @event_date_time\n end",
"def start_time\n if ev = start_event.last\n ev.time\n end\n end",
"def start_time\n if ev = start_event.la... | [
"0.7006623",
"0.66549665",
"0.6611304",
"0.6611304",
"0.64800406",
"0.64706606",
"0.6445554",
"0.643021",
"0.63939625",
"0.6335755",
"0.63185585",
"0.62896466",
"0.6266773",
"0.6201963",
"0.6164502",
"0.61613303",
"0.61613303",
"0.61517274",
"0.61352336",
"0.61327183",
"0.612... | 0.0 | -1 |
Access the parsed WebHook body | def data
@data ||= begin
case @content_type
when 'application/json'
MultiJson.decode(@body)
else
raise "Unknown Content-Type (#{@content_type})"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parsed_body\n @body\n end",
"def body\n data[:body]\n end",
"def body\n self['body']\n end",
"def parsed_body\n @parsed_body ||= JSON.parse(@body, symbolize_names: true)\n end",
"def body\n self[:body]\n end",
"def get_body\n request_object.body\n end",
"def ... | [
"0.73123384",
"0.7199206",
"0.70377946",
"0.67122465",
"0.6582423",
"0.6573571",
"0.6572253",
"0.6492791",
"0.6490541",
"0.6488285",
"0.6463791",
"0.64153427",
"0.6396065",
"0.6372442",
"0.6364014",
"0.6363024",
"0.6344729",
"0.6320617",
"0.628715",
"0.62800235",
"0.62750345"... | 0.0 | -1 |
Checks signature against secret and returns boolean | def check_signature(secret)
digest = OpenSSL::Digest::SHA256.new
expected = OpenSSL::HMAC.hexdigest(digest, secret, @body)
if @signature == expected
return true
else
Pusher.logger.warn "Received WebHook with invalid signature: got #{@signature}, expected #{expected}"
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_valid_signature?\n Adyen::HPP::Signature.verify(params, shared_secret)\n end",
"def valid_signature?\n params['verifier'] == Digest::MD5.hexdigest([ params['id'], params['snuid'], params['currency'], Offerpal.secret_key ].join(':'))\n end",
"def verify_signature\n r... | [
"0.789172",
"0.7681748",
"0.76770407",
"0.7668533",
"0.7544866",
"0.74624294",
"0.74435353",
"0.74171776",
"0.73132676",
"0.7311373",
"0.7293188",
"0.72777575",
"0.7261792",
"0.7250269",
"0.72500986",
"0.721476",
"0.720883",
"0.7190518",
"0.71811783",
"0.7178281",
"0.7178281"... | 0.8259257 | 0 |
Output file for the sprites image | def path
File.join(@sprites.configuration.sprites_path, @path || sprite_file_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_file\n a = []\n\n @sprites.product(@palettes).each do |pair|\n a << pair.first.to_canvas(pair.last)\n end\n\n combine_canvas(a).to_datastream\n end",
"def sprites_tech_demo\n outputs.labels << [ 5, 170, \"Sprites (x, y, w, h, path, angle, a)\"]\n outputs.... | [
"0.7505515",
"0.6618053",
"0.6611941",
"0.6474697",
"0.64234906",
"0.6351401",
"0.6343508",
"0.6315086",
"0.63070214",
"0.6261061",
"0.6255659",
"0.6203282",
"0.617633",
"0.61539817",
"0.61381596",
"0.6135809",
"0.61247385",
"0.61094123",
"0.60974103",
"0.60894936",
"0.604075... | 0.61204374 | 17 |
Output file for the sprites stylesheet | def stylesheet_path
File.join(@sprites.configuration.sprite_stylesheets_path, @stylesheet_path || stylesheet_file_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_file\n a = []\n\n @sprites.product(@palettes).each do |pair|\n a << pair.first.to_canvas(pair.last)\n end\n\n combine_canvas(a).to_datastream\n end",
"def write\n self.theme_assets_by_priority.each do |asset|\n self.output_resource_op asset... | [
"0.689127",
"0.6246256",
"0.6085263",
"0.5985716",
"0.59790933",
"0.58539",
"0.5735225",
"0.5735225",
"0.5704595",
"0.5703317",
"0.569758",
"0.56890845",
"0.5680265",
"0.56562287",
"0.5653987",
"0.56469375",
"0.562188",
"0.5590096",
"0.5589686",
"0.555198",
"0.5546563",
"0.... | 0.6115335 | 2 |
The +sprite_piece+ method adds sprite_piecess to the sprite === Example === sprite :foo do sprite_piece 'buttons/btnblackdefault28.png', 'a.black.wf_button > span, button.black.wf_submit span' Arguments: [String] the path to sprite piece relatie to config.sprite_pieces_path [String] (optional) the css selector to use f... | def sprite_piece(path, css_class = nil, options = {})
css_class ||= File.basename(path, File.extname(path)).split('/').join('-')
@sprite_pieces.add(path, css_class, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_piece(piece, pos)\n\n end",
"def draw_enemy_pieces args\n args.state.enemy.pieces.each do |p|\n if p[:onboard]\n args.outputs.primitives << {\n x: args.state.board.x + args.state.tiles[p[:tile]][:x],\n y: args.state.board.y + args.state.tiles[p[:tile]][:y],\n w: 100,\n ... | [
"0.6345455",
"0.616857",
"0.59912646",
"0.5925641",
"0.57479554",
"0.5694334",
"0.56489193",
"0.5572194",
"0.5571082",
"0.5570377",
"0.5570377",
"0.55428886",
"0.5462491",
"0.5399145",
"0.5346501",
"0.53335166",
"0.52981764",
"0.52960914",
"0.5268674",
"0.5259687",
"0.5251156... | 0.76627207 | 0 |
TODO most of this is borrowed from rspeccore's spec_helper should be extracted to something we can use here | def in_editor?
ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spec; end",
"def spec; end",
"def spec_dirs; end",
"def spec_support_dir\n @spec_support_dir ||= File.expand_path(File.dirname(__FILE__))\nend",
"def spec\n File.join root, 'spec'\n end",
"def generate_spec_header()\n aspec=File.new('item_spec.rb','w')\n specHeader=<<EOF\nTEST_ROOT=ENV['AME... | [
"0.70509034",
"0.70509034",
"0.6016642",
"0.5953712",
"0.5880795",
"0.5858032",
"0.5797985",
"0.5765352",
"0.57065403",
"0.5698243",
"0.5698243",
"0.5698243",
"0.5698243",
"0.5698243",
"0.5698243",
"0.5689934",
"0.56723547",
"0.56723547",
"0.56385726",
"0.5605482",
"0.5605266... | 0.0 | -1 |
:registerable dragonfly_accessor :last_sign_in_ip image_accessor :last_sign_in_ip | def send_survey
Message.send_survey_to(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_sign_in_ip; end",
"def current_sign_in_ip; end",
"def register_last_ip_address(user, _username, _password, _options)\n return unless sorcery_config.register_last_ip_address\n\n user.set_last_ip_address(request.remote_ip)\n end",
"def after_ip_authentication\n e... | [
"0.75094974",
"0.75094974",
"0.61611986",
"0.60185975",
"0.5966154",
"0.59246135",
"0.5892457",
"0.58799887",
"0.587783",
"0.57808435",
"0.57808435",
"0.57808435",
"0.57808435",
"0.57808435",
"0.57808435",
"0.5747168",
"0.5737417",
"0.57131314",
"0.57079625",
"0.5661997",
"0.... | 0.0 | -1 |
Encrypts the password with the user salt | def encrypt(password)
self.class.encrypt(password, salt)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end",
"def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end",
"def encrypt_password\n ... | [
"0.8456656",
"0.83809954",
"0.837295",
"0.83666867",
"0.8361271",
"0.83577955",
"0.83577955",
"0.83577955",
"0.83577955",
"0.83577955",
"0.83577955",
"0.83539045",
"0.8353123",
"0.83147633",
"0.8314556",
"0.83011955",
"0.82853645",
"0.8279242",
"0.8253498",
"0.82321554",
"0.8... | 0.0 | -1 |
These create and unset the fields required for remembering users between browser closes | def remember_me
self.remember_token_expires_at = 2.weeks.from_now.utc
self.remember_token = encrypt("#{email}--#{remember_token_expires_at}")
save(false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forgets\n update_attribute(:remember_digest, nil)\n end",
"def after_save\n cookies['global_properties_for_user'] = nil\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:... | [
"0.65625703",
"0.6457621",
"0.6436497",
"0.6436497",
"0.6322159",
"0.6321848",
"0.6301566",
"0.6301566",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
"0.6269944",
... | 0.0 | -1 |
Set the password reset | def set_password_reset
self.make_password_reset_code
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_password_reset\n\t\tself.code = SecureRandom.urlsafe_base64\n\t\tself.expires_at = 4.hours.from_now\n\t\tself.save!\n\tend",
"def password_reset\n tester = Tester.first\n tester.reset_token = Tester.new_token\n TesterMailer.password_reset(tester)\n end",
"def password_reset\n\t\tshepherd = Sh... | [
"0.8141931",
"0.78038853",
"0.7787905",
"0.7752375",
"0.7708413",
"0.765088",
"0.7586867",
"0.7566352",
"0.7558033",
"0.7553696",
"0.75482965",
"0.75482965",
"0.75482965",
"0.75482965",
"0.75482965",
"0.75482965",
"0.75482965",
"0.75416875",
"0.75393844",
"0.7529541",
"0.7524... | 0.8350861 | 0 |
Return the first name of the user | def first_name
self.name.split(' ').first.titlecase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_firstname\n return @message[:user][:name].split(' ').first\n end",
"def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end",
"def first_name # same as field name ;\n User.where(id: object.user_id)[0].first_name\n end",
"def sho... | [
"0.8528741",
"0.8476795",
"0.8440563",
"0.84014857",
"0.8391002",
"0.8386815",
"0.83802444",
"0.8267194",
"0.8164223",
"0.81572247",
"0.81496584",
"0.81371444",
"0.8130937",
"0.81283706",
"0.8125856",
"0.81247437",
"0.8045241",
"0.8040159",
"0.7988887",
"0.79386866",
"0.79297... | 0.0 | -1 |
Does this user have this role? | def has_role?(role)
self.roles_cached.nil? ? false : self.roles_cached.split(',').include?(role)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_role?\n roles.any? { |role| Roles.user_roles.include?(role) }\n end",
"def has_role?(the_role)\n\t\tthe_role==self.role ? true : false\n\tend",
"def has_role?( user, object )\n false\n end",
"def user?\n has_role? :user\n end",
"def has_role?\n Role.roles.include? role.try(:name... | [
"0.8461565",
"0.8326596",
"0.8265158",
"0.81865406",
"0.81411403",
"0.8137724",
"0.8137724",
"0.8094567",
"0.80938214",
"0.8090123",
"0.80595857",
"0.8045201",
"0.80158776",
"0.79892623",
"0.79892623",
"0.79819363",
"0.793749",
"0.7936886",
"0.7922465",
"0.79159456",
"0.78893... | 0.0 | -1 |
ROLES Set the roles this user is a part of based on what is coming in LDAP. Create roles if necessary | def set_roles_cached(ldap_roles_arr)
# Cache the roles as a concatenated string into the user object
self.roles_cached = ldap_roles_arr.join(',')
save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_possible_roles\n\tif User.has_role Role.ADMINISTRATOR,session[:roles]\n\t @roles=Role.all\n\t return\n\tend\n\n\t@logged_in_user_role_id = UserRoleMap.getRoleidByUserid(session[:session_user])\n\t#@roles = Role.where(:id => RoleReportTo.select(\"user_role_id\").where(:manager_role_id => @logged_in_user_r... | [
"0.6679174",
"0.66360193",
"0.66360193",
"0.6542852",
"0.6513588",
"0.65079045",
"0.63333964",
"0.6329883",
"0.63008803",
"0.6273387",
"0.6227723",
"0.6150172",
"0.6141379",
"0.61130965",
"0.60977584",
"0.6095278",
"0.609126",
"0.6048858",
"0.6042875",
"0.6042323",
"0.6039571... | 0.61639535 | 11 |
Save a random password as a reset code | def make_password_reset_code
self.password_reset_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_reset_code\n self.password_reset_code = Digest::SHA1.hexdigest( Time.now.to_s.split(//).sort_by {rand}.join )\n self.save\n end",
"def reset_password\n o = [('a'..'z'),('A'..'Z'),('0'..'9')].map{|i| i.to_a}.flatten\n new_password = (0..6).map{ o[rand(o.length)] }.join\n self.password =... | [
"0.81696016",
"0.78385603",
"0.7779419",
"0.768316",
"0.7517673",
"0.7511403",
"0.7417194",
"0.73907834",
"0.7311005",
"0.72362006",
"0.71800923",
"0.7104994",
"0.70883244",
"0.70553374",
"0.7044912",
"0.6995794",
"0.6958833",
"0.6956285",
"0.6947863",
"0.6947863",
"0.6942958... | 0.76487666 | 4 |
Parse NetID and UID from uid attributes | def parse_uids(uid_array, dn)
uid_dn = dn.split(',')[0].split('=')[1]
uid_alias = nil
uid_array.each do |uid|
if uid.match(uid_dn)
uid_dn = uid
else
uid_alias = uid
end
end
if uid_alias.nil?
uid_alias = uid_dn
end
return uid_dn, uid_alias
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_uid(uid)\n\treturn parsed_id = uid.split(\":\")\nend",
"def set_uid\n unless gn.blank? || sn.blank?\n self['uid'] = gn.to_slug.approximate_ascii.normalize.to_s + '.' + sn.to_slug.approximate_ascii.normalize.to_s if uid.blank?\n end\n end",
"def read_uid\n readers=NFC::Reader.all\n\trea... | [
"0.7314487",
"0.6268105",
"0.607059",
"0.6004057",
"0.5888458",
"0.5871541",
"0.5863586",
"0.5858436",
"0.57930934",
"0.57930934",
"0.5781162",
"0.5757115",
"0.56899375",
"0.56899375",
"0.5688525",
"0.5683637",
"0.5683637",
"0.5675139",
"0.5654915",
"0.5616102",
"0.5609819",
... | 0.634629 | 1 |
True if presentation contains Narration | def narration_present?
content_types_xml = nil
pres_doc = @files.file.open '[Content_Types].xml' rescue nil
content_types_xml = Nokogiri::XML::Document.parse(pres_doc) if pres_doc
content = content_types_xml.xpath('//@Extension')
if content.to_s.include?('m4a')
@type = 'm4a'
@narration =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_presentation?(); @type == GRT_PRESENTATION; end",
"def notional?\n (notional)\n end",
"def notional?\n (capital_project.notional?)\n end",
"def naturally_occurring?\n (naturally_occurring == 'Y' && waste_producer_water_discount?)\n end",
"def noun_articles_present? set\n ((set... | [
"0.68864244",
"0.64847606",
"0.60481626",
"0.6017848",
"0.59551775",
"0.58467424",
"0.5733938",
"0.5679544",
"0.5679544",
"0.5672254",
"0.5630483",
"0.562586",
"0.5618862",
"0.56121176",
"0.56108",
"0.5603138",
"0.55962646",
"0.5593143",
"0.55886227",
"0.5518653",
"0.5514987"... | 0.67414486 | 1 |
Creates slides out of the corresponding files. | def slides
@slides = Array.new
@files.each do |f|
if f.name.include? 'ppt/slides/slide'
@slides.push Slide.new(self, f.name)
end
end
@slides.sort{|a,b| a.slide_num <=> b.slide_num}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebuild_pptx\n Zip::File.open(@files.to_s, Zip::File::CREATE) { |zipfile|\n @slides.each do |f|\n if f.changed\n # Temporary file to store the manipulated xml\n temp_file = Tempfile.new(f.slide_file_name)\n # Store the manipulated xml inside the file\n temp_fi... | [
"0.6771939",
"0.66809994",
"0.6272948",
"0.6222441",
"0.6170869",
"0.614201",
"0.6126124",
"0.6077725",
"0.60555285",
"0.60476655",
"0.5984137",
"0.5973146",
"0.59000725",
"0.5808079",
"0.5799459",
"0.57828915",
"0.5777621",
"0.5761362",
"0.57458735",
"0.57426786",
"0.5716764... | 0.66190296 | 2 |
Creates a physical copy of the narration file and returns the file path in the asset pipeline | def open_narration(slide_no)
if @type == 'm4a'
@files.extract("ppt/media/media#{slide_no}.m4a", "#{Rails.root}/public/audios/#{$filename}media#{slide_no}.m4a") rescue
$filename+'media'+slide_no.to_s+'.m4a'
end
if @type == 'wav'
@files.extract("ppt/media/media#{slide_no}.wav", "#{Rails.root}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_path\n File.join(AssetMapper.assets_dir, filename)\n end",
"def target_asset_path(asset)\n File.join('public', asset.folder, asset.filename)\n end",
"def asset_filepath(file)\n File.join(base_path, file)\n end",
"def path\n asset_source_path\n end",
"def... | [
"0.6898452",
"0.6742915",
"0.66509336",
"0.6486209",
"0.6486209",
"0.6410854",
"0.62876576",
"0.62582946",
"0.6243849",
"0.6243849",
"0.623892",
"0.62200797",
"0.61896044",
"0.6145041",
"0.6144701",
"0.6140454",
"0.61386853",
"0.6116499",
"0.60857874",
"0.60449153",
"0.603140... | 0.0 | -1 |
Since the slides have to be manipulated to show correctly in Libre, the pptx has to be rebuild. | def rebuild_pptx
Zip::File.open(@files.to_s, Zip::File::CREATE) { |zipfile|
@slides.each do |f|
if f.changed
# Temporary file to store the manipulated xml
temp_file = Tempfile.new(f.slide_file_name)
# Store the manipulated xml inside the file
temp_file.write(f.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n #@deck = Powerpoint::Presentation.new\n # Creating an introduction slide:\n # title = 'Bicycle Of the Mind'\n # subtitle = 'created by Steve Jobs'\n # @deck.add_intro title, subtitle\n\n # Creating a text-only slide:\n # Title must be a string.\n # Content must be an array of st... | [
"0.7585843",
"0.62164867",
"0.61940885",
"0.6169247",
"0.61516356",
"0.61308503",
"0.61023045",
"0.61010945",
"0.6065383",
"0.60214996",
"0.6015732",
"0.59621775",
"0.59458137",
"0.5940929",
"0.59224564",
"0.59041184",
"0.58885455",
"0.5886825",
"0.58437824",
"0.5843176",
"0.... | 0.714509 | 1 |
Generates the pdf with Libreconv gem 'libreconv' | def generate_pdf(filename)
@destination_path = "#{Rails.root}/public/files/"+filename.remove('pptx')+'pdf'
Libreconv.convert( @files.to_s, @destination_path, nil, 'pdf:writer_pdf_Export')
# Docsplit.extract_pdf(@files.to_s)
# Creates the manipulated pptx file physically
FileUtils.mv @files.to_s, "#{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_pdf\n to_prawn.render\n end",
"def generate_pdf\n output_path ||= CurationConcerns::DerivativePath.derivative_path_for_reference(curation_concern, 'pdf')\n output_file_dir = File.dirname(output_path)\n FileUtils.mkdir_p(output_file_dir) unless File.directory?(output_file_dir)\n ... | [
"0.71248114",
"0.7124733",
"0.70637155",
"0.7056156",
"0.7026916",
"0.69392616",
"0.68724877",
"0.6852834",
"0.6806924",
"0.6787898",
"0.6784026",
"0.67659044",
"0.67511696",
"0.67250174",
"0.66924226",
"0.66918224",
"0.6681803",
"0.65975904",
"0.658571",
"0.6578216",
"0.6566... | 0.7067647 | 2 |
Generates Images out of the pptx into the root folder Installation and dependencies at | def generate_images
Docsplit.extract_images(@files.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_generated_images(parent)\n img = parent.find_inspire_image\n mobile = parent.image_for img, 'mobile_inspire'\n desktop = parent.image_for img, 'desktop_inspire'\n thumbnails = parent.image_for '', 'thumbnails'\n\n FileUtils.cp(mobile, \"#{data_path}/inspire/mobile\")\n FileUtils.cp(deskt... | [
"0.6458023",
"0.6240414",
"0.6089061",
"0.60334754",
"0.5888782",
"0.5855308",
"0.585093",
"0.57822955",
"0.5773663",
"0.5734427",
"0.5720052",
"0.5702539",
"0.5657653",
"0.5645314",
"0.5625725",
"0.55954236",
"0.5587446",
"0.55452496",
"0.5542567",
"0.55407065",
"0.55380815"... | 0.5850577 | 7 |
this could be a hash/array type if needed, tracking position and value of flags | def denuncia (identificador)
saida = false
survivorAbduzido = Survivor.find(identificador)
if survivorAbduzido.flag1 == 0
survivorAbduzido.flag1 = self.id
survivorAbduzido.save
saida=true
elsif survivorAbduzido.flag2 == 0&&self.id != survivorAbduzido.flag1
survivorAbduzido.flag2 = self.id
sur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flags; end",
"def flags \n @flags ||= {}\n end",
"def flags #:nodoc:\n @flags ||= {}\n end",
"def flags\n return @val\n end",
"def flags\n @flags\n end",
"def flags\n @flags\n end",
"def flags\n @values.fetch('flags') { \n @values['flags']... | [
"0.6963634",
"0.6952999",
"0.67385066",
"0.6655369",
"0.66135174",
"0.66135174",
"0.6529839",
"0.64312625",
"0.6385158",
"0.6335895",
"0.6311951",
"0.62065357",
"0.62061673",
"0.6199689",
"0.60955536",
"0.6063021",
"0.6059905",
"0.5975768",
"0.597543",
"0.5964746",
"0.593079"... | 0.0 | -1 |
Do any attributes have unsaved changes? person.changed? => false person.name = 'bob' person.changed? => true | def changed?
!changed_attributes.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed?\n return true if attributes_changed?\n return true if associations_changed?\n false\n end",
"def anything_changed?\n self.changed?;\n end",
"def changed?\r\n @changed\r\n end",
"def changed? \n @changed == true\n end",
"def changed?\n eav_attributes.e... | [
"0.7841411",
"0.7805559",
"0.77242327",
"0.76751775",
"0.7664443",
"0.75970185",
"0.7577152",
"0.75640935",
"0.7556537",
"0.75553644",
"0.7536387",
"0.7487006",
"0.74366003",
"0.7373964",
"0.73658395",
"0.736155",
"0.7353614",
"0.7322028",
"0.73213214",
"0.7303272",
"0.729897... | 0.81476855 | 0 |
List of attributes with unsaved changes. person.changed => [] person.name = 'bob' person.changed => ['name'] | def changed
changed_attributes.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dirty_attributes\n changed.inject({}) { |h, k| h[k] = attributes[k.to_s]; h }\n end",
"def attribute_changes\n attributes.changes\n end",
"def old_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs, (attr, values)|\n attrs[attr] = Array(values)... | [
"0.767864",
"0.7594541",
"0.7456186",
"0.74028325",
"0.7400371",
"0.738247",
"0.7292953",
"0.7292953",
"0.71321505",
"0.7045315",
"0.69875896",
"0.6927453",
"0.6923163",
"0.69194037",
"0.69055426",
"0.6852947",
"0.68510973",
"0.6839247",
"0.6811858",
"0.68000823",
"0.6796177"... | 0.7762246 | 0 |
Map of change attr => original value. | def changed_attributes
@changed_attributes ||= {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute_change(attr)\n [changed_attributes[attr], __send__(attr)] if attribute_changed?(attr)\n end",
"def changed_attributes\r\n attributes = HashWithIndifferentAccess.new\r\n \r\n if self.edited\r\n %w{rate name}.each do |attr|\r\n if self.different?(attr)\r\n at... | [
"0.7494222",
"0.72859603",
"0.6985771",
"0.6911646",
"0.68584967",
"0.68521315",
"0.6807654",
"0.6710726",
"0.67004097",
"0.6628179",
"0.6624247",
"0.6606708",
"0.6597065",
"0.6592544",
"0.6587304",
"0.65663356",
"0.64648664",
"0.63168347",
"0.627827",
"0.6222945",
"0.6202313... | 0.6876675 | 5 |
Map of fields that were changed when the model was saved | def previously_changed_attributes
@previously_changed || {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changed\n changed_attributes.keys\n end",
"def changed_attributes\n @_hr_changed.select{|k,v| v}.keys.inject({}) {|h,k| h[k]=self[k]; h}\n end",
"def changed_attributes\n @changed_attributes ||= {}\n end",
"def changed_attributes\n @changed_attributes ||= {}\n end"... | [
"0.77921546",
"0.75770986",
"0.75318646",
"0.75318646",
"0.7350283",
"0.72963554",
"0.7286818",
"0.7237441",
"0.7218302",
"0.7156053",
"0.7045327",
"0.7042039",
"0.70379734",
"0.69332266",
"0.68235713",
"0.6785227",
"0.6785227",
"0.6770816",
"0.67578137",
"0.67269593",
"0.670... | 0.70011276 | 13 |
Handle _changed? for +method_missing+. | def attribute_changed?(attr)
changed_attributes.include?(attr)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(meth, *args)\n return true if meth.to_s =~ /^observe_/\n super(meth, *args)\n end",
"def method_missing(s,*a,&b)\n if @change.respond_to?(s)\n @change.send(s,*a,&b)\n else\np caller\n super(s,*a,&b)\n end\n end",
"def method_missing(method, *args,... | [
"0.6670991",
"0.636693",
"0.6319467",
"0.62764865",
"0.62764865",
"0.62503624",
"0.62430996",
"0.62342477",
"0.6220851",
"0.6208148",
"0.61908674",
"0.61169964",
"0.60995716",
"0.6091576",
"0.6072047",
"0.6072047",
"0.6072047",
"0.60558724",
"0.60545266",
"0.60287637",
"0.599... | 0.5614873 | 73 |
Handle _change for +method_missing+. | def attribute_change(attr)
[changed_attributes[attr], __send__(attr)] if attribute_changed?(attr)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(s,*a,&b)\n if @change.respond_to?(s)\n @change.send(s,*a,&b)\n else\np caller\n super(s,*a,&b)\n end\n end",
"def method_missing(method, *args, &blk); end",
"def method_missing(method, *args, &block); end",
"def method_missing(method_name, *args); end",
"d... | [
"0.7242908",
"0.6715497",
"0.6700712",
"0.6682659",
"0.6682659",
"0.6596079",
"0.6514531",
"0.6505484",
"0.642805",
"0.642805",
"0.642805",
"0.642472",
"0.6400755",
"0.63942504",
"0.63942504",
"0.6283203",
"0.6249275",
"0.6249275",
"0.6249275",
"0.6249275",
"0.6241072",
"0.... | 0.0 | -1 |
Handle _was for +method_missing+. | def attribute_was(attr)
attribute_changed?(attr) ? changed_attributes[attr] : __send__(attr)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &blk); end",
"def method_missing(code, *args, &blk); end",
"def method_missing(code, *args, &blk); end",
"def method_missing(method, *args, &block); end",
"def method_missing(method_name, *args); end",
"def method_missing(method_name, *args); end",
"def method_missing(... | [
"0.7017379",
"0.70080364",
"0.70080364",
"0.69472265",
"0.69248617",
"0.69248617",
"0.6878383",
"0.68056005",
"0.68056005",
"0.68056005",
"0.68005127",
"0.6764524",
"0.6764524",
"0.6764524",
"0.6764524",
"0.67378074",
"0.67378074",
"0.6711907",
"0.6562585",
"0.64382684",
"0.6... | 0.0 | -1 |
Handle _will_change! for +method_missing+. | def attribute_will_change!(attr)
begin
value = __send__(attr)
value = value.duplicable? ? value.clone : value
rescue TypeError, NoMethodError
end
changed_attributes[attr] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(s,*a,&b)\n if @change.respond_to?(s)\n @change.send(s,*a,&b)\n else\np caller\n super(s,*a,&b)\n end\n end",
"def notify_will_change!\n collection_will_change!\n forward \"#{@key}_will_change!\"\n end",
"def method_missing(method, *args, &bl... | [
"0.6465724",
"0.6463111",
"0.6457731",
"0.63411677",
"0.61253506",
"0.6101245",
"0.60823923",
"0.60506755",
"0.60036474",
"0.5954052",
"0.5954052",
"0.59235495",
"0.58090526",
"0.57734054",
"0.57708335",
"0.57708335",
"0.57708335",
"0.5758504",
"0.5744094",
"0.5714543",
"0.57... | 0.57603586 | 17 |
Handle reset_! for +method_missing+. | def reset_attribute!(attr)
__send__("#{attr}=", changed_attributes[attr]) if attribute_changed?(attr)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(_object); end",
"def implementation_specific_reset\n end",
"def reset!; end",
"def reset!; end",
"def reset!; end",
"def reset!; end",
"def method_missing(*)\n invertable nil\n end",
"def method_missing(*)\n nil\n end",
"def reset()\n end",
"def reset ... | [
"0.67463493",
"0.669697",
"0.6474413",
"0.6474413",
"0.6474413",
"0.6474413",
"0.6420498",
"0.6377109",
"0.63261956",
"0.62792486",
"0.62376237",
"0.6176091",
"0.6176091",
"0.6176091",
"0.6176091",
"0.6176091",
"0.6176091",
"0.6176091",
"0.6176091",
"0.6176091",
"0.6176091",
... | 0.0 | -1 |
defines parameters for requests coming to associated object/controlelr typically defines all attributes and uses except option to exclude params on a perrole basis | def params
[<%= attributes.map {|a| ":#{a.name}" }.sort.join(', ') %>]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def special_params\n @special_params ||= %i[id class inherited border borders]\n end",
"def attributes\n restricted = defined?(self.class::NON_ATTRIBUTE_PARAMS) ? self.class::NON_ATTRIBUTE_PARAMS : []\n (self.class::PARAM_DEFAULTS.keys - restricted).index_with { |attr| send(attr) }.with_indiffe... | [
"0.65462554",
"0.653008",
"0.65085137",
"0.6378832",
"0.63426495",
"0.62787926",
"0.62751096",
"0.6258093",
"0.620023",
"0.61981285",
"0.6180928",
"0.61296237",
"0.61201835",
"0.6092262",
"0.6047472",
"0.6044823",
"0.6044618",
"0.6042112",
"0.60156167",
"0.60105413",
"0.60105... | 0.0 | -1 |
define methods for each of your user roles here allow [:actions] defines routes allowed for that role an optional block can be passed to allow to check things like ownership. allow_params options: [:except, :only] define params user role can change no options gives access to all of params except excludes any listed onl... | def guest
allow [:show]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grant_access_to(roles, options = {})\n roles = [roles].flatten\n options.assert_valid_keys(:if, :unless, :only, :except)\n unless (@roles_checked ||= false)\n @roles_checked = true\n before_filter :check_roles\n end\n\n # convert any actions into symbols\n [:only, :e... | [
"0.6831555",
"0.66316414",
"0.6601783",
"0.6473347",
"0.6429565",
"0.63434887",
"0.6280892",
"0.6277773",
"0.6170694",
"0.61237437",
"0.61189747",
"0.6075121",
"0.6069968",
"0.6030553",
"0.60155916",
"0.6006491",
"0.600602",
"0.5957388",
"0.5957388",
"0.5953452",
"0.5949513",... | 0.0 | -1 |
Find a Xrc::User object from its JID | def [](jid)
users.find {|user| user.jid == jid }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_user(jid)\n raise 'subclass must implement'\n end",
"def get_user(jid, create)\n # Drop the resource.\n parts = jid.to_s.split('/')\n jid = parts[0]\n\n user = @users[jid]\n if not user and create\n user = User.new(@sender, jid, invent_nick(jid))\n @users[jid] = user\n ... | [
"0.6811341",
"0.67778087",
"0.669432",
"0.6687507",
"0.65625185",
"0.6558736",
"0.6509119",
"0.6476827",
"0.64345974",
"0.6430528",
"0.63977504",
"0.6395609",
"0.6381199",
"0.63507867",
"0.63481677",
"0.63327926",
"0.63145566",
"0.6288898",
"0.6259413",
"0.6231807",
"0.622105... | 0.65561795 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_organization
if current_user.is_admin?
@organization = Organization.where(id: params[:id]).first
else
@organization = current_user.organizations.where(id: params[:id]).first
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def organization_params
params.require(:organization).permit(:name, :url, :is_list_anonymous_only, :is_list_apps_without_approval)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
move location by the object's velocity and time in s (delta) | def move(delta)
new_x = self.location.x + (self.vel.x * delta)
new_y = self.location.y + (self.vel.y * delta)
new_point = Point.new(new_x, new_y)
self.with_location(new_point)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move\n move_by get_incremental_position_for_velocity if (any_velocity?)\n decrease_velocity\n @has_increased_velocity_for = {\n x: false,\n y: false\n }\n @velocity_deltatime.update\n end",
"def move_position\n @x += @velocity_x\n @y += @veloci... | [
"0.7595662",
"0.75367427",
"0.7106651",
"0.7086015",
"0.7045481",
"0.6941803",
"0.68872017",
"0.6840577",
"0.6764095",
"0.67534924",
"0.67348486",
"0.6716526",
"0.6700696",
"0.66921175",
"0.666512",
"0.6623894",
"0.6554621",
"0.65433455",
"0.6535156",
"0.6523374",
"0.6513384"... | 0.74745715 | 2 |
Public: Initialize an ElevatorDispatcher. elevators Array, collection of elevators to apply strategies to request ElevatorRequest, request to get elevator for strategies Array, collection of strategies in the order they should be applied, strategies must respond to elevator(2) | def initialize(elevators, request, strategies: STRATAGIES)
@elevators = elevators
@request = request
@strategies = strategies
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(elevators, request)\n @elevators = elevators\n @request = request\n end",
"def initialize(number_of_elevators, number_of_floors, elevator_capacity,elevator_resting_floor)\n\t\tputs \"Setting up #{number_of_elevators} elevators of capacity #{elevator_capacity}\"\n\t\t@elevators =... | [
"0.69044286",
"0.6440673",
"0.6390678",
"0.6247129",
"0.59696406",
"0.5924433",
"0.57817227",
"0.55210614",
"0.5409741",
"0.5330671",
"0.52963126",
"0.5281374",
"0.52238274",
"0.5140569",
"0.5093607",
"0.50842535",
"0.5011755",
"0.50057226",
"0.49667242",
"0.49495995",
"0.483... | 0.777506 | 0 |
Public: Elevator, returns the best elevator from the first strategy that returns an elevator | def next_elevator
strategies.map { |strategy| strategy.elevator(elevators, request) }.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elevator\n elevators.sort_by { |e| e.stop_count }.first\n end",
"def choose_elevator\n elevator_scores = []\n\n for elevator in @column.elevator_list do\n \n # Initialize score to 0\n score = 0\n floor_difference = elevator.current_floor -... | [
"0.754317",
"0.716972",
"0.7127582",
"0.7083666",
"0.6557474",
"0.6535587",
"0.6509663",
"0.6052623",
"0.600095",
"0.5889116",
"0.57161623",
"0.55887204",
"0.5532533",
"0.5520634",
"0.54560584",
"0.54317284",
"0.54316324",
"0.5424037",
"0.540325",
"0.53334033",
"0.5294862",
... | 0.77099717 | 0 |
GET /proposals GET /proposals.json | def index
#@proposals = Proposal.where(date: Time.now.next_week.all_week)
@propositions = Proposal.a_traiter
if current_collaborator.role == "staffeur" or current_collaborator.role == "admin" or current_collaborator.role == "manager_dri"
@entites = Entity.all
elsif current_collaborator.role == "ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @proposals = listing.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def index\n @proposals = current_user.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json... | [
"0.80825967",
"0.80394423",
"0.781896",
"0.7662229",
"0.74502605",
"0.7016849",
"0.7016849",
"0.6909577",
"0.68931156",
"0.68671674",
"0.6863437",
"0.6778867",
"0.67788464",
"0.65703124",
"0.6505699",
"0.6408625",
"0.64041877",
"0.63257915",
"0.63080645",
"0.6293524",
"0.6287... | 0.0 | -1 |
GET /proposals/1 GET /proposals/1.json | def show
#@request = @proposal.requests.new date: @proposal.date, etat: "en attente"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @proposals = listing.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proposals }\n end\n end",
"def index\n @proposals = current_user.proposals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json... | [
"0.78322846",
"0.76696813",
"0.7424885",
"0.73820436",
"0.72366583",
"0.72366583",
"0.71750474",
"0.7022037",
"0.70091",
"0.6875907",
"0.67435455",
"0.6632",
"0.6587003",
"0.6506481",
"0.6462843",
"0.6460227",
"0.6460227",
"0.6460227",
"0.6389119",
"0.63839316",
"0.6378668",
... | 0.0 | -1 |
POST /proposals POST /proposals.json | def create
@proposal = Proposal.new(proposal_params)
authorize! :create, @proposal
respond_to do |format|
if @proposal.save
format.html { redirect_to creer_propositions_entity_path(@proposal.entity), notice: 'La proposition a été créée avec succès.' }
format.json { render action: 'sho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @proposal = listing.proposals.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proposal }\n end\n end",
"def create\n @proposal = Proposal.new(params[:proposal])\n\n respond_to do |format|\n if @proposal.save\n format.html... | [
"0.68781424",
"0.6849726",
"0.6847606",
"0.6782092",
"0.6738161",
"0.67307097",
"0.672717",
"0.67271096",
"0.66486466",
"0.6647748",
"0.6554859",
"0.6551712",
"0.65323824",
"0.64778584",
"0.6454547",
"0.64312893",
"0.6390646",
"0.63889146",
"0.63868827",
"0.6351745",
"0.63120... | 0.60200703 | 35 |
PATCH/PUT /proposals/1 PATCH/PUT /proposals/1.json | def update
respond_to do |format|
if @proposal.update(proposal_params)
format.html { redirect_to :back, notice: 'La proposition a été modifiée.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @proposal.errors, stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @proposal = listing.proposals.find(params[:id])\n\n respond_to do |format|\n if @proposal.update_attributes(params[:proposal])\n format.html { redirect_to @proposal, notice: 'Proposal was successfully updated.' }\n format.json { head :no_content }\n else\n format.h... | [
"0.75661427",
"0.74219793",
"0.73755383",
"0.7342709",
"0.71865106",
"0.71379",
"0.70454407",
"0.6934484",
"0.6930384",
"0.69296306",
"0.68937993",
"0.6859826",
"0.64791113",
"0.64432275",
"0.6212414",
"0.62065303",
"0.61849785",
"0.61497575",
"0.6133355",
"0.6133355",
"0.613... | 0.7149712 | 5 |
DELETE /proposals/1 DELETE /proposals/1.json | def destroy
@proposal.destroy
respond_to do |format|
format.html { redirect_to :back, notice: "La proposition a été supprimée"}
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @proposal = Proposal.find(params[:id])\n @proposal.destroy\n\n respond_to do |format|\n format.html { redirect_to proposals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @proposal = Proposal.find(params[:id])\n @proposal.destroy\n\n respond_to... | [
"0.7913258",
"0.7913258",
"0.77106977",
"0.7677443",
"0.7642395",
"0.7607506",
"0.7607506",
"0.7607506",
"0.74856466",
"0.74042296",
"0.7362166",
"0.73345053",
"0.7122501",
"0.6992418",
"0.69782144",
"0.69289726",
"0.6910627",
"0.6502949",
"0.6474011",
"0.647114",
"0.6455633"... | 0.70645434 | 13 |
Use callbacks to share common setup or constraints between actions. | def set_proposal
@proposal = Proposal.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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def proposal_params
params.require(:proposal).permit(:consultant_id, :date, :nbre_jour, :etat, :project_id, :entity_id)
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.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def paypal_recipient_accounts_params
params.require(:paypal_recipient_account).permit(:email)
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 |
config/initializers/linkedin.rb (for instance) LinkedIn.configure do |config| config.token = 'consumer_token' config.secret = 'consumer_secret' end elsewhere client = LinkedIn::Client.new | def configure
yield self
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client\n OAuth2::Client.new(\n API_KEY, \n API_SECRET, \n :authorize_url => \"/uas/oauth2/authorization?response_type=code\", #LinkedIn's authorization path\n :token_url => \"/uas/oauth2/accessToken\", #LinkedIn's access token path\n :site => \"https://www.linkedin.com\"\n ... | [
"0.8078429",
"0.8078429",
"0.80485946",
"0.7902969",
"0.7888239",
"0.77124923",
"0.77101547",
"0.7103388",
"0.7063797",
"0.69138104",
"0.67257774",
"0.64789",
"0.64596236",
"0.63723475",
"0.6368118",
"0.62858766",
"0.62509626",
"0.6218299",
"0.6198164",
"0.6191681",
"0.618097... | 0.0 | -1 |
Build XML from transform object, build XML | def buildXML(transform_obj)
xml_string = '<PoortegoTransformResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="' + "#{ENV['POORTEGO_LOCAL_BASE']}/poortego/lib/core/poortego_transform/xml/PoortegoTransformResponse.xsd" + '">'
xml_string << '<ResponseData>'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(xml)\n xml = xml.root if xml.is_a? Nokogiri::XML::Document\n xml = Nokogiri::XML(xml, nil, nil, Nokogiri::XML::ParseOptions.new).root unless xml.is_a? Nokogiri::XML::Node\n @document = xml.document\n generate_element(xml)\n end",
"def to_xml\n builder.target!\n en... | [
"0.6987688",
"0.64223707",
"0.6318297",
"0.629699",
"0.61424035",
"0.6136204",
"0.6131905",
"0.6089314",
"0.6089095",
"0.60478884",
"0.5981049",
"0.59750676",
"0.5964036",
"0.5955939",
"0.5955939",
"0.5955939",
"0.5955939",
"0.5955939",
"0.5955939",
"0.59490424",
"0.5945658",... | 0.7577496 | 0 |
Validate XML validate XML against XSD | def validateXML(xml_string)
begin
xsd_filename = "#{ENV['POORTEGO_LOCAL_BASE']}/poortego/lib/core/poortego_transform/xml/PoortegoTransformResponse.xsd"
document = LibXML::XML::Document.string(xml_string)
schema = LibXML::XML::Schema.new(xsd_filename)
result = document.validate_schema(s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_xml(xml)\n doc = Nokogiri.XML(xml)\n raise ArgumentError, \"XML is not well formed: #{xml}\" unless doc.errors.empty?\n end",
"def validate_xml f\n\n # make a document builder\n factory = javax.xml.parsers.DocumentBuilderFactory.newInstance\n factory.setNamespaceAware true\n ... | [
"0.7584681",
"0.74399275",
"0.7327663",
"0.71916574",
"0.7182752",
"0.70780563",
"0.6938871",
"0.6913833",
"0.6769541",
"0.6768296",
"0.6588914",
"0.6578461",
"0.65401983",
"0.65176123",
"0.64983344",
"0.6439662",
"0.6288611",
"0.6212872",
"0.6211298",
"0.6136836",
"0.6109457... | 0.6943006 | 6 |
Parse XML from XML, build transform object | def parseXML()
@transform = PoortegoTransform.new('ParsedResponse')
result_href = XmlSimple.xml_in(@xml_response.to_s)
unless (result_href.has_key?('ResponseData'))
return
end
(result_href['ResponseData'])[0].each do |response_key, response_val|
if (response_key == 'Entities')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(xml)\n xml = xml.root if xml.is_a? Nokogiri::XML::Document\n xml = Nokogiri::XML(xml, nil, nil, Nokogiri::XML::ParseOptions.new).root unless xml.is_a? Nokogiri::XML::Node\n @document = xml.document\n generate_element(xml)\n end",
"def parse_xml(xml)\n new from_xml(xml)... | [
"0.7297005",
"0.6833989",
"0.6604294",
"0.6519266",
"0.64041835",
"0.6317666",
"0.6285617",
"0.6107818",
"0.60988224",
"0.6096676",
"0.6077044",
"0.6020577",
"0.5996376",
"0.5956357",
"0.59484977",
"0.58713436",
"0.5849294",
"0.58468926",
"0.5752779",
"0.5747325",
"0.5745584"... | 0.622459 | 7 |
Parse entities parsed out in XML Simple | def parse_entities_hash(entity_hash_arrays)
entity_hash_arrays.each do |entity_hash_array|
## Do an existance check first
unless (entity_hash_array.has_key?("Entity"))
next
end
# Loop through each entity in the entities block
(entity_hash_array["Entity"]).each do ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_html_entity; end",
"def test_entities\n\tsourceWithoutPreproc = '<!DOCTYPE x [\n<!ENTITY example \"<p>An ampersand (&#38;) may be escaped numerically (&#38;#38;) or with a general entity (&amp;).</p>\" >\n]>'\n\tbody = \"\\n<x>&example;</x>\"\n\n\ttoker = NQXML::Tokenizer.new(\"<?xml versio... | [
"0.7023182",
"0.65706086",
"0.6381833",
"0.6293518",
"0.62660426",
"0.61515474",
"0.6119305",
"0.60115916",
"0.5974038",
"0.59332836",
"0.589636",
"0.5848394",
"0.5835993",
"0.5817446",
"0.5751252",
"0.5684451",
"0.5534698",
"0.553087",
"0.54830605",
"0.5432671",
"0.5431917",... | 0.49344364 | 63 |
Parse links parsed out of XML Simple | def parse_links_hash(link_hash_arrays)
link_hash_arrays.each do |link_array|
unless (link_array.has_key?("Link"))
next
end
# Loop thru each link pulled from XML
(link_array["Link"]).each do |link_hash|
# Select or Insect Link
puts "Searching for l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_link; end",
"def parse_links\n @body.scan(@@link_re) do |x|\n m = Regexp.last_match\n type = 'link'\n from = self\n text = m['text_or_to']\n to = @twine.passage_from_name(m['to'] ? m['to'] : m['text_or_to'])\n @links << Link.new(from, to, text, type)\n end\n end",
... | [
"0.7352725",
"0.6959107",
"0.66720474",
"0.6669495",
"0.65669614",
"0.65559393",
"0.65552443",
"0.65549266",
"0.6547412",
"0.6525323",
"0.6521145",
"0.6398394",
"0.63629824",
"0.6304137",
"0.62767965",
"0.62366366",
"0.6187842",
"0.6187842",
"0.61581904",
"0.6145409",
"0.6102... | 0.0 | -1 |
GET /api/v1/users/1/requests todo: check if really needed | def index
user = User.find_by(id: params[:user_id])
return respond_with contributions: [], status: :not_found if user.nil?
contributions = user.contributions
respond_with contributions: contributions, status: :ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friend_requests\n get(\"users/requests\").requests\n end",
"def my_request\n request = Request.where(user_id: @current_user.id)\n if request\n render json: {\n status: 'success',\n message: 'Requests fo... | [
"0.74436146",
"0.65620875",
"0.6558959",
"0.6521776",
"0.6486022",
"0.63911414",
"0.6359928",
"0.63291925",
"0.63086843",
"0.6263171",
"0.6254991",
"0.62082344",
"0.6162765",
"0.6155497",
"0.6126545",
"0.61244434",
"0.6113277",
"0.609709",
"0.60652614",
"0.60584795",
"0.60285... | 0.0 | -1 |
todo: refactor POST /api/v1/rides/:ride_id/requests | def create
if params.has_key?(:unbound_contributions)
user = User.find_by(id: params[:user_id])
ride = Ride.find_by(id: params[:ride_id])
price = ride[:price]
distance = user.rides.find_by(id: params[:ride_id])[:realtime_km]
project_id = ride.project[:id]
contribution_amount = p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ride_request = RideRequest.new(ride_request_params)\n\n respond_to do |format|\n if @ride_request.save\n format.html { redirect_to @ride_request, notice: 'Ride request was successfully created.' }\n format.json { render :show, status: :created, location: @ride_request }\n ... | [
"0.6719098",
"0.6681743",
"0.6672126",
"0.6657575",
"0.63996756",
"0.6068679",
"0.5927328",
"0.59164673",
"0.58571476",
"0.58029765",
"0.5794537",
"0.5786327",
"0.5762345",
"0.5758499",
"0.57202893",
"0.5708873",
"0.5683855",
"0.56494415",
"0.5625726",
"0.5622609",
"0.5609082... | 0.6313678 | 5 |
redirects to stored location (or to the default). | def redirect_back_or(default)
redirect_to(session[:forwarding_url] || default)
session.delete(:forwarind_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_to_stored(default='/')\n return_to = session[:return_to] || default\n session[:return_to] = nil\n redirect return_to\n end",
"def redirect_to_stored_location_or(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end",
"def redirect_ba... | [
"0.8107985",
"0.8034801",
"0.7636486",
"0.76222956",
"0.7412404",
"0.7341673",
"0.7290278",
"0.7163519",
"0.7152072",
"0.7131469",
"0.7069455",
"0.704326",
"0.7033379",
"0.70246804",
"0.70125157",
"0.7009527",
"0.7002724",
"0.69978774",
"0.698725",
"0.6977732",
"0.69768393",
... | 0.69109035 | 26 |
Runs the test case. | def test_setNamedItemNS01
doc = nil
elementList = nil
anotherElement = nil
anotherMap = nil
arg = nil
testAddress = nil
map = nil
setNode = nil
doc = load_document("staffNS", true)
elementList = doc.getElementsByTagName("address")
anotherElement = elementList.item(2)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n print_banner\n @test_plan.each do |plan|\n found_nodes = nodes(plan)\n if found_nodes\n found_nodes.each { |node| execute_plan_tests(node, plan) }\n end\n end\n exit @ret_code\n end",
"def run\n\n @startDate = Time.now.to_i * 1000\n @status... | [
"0.7799092",
"0.7670545",
"0.75712216",
"0.75627315",
"0.75226235",
"0.75201446",
"0.74722594",
"0.7330742",
"0.7330742",
"0.72492516",
"0.72388816",
"0.72313887",
"0.72023034",
"0.7136023",
"0.70817155",
"0.7047509",
"0.7020568",
"0.6938718",
"0.6918842",
"0.6867642",
"0.685... | 0.0 | -1 |
Gets URI that identifies the test. | def targetURI
"http://www.w3.org/2001/DOM-Test-Suite/tests/Level-1/setNamedItemNS01"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getURI()\n return @uri.to_s\n end",
"def uri\n @uri.to_s\n end",
"def uri\n uri_for({}, nil)\n end",
"def uri\n return @uri\n end",
"def uri\n return @uri\n end",
"def uri\n @uri\n end",
"def uri\n @uri\n end"... | [
"0.7386197",
"0.7350408",
"0.7149793",
"0.7136326",
"0.7136326",
"0.7112705",
"0.7112705",
"0.7086451",
"0.7063769",
"0.69867074",
"0.6924332",
"0.6924332",
"0.6910681",
"0.6910681",
"0.6859813",
"0.6830608",
"0.6805477",
"0.67830634",
"0.67632747",
"0.67632747",
"0.6750586",... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.