query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Gets the gracePeriodInMinutes property value. The number of minutes to wait before restarting the device after an app installation. | def grace_period_in_minutes
return @grace_period_in_minutes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grace_period\n config['grace_period'] || 60\n end",
"def grace_period_in_minutes=(value)\n @grace_period_in_minutes = value\n end",
"def grace_period\n Integer(ENV[\"BUDDY_CHECK_GRACE_PERIOD\"].presence || \"4\").hours\n end",
"def grace_period\n (ENV[... | [
"0.7927201",
"0.7733176",
"0.75255436",
"0.7262469",
"0.6507338",
"0.62577146",
"0.5999537",
"0.59116185",
"0.5834151",
"0.57465625",
"0.57101595",
"0.5709149",
"0.5608274",
"0.55790067",
"0.5444113",
"0.53648925",
"0.53648925",
"0.53526986",
"0.53356713",
"0.53356713",
"0.53... | 0.852647 | 0 |
Sets the gracePeriodInMinutes property value. The number of minutes to wait before restarting the device after an app installation. | def grace_period_in_minutes=(value)
@grace_period_in_minutes = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grace_period\n config['grace_period'] || 60\n end",
"def grace_period_in_minutes\n return @grace_period_in_minutes\n end",
"def grace_period\n Integer(ENV[\"BUDDY_CHECK_GRACE_PERIOD\"].presence || \"4\").hours\n end",
"def grace_period\n (ENV[\"BUDDY_C... | [
"0.72385937",
"0.6891492",
"0.63716114",
"0.6176589",
"0.5830609",
"0.54698396",
"0.53761536",
"0.5191597",
"0.51391387",
"0.50907636",
"0.5034328",
"0.49405888",
"0.4938738",
"0.48332992",
"0.4831327",
"0.48058861",
"0.47441655",
"0.47361067",
"0.46910712",
"0.4637752",
"0.4... | 0.7802341 | 0 |
Gets the restartNotificationSnoozeDurationInMinutes property value. The number of minutes to snooze the restart notification dialog when the snooze button is selected. | def restart_notification_snooze_duration_in_minutes
return @restart_notification_snooze_duration_in_minutes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restart_notification_snooze_duration_in_minutes=(value)\n @restart_notification_snooze_duration_in_minutes = value\n end",
"def minutes\n _nudge[1]\n end",
"def countdown_display_before_restart_in_minutes\n return @countdown_display_before_restart_in_minutes\n ... | [
"0.80405897",
"0.58074635",
"0.57878417",
"0.57857066",
"0.5722918",
"0.5672198",
"0.56698054",
"0.5646157",
"0.55132204",
"0.5461743",
"0.5448392",
"0.54086286",
"0.54086286",
"0.54074484",
"0.54024965",
"0.54024965",
"0.5375624",
"0.53550667",
"0.535254",
"0.53249764",
"0.5... | 0.86595196 | 0 |
Sets the restartNotificationSnoozeDurationInMinutes property value. The number of minutes to snooze the restart notification dialog when the snooze button is selected. | def restart_notification_snooze_duration_in_minutes=(value)
@restart_notification_snooze_duration_in_minutes = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restart_notification_snooze_duration_in_minutes\n return @restart_notification_snooze_duration_in_minutes\n end",
"def countdown_display_before_restart_in_minutes=(value)\n @countdown_display_before_restart_in_minutes = value\n end",
"def restart_count=(v... | [
"0.7709535",
"0.54065514",
"0.5065944",
"0.50300866",
"0.48830426",
"0.48774555",
"0.48566982",
"0.48280942",
"0.48192656",
"0.47637227",
"0.47637227",
"0.47322124",
"0.46878687",
"0.46627617",
"0.46418434",
"0.45728937",
"0.45712686",
"0.45511588",
"0.45501104",
"0.45446718",
... | 0.84445095 | 0 |
Optionally produces a unique key to ensure uniqueness of this job. See the Generators module methods for example job_id generators you can use. | def create_job_id
application_job_overrides_method!(__method__)
# default implementation for framework jobs
Generators.generate_uuid(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_key\n @unique_key ||= section.identifier\n end",
"def job_identity(args)\n Digest::SHA1.hexdigest([ Time.now.to_f, rand, self, args ].join)\n end",
"def job_key\n Digest::MD5.hexdigest(path)\n end",
"def key(name)\n @unique_key = name\n end",
"def generate... | [
"0.69451106",
"0.67873806",
"0.6724584",
"0.6546879",
"0.65102255",
"0.6479524",
"0.62474793",
"0.6236482",
"0.621921",
"0.620373",
"0.61658543",
"0.6165188",
"0.6146043",
"0.61419886",
"0.6134388",
"0.6120992",
"0.60996795",
"0.6059127",
"0.6036548",
"0.6024705",
"0.60245883... | 0.69101393 | 1 |
Example: 34,592,129,909 => [3,4,5,9,2,1,2,9,9,0,9] | def num_to_array num
array = []
div = 100000
while div >= 1
if (num / div) > 0
digit = num / div
array << digit
num = num - (div * digit)
end
div = div / 10
end
return array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digit_list(num)\n arr = []\n divisor = 10**((num.to_s.length) - 1)\n \n while divisor >= 1\n digit = num/divisor\n arr << (num / divisor)\n num -= digit*divisor\n\n divisor = divisor / 10\n end\n \n arr\nend",
"def given\n [6,5,3,1,8,7,2,3]\nend",
"def cracklepop_numbers(from, to)\n (f... | [
"0.6796014",
"0.67468256",
"0.66053814",
"0.658939",
"0.65767604",
"0.6517231",
"0.6487109",
"0.6483543",
"0.64770216",
"0.6473975",
"0.64121974",
"0.64044446",
"0.6392021",
"0.6385052",
"0.6381544",
"0.6380667",
"0.63645804",
"0.63514507",
"0.63497907",
"0.6341346",
"0.63396... | 0.67473537 | 1 |
Creates a new GetDecksResponse | def initialize(response)
handle_errors(response)
JSON.parse(response.body).each do |key, value|
if key == 'decks'
# Keep the API response count, it will differ when invalid decks are stripped
@decks_count = value.size
instance_variable_set(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend",
"def create_response(request)\n response = Response.new\n end",
"def initialize(response)\n handle_errors(response)\n\n @deck = ZombieBattleground::Api::Models::Deck.new(JSON.parse(response.body))\n ... | [
"0.5612215",
"0.5533734",
"0.5371256",
"0.52257246",
"0.5163544",
"0.515944",
"0.51577",
"0.5107998",
"0.5074359",
"0.50703037",
"0.50401974",
"0.50234216",
"0.5021981",
"0.4982436",
"0.49554443",
"0.49522188",
"0.49125293",
"0.49082685",
"0.48954833",
"0.4892001",
"0.4892001... | 0.5753592 | 0 |
Validator for decks in decks | def decks_contains_valid_decks
@decks.each do |deck|
next if deck.is_a?(ZombieBattleground::Api::Models::Deck) &&
deck.valid? &&
deck.errors.size.zero?
errors.add(:decks, 'decks must be an array of Deck')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_invalid_decks\n @decks.select! do |deck|\n deck.is_a?(ZombieBattleground::Api::Models::Deck) &&\n deck.valid? &&\n deck.errors.size.zero?\n end\n end",
"def decks_is_an_array_of_deck\n unless @decks.is_a?(Array)\n errors... | [
"0.6536624",
"0.6467546",
"0.6031117",
"0.5980525",
"0.57976454",
"0.5779107",
"0.57296395",
"0.57295007",
"0.5706486",
"0.56935155",
"0.56799835",
"0.5678328",
"0.56366324",
"0.5572912",
"0.553737",
"0.55199265",
"0.5515637",
"0.5477121",
"0.544545",
"0.54299545",
"0.5417221... | 0.80109626 | 0 |
Removes invalid vards from deck | def remove_invalid_decks
@decks.select! do |deck|
deck.is_a?(ZombieBattleground::Api::Models::Deck) &&
deck.valid? &&
deck.errors.size.zero?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_invalid_codes(guess)\n @valid_codes.filter! { |code| code.check_code(guess) == [@black_pegs, @white_pegs] }\n puts \"#{@valid_codes.count} possible codes left\"\n end",
"def find_unseen\n unseen.replace(full_deck)\n (my_hand + op_hand + my_lands.values +\n op_lands.values + discards.... | [
"0.61292017",
"0.6067254",
"0.60121524",
"0.5808344",
"0.5545818",
"0.5521131",
"0.5516175",
"0.55056226",
"0.5500904",
"0.5476033",
"0.54756474",
"0.5460172",
"0.5446137",
"0.5412514",
"0.5403982",
"0.53832686",
"0.53735137",
"0.5367933",
"0.5349089",
"0.5344778",
"0.5327373... | 0.6802469 | 0 |
Mock a crappy remote API call that could toss an exception on some upstream error. It also mocks a return value of ':pending' when it's not complete and returns ':happy' when it's complete. | def crappy_api_call
$count += 1
# First two calls fail
raise "OH SNAP" if $count < 3
# Next few calls say pending
return :pending if $count < 5
# Then finally done
return :happy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_WAPI_do_request_rest_client_error_417\n\n\n stub_request(:get, \"https://start/hey\").\n with(:headers => {'Accept' => 'application/json', 'Accept-Encoding' => 'gzip, deflate', 'Authorization' => 'Bearer sweet!'}).\n to_return(:status => 417, :body => \"\", :headers => {})\n\n a = Hash... | [
"0.6178254",
"0.6141393",
"0.60216916",
"0.59456843",
"0.5910256",
"0.5890731",
"0.5865106",
"0.58541054",
"0.5812357",
"0.57681704",
"0.57539564",
"0.57478607",
"0.57234883",
"0.57191676",
"0.56989217",
"0.56568074",
"0.56478715",
"0.56476104",
"0.5606398",
"0.55973184",
"0.... | 0.67977315 | 0 |
Open the bookmarks and return an REXML::Document. If the cache option is provided, the document is loaded from the localpath specified. | def open
require 'rexml/document'
xml =
if cache && File.exist?(cache)
File.read(cache)
else
request :all
end
File.open(cache, 'wb') { |io| io.write(xml) } if cache
REXML::Document.new(xml)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(path)\n document = parse(File.read(path))\n document.path = path\n document\n end",
"def get_html\n print \"Getting doc...\"\n if File.size?(@cache)\n html = File.read(@cache)\n else\n html = open(URL).read\n IO.write(@cache, html)\n end\n puts \"d... | [
"0.5680514",
"0.55620104",
"0.54649127",
"0.54545224",
"0.5450304",
"0.5341162",
"0.5259545",
"0.5218658",
"0.5166951",
"0.5152344",
"0.51081336",
"0.50645673",
"0.50215924",
"0.499534",
"0.49784198",
"0.49608606",
"0.4945149",
"0.49401587",
"0.49323162",
"0.49273184",
"0.492... | 0.72416097 | 0 |
Determine if any bookmarks have been updated since the time specified. | def updated_since?(time)
time < last_updated_at
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stale?(time = Time.now)\n updated_at < time\n end",
"def has_beeen_updated_recently?( update_time )\n now = Time.now.utc\n ( (! update_time.nil?) && (update_time.year == now.year) && (update_time.month == now.month) && (update_time.day == now.day) &&\n (update_time.hour == now.hour) && (up... | [
"0.70125854",
"0.6957735",
"0.68587834",
"0.685865",
"0.6844506",
"0.6724337",
"0.6705332",
"0.6684811",
"0.6628862",
"0.6596946",
"0.6590277",
"0.653508",
"0.6528973",
"0.6457132",
"0.6413472",
"0.6410814",
"0.6402752",
"0.63746107",
"0.6356492",
"0.6343933",
"0.6343933",
... | 0.741279 | 0 |
Yield each bookmark to the block that requires synchronization. The :since option may be specified to indicate the time of the most recently updated bookmark. Only bookmarks whose time is more recent than the time specified are yielded. | def synchronize(options={})
if since = options[:since]
since.utc
return false unless updated_since?(since)
else
since = Time.at(0)
since.utc
end
open.elements.each('posts/post') do |el|
attributes = el.attributes
time = Time.iso8601(attributes['tim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bookmark_query(q,&blk)\n response = query(q)\n bookmark = response[\"bookmark\"]\n docs = response[\"docs\"]\n\n until !docs || docs.empty?\n yield docs\n q[\"bookmark\"] = bookmark\n response = query(q)\n bookmark = response[\"bookmark\"]\n ... | [
"0.5677542",
"0.5362584",
"0.5287357",
"0.5209643",
"0.5123315",
"0.50758433",
"0.49724126",
"0.49338025",
"0.49207413",
"0.48885435",
"0.4852993",
"0.47811237",
"0.47484133",
"0.4718143",
"0.4698666",
"0.46631137",
"0.46602684",
"0.46602684",
"0.46602684",
"0.46580476",
"0.4... | 0.5633354 | 1 |
Initializes all keys to `UNSET_VALUE` | def initialize
super
keys.each do |key|
set(key, self.class::UNSET_VALUE)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear\n keys.each do |k|\n Jeapie.instance_variable_set(\"@#{k}\", nil)\n end\n end",
"def reset_initial_values\n @initial_values.clear if @initial_values\n @missing_initial_values.clear if @missing_initial_values\n end",
"def reset!\n @significant_keys = nil\n @orders = ... | [
"0.69660556",
"0.6755322",
"0.67488617",
"0.6719314",
"0.66499686",
"0.66154104",
"0.6439547",
"0.64275587",
"0.64091766",
"0.63930345",
"0.6391282",
"0.6360693",
"0.6350334",
"0.63373464",
"0.6332697",
"0.6281231",
"0.6239432",
"0.6217614",
"0.6217614",
"0.621136",
"0.619826... | 0.8348679 | 0 |
Returns a configuration line/stanza for the specified key and value. The returned line should include linefeed `\\n` if not empty. The default implementations returns "=\\n". | def config_for(key, value)
"#{key}=#{value && value}\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_line(value)\n config_value = AppConfig.config[value]\n if config_value.kind_of? Mash\n config_value = config_value.to_hash\n end\n str = [config_value.inspect].flatten.first.split(\"\\n\").first\n if str.length > VALUE_LENGTH\n str = str[0..(VALUE_LENGTH - 4)] + '...'\n end\n ... | [
"0.6334932",
"0.595716",
"0.55967873",
"0.5538644",
"0.5380671",
"0.5348368",
"0.5344652",
"0.5301884",
"0.52344185",
"0.5225823",
"0.51633716",
"0.513886",
"0.5133486",
"0.512706",
"0.5108123",
"0.5065678",
"0.50303304",
"0.50193423",
"0.50114393",
"0.49856082",
"0.49671972"... | 0.6606757 | 0 |
This gets a game cliche from a list of cliches in a text file | def get_game_cliche
#initialize variable
chosen_line = nil
#Get the cliche
File.foreach("game_cliches.txt").each_with_index do |line, number|
chosen_line = line if rand < 1.0/(number+1)
end
return chosen_line.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_file(file)\n file_lines_array = File.readlines(file)\n file_characters_array = []\n file_lines_array.each do |line|\n file_characters_array << line\n end\n file_characters_array.map! do |character|\n character = @dictionary[character]\n end\n morse_code = file_characters_arr... | [
"0.60776716",
"0.58314663",
"0.5727392",
"0.5727392",
"0.56803805",
"0.55513674",
"0.5522171",
"0.55120814",
"0.53398526",
"0.5279201",
"0.52735335",
"0.52666813",
"0.52592844",
"0.52514553",
"0.52434874",
"0.51947075",
"0.516467",
"0.5110767",
"0.5105512",
"0.50975233",
"0.5... | 0.7069886 | 0 |
This gets a business model from a list in a text file | def get_business_model
#initialize variable
chosen_line = nil
#Get the cliche
File.foreach("business_models.txt").each_with_index do |line, number|
chosen_line = line if rand < 1.0/(number+1)
end
return chosen_line.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_from_file(filename = \"listsave\")\n\t\tIO.readlines(filename).each do |line|\n\t\t\tadd_task(Task.new(line.chomp))\n\t\tend\n\tend",
"def read_models\n File.readlines(\"car-models.txt\").each do |line|\n @modles_hash[line[0,1]] = line.partition('=').last.chomp\n end\n # puts \"@modles_has... | [
"0.5695746",
"0.5681048",
"0.5620122",
"0.5601672",
"0.55808204",
"0.55757797",
"0.5550483",
"0.5545499",
"0.5530213",
"0.54000396",
"0.53902805",
"0.53765845",
"0.5367506",
"0.53501093",
"0.5347121",
"0.53337157",
"0.53337157",
"0.5333076",
"0.5310881",
"0.5310881",
"0.52765... | 0.6435022 | 0 |
This gets a game genre from a list in a text file | def get_game_genre
#initialize variable
chosen_line = nil
#Get the cliche
File.foreach("game_genres.txt").each_with_index do |line, number|
chosen_line = line if rand < 1.0/(number+1)
end
return chosen_line.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_genre_list()\n File.open('./genre_list')\nend",
"def load_genre(file_name)\n\t\tindata = []\n\t\tCSV.foreach(\"#{file_name}\", col_sep: \"|\") do |row|\n\t\t\tgenre_for_movie = [row[5].to_i,row[6].to_i,row[7].to_i,row[8].to_i,row[9].to_i,row[10].to_i,row[11].to_i,row[12].to_i,row[13].to_i,row[14].to_i,... | [
"0.692953",
"0.67731315",
"0.6715894",
"0.6458827",
"0.6436415",
"0.6399445",
"0.63710093",
"0.62383497",
"0.6196342",
"0.6195388",
"0.61871946",
"0.6115621",
"0.6111598",
"0.60685605",
"0.6032322",
"0.60173255",
"0.5997231",
"0.5992747",
"0.59678346",
"0.5966975",
"0.587621"... | 0.7423634 | 0 |
The top left of checkerboard should always be filled with [r] You should assume the size input is always an integer You should not assume the size input is always positive number Input size of <= 0 will return an empty string | def checkerboard(size)
for i in 1..size do
i % 2 == 0 ? checker=0 : checker=1
for j in 1..size do
if checker == 1
print "[r]"
checker = 0
else
print "[b]"
checker = 1
end
end
puts "\n"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkerboard(size)\n return \"\" if size <= 0\n completed_board = \"\"\n\n first_line = size.times do |n|\n if n.odd?\n completed_board << \"[r]\"\n else\n completed_board << \"[b]\"\n end\n end\n\n # binding.pry\nend",
"def board(empty_square_char = '.')\n board_str = \" ABCDEFGH... | [
"0.7710083",
"0.67398125",
"0.66570306",
"0.64006877",
"0.63859284",
"0.63433677",
"0.6326673",
"0.63063467",
"0.6300146",
"0.62883115",
"0.62721723",
"0.6269958",
"0.62586683",
"0.6236139",
"0.6236139",
"0.62247515",
"0.62210417",
"0.6220166",
"0.6217392",
"0.6162387",
"0.61... | 0.7139748 | 1 |
The number of alarms. Returns an Integer. | def count
@alarms.objects.find { |o| o.name == "count" }.val
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count\n @monkeys.count\n end",
"def aps_notification_count_for_application(application_name)\n redis.llen(aps_application_queue_key(application_name)).to_i\n end",
"def num_missed_calls\n missed_contacts.count\n end",
"def get_at_words_count\n @redis.llen(\"store:ats\").to_... | [
"0.6462344",
"0.628732",
"0.5995112",
"0.5980965",
"0.5917086",
"0.5846684",
"0.5811305",
"0.5753843",
"0.5741786",
"0.5738726",
"0.5713813",
"0.5709746",
"0.56947064",
"0.56912374",
"0.56524205",
"0.5648412",
"0.56226647",
"0.5620281",
"0.5602073",
"0.5579684",
"0.55703425",... | 0.7122949 | 0 |
Query alarms. options A Hash of options: :start A DateTime instance describing the earliest time to query history for. :end A DateTime instance describing the latest time to query history for. | def query options
from = options.fetch :start
to = options.fetch :end
query = @alarms.objects.find { |o| o.name == "query" }
filter = OBIX::Builder.new do
obj do
abstime name: "start", val: from.iso8601
abstime name: "end", val: to.iso8601
end
end.ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query options\n from = options.fetch :start\n to = options.fetch :end\n\n query = @history.objects.find { |o| o.name == \"query\" }\n\n filter = OBIX::Builder.new do\n obj do\n abstime name: \"start\", val: from.iso8601\n abstime name: \"end\", val: to.iso8601\n ... | [
"0.7354929",
"0.5985333",
"0.58743316",
"0.58070326",
"0.5764716",
"0.5755746",
"0.5753159",
"0.5711461",
"0.56931704",
"0.5642877",
"0.5606174",
"0.5584435",
"0.54797727",
"0.54386693",
"0.54228055",
"0.54051065",
"0.53797007",
"0.53651226",
"0.5352223",
"0.534723",
"0.53454... | 0.8652422 | 0 |
returns the measure record associated with the device | def measure_for_device(device_id, measure_id)
device = Device.where(:name => device_id)
# use first on device to get record from association, then
# use first again on measures to get measure record
device.first.measures.where(:name => measure_id).first if device.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure\n Measure.new(1, self)\n end",
"def get_cell_measures(cell)\n query_cell_info '/cell/getMeasures', cell\n end",
"def get_patient_result(patient_id)\n qm = QualityMeasure.new(@measure_id, @sub_id)\n measure = Builder.new(get_db, qm.definition, @parameter_values)\n ... | [
"0.6254628",
"0.62511176",
"0.6113168",
"0.6065451",
"0.6030521",
"0.6027722",
"0.5988547",
"0.5962184",
"0.5931976",
"0.59317654",
"0.59277445",
"0.5884901",
"0.5878865",
"0.58713424",
"0.5865355",
"0.586038",
"0.5829321",
"0.58077085",
"0.5791861",
"0.57839763",
"0.5758343"... | 0.77113473 | 0 |
write a function to search target in nums. If target exists, then return its index, otherwise return 1. Template 1 is the most basic and elementary form of Binary Search. It is the standard Binary Search Template that most high schools or universities use when they first teach students computer science. Template 1 is u... | def search(nums, target)
left = 0
right = nums.length - 1
while left <= right
pivot = left + (right - left) / 2
return pivot if nums[pivot] == target
if target < nums[pivot]
right = pivot - 1
else
left = pivot + 1
end
end
-1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n mid = (start_ind + last_ind) / 2\n\n #having condition as start_ind + 1 < last_ind will be helpful in find first/last position in function\n #also avoid infinite loop when the array ... | [
"0.86517495",
"0.8379405",
"0.81462884",
"0.8144708",
"0.794463",
"0.78020096",
"0.7797183",
"0.77851063",
"0.7719615",
"0.77196014",
"0.7711477",
"0.7692617",
"0.7687563",
"0.76829803",
"0.7676202",
"0.76682353",
"0.7660379",
"0.7660379",
"0.7649494",
"0.76413953",
"0.762154... | 0.86788327 | 0 |
Adds a handler to the reactor. A handler is a callable taking a single argument, the message. | def add_handler(handler)
@handlers << handler
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_message_handler(&block)\n @message_handlers << block\n end",
"def add_handler(name, handler)\n subscribe(name)\n subscriptions[name].handlers << handler\n end",
"def handler\n @handlers.push(proc do |msg|\n yield msg\n end)\n end",
"def add_handler(new_handler)\n ... | [
"0.7231306",
"0.70802605",
"0.6918257",
"0.67517906",
"0.6619087",
"0.6497206",
"0.6444436",
"0.64262986",
"0.63075036",
"0.6248153",
"0.621285",
"0.6183933",
"0.617584",
"0.61286837",
"0.5891722",
"0.5729914",
"0.5725149",
"0.5690471",
"0.56413794",
"0.5638347",
"0.5552255",... | 0.7232581 | 0 |
GET /recovery_passwords GET /recovery_passwords.json | def index
@recovery_passwords = RecoveryPassword.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @passwords = current_user.passwords\n end",
"def password\n respond_to do |format|\n format.html\n format.json { render json: { :password => get_password } }\n end\n end",
"def forgot_password\n user = validate_user(params['forgot_username'])\n\n devices = get_mfa_devices... | [
"0.6642948",
"0.65952843",
"0.6493781",
"0.62614274",
"0.62520427",
"0.62235296",
"0.6222507",
"0.6112147",
"0.605353",
"0.6041732",
"0.6038329",
"0.60291475",
"0.59056455",
"0.59056455",
"0.58997273",
"0.5888444",
"0.58786786",
"0.58556145",
"0.5850409",
"0.5814593",
"0.5804... | 0.70308644 | 0 |
POST /recovery_passwords POST /recovery_passwords.json | def create
@recovery_password = RecoveryPassword.new(recovery_password_params)
respond_to do |format|
if @recovery_password.save
format.html { redirect_to @recovery_password, notice: 'Recovery password ha sido creado.' }
format.json { render :show, status: :created, location: @recovery_pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n puts 'Recovery password!!!!!!!!!!!!!!!!!!!!!!'\n self.resource = resource_class.send_reset_password_instructions(resource_params)\n\n if successfully_sent?(resource)\n render status: 200, json: nil\n else\n render status: 400, json: { message: 'Invalid email!' }\n # binding.... | [
"0.6374773",
"0.62566763",
"0.62361735",
"0.62082964",
"0.61124355",
"0.6088549",
"0.6035341",
"0.60332566",
"0.60098505",
"0.5997153",
"0.59957033",
"0.59919095",
"0.5968382",
"0.59658456",
"0.59611714",
"0.59586763",
"0.59586763",
"0.5920181",
"0.59013224",
"0.5885759",
"0.... | 0.66673905 | 0 |
DELETE /recovery_passwords/1 DELETE /recovery_passwords/1.json | def destroy
@recovery_password.destroy
respond_to do |format|
format.html { redirect_to recovery_passwords_url, notice: 'Recovery password ha sido eliminado.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @password.destroy\n respond_to do |format|\n format.html { redirect_to passwords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @xmt_mgr_password.destroy\n respond_to do |format|\n format.html { redirect_to xmt_mgr_passwords_url, notice: 'Passwo... | [
"0.69135994",
"0.65709585",
"0.6546936",
"0.6473401",
"0.63672",
"0.6350938",
"0.63128436",
"0.6280077",
"0.6279821",
"0.62780744",
"0.6257426",
"0.62523204",
"0.6236595",
"0.6233573",
"0.61981446",
"0.6159638",
"0.61543375",
"0.61443245",
"0.6133967",
"0.6116662",
"0.6086743... | 0.69258785 | 0 |
== Constraints Chef libraries are evaluated before the recipe that places the chef_gem that it needs is put into place. This places two constraints on this library: 1) A 'require' must be done in a method 2) This class cannot use 'Subclass < Superclass' As Net::LDAP is a class it cannot be included as a module | def initialize
require 'rubygems'
require 'net-ldap'
require 'cicphash'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conscientious_require; end",
"def load_cloudflare_cookbook_gems\n return if defined? @@cloudflare_cookbook_gems_loaded\n chef_gem 'cloudflare' do\n action :install\n version '2.0.1'\n end\n require 'resolv'\n require 'cloudflare'\n @@cloudflare_cookbook_gems_loaded = true\nend... | [
"0.6480207",
"0.64590555",
"0.62435687",
"0.6108768",
"0.6097916",
"0.6090847",
"0.6049699",
"0.6030041",
"0.60176545",
"0.6016308",
"0.5910933",
"0.5820359",
"0.57835615",
"0.57699853",
"0.5769488",
"0.5702365",
"0.5679358",
"0.56678206",
"0.56448567",
"0.5639703",
"0.558224... | 0.66525275 | 0 |
== Bind This method should not be used directly. It is used to bind to the directory server. The databag_name is the name of the databag that is used for looking up connection credentials. It returns a connected ruby Net::LDAP object | def bind( host, port, credentials, databag_name, use_tls ) # :yields: host, port, credentials, databag_name, use_tls
credentials = credentials.kind_of?(Hash) ? credentials.to_hash : credentials.to_s
unless databag_name.kind_of?(String) or databag_name.kind_of?(Symbol)
raise "Invalid databag_name: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind\n conn = Net::LDAP.new :host => @config[:server],\n :port => @config[:port],\n :base => @config[:base]\n if @config[:encryption]\n conn.encryption @config[:encryption]\n end\n \n ... | [
"0.6913362",
"0.63650143",
"0.6115088",
"0.6058074",
"0.6005063",
"0.6000602",
"0.5991074",
"0.59695226",
"0.5956265",
"0.5793615",
"0.5700936",
"0.5565955",
"0.5537644",
"0.5522277",
"0.5521801",
"0.5499361",
"0.5465693",
"0.5459872",
"0.53915536",
"0.5391111",
"0.53690284",... | 0.7768266 | 0 |
== Search This method is used to search the directory server. It accepts the connection resource object described above along with the basedn to be searched. Optionally it also accepts an LDAP filter and scope. The default filter is objectClass= and the default scope is 'base' It returns a list of entries. | def search( c, basedn, *constraints ) # :yields: connection_info, basedn, filter, scope
self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap
raise "Must specify base dn for search" unless basedn
( filter, scope, attributes ) = constraints
filter = filter.nil? ? N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_ldap(session_handle, base, scope, filter, fields)\n vprint_status(\"Searching LDAP directory\")\n search = wldap32.ldap_search_sA(session_handle, base, scope, filter, nil, 0, 4)\n vprint_status(\"search: #{search}\")\n\n if search['return'] == LDAP_SIZELIMIT_EXCEEDED\n print_error(\"LDAP... | [
"0.70574045",
"0.6846109",
"0.6770961",
"0.65752316",
"0.6574974",
"0.645856",
"0.6366931",
"0.62826765",
"0.6233852",
"0.6118379",
"0.60482985",
"0.6020928",
"0.5801382",
"0.56704265",
"0.5670218",
"0.56624055",
"0.5576212",
"0.5559215",
"0.5526331",
"0.55008805",
"0.5485458... | 0.830434 | 0 |
== Get Entry This method accepts a connection resource object. It is intended to be used with Chef::Resource::LdapEntry objects that will also have a .dn method indicating Distinguished Name to be retrieved. It returns a single entry. | def get_entry( c, dn ) # :yields: connection_info, distinguished_name
self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap
entry = @ldap.search(
base: dn,
filter: Net::LDAP::Filter.eq( 'objectClass', '*' ),
scope: Net::L... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_entry\n\t\tself.log.debug \"Looking up entry for %s\" % [ self.dn ]\n\t\tentry = nil\n\n\t\tif self.include_operational_attrs?\n\t\t\tself.log.debug \" including operational attributes.\"\n\t\t\tentry = self.directory.get_extended_entry( self )\n\t\telse\n\t\t\tself.log.debug \" not including operatio... | [
"0.69192225",
"0.6838741",
"0.6255633",
"0.62506276",
"0.6213904",
"0.61219466",
"0.6081091",
"0.6077004",
"0.6066452",
"0.60608196",
"0.594333",
"0.5859642",
"0.58492595",
"0.58359665",
"0.5781691",
"0.5781691",
"0.5737232",
"0.5667582",
"0.566263",
"0.56159306",
"0.5518761"... | 0.78271013 | 0 |
== Add Entry This method accepts a connection resource object, a distinguished name, and the attributes for the entry to be added. | def add_entry( c, dn, attrs ) # :yields: connection_info, distinguished_name, attributes
self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap
# Ensure no duplicates by casting as a case insensitive, case preserving hash
attrs = CICPHash.new.merge(attrs)
# Ensu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_entry entry\n @data << entry\n end",
"def add_subscription_entry(name, entry)\n\t\tend",
"def add(entry)\n @entries[entry.tag] = entry\n end",
"def add(dn, attributes)\n attributes = normalize_attributes(attributes)\n log_dispatch(:add, dn, attributes)\n adapter.add... | [
"0.61634195",
"0.6126714",
"0.6046693",
"0.60178816",
"0.58524925",
"0.568015",
"0.56614065",
"0.5592205",
"0.5586353",
"0.5576164",
"0.55708426",
"0.55561775",
"0.5537293",
"0.5488622",
"0.5487179",
"0.54644245",
"0.54437673",
"0.5431659",
"0.54093915",
"0.54081136",
"0.5394... | 0.76255393 | 0 |
== Modify Entry Accepts a connection resource object as the first argument, followed by an Array of ldap operations. It is intended to be used with Chef::Resource::LdapEntry objects that will also have a .dn method that returns the DN of the entry to be modified. Each ldap operation in the ldap operations list is an Ar... | def modify_entry( c, dn, ops ) # :yields: connection_info, distinguished_name, operations
entry = self.get_entry( c, dn )
@ldap.modify dn: dn, operations: ops
raise "Unable to modify record: #{@ldap.get_operation_result.message}" unless @ldap.get_operation_result.message =~ /(Success|Attribute or ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_entry(entry, ldap_attrs, user_attrs, ldap_key, user_key)\n if user_attrs.has_key?(user_key)\n if ldap_attrs.has_key?(ldap_key)\n if user_attrs[user_key] != ldap_attrs[ldap_key].first\n entry << LDAP.mod(LDAP::LDAP_MOD_REPLACE, ldap_key, user_attrs[user_key].is_a?(String) ... | [
"0.6744574",
"0.6497927",
"0.60004467",
"0.595042",
"0.59479856",
"0.59115237",
"0.57591045",
"0.5537294",
"0.5492222",
"0.5431266",
"0.5388358",
"0.5270078",
"0.5257175",
"0.5213396",
"0.5180569",
"0.51710707",
"0.5163162",
"0.515719",
"0.50943655",
"0.50943655",
"0.50694454... | 0.79542965 | 0 |
== Delete Entry Expects a connection resource object, along with a .dn method that returns the Distinguished Name of the entry to be deleted. | def delete_entry( c, dn ) # :yields: connection_info, distinguished_name
self.bind( c.host, c.port, c.credentials, c.databag_name, c.use_tls ) unless @ldap
@ldap.delete dn: dn
raise "Unable to remove record: #{@ldap.get_operation_result.message}" unless @ldap.get_operation_result.message =~ /(Succe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(dn)\n @conn.delete :dn => dn\n end",
"def delete(dn)\n log_dispatch(:delete, dn)\n adapter.delete(dn)\n end",
"def delete_entry(entry)\n @address_book.entries.delete(entry)\n puts \"#{entry.name} has been deleted\"\n end",
"def destroy\n begin\n self.clas... | [
"0.7283597",
"0.68367934",
"0.68008673",
"0.67022884",
"0.6545504",
"0.6452004",
"0.63261557",
"0.6283859",
"0.5983127",
"0.59383315",
"0.5937805",
"0.59077823",
"0.5865994",
"0.58384407",
"0.5783325",
"0.5737294",
"0.5722508",
"0.5717711",
"0.570386",
"0.56989276",
"0.566451... | 0.79056066 | 0 |
Just an idea, instead of localeStorage, saving the current project in Redis in a hash. Not implemented. | def cache(user)
"#{user.id}_project"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_locale\n Thread.current[:\"localite:locale\"] || base\n end",
"def translations_hash; end",
"def current\n locale = I18n.locale\n @current ||=\n Rails.cache.fetch(\"languages/current/#{locale}\") do\n l = Language.find_by_group(locale)\n l ||= Language.english... | [
"0.5913796",
"0.58742917",
"0.57955784",
"0.5696557",
"0.56920224",
"0.56034577",
"0.5578434",
"0.5498196",
"0.54722613",
"0.54700357",
"0.5460152",
"0.5426229",
"0.53552544",
"0.5337919",
"0.5317755",
"0.5310304",
"0.5302839",
"0.5284406",
"0.5281995",
"0.5275137",
"0.526450... | 0.5911733 | 1 |
turn a href into an absolute path | def make_path(base, href)
return href if href[0] == '/'
base + href
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand_path(href)\n return href if href.match(/^https*:\\/\\//) # if starts with protocol complete link\n return @request_href unless href.match(/[a-zA-Z0-9]+/) # rejects href=\"#\" and allows non-unique exception handling.\n return @request_href if href.match(/#[a-zA-Z0-9]*$/)\n\n if href[0, 1] !=... | [
"0.74313325",
"0.7259466",
"0.7234768",
"0.7195484",
"0.71680987",
"0.71527714",
"0.7023498",
"0.6959961",
"0.6959891",
"0.6949252",
"0.69085574",
"0.6827566",
"0.6731841",
"0.67244583",
"0.671601",
"0.6713233",
"0.67031634",
"0.66990775",
"0.66528964",
"0.6634661",
"0.662463... | 0.7278829 | 1 |
reduce any '../', './', and '//' in a path or uri | def reduce_path(path)
if path =~ /^(https?:\/\/.+)(\/.*)/
prefix = $1
path = $2
relative = false
else
prefix = nil
relative = path[0] != '/'
end
while path.sub!(/\/*[^\/]+\/+\.\./, ''); end
while path.sub!(/\/+\.\/+/, '/'); end
path = path[2..... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri(path)\n s = File::expand_path(path).gsub(DIR, \"\").gsub(File::SEPARATOR, '/')\n return s == '' ? '/' : s\n end",
"def normalize_path(url); end",
"def normalize_path(url); end",
"def normalize_uri(*strs)\n new_str = strs * \"/\"\n\n new_str = new_str.gsub!(\"//\", \"/\") while new_str.in... | [
"0.7050252",
"0.6911172",
"0.6911172",
"0.68011254",
"0.677133",
"0.67306715",
"0.6601699",
"0.65985906",
"0.65985906",
"0.6590226",
"0.6532023",
"0.6532023",
"0.6453584",
"0.64493656",
"0.6447845",
"0.6432042",
"0.64209706",
"0.63909125",
"0.6367975",
"0.6360824",
"0.6354751... | 0.7364567 | 0 |
Create an empty page with necessary assets for project +p+ | def create_empty_page(p)
cli.say 'Creating project page'
FileUtils.mkdir_p(browse_file(p, '.'))
%w[favicon-32.png style.css].each do |i|
FileUtils.cp(template_file(i), browse_file(p, i))
end
write_file(p, 'about.html') do
build_from_template('about.html', citation: MiGA::MiGA.CITATION)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_project_page(p)\n # Redirect page\n write_file(p, '../index.html') { build_from_template('redirect.html') }\n\n # Summaries\n summaries = Dir[\"#{p.path}/*.tsv\"].map do |i|\n b = File.basename(i, '.tsv')\n generate_summary_page(i, p)\n \"<li><a href='s-#{b}.html'>#{format_n... | [
"0.702871",
"0.67735654",
"0.6353886",
"0.6273523",
"0.6258971",
"0.6180119",
"0.613617",
"0.6118454",
"0.6103431",
"0.6102516",
"0.6098231",
"0.6093809",
"0.6092664",
"0.60811114",
"0.60627323",
"0.6057448",
"0.6052244",
"0.60504496",
"0.6045839",
"0.6034876",
"0.59940636",
... | 0.8454481 | 0 |
Create landing page for project +p+ | def generate_project_page(p)
# Redirect page
write_file(p, '../index.html') { build_from_template('redirect.html') }
# Summaries
summaries = Dir["#{p.path}/*.tsv"].map do |i|
b = File.basename(i, '.tsv')
generate_summary_page(i, p)
"<li><a href='s-#{b}.html'>#{format_name(b)}</a></li>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_empty_page(p)\n cli.say 'Creating project page'\n FileUtils.mkdir_p(browse_file(p, '.'))\n %w[favicon-32.png style.css].each do |i|\n FileUtils.cp(template_file(i), browse_file(p, i))\n end\n write_file(p, 'about.html') do\n build_from_template('about.html', citation: MiGA::MiGA... | [
"0.7371354",
"0.6664608",
"0.6611665",
"0.6508865",
"0.6410716",
"0.63955003",
"0.6310804",
"0.6294235",
"0.6290953",
"0.6285155",
"0.6269014",
"0.6267971",
"0.62649435",
"0.6193769",
"0.6182318",
"0.6173127",
"0.6159468",
"0.61482817",
"0.61232287",
"0.61231667",
"0.6119241"... | 0.77630687 | 0 |
Create page for the summary +path+ in project +p+ | def generate_summary_page(path, p)
b = File.basename(path, '.tsv')
table = '<table class="table table-hover table-responsive">'
File.open(path, 'r') do |fh|
fh.each do |ln|
r = ln.chomp.split("\t")
if $. == 1
table += '<thead><tr>' +
r.map { |i| "<th scope=col>#{f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_project_page(p)\n # Redirect page\n write_file(p, '../index.html') { build_from_template('redirect.html') }\n\n # Summaries\n summaries = Dir[\"#{p.path}/*.tsv\"].map do |i|\n b = File.basename(i, '.tsv')\n generate_summary_page(i, p)\n \"<li><a href='s-#{b}.html'>#{format_n... | [
"0.7484316",
"0.6507673",
"0.6498785",
"0.63521224",
"0.60548556",
"0.59551257",
"0.584933",
"0.5718473",
"0.5688941",
"0.5640451",
"0.5592488",
"0.5543848",
"0.5512932",
"0.55012167",
"0.5489683",
"0.5489683",
"0.5489683",
"0.5489683",
"0.5489683",
"0.5489683",
"0.5489683",
... | 0.7636214 | 0 |
Create page for dataset +d+ within project +p+ | def generate_dataset_page(p, d)
data = {
unmiga_name: d.name.unmiga_name,
information: format_metadata(d),
results: format_results(d)
}
write_file(p, "d_#{d.name}.html") do
build_from_template('dataset.html', data)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_datasets_index(p)\n cli.say 'Creating index pages'\n data = format_dataset_index(p)\n data.each do |k, v|\n write_file(p, \"#{k}_datasets.html\") do\n v[:list] = 'None' if v[:list] == ''\n build_from_template(\n 'datasets.html',\n v.merge(:\"#{k}_datasets_... | [
"0.68037844",
"0.64201796",
"0.6405191",
"0.6208129",
"0.5913871",
"0.5708373",
"0.56997925",
"0.5664465",
"0.56394017",
"0.5603932",
"0.554942",
"0.55379516",
"0.55356014",
"0.553241",
"0.54918236",
"0.5452057",
"0.54436624",
"0.54004836",
"0.5386109",
"0.5359547",
"0.535954... | 0.86693054 | 0 |
Create pages for reference and query dataset indexes | def generate_datasets_index(p)
cli.say 'Creating index pages'
data = format_dataset_index(p)
data.each do |k, v|
write_file(p, "#{k}_datasets.html") do
v[:list] = 'None' if v[:list] == ''
build_from_template(
'datasets.html',
v.merge(:"#{k}_datasets_active" => 'acti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_indexes\n @first_page = first_page\n generate_index('index')\n generate_index('indexes')\n end",
"def index_pages\n debug_msg \" generating pages search index\"\n\n pages = @files.select do |file|\n file.text?\n end\n\n pages.each do |page|\n debug_msg \" #{page.p... | [
"0.7581115",
"0.7085274",
"0.69342494",
"0.66503674",
"0.6550457",
"0.6513609",
"0.6435873",
"0.63384014",
"0.63214314",
"0.628524",
"0.6247826",
"0.62302375",
"0.6215779",
"0.6195686",
"0.6191556",
"0.61650985",
"0.6163107",
"0.6147718",
"0.61047316",
"0.60825545",
"0.607092... | 0.73654836 | 1 |
Format +obj+ metadata as a table | def format_metadata(obj)
'<table class="table table-sm table-responsive">' +
obj.metadata.data.map do |k, v|
case k
when /^run_/, :plugins, :user
next
when :web_assembly_gz
v = "<a href='#{v}'>#{v[0..50]}...</a>"
when :datasets
v = v.size
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_row(obj, out_mode, depth)\n row = []\n variables = out_mode == :full ? obj.class::FIELDS_FULL : obj.class::FIELDS_SUMMARY\n variables.each do |var|\n val = obj.instance_variable_get(\"@#{var}\")\n val = val[0..32] if out_mode == :summary # Shorten data for summary -... | [
"0.63745046",
"0.6241079",
"0.62046194",
"0.5997506",
"0.5989809",
"0.59521073",
"0.5918139",
"0.58749056",
"0.58509296",
"0.5800575",
"0.578684",
"0.578684",
"0.5783817",
"0.5769742",
"0.57531536",
"0.574793",
"0.57232594",
"0.5713948",
"0.5704228",
"0.56967455",
"0.5633141"... | 0.7606932 | 0 |
Format +obj+ results as cards | def format_results(obj)
o = ''
obj.each_result do |key, res|
links = format_result_links(res)
stats = format_result_stats(res)
next unless links || stats
name = format_name(key)
url_doc =
'http://manual.microbial-genomes.org/part5/workflow#' +
key.to_s.tr('_', '-')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_result(obj)\n formatted_str = \"\\n\\nSearch Results: \\n\\n\"\n obj.each do |key, value|\n unless key == \"_id\"\n\t key_str = key.capitalize\n\t if value.kind_of?(Array)\n\t\t \tformatted_str << key_str << \": \"\n\t\t \tvalue.each do |var|\n\t\t \t\tformatted_str << var.to_s << ((v... | [
"0.64820445",
"0.6226193",
"0.5886291",
"0.5849091",
"0.58358157",
"0.5789512",
"0.5777686",
"0.5776829",
"0.5770966",
"0.5745876",
"0.5724106",
"0.57017106",
"0.56891537",
"0.56819046",
"0.5678904",
"0.56606877",
"0.56455904",
"0.5630276",
"0.56124246",
"0.56106174",
"0.5596... | 0.77843404 | 0 |
Write +file+ within the browse folder of project +p+ using the passed block output as content | def write_file(p, file)
File.open(browse_file(p, file), 'w') { |fh| fh.print yield }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(block)\n @filemgr.write(block, @contents)\n end",
"def output(file, &block)\n @outfile = File.expand_path(file)\n @block = block\n self\n end",
"def write_to(file_name, &block)\n file = File.new(file_name, \"w\")\n file.write \"---\\n\"\n yield(file) if block_given?\n file... | [
"0.66409993",
"0.6551999",
"0.6197935",
"0.61722183",
"0.61622196",
"0.6113944",
"0.6112693",
"0.6066088",
"0.60583067",
"0.59728247",
"0.5966772",
"0.59273505",
"0.59130883",
"0.59073776",
"0.58719283",
"0.5867446",
"0.58516586",
"0.58434427",
"0.5830314",
"0.58273727",
"0.5... | 0.7643977 | 0 |
Use a +template+ file to generate content with a hash of +data+ over the layout page if +layout+ is true | def build_from_template(template, data = {}, layout = true)
cont = File.read(template_file(template)).miga_variables(data)
return cont unless layout
build_from_template(
'layout.html',
data.merge(content: cont, project_name: cli.load_project.name),
false
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mustache(template, args={}, layout=true)\n args = args.update(:site => site, :site_tags => tags, :current_user => current_user)\n layout_class = UserApp::Views::Layout\n layout_class.template = design.layout\n view_class = UserApp::Views.const_get(template.to_s.classify)\n vi... | [
"0.6997361",
"0.67198944",
"0.67088735",
"0.6704546",
"0.66211927",
"0.6575901",
"0.647485",
"0.639517",
"0.6370739",
"0.6320471",
"0.629727",
"0.62776285",
"0.62680995",
"0.623344",
"0.62254375",
"0.62193334",
"0.6199515",
"0.6190676",
"0.6162726",
"0.61603975",
"0.61348367"... | 0.73471045 | 0 |
Path to the template browse file | def template_file(file)
File.join(
MiGA::MiGA.root_path,
'lib', 'miga', 'cli', 'action', 'browse', file
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_path\n File.expand_path('../templates', __FILE__)\n end",
"def template_path\n File.expand_path(File.join(File.dirname(__FILE__), \"template.rb\"))\n end",
"def full_path\n \"templates/#{filename}\"\n end",
"def template_path\n \"#{template_dir}/#{template_name}\... | [
"0.7515096",
"0.7345798",
"0.72823894",
"0.7268778",
"0.72396916",
"0.7000569",
"0.6968479",
"0.6914573",
"0.69109267",
"0.6904416",
"0.6890691",
"0.68772614",
"0.6826309",
"0.6808136",
"0.6794476",
"0.67501146",
"0.6747688",
"0.6718692",
"0.66853267",
"0.6671208",
"0.6648840... | 0.7424156 | 1 |
Path to the browse file in the project | def browse_file(p, file)
File.join(p.path, 'browse', file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n project\n end",
"def code_browse path\n dr = ruby_renderer\n view(path, :close_key => 'q', :title => $0) do |t|\n t.renderer dr\n t.bind_key([?\\\\,?\\\\,?o],'choose file') { \n str = choose_file \"**/*\"\n if str and str != \"\"\n t.add_conten... | [
"0.66099113",
"0.63447005",
"0.6344689",
"0.63362616",
"0.63069445",
"0.62917894",
"0.6266471",
"0.62566894",
"0.62329155",
"0.62251616",
"0.62099624",
"0.6183693",
"0.6176807",
"0.61586636",
"0.6128603",
"0.6115792",
"0.6110082",
"0.61082464",
"0.6090519",
"0.60740787",
"0.6... | 0.7663598 | 0 |
determine the future value of an investment of present_value with given interest rate over time periods number of periods (years) that the interest is cumulated rate the annual rate of return present_value the value at the start of the period compound_frequency number of compounds / period(year) | def future_value(rate,periods,present_value,compound_frequency = 1)
compound_frequency = resolve_compound_frequency!(compound_frequency)
if compound_frequency == :continuous
return continuous_compound_fv(rate,periods,present_value)
end
future_value = present_value * (1+rate/compound_freq... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def present_value(rate,periods,future_value)\n present_value = future_value / (1+rate)**periods\n end",
"def compound_return(periods,present_value,future_value)\n pv = present_value.to_d\n fv = future_value.to_d\n n = periods.to_d\n rate = ((fv / pv)**(1/n))-1\n end",
"def future... | [
"0.7779788",
"0.75517434",
"0.7306679",
"0.6672953",
"0.65825135",
"0.63988066",
"0.6284648",
"0.6245956",
"0.6159949",
"0.61575097",
"0.60779995",
"0.60768104",
"0.6067823",
"0.6065797",
"0.60527045",
"0.59514064",
"0.5936478",
"0.5902118",
"0.5874436",
"0.58550656",
"0.5800... | 0.80783045 | 0 |
determine the present value required to acheive a future value with given interest rate over time periods number of periods (years) that the interest is cumulated rate the annual rate of return future_value the value at the end of the period | def present_value(rate,periods,future_value)
present_value = future_value / (1+rate)**periods
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def future_given_present(present_value, interest, term)\n (present_value.to_f * (1 + interest.to_f) ** term).round(4)\n end",
"def compound_return(periods,present_value,future_value)\n pv = present_value.to_d\n fv = future_value.to_d\n n = periods.to_d\n rate = ((fv / pv)**(1/n))-1\n e... | [
"0.74859816",
"0.7460934",
"0.73605585",
"0.70097977",
"0.69373226",
"0.67010456",
"0.65248215",
"0.65005285",
"0.64793396",
"0.6350233",
"0.62822175",
"0.62789625",
"0.62492776",
"0.6179234",
"0.61650795",
"0.6115266",
"0.6107985",
"0.6103223",
"0.60859317",
"0.60255533",
"0... | 0.7800808 | 0 |
determine the rate of return over a period periods number of periods (years) that the interest is cumulated present_value the value at the start of the period future_value the value at the end of the period | def compound_return(periods,present_value,future_value)
pv = present_value.to_d
fv = future_value.to_d
n = periods.to_d
rate = ((fv / pv)**(1/n))-1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def present_value(rate,periods,future_value)\n present_value = future_value / (1+rate)**periods\n end",
"def future_value(rate,periods,present_value,compound_frequency = 1)\n compound_frequency = resolve_compound_frequency!(compound_frequency)\n if compound_frequency == :continuous\n ret... | [
"0.78171325",
"0.69233257",
"0.68300253",
"0.6731517",
"0.6698266",
"0.6611931",
"0.6558443",
"0.64138514",
"0.6395259",
"0.635134",
"0.6257746",
"0.62558013",
"0.62553144",
"0.623989",
"0.62014925",
"0.6158807",
"0.6115589",
"0.6073032",
"0.6028322",
"0.6027582",
"0.5992313"... | 0.79168487 | 0 |
determine the investment horizon (length of time) required to create a future value given a present value and interest rate present_value the value at the start of the period future_value the value at the end of the period rate the annual rate of return | def investment_horizon(rate,present_value,future_value)
pv = present_value.to_d
fv = future_value.to_d
periods = Math.log(fv/pv) / Math.log(1+rate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def present_value(rate,periods,future_value)\n present_value = future_value / (1+rate)**periods\n end",
"def future_given_present(present_value, interest, term)\n (present_value.to_f * (1 + interest.to_f) ** term).round(4)\n end",
"def present_given_future(future_value, interest, term)\n (future... | [
"0.73584276",
"0.7230214",
"0.6933694",
"0.66302454",
"0.6504473",
"0.61318266",
"0.5859032",
"0.5783148",
"0.5606104",
"0.55674577",
"0.556436",
"0.5499632",
"0.54799885",
"0.54791063",
"0.5467902",
"0.54229295",
"0.5418428",
"0.5403856",
"0.5395165",
"0.5387388",
"0.528683"... | 0.78798425 | 0 |
determine the effective annual rate for a given simple interest rate compounded over a given number of periods rate simple annual rate compound_per_period compound / period | def effective_annual_rate(rate,compound_frequency)
compound_frequency = resolve_compound_frequency!(compound_frequency)
if compound_frequency == :continuous
return continuous_effective_annual_rate(rate)
end
m= compound_frequency
e_rate = (1 + rate/m)**m -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anticipated_interest(rate, periods)\n\t\t (1 - (( 1 / ( rate.to_f + 1 )) ** (1.0 / periods)))\n\t\tend",
"def compound_interest(rate, count = 1, period = 12)\n Money.new(cents * ((1 + rate / 100.0 / period) ** count - 1))\n end",
"def calculate_loan(rate, n_periods, total_loan_amount)\n fixed_payment... | [
"0.6941773",
"0.6785467",
"0.6609534",
"0.65379953",
"0.6418716",
"0.6287261",
"0.627252",
"0.6134057",
"0.6099594",
"0.60314786",
"0.6006965",
"0.59807014",
"0.59512377",
"0.5846905",
"0.58282346",
"0.5824809",
"0.58177525",
"0.5814894",
"0.57970273",
"0.5775244",
"0.5764877... | 0.757776 | 0 |
Migrating this to `authorizerhomerooms` | def authorized_homerooms
if EnvironmentVariable.is_true('ENABLE_HOMEROOM_AUTHORIZATION_V2')
authorizer.homerooms
else
authorizer.allowed_homerooms_DEPRECATED(acknowledge_deprecation: true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized_by(authorizer)\n authorizer.to_s.camelize.constantize # get authorizer loaded\n alias_method :old_users, :users\n alias_method :old_method_missing, :method_missing\n include TransitiveAuthorization::Authorizee::InstanceMethods\n self.cattr_accessor :transitive_authorizer\n ... | [
"0.6965431",
"0.63082737",
"0.62287205",
"0.61290187",
"0.59146535",
"0.59146535",
"0.5896997",
"0.5896997",
"0.58728963",
"0.5806797",
"0.5795525",
"0.57881975",
"0.57546115",
"0.5666361",
"0.5666361",
"0.5648755",
"0.563015",
"0.5618461",
"0.559866",
"0.55767435",
"0.556891... | 0.7283598 | 0 |
Query for students through homeroom, but scoped within studentlevel authorization check. This is essentially doublewrapping the authorizaiton checks; the homeroom authorization check should separately only allow access when the educator can access all students in the homeroom. | def authorized_students(homeroom)
authorized do
homeroom.students
.active
.includes(:event_notes, :interventions, :homeroom)
.to_a
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def school_students(query={})\n self.simple_client.get(\"/api/v1/schools/my/students?#{query.to_query}\")\n end",
"def query_student(hQuery)\n result = []\n\n hQuery[:status] = :active unless hQuery.key?(:status)\n\n @data[:students].each do |hValue|\n elem = hValue\n hQuery.each do |query... | [
"0.63462687",
"0.6304662",
"0.61484975",
"0.57862616",
"0.56988627",
"0.5667931",
"0.56361127",
"0.5581746",
"0.5519501",
"0.5499715",
"0.54860336",
"0.5476777",
"0.5427626",
"0.5418739",
"0.5410691",
"0.53927666",
"0.5379627",
"0.53769565",
"0.53667456",
"0.533562",
"0.53337... | 0.77949256 | 0 |
Serializes a Student into a hash with other fields joined in (that are used to perform filtering and slicing in the UI). This may be slow if you're doing it for many students without eager includes. | def fat_student_hash(student)
HashWithIndifferentAccess.new(student.as_json({
except: [
:primary_phone,
:primary_email,
:student_address
]
}).merge({
has_photo: student.has_photo,
discipline_incidents_count: student.most_recent_school_year_discipline_incidents_cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_students(student_ids, section)\n students = Student\n .active\n .where(id: student_ids)\n .includes(:student_section_assignments)\n\n students.map do |student|\n grade_numeric = student.student_section_assignments.find_by_section_id(section.id).grade_numeric\n student.a... | [
"0.74007237",
"0.7180264",
"0.7028448",
"0.69895357",
"0.6417459",
"0.63001305",
"0.6236654",
"0.62192965",
"0.6130004",
"0.60334575",
"0.5991246",
"0.59414005",
"0.59389347",
"0.59350747",
"0.5875466",
"0.5874363",
"0.5831538",
"0.57497793",
"0.5737095",
"0.56373227",
"0.561... | 0.7238609 | 1 |
SpEd Data as defined by Somerville Schools | def sped_data(student)
{
sped_level: sped_level(student),
sped_tooltip_message: sped_tooltip_message(student),
sped_bubble_class: sped_bubble_class(student)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sld; end",
"def sp\n\t\t# --Stallция Preφιcς--\n\t\ts = ['S', 'Z', 'C', 'S']\n\t\tt = ['t', 'zt', 'ct', 'st']\n\t\ta = ['a', 'å', 'ä', 'ą']\n\t\tl = ['l', 'll', 'л', 'лл', 'lъ', 'llъ', 'лъ', 'ллъ',]\n\t\tc = ['c', 'z', 's', 'c', 'z', 'ц']\n\t\ti = ['i', '', 'и']\n\t\tja = ['a', 'ja', 'ya', 'ia', 'иa','я', 'ѧ... | [
"0.57599723",
"0.5654223",
"0.5592384",
"0.55232763",
"0.5443806",
"0.5325148",
"0.5241047",
"0.52281827",
"0.52018094",
"0.5200175",
"0.5169785",
"0.5169777",
"0.51659054",
"0.5161655",
"0.515208",
"0.5147694",
"0.5135845",
"0.5131139",
"0.5131139",
"0.51245856",
"0.511807",... | 0.640719 | 0 |
GET /featured_clients GET /featured_clients.json | def index
@featured_clients = FeaturedClient.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_featured_client\n @featured_client = FeaturedClient.find(params[:id])\n end",
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def show\n render json: @client\n end",
"def get_featured\n render json: Event.where(is_featured: true), status: :ok\n end... | [
"0.6933652",
"0.683633",
"0.67539525",
"0.6728703",
"0.66623473",
"0.6645311",
"0.6645311",
"0.6645311",
"0.6645311",
"0.6645311",
"0.6645311",
"0.6645311",
"0.6604498",
"0.65847147",
"0.6570766",
"0.656262",
"0.6558943",
"0.6556442",
"0.6501677",
"0.64970773",
"0.6423044",
... | 0.78416455 | 0 |
POST /featured_clients POST /featured_clients.json | def create
@featured_client = FeaturedClient.new(featured_client_params)
respond_to do |format|
if @featured_client.save
format.html { redirect_to @featured_client, notice: 'Featured client was successfully created.' }
format.json { render :show, status: :created, location: @featured_clie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_featured_client\n @featured_client = FeaturedClient.find(params[:id])\n end",
"def update_features(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/features\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\... | [
"0.67577773",
"0.6596986",
"0.6583391",
"0.6533749",
"0.6523827",
"0.6325813",
"0.6287912",
"0.6286387",
"0.62818676",
"0.62335885",
"0.6210315",
"0.62056553",
"0.62049633",
"0.6194312",
"0.6185106",
"0.61788565",
"0.61700845",
"0.6154021",
"0.6149242",
"0.6149242",
"0.614924... | 0.7798717 | 0 |
PATCH/PUT /featured_clients/1 PATCH/PUT /featured_clients/1.json | def update
respond_to do |format|
if @featured_client.update(featured_client_params)
format.html { redirect_to @featured_client, notice: 'Featured client was successfully updated.' }
format.json { render :show, status: :ok, location: @featured_client }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_features(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/features\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n features:[{\"name\":\"public_dashboards\",\"enabled\":true},\n {\"name\":\"publishe... | [
"0.7180061",
"0.71587324",
"0.67126924",
"0.6706564",
"0.6624684",
"0.66181684",
"0.66181684",
"0.657036",
"0.6560939",
"0.6560939",
"0.6537225",
"0.6521621",
"0.6474115",
"0.64677155",
"0.64466053",
"0.64425135",
"0.64348674",
"0.6433545",
"0.64225364",
"0.64199555",
"0.6416... | 0.7571402 | 0 |
DELETE /featured_clients/1 DELETE /featured_clients/1.json | def destroy
@featured_client.destroy
respond_to do |format|
format.html { redirect_to featured_clients_url, notice: 'Featured client was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_ur... | [
"0.75142395",
"0.745067",
"0.745067",
"0.745067",
"0.745067",
"0.745067",
"0.745067",
"0.745067",
"0.745067",
"0.745067",
"0.744217",
"0.7420447",
"0.7420447",
"0.7416775",
"0.7321803",
"0.73160225",
"0.7283156",
"0.7262876",
"0.7257515",
"0.7226291",
"0.72083664",
"0.71967... | 0.79933196 | 0 |
Convert value to bit array to_multi_bit( '0b101010', 6 ) => [1,0,1,0,1,0] to_multi_bit( '0b101010', 10 ) => [1,0,1,0,1,0,0,0,0,0] to_multi_bit( '0b101010', 3 ) => [1,0,1] to_multi_bit( '0b01010' ) => [1,0,1,0] minimum array size for val to_multi_bit( '' ) => [0] null string is equivalent to 0 | def to_multi_bit( val, array_size=-1 )
array_size = Integer(array_size) unless array_size.kind_of?(Integer)
if val == '' then
val = '0'
end
begin
val = Integer(val).to_s(2)
rescue => e
raise ParameterError, "#{__method__} contains invalid string for number"
end
arr = val.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_bit_array\n BitMapping.number_to_bit_array(number)\n end",
"def input_to_bitstring( value )\r\n value\r\n end",
"def number_to_bit_array(number, minimum_binary_places = 0)\n assert_non_negative(number)\n array = []\n while number > 0\n array << (number & 1)\n ... | [
"0.71019197",
"0.64645636",
"0.6271918",
"0.6154316",
"0.6136181",
"0.61169845",
"0.60882556",
"0.6005125",
"0.59984744",
"0.5980631",
"0.59593886",
"0.5871188",
"0.58386976",
"0.5829",
"0.58206475",
"0.5820063",
"0.5797414",
"0.5794982",
"0.57928",
"0.56683254",
"0.56529534"... | 0.7963539 | 0 |
class_exsits?("String") => ture class_exists?("djfakf20dak") => false | def class_exists?(classname)
str = classname.to_s
eval("defined?(#{str}) && #{str}.is_a?(Class)") == true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_exists? string\n\tc = Object.const_get string\n\treturn c.is_a? Class\nrescue NameError\n\treturn false\nend",
"def class_exists?(class_name)\n begin\n class_name.constantize\n true\n rescue NameError => ne\n false\n end\n end",
"def class_exists?(class_name)\n klass = Modul... | [
"0.8096085",
"0.76872027",
"0.7647681",
"0.7635851",
"0.75350523",
"0.74830174",
"0.7474969",
"0.7474969",
"0.7474969",
"0.7412033",
"0.73887044",
"0.7370037",
"0.72096604",
"0.71148914",
"0.7091627",
"0.70484865",
"0.7038288",
"0.69804",
"0.69743073",
"0.6939178",
"0.6915956... | 0.8161565 | 0 |
Returns info for the specified venue. | def venue(id)
options = { :venue_id => id }
get('/venue_info', options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def venue(id)\n get(\"venues/#{id}\").venue\n end",
"def venue(vid, options = {})\n options.merge!({ :query => { :key => @api_key } })\n self.class.get(\"/venues/#{vid}\", options)\n end",
"def venue\n \t@events = Event.where(:venue => params[:venue])\n\n \trespond_to do |format|\n \t\tif... | [
"0.7556617",
"0.72925836",
"0.71240777",
"0.6950226",
"0.69235957",
"0.6780076",
"0.6749551",
"0.6677567",
"0.66518515",
"0.6548156",
"0.64478546",
"0.6389568",
"0.63407123",
"0.63203627",
"0.63155055",
"0.6270055",
"0.62002933",
"0.6194573",
"0.616607",
"0.61569226",
"0.6144... | 0.79124004 | 0 |
GET /communities/new GET /communities/new.json | def new
@community = Community.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @community }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @community = @district.communities.new\n\n respond_to do |format|\n format.html\n format.json { render json: @community }\n end\n end",
"def create\n @community = @district.communities.new(params[:community])\n\n respond_to do |format|\n if @community.save\n format... | [
"0.7959961",
"0.71575254",
"0.7025313",
"0.7009266",
"0.6981981",
"0.695217",
"0.6947142",
"0.68749774",
"0.68749774",
"0.6841163",
"0.6815259",
"0.67953557",
"0.6756949",
"0.6732288",
"0.6707693",
"0.66622007",
"0.6636089",
"0.66074175",
"0.6576715",
"0.65577555",
"0.65519",... | 0.7494975 | 1 |
PUT /communities/1 PUT /communities/1.json | def update
@community = Community.find(params[:id])
respond_to do |format|
if @community.update_attributes(params[:community])
format.html { redirect_to @community, notice: 'Community was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @community = current_user.own_communities.find(params[:id])\n flash[:notice] = 'Community was successfully updated.' if @community.update_attributes(update_params)\n respond_with(@community)\n end",
"def update\n if @community.update(community_params)\n render :show, status: :ok, l... | [
"0.70225936",
"0.67517334",
"0.67264223",
"0.6724205",
"0.6630993",
"0.65974313",
"0.65974313",
"0.65297955",
"0.6431997",
"0.6372459",
"0.6371188",
"0.6314842",
"0.6314842",
"0.62161005",
"0.6210379",
"0.6209496",
"0.6209496",
"0.6209496",
"0.6209496",
"0.6209496",
"0.620949... | 0.67545354 | 1 |
DELETE /communities/1 DELETE /communities/1.json | def destroy
@community = Community.find(params[:id])
@community.destroy
respond_to do |format|
format.html { redirect_to communities_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @community.destroy\n respond_to do |format|\n format.html { redirect_to communities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @community = Community.find(params[:id])\n @community.destroy\n\n respond_to do |format|\n format.html { redire... | [
"0.77494264",
"0.7628726",
"0.758887",
"0.7582639",
"0.75190085",
"0.75190085",
"0.75190085",
"0.75190085",
"0.7345361",
"0.7032567",
"0.6991609",
"0.6987676",
"0.6948728",
"0.69379205",
"0.69283324",
"0.6902466",
"0.6833026",
"0.68261915",
"0.6721534",
"0.67208093",
"0.66859... | 0.77372575 | 1 |
Load appium.txt (toml format) into system ENV the basedir of this file + appium.txt is what's used | def load_appium_txt opts
raise 'opts must be a hash' unless opts.kind_of? Hash
opts.each_pair { |k,v| opts[k.to_s.downcase.strip.intern] = v }
opts = {} if opts.nil?
file = opts.fetch :file, nil
raise 'Must pass file' unless file
verbose = opts.fetch :verbose, false
# Check for env vars in .txt
parent_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_driver\n return if $driver\n caps = Appium.load_appium_txt file: File.join(Dir.pwd, 'appium.txt')\n $driver = Appium::Driver.new caps\n # debug \"setting up driver using #{caps.to_yaml}\"\nend",
"def root_dir\n __FILE__.match(%r{.*(appium-test-runner)}).to_s\n end",
"def run_android test_file... | [
"0.5981987",
"0.5774271",
"0.56039727",
"0.55971855",
"0.55521613",
"0.54813564",
"0.543904",
"0.541871",
"0.54058915",
"0.5370258",
"0.5336662",
"0.5312171",
"0.5307017",
"0.5273903",
"0.527349",
"0.5264785",
"0.5259214",
"0.5235099",
"0.5223799",
"0.52233565",
"0.519876",
... | 0.81331265 | 0 |
Get the server url for sauce or local based on env vars. | def server_url
return @custom_url if @custom_url
if !@sauce_username.nil? && !@sauce_access_key.nil?
"http://#{@sauce_username}:#{@sauce_access_key}@ondemand.saucelabs.com:80/wd/hub"
else
"http://127.0.0.1:#{@port}/wd/hub"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def site_url\n if Rails.env.production?\n # Place your production URL in the quotes below\n \"http://www.ezonline.com/\"\n else\n # Our dev & test URL\n \"http://ezonline-dev.com:3000\"\n end\n end",
"def host\n return @@nfg_urls['sandbox']['host'] if @use_sandbox\n @@nfg_... | [
"0.7494612",
"0.7353119",
"0.7247557",
"0.71140593",
"0.7103848",
"0.7103848",
"0.7079462",
"0.7078015",
"0.70766836",
"0.7011295",
"0.70039564",
"0.69781536",
"0.6976606",
"0.6950521",
"0.6943098",
"0.6860118",
"0.68076366",
"0.6805368",
"0.6766746",
"0.6763752",
"0.67558944... | 0.7927469 | 0 |
Takes a png screenshot and saves to the target path. Example: screenshot '/tmp/hi.png' | def screenshot png_save_path
@driver.save_screenshot png_save_path
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_screenshot(png_path)\n extension = File.extname(png_path).downcase\n if extension != '.png'\n ::Appium::Logger.warn 'name used for saved screenshot does not match file type. ' \\\n 'It should end with .png extension'\n end\n File.open(png... | [
"0.7713248",
"0.73897016",
"0.7361552",
"0.7261436",
"0.72201663",
"0.71657145",
"0.71561575",
"0.7147954",
"0.7093388",
"0.7071087",
"0.7060184",
"0.7058387",
"0.70374185",
"0.70342076",
"0.7021363",
"0.69934297",
"0.69775933",
"0.69728357",
"0.6949938",
"0.69415283",
"0.691... | 0.8234669 | 0 |
Set implicit wait and default_wait to zero. | def no_wait
@last_waits = [@default_wait, 0]
@default_wait = 0
@driver.manage.timeouts.implicit_wait = 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_wait\n @default_wait\n end",
"def set_implicit_wait_by_default(wait)\n return if @default_wait.nil?\n\n @driver.manage.timeouts.implicit_wait = wait\n rescue ::Selenium::WebDriver::Error::UnknownError => e\n unless e.message.include?('The operation requested is not y... | [
"0.76416105",
"0.7500537",
"0.721602",
"0.65911514",
"0.65868926",
"0.6399924",
"0.6341235",
"0.63308007",
"0.6221979",
"0.6141044",
"0.60687554",
"0.60397017",
"0.60141146",
"0.5988994",
"0.5857542",
"0.5737748",
"0.5725504",
"0.5707285",
"0.5707285",
"0.5707285",
"0.5680033... | 0.7951602 | 0 |
Set implicit wait and default_wait to timeout, defaults to 30. if set_wait is called without a param then the second to last wait will be used. ```ruby` set_wait 2 set_wait 3 set_wait 2 ```` | def set_wait timeout=nil
if timeout.nil?
# puts "timeout = @default_wait = @last_wait"
# puts "timeout = @default_wait = #{@last_waits}"
timeout = @default_wait = @last_waits.first
else
@default_wait = timeout
# puts "last waits before: #{@last_waits}"
@last_w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_implicit_wait_by_default(wait)\n return if @default_wait.nil?\n\n @driver.manage.timeouts.implicit_wait = wait\n rescue ::Selenium::WebDriver::Error::UnknownError => e\n unless e.message.include?('The operation requested is not yet implemented')\n raise ::Appium::Core::Er... | [
"0.7200762",
"0.6679357",
"0.65788174",
"0.6443681",
"0.6226858",
"0.596722",
"0.59339607",
"0.58681065",
"0.5848157",
"0.5846182",
"0.58411944",
"0.58411944",
"0.58140564",
"0.5790305",
"0.57674325",
"0.57514125",
"0.57201034",
"0.5716633",
"0.56703126",
"0.5669643",
"0.5607... | 0.8285323 | 0 |
Returns the default client side wait. This value is independent of what the server is using | def default_wait
@default_wait
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_timeout\n @wait_timeout ||= options[:wait_timeout] || DEFAULT_WAIT_TIMEOUT\n end",
"def set_implicit_wait_by_default(wait)\n return if @default_wait.nil?\n\n @driver.manage.timeouts.implicit_wait = wait\n rescue ::Selenium::WebDriver::Error::UnknownError => e\n unle... | [
"0.6918232",
"0.60194534",
"0.59551215",
"0.588512",
"0.5776252",
"0.57113725",
"0.5703889",
"0.56906146",
"0.56605303",
"0.56548905",
"0.5632716",
"0.5559097",
"0.54802066",
"0.5451355",
"0.54511195",
"0.5442161",
"0.5430147",
"0.5423666",
"0.540995",
"0.5396949",
"0.5383813... | 0.7904518 | 0 |
Quit the driver and Pry. quit and exit are reserved by Pry. | def x
driver_quit
exit # exit pry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quit!\n quit\n exit!\n end",
"def quit_driver()\n @driver.shutdown\n end",
"def quit\r\n @@driver.quit\r\n end",
"def quit\n\t\t@driver.quit\n\tend",
"def quit\n exit(1)\n end",
"def quit\n @ui.close\n @player.close\n @logger.close\n exit\n end",
"d... | [
"0.7649962",
"0.75097275",
"0.7461979",
"0.7409583",
"0.7335107",
"0.7230508",
"0.7230508",
"0.7108723",
"0.70328236",
"0.703234",
"0.70131856",
"0.6982187",
"0.69693995",
"0.6916052",
"0.68841213",
"0.68841213",
"0.68736315",
"0.683998",
"0.6834304",
"0.682177",
"0.6782976",... | 0.784934 | 0 |
Finds and returns the 1st node whose value is 'value' | def find(value)
self.each {|node| return node if node.value == value}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(value)\n node = @head\n while node\n if node.value == value\n return node\n end\n node = node.next\n end\n\n return nil\n end",
"def find_node(value)\n current = @anchor.next_node\n while current != @anchor\n return current if current.value == va... | [
"0.80587685",
"0.80214393",
"0.7959897",
"0.7671774",
"0.764562",
"0.764562",
"0.74783874",
"0.74122894",
"0.7408482",
"0.73552215",
"0.73340523",
"0.7307569",
"0.7260175",
"0.7225086",
"0.7193016",
"0.7160144",
"0.713884",
"0.7131601",
"0.7126046",
"0.71244234",
"0.7061111",... | 0.81960785 | 0 |
find_all(value) finds and return (in an array) all the nodes whose value is 'value' | def find_all(value)
nodes = []
self.each {|node| nodes << node if node.value == value}
nodes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elements_by_xpath(value)\n find_by_xpath(value)\n end",
"def find_all_nodes(xpath, select_result_value=false)\n if self.feed_data_type != :xml\n raise \"The feed data type is not xml.\"\n end\n return FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [xpath],\n :... | [
"0.73790395",
"0.6820984",
"0.67537713",
"0.62753576",
"0.62564236",
"0.6141319",
"0.61087537",
"0.6062094",
"0.6044982",
"0.60254693",
"0.59540236",
"0.58442485",
"0.5819881",
"0.5805825",
"0.5749595",
"0.5743802",
"0.57175523",
"0.57110125",
"0.5671111",
"0.56692845",
"0.56... | 0.859019 | 0 |
push(value) adds a value 'value' to the end of the linked list | def push(value)
last.next_node = Node.new(value, nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(value)\n @head = LinkedListNode.new(value, @head)\n end",
"def push(value)\n\t\t\t\tif @length == 0\n\t\t\t\t\t@head = @tail = newNode(nil, value, nil)\n\t\t\t\telse\n\t\t\t\t\t@tail.next = newNode(@tail, value, nil)\n\t\t\t\t\t@tail = @tail.next\n\n\t\t\t\t\tif @length == 1\n\t\t\t\t\t\t@head... | [
"0.8621315",
"0.8543513",
"0.8484303",
"0.8457438",
"0.8457438",
"0.84379774",
"0.84340274",
"0.84340274",
"0.84321713",
"0.8428468",
"0.84120625",
"0.84027535",
"0.8401683",
"0.8401683",
"0.83994704",
"0.83962727",
"0.83738476",
"0.8365877",
"0.83572245",
"0.8356332",
"0.835... | 0.86422974 | 0 |
The "type" of dependencies this manager manages. This can be the language, tool, etc. | def type
raise LicenseScout::Exceptions::Error.new("All DependencyManagers must have a `#type` method")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n @klass.is_a?(Rubinius::ToolSets::Runtime::ToolSet::AST::Class) ? \"class\" : \"module\"\n end",
"def type\n @type ||= self.class.name.split('::').last\n end",
"def dependency name, version, type = :runtime\n raise \"Unknown dependency type: #{type}\" unless\n [:runtime, :dev, :de... | [
"0.6768606",
"0.64739126",
"0.64718497",
"0.6274962",
"0.61399627",
"0.61187696",
"0.608098",
"0.60559875",
"0.60549706",
"0.60549706",
"0.60549706",
"0.601348",
"0.6011569",
"0.59861875",
"0.59820884",
"0.59820884",
"0.59820884",
"0.59811634",
"0.59806734",
"0.5944626",
"0.5... | 0.7233944 | 0 |
Implementation's of this method in subclasses are the methods that are responsible for all the heavylifting when it comes to determining the dependencies (and their licenses). They should return an array of `LicenseScout::Dependency`. | def dependencies
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def licenses\n licenses = []\n uris = metadata[dataset_uri][dct.license.to_s]\n if uris.nil?\n []\n else\n uris.each do |uri|\n l = metadata[uri]\n licenses << License.new(:uri => uri, :name => l[dct.title.to_s])\n end\n return l... | [
"0.6979492",
"0.68642575",
"0.6855722",
"0.6850754",
"0.6844061",
"0.684021",
"0.67019534",
"0.6685572",
"0.66536504",
"0.65131265",
"0.6511361",
"0.6506128",
"0.64482623",
"0.64454293",
"0.64454293",
"0.64454293",
"0.64454293",
"0.643095",
"0.6416843",
"0.63927746",
"0.63927... | 0.69650996 | 1 |
A helper that allows you to quickly create a new Dependency (with the type) | def new_dependency(name, version, path)
LicenseScout::Log.debug("[#{type}] Found #{name} #{version}#{" #{path}" unless path.nil?}")
Dependency.new(name, version, path, type)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def d(*args)\n Dependency.new(*args)\n end",
"def as_a_dependency\n Aws::Templates::Utils::Dependency.new(object)\n end",
"def add_dependency_with_type(dependency, type, requirements)\n requirements = if requirements.empty?\n Gem::Requirement.default\n else\n req... | [
"0.70160085",
"0.6388023",
"0.62843645",
"0.61787224",
"0.6020573",
"0.59608924",
"0.5925612",
"0.5895755",
"0.5841771",
"0.5823852",
"0.5804395",
"0.57698995",
"0.5739764",
"0.5675239",
"0.567129",
"0.5561659",
"0.55614346",
"0.5532884",
"0.5526409",
"0.5510601",
"0.54771894... | 0.694366 | 1 |
Creates and returns a new RecBack MazeHelper object. Many options are supported: [:width] The number of columns in the maze. [:height] The number of rows in the maze. [:seed] The maze algorithm to use. This should be a class, | def initialize(options = {})
@width = (options[:width] || 10).to_i
@height = (options[:height] || @width).to_i
@seed = (options[:seed] || rand(0xFFFF_FFFF)).to_i
@grid = Array.new(height) {Array.new(width, 0)}
srand(@seed)
# start carving the maze passage from the upper-left corner
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redesign\r\n\t\tm = MazeMaker.new(@n,@m)\r\n\t\t@maze = m.make_maze\r\n\tend",
"def get_maze(full=true)\n Maze.new(@width, @height, @start_p, @end_p, full)\n end",
"def generate\n carve maze.cell_at(0,0)\n maze\n end",
"def initialize(options = {})\n @width = (options[:width] || 10).t... | [
"0.60306096",
"0.5867004",
"0.5722799",
"0.5674609",
"0.55316454",
"0.5510154",
"0.54470944",
"0.5416506",
"0.5395136",
"0.5344716",
"0.5318697",
"0.52820045",
"0.5241874",
"0.5171722",
"0.5171573",
"0.5103918",
"0.5090913",
"0.5081683",
"0.5038239",
"0.49908844",
"0.49598753... | 0.680969 | 0 |
Returns original window if defined, current window if not See Windowuse | def original_window
@original_window ||= window
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_window; @window; end",
"def window\r\n return $window\r\n end",
"def window\n @session.request(:vim_get_current_window)\n end",
"def window\n @win\n end",
"def usable_window\n window = @windows.last\n window if window.loaded?\n end",
"def active_window\n window... | [
"0.787422",
"0.7749725",
"0.7462729",
"0.7365655",
"0.73364246",
"0.7200005",
"0.7185287",
"0.7107227",
"0.7069621",
"0.7069621",
"0.7031164",
"0.69700843",
"0.695627",
"0.6947236",
"0.69061977",
"0.6901702",
"0.6901667",
"0.68819124",
"0.68757325",
"0.6871016",
"0.68509674",... | 0.82171977 | 0 |
Returns estimated effort for a ProjectPhase by calculating the sum of the estimated effort for each StockDeliverableType and CustomDeliverableType | def estimated_effort
total_estimated_effort = 0
self.project_phase_deliverables.each do |deliverable|
total_estimated_effort += deliverable.estimated_effort.to_f unless deliverable.nil?
end
return total_estimated_effort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_phase_actual_effort(project_id, phase)\n @hours = 0\n @dataset = Deliverable.find_all_by_phase_and_project_id(phase, project_id)\n puts @dataset\n if @dataset.nil?\n return 0\n else\n @dataset.each do |d|\n @hours += d.hours_logged\n end\n return @hours\n ... | [
"0.6394787",
"0.62272865",
"0.5798721",
"0.56754416",
"0.5484788",
"0.5387674",
"0.536942",
"0.53105897",
"0.52936953",
"0.5292658",
"0.52565676",
"0.5237736",
"0.51657087",
"0.51464784",
"0.51193655",
"0.5102273",
"0.50990856",
"0.5075204",
"0.5070166",
"0.5062832",
"0.50492... | 0.7271085 | 0 |
function to get the total logged effort for this deliverable | def logged_effort
total_logged_effort = 0
self.project_phase_deliverables.each do |deliverable|
total_logged_effort += deliverable.logged_effort.to_f unless deliverable.nil?
end
return total_logged_effort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimated_effort\n total_estimated_effort = 0\n\n self.project_phase_deliverables.each do |deliverable|\n total_estimated_effort += deliverable.estimated_effort.to_f unless deliverable.nil?\n end\n\n return total_estimated_effort\n end",
"def total\n count = 0\n self.total_time_exer... | [
"0.7250742",
"0.6434303",
"0.6432553",
"0.6411589",
"0.64055353",
"0.6349569",
"0.6248869",
"0.6048537",
"0.6018238",
"0.5975668",
"0.5954886",
"0.5953312",
"0.5903224",
"0.5894547",
"0.58932376",
"0.58912987",
"0.588154",
"0.585457",
"0.58411676",
"0.583361",
"0.58333963",
... | 0.82118356 | 0 |
function to return the aggregated project phase deliverables with both stock and custom | def project_phase_deliverables
project_phase_deliverables = []
stock_deliverable_types.each do |stock|
stock.deliverables.each do |d|
project_phase_deliverables << d
end
end
custom_deliverable_types.each do |custom|
custom.deliverables.each do |d|
project_phase_deliver... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deliverables\n return Deliverable.where(project_id: @project.id)\n end",
"def getDeliverableTypes\n @projectPhase = ProjectPhase.find(@project_phase_id)\n @deliverableTypes = DeliverableType.find_all_by_lifecycle_phase_id(@projectPhase.lifecycle_phase_id)\n @deliverableTypesArray = []\n @deli... | [
"0.65836674",
"0.6328863",
"0.6298275",
"0.60927415",
"0.60913974",
"0.60671175",
"0.6051786",
"0.60024947",
"0.59516114",
"0.58622426",
"0.5858245",
"0.58278084",
"0.57256776",
"0.5671447",
"0.56512403",
"0.55656505",
"0.554246",
"0.5535978",
"0.55007213",
"0.54706866",
"0.5... | 0.806633 | 0 |
gets the current theme or returns default if it comes back blank | def get_theme
use_theme = Preference.get_setting('CURRENT_THEME')
(use_theme == '' ? 'default' : use_theme).downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_theme\n nil\n end",
"def get_theme\n\t\tif @current_user and @current_user.theme\n\t\t\t@current_theme = @current_user.theme.css_class\n\t\telse\n\t\t\t@current_theme = \"pond\"\n\t\tend\n\tend",
"def theme\n @theme || 'plastik'\n end",
"def current_theme(passed_theme = nil)\n... | [
"0.83288646",
"0.79230934",
"0.7906802",
"0.78816706",
"0.77404493",
"0.7739274",
"0.7630222",
"0.75294083",
"0.74879324",
"0.73766637",
"0.7246554",
"0.70597017",
"0.70159614",
"0.67778724",
"0.6729735",
"0.65933573",
"0.65707153",
"0.6463578",
"0.6463578",
"0.6463578",
"0.6... | 0.85378844 | 0 |
The value which is used for sorting. Used on the preset scenario list | def sorting_value
respond_to?(:ordering) ? ordering : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valueOrder(obj)\n if obj.tutors.exists?\n obj.tutors.sort_by {|t| t.pname }.first.pname\n else\n \"_\"\n end\n end",
"def default_sort_attribute\n ::Mincer.config.sorting.sort_attribute\n end",
"def calculate_sort_value options\n dummy_time = dummy_time_for_day openin... | [
"0.6464138",
"0.63776237",
"0.63436735",
"0.6317916",
"0.6288007",
"0.6167908",
"0.61620027",
"0.61186767",
"0.6088003",
"0.59630585",
"0.5926655",
"0.59065783",
"0.58935887",
"0.5840346",
"0.58377767",
"0.5814039",
"0.5781655",
"0.57744765",
"0.57550967",
"0.57550967",
"0.57... | 0.65542465 | 0 |
Creates the four required columns that constitutes a single cascading namespace settings attribute. This helper is only appropriate if the setting is not already present as a noncascading attribute. Creates the `setting_name` column along with the `lock_setting_name` column in both `namespace_settings` and `application... | def add_cascading_namespace_setting(setting_name, type, **options)
lock_column_name = "lock_#{setting_name}".to_sym
check_cascading_namespace_setting_consistency(setting_name, lock_column_name)
namespace_options = options.merge(null: true, default: nil)
add_column(:namespace_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setting_class\n @setting_class ||= case orm\n when :activerecord\n require 'settler/orm/activerecord/setting'\n Settler::ORM::Activerecord::Setting\n else\n require 'settler/orm/ruby/setting'\n Settler::ORM::Ruby::Setting\n end\n end",
"def setting_params\n ... | [
"0.49649224",
"0.4823334",
"0.47971034",
"0.46413702",
"0.4559991",
"0.4529144",
"0.45199347",
"0.450397",
"0.44972235",
"0.44927645",
"0.44905928",
"0.44677636",
"0.44619715",
"0.44599438",
"0.44313174",
"0.4407542",
"0.43775278",
"0.43568566",
"0.4345559",
"0.43305054",
"0.... | 0.80753994 | 0 |
Because pagy gem method pagy_next_url return url base on request url, but sometime we want specify base url. So this is what this method doing. | def next_url_for_path(path, pagy)
return unless pagy.next
url = URI.parse(path); url_query = Rack::Utils.parse_query url.query
url.query = Rack::Utils.build_query url_query.merge(pagy.vars[:page_param].to_s => pagy.next)
url.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_page_url\n \"#{request.path}?page=#{@page + 1}\"\n end",
"def next_url_str\n \"#{@url_base_str}?#{QUERY_STRING_PART1}&#{@query_str_next_page}\"\n end",
"def next_page_path; end",
"def next_page_url\n current_page = params[:page].try(:to_i) || 1\n if request.path.match /\\/page\\/(\... | [
"0.7240253",
"0.72379565",
"0.71005315",
"0.6989908",
"0.6839695",
"0.674903",
"0.66792136",
"0.6646795",
"0.6597067",
"0.6586699",
"0.6576461",
"0.6576461",
"0.65652233",
"0.65496325",
"0.65496325",
"0.6504919",
"0.6459087",
"0.6459087",
"0.6455604",
"0.6445155",
"0.6340858"... | 0.73391056 | 0 |
GET /magic_item_names GET /magic_item_names.json | def index
@magic_item_names = MagicItemName.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_item_names\n items = []\n Static.get_item_list.values.each do |f|\n items << f[\"name\"]\n end\n items\n end",
"def name_list\n begin\n @products = Product.pluck(:name)\n render json: { names: @products }, status: 200\n rescue => exception\n render json: {... | [
"0.73406905",
"0.67368335",
"0.66846734",
"0.65237606",
"0.63395196",
"0.63226616",
"0.63028604",
"0.6240045",
"0.61300594",
"0.60667986",
"0.60667986",
"0.60496145",
"0.60417163",
"0.59857535",
"0.5984824",
"0.59831995",
"0.59586614",
"0.5957465",
"0.5909478",
"0.58989453",
... | 0.7702119 | 0 |
POST /magic_item_names POST /magic_item_names.json | def create
@magic_item_name = MagicItemName.new(magic_item_name_params)
respond_to do |format|
if @magic_item_name.save
format.html { redirect_to @magic_item_name, notice: 'Magic item name was successfully created.' }
format.json { render :show, status: :created, location: @magic_item_nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @magic_item_names = MagicItemName.all\n end",
"def magic_item_name_params\n params.require(:magic_item_name).permit(:name, :affix)\n end",
"def item_name\n params['item_name']\n end",
"def set_magic_item_name\n @magic_item_name = MagicItemName.find(params[:id]... | [
"0.65030557",
"0.64285296",
"0.6226741",
"0.61364675",
"0.59521884",
"0.58190954",
"0.5768685",
"0.5681343",
"0.56139356",
"0.5612835",
"0.5602044",
"0.55766296",
"0.55756",
"0.55729985",
"0.5565371",
"0.5503138",
"0.548819",
"0.5464174",
"0.5464174",
"0.54093695",
"0.53995",... | 0.6748295 | 0 |
PATCH/PUT /magic_item_names/1 PATCH/PUT /magic_item_names/1.json | def update
respond_to do |format|
if @magic_item_name.update(magic_item_name_params)
format.html { redirect_to @magic_item_name, notice: 'Magic item name was successfully updated.' }
format.json { render :show, status: :ok, location: @magic_item_name }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_names\n\t\tparams[:item].each do |key, item|\n\t\t\tcurrent_item = Item.find(key)\n\t\t\tcurrent_item.update(:claimed_by => item[:claimed_by])\n\t\tend\n\t\tflash[:success] = \"Names updated.\"\n\t\tredirect_to(:back)\n\tend",
"def set_magic_item_name\n @magic_item_name = MagicItemName.find(param... | [
"0.6601336",
"0.6478073",
"0.63877803",
"0.63482547",
"0.63341767",
"0.6286458",
"0.62237185",
"0.622177",
"0.6183182",
"0.61792547",
"0.61488265",
"0.6087684",
"0.6069304",
"0.603378",
"0.6031951",
"0.6026903",
"0.5998217",
"0.5994053",
"0.5974475",
"0.5969632",
"0.5966828",... | 0.7312591 | 0 |
DELETE /magic_item_names/1 DELETE /magic_item_names/1.json | def destroy
@magic_item_name.destroy
respond_to do |format|
format.html { redirect_to magic_item_names_url, notice: 'Magic item name was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @itemname = Itemname.find(params[:id])\n @itemname.destroy\n\n respond_to do |format|\n format.html { redirect_to itemnames_url }\n format.json { head :no_content }\n end\n end",
"def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/it... | [
"0.712925",
"0.70415443",
"0.6835347",
"0.6801185",
"0.6763019",
"0.6763019",
"0.6760498",
"0.6754438",
"0.67372817",
"0.66783565",
"0.66700804",
"0.6613633",
"0.66009676",
"0.65984744",
"0.65813076",
"0.6577654",
"0.6559557",
"0.6520968",
"0.6520809",
"0.64875764",
"0.648374... | 0.7403804 | 0 |
3 ways to register filter 1. builtin filter filter.add_filter(:mtime, :passed, 30, :days) 2. custom filter filter.add_filter(my_filter) (my_filter must implements match?(path) method) 3. block filter filter.add_filter do |path| filter operations end | def add_filter(*args, &block)
# 3. block filter
if block_given?
filter = File::Visitor::Filter::Proc.new(block)
@filters.push(filter)
return true
end
# 2. custom filter
if (1 == args.size)
custom_filter = args.shift
unless (custom_filter.respond_to?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_filter(mod); end",
"def add_filter(type, path = nil, **options, &block)\n source_location = block.respond_to?(:source_location) ?\n block.source_location.first : caller_files[1]\n result = super\n watch_element(source_location, :\"#{type}_filter\", filters[type].last)\n... | [
"0.70155233",
"0.6996598",
"0.68954813",
"0.6658535",
"0.663216",
"0.658385",
"0.6567839",
"0.6495973",
"0.64650005",
"0.6464861",
"0.6454527",
"0.6416924",
"0.6345174",
"0.6312059",
"0.6290705",
"0.6290705",
"0.6271176",
"0.6257901",
"0.6233235",
"0.62192565",
"0.6142459",
... | 0.7337683 | 0 |
dir: target directory mode: file visit all files dir visit directory only handler: proc to call | def visit_with_mode(dir, mode, &handler)
assert_directory(dir)
entries = Dir.entries(dir)
.sort_by { |filename| filename }
if @direction == :desc
entries.reverse!
end
entries.each do |entry|
next if (dot_dir?(entry) && !@visit_dot_dir)
abs_path = File.jo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_directory(dir, files, rec)\n dir.children(true).each do |f|\n # ignore sub-directories\n if f.directory?\n if rec == false\n next\n else\n process_directory(f.expand_path, files, rec)\n end\n end\n pro... | [
"0.7269948",
"0.72344595",
"0.7196083",
"0.67955124",
"0.6779908",
"0.67796755",
"0.6704745",
"0.6700345",
"0.6700345",
"0.6691016",
"0.66885805",
"0.66692245",
"0.66111976",
"0.660302",
"0.6600337",
"0.65905225",
"0.6588868",
"0.658193",
"0.6553596",
"0.64825714",
"0.6463325... | 0.76961493 | 0 |
Returns only the children with +results+ | def children_with_results
children.select(&:any_results_including_children?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children\n\t\treturn self.search( :one, '(objectClass=*)' )\n\tend",
"def any_results_including_children?\n races.any?(&:any_results?) || children.any?(&:any_results_including_children?)\n end",
"def pull_out(parent_hash)\n return parent_hash[\"results\"]\n rescue\n return []\n ... | [
"0.6459362",
"0.6355265",
"0.63484645",
"0.6250594",
"0.6238641",
"0.5964827",
"0.59176993",
"0.5885458",
"0.5861433",
"0.5841403",
"0.5840733",
"0.5839581",
"0.57967174",
"0.57507205",
"0.5739048",
"0.5718785",
"0.5714855",
"0.56983995",
"0.5697021",
"0.5694411",
"0.5668937"... | 0.8369089 | 0 |
Returns only the Races with +results+ | def races_with_results
races.select(&:any_results?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_results(race)\n Result.all(\n :include => [:race, {:person => :team}, :team, {:race => [:event, :category]}],\n :conditions => [%Q{\n members_only_place between 1 AND #{point_schedule.size - 1}\n and results.person_id is not null\n ... | [
"0.72392356",
"0.70322144",
"0.69340986",
"0.69137114",
"0.6877534",
"0.67981076",
"0.6605429",
"0.6552044",
"0.64661694",
"0.633136",
"0.6317928",
"0.62822217",
"0.62274146",
"0.6181003",
"0.61339587",
"0.59963137",
"0.5985405",
"0.5925433",
"0.5776336",
"0.5770774",
"0.5759... | 0.7977516 | 0 |
Returns an array with the relative path of the selected songs (Overrides def on MusicBaseController) | def get_selected_paths
return get_songs_column( :path )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_selected_paths\n return get_songs_relation.pluck( :path )\n end",
"def song_plays\n SongPlay.where(:song_path => path)\n end",
"def path\n File.expand_path File.join(songs.first.path, '..').gsub(' ','\\ ')\n end",
"def path # getter method \n # - this method will get the path passe... | [
"0.7602469",
"0.6756914",
"0.6566635",
"0.6497871",
"0.64439666",
"0.64439666",
"0.6416481",
"0.6416481",
"0.6416481",
"0.6416481",
"0.6416481",
"0.6416481",
"0.6416481",
"0.6416481",
"0.6416481",
"0.6416481",
"0.6335312",
"0.63043845",
"0.62646556",
"0.6229565",
"0.6189326",... | 0.7722529 | 0 |
NOTE do not pattern your production application after this (refer to test_should_create_customer_profile_transaction_auth_only_and_then_prior_auth_capture_requests instead as the correct way to do an auth then capture). capture_only "is used to complete a previously authorized transaction that was not originally submit... | def test_should_create_customer_profile_transaction_auth_only_and_then_capture_only_requests
@gateway.expects(:ssl_post).returns(successful_create_customer_profile_transaction_response(:auth_only))
assert response = @gateway.create_customer_profile_transaction(
transaction: {
customer_profile_id:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_authorization_and_capture\n return if Base.mode == :test # only tests in production mode\n assert_equal Base.mode, :production\n assert authorization = @gateway.authorize(@amount, @credit_card, @options)\n assert_success authorization\n \n assert capture = @gateway.capture(@amount, authori... | [
"0.6622601",
"0.66165835",
"0.66148984",
"0.64050114",
"0.6402435",
"0.62876874",
"0.6284776",
"0.62716687",
"0.6201491",
"0.6200618",
"0.61151105",
"0.6092354",
"0.606081",
"0.6026894",
"0.6023429",
"0.601596",
"0.5996501",
"0.5947878",
"0.59419584",
"0.5903622",
"0.5870499"... | 0.6712602 | 0 |
Get an strategy by its id | def get(id)
self.class.strategies.select { |strategy| strategy.id == strategy.id }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_strategy\n @strategy = Strategy.find(params[:id])\n end",
"def set_strategy\n if params[:id]\n @strategy = Strategy.find(params[:id])\n else \n @strategy = Strategy.find_by(uuid: params[:uuid])\n end\n end",
"def _fetch_strategy(name, scope)\n @strategies[sc... | [
"0.687599",
"0.6719225",
"0.61248964",
"0.60925907",
"0.603201",
"0.59219956",
"0.58672255",
"0.57997185",
"0.5797541",
"0.5793163",
"0.57907176",
"0.57891375",
"0.57810223",
"0.5767059",
"0.5754778",
"0.5749873",
"0.5743043",
"0.5742503",
"0.5708508",
"0.5689515",
"0.5684819... | 0.854905 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.