query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Returns boolean of comparison true only if key == 'other' | def is_other?
key == 'other'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eql?(other)\n key == other.key\n end",
"def ==(other)\n key == other.key\n end",
"def ==(other)\n key == other.key\n end",
"def ==(other)\n return false unless other.is_a?(Key)\n name == other.name && operator == other.operator && expanded == other.expanded\n end",
"def... | [
"0.6952454",
"0.6843059",
"0.6843059",
"0.6814786",
"0.6672624",
"0.6606317",
"0.65257394",
"0.6422569",
"0.6417517",
"0.6409944",
"0.6409944",
"0.6409944",
"0.6409944",
"0.6409944",
"0.6409944",
"0.6408887",
"0.6344905",
"0.6344905",
"0.6338747",
"0.62710446",
"0.6224358",
... | 0.83853227 | 1 |
iTunes U requires all request to include an authorization token that includes a User's credentials, indetifiying information, and the time of the request. This data is hashed against your institution's shared secret (provider by Apple with your iTunes U account information). Because tokens are valid only for 90 seconds... | def generate_authorization_token
# create the token that contains the necessary elements to authorize the user
# using a nested array because the alphabetical order must be maintained
token = [['credentials', self.user.to_credential_string,], ['identity', self.user.to_identity_string], ['time', Time.now... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_token\n username = @credentials['username']\n password = @credentials['password']\n # app_name = @credentials['app_name']\n app_name = @credentials['app_name']\n vendor_name = @credentials['vendor_name']\n bus_num = @credentials['bus_num']\n scope = @credentials['scope']\n\n pay... | [
"0.5983701",
"0.5966323",
"0.58319956",
"0.5737959",
"0.5711039",
"0.570929",
"0.5656763",
"0.56490046",
"0.5642586",
"0.56357515",
"0.56336546",
"0.5615039",
"0.56137097",
"0.5604563",
"0.55892694",
"0.5554911",
"0.5518252",
"0.5477136",
"0.5471622",
"0.5468005",
"0.5468005"... | 0.5870556 | 2 |
The URL that receives all iTunes U webservices requests. This is different for each institution and inclues your site name provided by Apple. | def webservices_url
"#{API_URL}/ProcessWebServicesDocument/#{options[:site]}?#{self.generate_authorization_token}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_url\n URI.parse(\"#{@server}#{URL}\")\n end",
"def url\n URI.parse(\"#{protocol}://#{host}:#{port}#{store_uri}\")\n end",
"def url\n if @response_type.eql?('NVP')\n @url = (is_sandbox? ? 'https://sandbox.zooz.co' : 'https://app.zooz.com') +\n '/mobile/SecuredWebServlet'... | [
"0.67227757",
"0.6687034",
"0.66524184",
"0.65889275",
"0.6578765",
"0.6541661",
"0.64579296",
"0.6423595",
"0.6418446",
"0.63932186",
"0.6374214",
"0.63646615",
"0.636186",
"0.636186",
"0.636186",
"0.63558215",
"0.6348297",
"0.63481337",
"0.6340859",
"0.63387805",
"0.6330514... | 0.6520806 | 6 |
Sends a string of XML data to iTunes U's webservices url for processing. Returns the iTunes U response XML. Used by Entity objects to send generated XML to iTunes U. | def process(xml)
timeout(TIMEOUT) do
url = URI.parse(webservices_url)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start {
request = Net::HTTP::Post.new(url.to_s)
request.body ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_request( xml )\n write( xml )\n read\n end",
"def send_xml(out_xml)\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri)\n\n @logger.error \"#$%$ #{@user}\"\n request.basic_auth @user, @passwor... | [
"0.63785696",
"0.62190396",
"0.6165021",
"0.5964152",
"0.58320075",
"0.5800222",
"0.57236105",
"0.5679765",
"0.56661725",
"0.56476617",
"0.5645593",
"0.56087613",
"0.55884844",
"0.5528589",
"0.55226886",
"0.5522385",
"0.55057764",
"0.5483687",
"0.5468196",
"0.5445685",
"0.540... | 0.56229496 | 11 |
Uploads a file from the local system to iTunes U. | def upload_file(file_path, itunes_location)
# url = URI.parse(self.upload_url_for_location(itunes_location))
# req = Net::HTTP::Post::Multipart.new(url.path, {"file" => UploadIO.new(file_path, "image/jpeg")})
# res = Net::HTTP.start(url.host, url.port) do |http|
# http.request(req)
# end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_media_file( wikipath, filename, raw )\n p filename\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'X-File-Name' => filename\n }\n url = upload_url( wikipath, filename )\n p url\n wait_second\n pp @agent.post( url, raw, headers )\n sa... | [
"0.7287691",
"0.69919086",
"0.6956943",
"0.6844342",
"0.66928893",
"0.65853274",
"0.65615195",
"0.6483833",
"0.6482632",
"0.6481115",
"0.6468398",
"0.64555126",
"0.64456797",
"0.6433043",
"0.6426671",
"0.64116263",
"0.6396875",
"0.63594663",
"0.63464713",
"0.6331798",
"0.6331... | 0.73779047 | 0 |
Retrieves and parses iTunesU usage logs. Options: +:from+:: Specifies the date to retrieve logs from. Defaults to +Date.today+ +:to+:: (optional) Specifies the ending date of a date range: (:from)..(:to). +:parse+:: Controls whether logs are parsed or returned raw. Example: connection.get_logs Retrieves and parses logs... | def get_logs(opt={})
opt[:from] ||= Date.today
#opt[:to] ||= Date.today - 1
opt[:parse] = opt[:parse].nil? ? true : opt[:parse]
#raise ":from date must preceed :to date." if opt[:to] && opt[:to] < opt[:from]
uri_str = "#{API_URL}/GetDailyReportLogs/#{options[:site]}?#{self.ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end",
"def get_all_logs(date_range_start, date_range_end, search = '', log_level = '',\n logger_assembly = '', user_id = 0, message_group_id = 0,\n include_traces = nil, org_unit_id = 0, bookmark ... | [
"0.6681482",
"0.6604971",
"0.6289347",
"0.61898863",
"0.61148304",
"0.6021649",
"0.5949822",
"0.5938107",
"0.5934434",
"0.5898904",
"0.5830028",
"0.58223903",
"0.5802401",
"0.57680285",
"0.5764383",
"0.57614255",
"0.56782216",
"0.5675617",
"0.56693524",
"0.56604886",
"0.56513... | 0.7650569 | 0 |
provide form to create a new user | def new
@user = User.new
render :new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t@user = User.new\n\t@title = \"Sign up\"\n end",
"def new\n\t\t @user = User.new\t\t#lo devo passare nella form per la create\n\tend",
"def new\n\t@title = \"Sign Up\"\n\t@user = User.new\n end",
"def new\n @myuser = User.new # Create a new user in memory, whose params will be filled by ... | [
"0.80562085",
"0.80328876",
"0.79887474",
"0.7954062",
"0.7841715",
"0.7841017",
"0.77434033",
"0.77251774",
"0.769896",
"0.76965475",
"0.7577362",
"0.7543834",
"0.753931",
"0.750764",
"0.75035834",
"0.74893886",
"0.74817437",
"0.7481165",
"0.7471217",
"0.74540925",
"0.745259... | 0.0 | -1 |
create a new user | def create
@user = User.create(user_params)
login(@user)
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_user\n User.create name: \"test\", email: \"test@example.com\", password: \"123456\"\n end",
"def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end",
"def create\n\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend",
"def create_use... | [
"0.83787125",
"0.834754",
"0.8327708",
"0.81524366",
"0.8125249",
"0.8098494",
"0.80984014",
"0.8009092",
"0.8002363",
"0.79579",
"0.79421294",
"0.7918258",
"0.7911783",
"0.7897437",
"0.7887462",
"0.7883866",
"0.7883866",
"0.7851761",
"0.7850498",
"0.78469807",
"0.78463584",
... | 0.77504325 | 36 |
show info for one user | def show
@user = User.find(params[:id]) #find user with that id and save as instance of user
render :show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info\n\t@user = User.find(params[:id])\n end",
"def show_user\n \tuser = User.where({:id => self.user_id}).first\n \tuser.name\n end",
"def show\n\t\t# Find all users with id passed by params.\n\t\t@user = User.find(params[:id])\n\t\tCUSTOM_LOGGER.info(\"Start to find users #{@user.to_yaml}\")\n\tend",
... | [
"0.82662034",
"0.7715904",
"0.7522241",
"0.74875635",
"0.7453036",
"0.7447052",
"0.740831",
"0.7393988",
"0.7359566",
"0.73582715",
"0.7321353",
"0.7320375",
"0.7314542",
"0.7310023",
"0.73082507",
"0.7292445",
"0.72741365",
"0.72710043",
"0.7248438",
"0.7232884",
"0.7214131"... | 0.71536213 | 34 |
walk through garden to find 'W' | def walk_through
count = 0
for i in 0..@n-1
for j in 0..@m-1
if @garden[i][j] == 'W'
@garden[i][j] = 'C'
count += 1
check_around(i,j)
end
end
end
puts count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_waters_next_step(location,cave)\n \n next_step = [0,0]\n \n if cave[location[:y] + 1][location[:x]] == \" \" # Attempt to flow down\n next_step[1] = 1\n elsif cave[location[:y]][location[:x] + 1] == \" \" # If unable to flow down try to flow right\n next_step[0] = 1\n else ... | [
"0.6071067",
"0.6024392",
"0.59996456",
"0.5858125",
"0.5610596",
"0.5577588",
"0.55396706",
"0.5513014",
"0.54580367",
"0.5410428",
"0.53790843",
"0.5315112",
"0.5302529",
"0.5279079",
"0.5269038",
"0.5253508",
"0.52230227",
"0.5221346",
"0.52208036",
"0.5214719",
"0.5199529... | 0.6654604 | 0 |
check around the target which had 'W' recursively loop if neighbor has 'W' and change to 'C' | def check_around(x,y)
for i in x-1..x+1 do
for j in y-1..y+1 do
if i >= 0 && i < @n && j >= 0 && j < @m && @garden[i][j] == 'W'
@garden[i][j] = 'C'
check_around(i,j)
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walk_through\n count = 0\n for i in 0..@n-1\n for j in 0..@m-1\n if @garden[i][j] == 'W'\n @garden[i][j] = 'C'\n count += 1\n check_around(i,j)\n end\n end\n end\n puts count\n end",
"def conway(current)\n def conway_alive_neighbours(current, i... | [
"0.6161736",
"0.5899519",
"0.5693257",
"0.56796515",
"0.5642598",
"0.5502024",
"0.54734665",
"0.5449857",
"0.5426232",
"0.53751206",
"0.5367571",
"0.53119767",
"0.5292295",
"0.52920204",
"0.5274943",
"0.5271753",
"0.5266254",
"0.52595824",
"0.5237535",
"0.5234469",
"0.5231335... | 0.5847944 | 2 |
Given an array, and a window size w, find the maximum range (max min) within a set of w elements. Naive Solution O(n m) time bc loop through array of size n while slicing the arr at size m O(n^2) time for Ruby's min and max functions O(n) space since .each_cons allocates temp space for each slice | def max_windowed_range(arr, window)
current_max_range = nil
arr.each_cons(window) do |slice|
current_range = slice.max - slice.min
if current_max_range == nil || current_max_range < current_range
current_max_range = current_range
end
end
return current_max_range
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def windowed_max_range(arr, w) # o(n^2)\n current_max_range = 0\n\n arr.each_index do |i|\n window = arr[i...i+w]\n max = window.max\n min = window.min\n if max - min > current_max_range\n current_max_range = max - min\n end\n end\n current_max_range\nend",... | [
"0.87779015",
"0.8701737",
"0.85929245",
"0.85885787",
"0.8576821",
"0.8555717",
"0.853714",
"0.8523386",
"0.84837943",
"0.84554636",
"0.8370358",
"0.8359265",
"0.82997966",
"0.82773906",
"0.8258819",
"0.8250853",
"0.8244279",
"0.822845",
"0.8221062",
"0.82184154",
"0.8211649... | 0.85489607 | 6 |
Optimized Solution O(n) time bc looping through an array of size n. Enqueue, dequeue, min, and max take O(1) constant time. | def max_windowed_range_op(arr, window)
queue = Min_max_stack_queue.new()
max_range = nil
arr.each do |ele|
queue.enqueue(ele)
if queue.size > window
queue.dequeue()
end
if queue.size == window
current_range = queue.max - queue.min
if max_range == nil || max_range < current_ran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def windowed_max_range_mmsq(array, window_size)\n max_range = nil\n queue = My_Stack_Queue.new\n array.each { |num| queue.enqueue(num) }\n window = My_Min_Max_Stack_Queue.new\n (window_size - 1).times { window.enqueue(queue.dequeue) } #O(n) b/c the dequeue operation is now O(1)\n\n until queue.em... | [
"0.7006858",
"0.69824886",
"0.69371873",
"0.6889279",
"0.6845632",
"0.6803926",
"0.677032",
"0.6740887",
"0.66735506",
"0.6638709",
"0.66343075",
"0.65662515",
"0.65581954",
"0.6527519",
"0.6525027",
"0.6507019",
"0.6485728",
"0.64613086",
"0.63992983",
"0.63691914",
"0.63578... | 0.6214708 | 31 |
This file contains code that populates the database with fake data for testing purposes | def db_seed
# Your code goes here!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_DB_initialization\n @fdb = setup\n assert(@fdb.size > 0, \"Database entries not correctly read in\")\n end",
"def populate_test_data\n @alice_mrn = 123\n @alice_picudb_id = @lomi.patients.insert({:mrn => @alice_mrn, :source => \"picudb\", :first_name => \"Alice\"})\n @alice_cerner_... | [
"0.7035197",
"0.6972767",
"0.6812558",
"0.67838246",
"0.6671686",
"0.6602398",
"0.6553615",
"0.655107",
"0.6503294",
"0.6475599",
"0.6453201",
"0.6436774",
"0.6421321",
"0.63878614",
"0.63675106",
"0.6366912",
"0.6358079",
"0.6345565",
"0.6334056",
"0.63055927",
"0.6283949",
... | 0.6289482 | 20 |
Return true if the user's password matches the submitted password. | def has_password?(submitted_password)
# Compare encrypted_password with the encrypted version of
# submitted_password.
encrypted_password == encrypt(submitted_password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end",
"def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend",
"def passwords_match?\n context.user.... | [
"0.84846497",
"0.83514154",
"0.8314946",
"0.83126307",
"0.827834",
"0.8242325",
"0.82152337",
"0.82152337",
"0.8203403",
"0.819433",
"0.8193615",
"0.818064",
"0.818064",
"0.81534135",
"0.81497765",
"0.813418",
"0.8128249",
"0.8128249",
"0.81280136",
"0.81280136",
"0.81280136"... | 0.7936543 | 56 |
class AddOrFalseArray < Array preferred way of changing behaviour, as long as we control instantiation def <<(element) if defined? element super(element) else return false end end end | def rake(task_string, opts={})
# default behaviour: rake tasks being invoked only once, unless reenabled
# for multiple execution, so let's just reenable always
Rake::Task[task_string].reenable
Rake::Task[task_string].invoke(opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def +(arr)\n raise 'Not Implemented'\n end",
"def << toadd\n# puts \"type: #{toadd.class}\"\n case toadd\n when Array\n# puts \"recognised array\"\n toadd.each do |ta| \n r = add_single ta\n raise \"This type is not recongnised.\" if r ==false\n end\n else\n ... | [
"0.677029",
"0.6711387",
"0.6675239",
"0.6622386",
"0.66188353",
"0.65307486",
"0.6367113",
"0.6283981",
"0.62708217",
"0.6258161",
"0.62151325",
"0.61881167",
"0.61587626",
"0.6153188",
"0.6153188",
"0.6153188",
"0.61504835",
"0.6063063",
"0.60624",
"0.6058467",
"0.6025128",... | 0.0 | -1 |
GET /questions/1 GET /questions/1.json | def show
@question = Question.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @question }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender js... | [
"0.7683254",
"0.7540626",
"0.737101",
"0.7303245",
"0.7251743",
"0.7231343",
"0.7230414",
"0.7230414",
"0.7230414",
"0.7194254",
"0.7168331",
"0.7120867",
"0.70868975",
"0.704648",
"0.69566995",
"0.693518",
"0.6902902",
"0.68723387",
"0.6862595",
"0.68389857",
"0.6827077",
... | 0.7174909 | 11 |
GET /questions/new GET /questions/new.json | def new
@question = Question.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @question }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question ... | [
"0.79149055",
"0.79149055",
"0.79149055",
"0.79149055",
"0.79149055",
"0.7886503",
"0.7803065",
"0.779545",
"0.7538112",
"0.74881715",
"0.7487909",
"0.7469361",
"0.745795",
"0.7452862",
"0.74346733",
"0.739897",
"0.739611",
"0.73627543",
"0.7340553",
"0.73198944",
"0.73077697... | 0.7836273 | 6 |
POST /questions POST /questions.json | def create
workout = Workout.find params[:workout_id]
result = Question.create(workout, {
:body => params[:body],
:answer_type => params[:answer_type] },
params[:answers].values
)
@question = result[:question]
respond_to do |format|
unless @question.persisted?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index ... | [
"0.73663974",
"0.7297181",
"0.70590156",
"0.70004314",
"0.69567543",
"0.6873842",
"0.6773212",
"0.672806",
"0.6711098",
"0.6708516",
"0.67059517",
"0.6688269",
"0.66470194",
"0.66347027",
"0.66260415",
"0.66260415",
"0.66260415",
"0.66260415",
"0.66260415",
"0.66260415",
"0.6... | 0.6259166 | 58 |
PUT /questions/1 PUT /questions/1.json | def update
@question = Question.update(params[:id], {
:body => params[:body],
:answer_type => params[:answer_type] },
params[:answers].values
)
respond_to do |format|
format.json { render :json => @question.as_json({:include => :answers}) }
# if @question.update_at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\... | [
"0.7163457",
"0.71061796",
"0.7029859",
"0.68663263",
"0.68620074",
"0.68410355",
"0.672236",
"0.67078197",
"0.66926074",
"0.6666983",
"0.6642791",
"0.6642791",
"0.6642791",
"0.6642791",
"0.6642791",
"0.654896",
"0.65428734",
"0.65385866",
"0.65123165",
"0.64821005",
"0.64676... | 0.6569455 | 15 |
DELETE /questions/1 DELETE /questions/1.json | def destroy
@question = Question.find(params[:id])
@question.destroy
respond_to do |format|
format.html { redirect_to questions_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted questio... | [
"0.7801243",
"0.77760345",
"0.762556",
"0.76092136",
"0.76092136",
"0.7587306",
"0.75842667",
"0.75842667",
"0.75842667",
"0.75842667",
"0.75842667",
"0.75842667",
"0.75230396",
"0.7521938",
"0.75034994",
"0.7487404",
"0.7483059",
"0.74802965",
"0.7471379",
"0.74472755",
"0.7... | 0.7591492 | 10 |
goes to the show method | def show
@playlist = Playlist.find(params[:id]) # Playlist.find(8)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @playlist }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n\t\t end",
"def show\n \t\n end",
"def show\n \t\n end",
"def show\t\t\t\t\n\t\t\tend",
"def show\n \n end",
"def show\n \n end",
"def show\n end",
"def show\n\t end",
"def show \r\n end",
"def show\n\t\t\n\tend",
"def show\n\t\t\n\tend",
"def... | [
"0.8845563",
"0.88411385",
"0.88411385",
"0.8808279",
"0.88021535",
"0.88021535",
"0.8794614",
"0.8761129",
"0.87550396",
"0.87270516",
"0.87270516",
"0.87270516",
"0.87200564",
"0.8718003",
"0.8713542",
"0.8713542",
"0.8713542",
"0.8713542",
"0.8708888",
"0.87048155",
"0.870... | 0.0 | -1 |
Creates a role within the given client. it will be visible in tokens given by this client during authentication, as it is already in scope. | def create_role(client:, **data)
create_object(type: 'Role', root: url_for(client), data: data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n chef_server_rest.post(\"roles\", self)\n self\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @client.roles << @role\n flash[:notice] = 'Role was successfully created.'\n format.html { redirect_to client_role_url(@client, @r... | [
"0.70292664",
"0.6927167",
"0.68617153",
"0.68602145",
"0.6784822",
"0.6468148",
"0.6466598",
"0.64571047",
"0.6435991",
"0.6405708",
"0.63475776",
"0.63475776",
"0.6276221",
"0.6271178",
"0.62676084",
"0.6206105",
"0.62008524",
"0.61829835",
"0.61149365",
"0.6107673",
"0.604... | 0.8344595 | 0 |
This method is for prevent user to access Signup & Login Page without logout | def save_login_state
if session[:user_id]
redirect_to user_profile_path(session[:user_id]), notice: 'Already Logged in!'
return false
else
return true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deny_access\n redirect_to signin_path, notice: \"Please sign in to access that page.\"\n end",
"def deny_access\n\t\t# store location for forwarding users after log in to their intended location\n\t\tstore_location\n \tredirect_to signin_path, :notice => \"Please sign in to access this page.\"\n \ten... | [
"0.75125766",
"0.7453426",
"0.7415995",
"0.730633",
"0.73015606",
"0.7289159",
"0.72415096",
"0.72411776",
"0.7237979",
"0.7199476",
"0.719502",
"0.7183218",
"0.7157498",
"0.71512353",
"0.7134546",
"0.7108698",
"0.7081631",
"0.7075467",
"0.70675516",
"0.70544046",
"0.70327944... | 0.0 | -1 |
Computes the Keccak256 hash of the given data. | def keccak256(data)
Digest::SHA3.new(256).digest(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sha256 key, data\n OpenSSL::HMAC.digest('sha256', key, data)\n rescue RuntimeError\n require 'hmac-sha2'\n HMAC::SHA256.digest(key, data)\n end",
"def hmac_sha256(data, secret)\n OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), secret, data)\n end",
"def hash_sha256(input)\n ... | [
"0.7298132",
"0.6808017",
"0.65760654",
"0.6574267",
"0.65692157",
"0.64950204",
"0.6469251",
"0.6328935",
"0.62616056",
"0.6157304",
"0.61566156",
"0.6028882",
"0.60163534",
"0.5997247",
"0.5985225",
"0.5963545",
"0.5950586",
"0.5815485",
"0.57684195",
"0.57337743",
"0.56909... | 0.79266745 | 0 |
Returns the address corresponding to the given public key. | def public_key_to_address(public_key_bin)
Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_key_to_address(public_key_bin)\n Secp256k1::Util.bin_to_hex(keccak256(public_key_bin[1..-1])[-20..-1])\n end",
"def address(network: nil)\n PublicKeyAddress.new(public_key: self.public_key, network: network || self.network)\n end",
"def public_key\n as_public_key(rpc(:account_key, _... | [
"0.7435704",
"0.7094765",
"0.68948084",
"0.6837327",
"0.66737735",
"0.6549235",
"0.65416914",
"0.65238565",
"0.64941525",
"0.6482094",
"0.6473768",
"0.63817704",
"0.63746727",
"0.63746727",
"0.63603777",
"0.63585395",
"0.63509285",
"0.63157934",
"0.63006103",
"0.6297133",
"0.... | 0.7466166 | 0 |
Signs a personal message with the given private key. | def sign(private_key, chain_id)
ctx = Secp256k1::Context.new
signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact
result = signature.bytes
result = result.append(Chains.to_v(recovery_id, chain_id))
result.pack('c*')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(message, private_key)\n msg_point = BLS.norm_p2h(message)\n msg_point * BLS.normalize_priv_key(private_key)\n end",
"def sign(private_key, chain_id)\n ctx = Secp256k1::Context.new\n signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact\n result = signature.bytes\... | [
"0.75908923",
"0.6615079",
"0.65945566",
"0.6473981",
"0.64653355",
"0.64036614",
"0.6397941",
"0.6365537",
"0.6336324",
"0.63082355",
"0.62996465",
"0.62723637",
"0.6005734",
"0.582421",
"0.5814325",
"0.5791384",
"0.57717425",
"0.5770727",
"0.5746826",
"0.574624",
"0.5738240... | 0.6617442 | 1 |
Produce a signature with legacy v values. | def sign_legacy(private_key)
ctx = Secp256k1::Context.new
signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact
result = signature.bytes
result = result.append(27 + recovery_id)
result.pack('c*')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_legacy(private_key)\n ctx = Secp256k1::Context.new\n signature, recovery_id = ctx.sign_recoverable(private_key, hash).compact\n result = signature.bytes\n result = result.append(27 + recovery_id)\n result.pack('c*')\n end",
"def update_signature!; end",
"def update_signatur... | [
"0.60654145",
"0.60008514",
"0.60008514",
"0.5936522",
"0.58631706",
"0.5858638",
"0.5775093",
"0.5768847",
"0.5743914",
"0.5660785",
"0.5620663",
"0.5604879",
"0.5600135",
"0.5577689",
"0.5540902",
"0.55401856",
"0.5518325",
"0.5512266",
"0.5495054",
"0.5494536",
"0.5479762"... | 0.61246634 | 0 |
Returns the keccak256 hash of the message. Applies the expected prefix for personal messages signed with Ethereum keys. | def hash
keccak256(prefixed_message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n keccak256(prefixed_message)\n end",
"def keccak(string)\n Keccak.hexdigest string, 1088, 512, 256\n end",
"def keccak256(data)\n Digest::SHA3.new(256).digest(data)\nend",
"def mining_hash\n Utils.keccak(rlp_encode skip_keys: [:mix_hash, :nonce])\n end",
"def to_sha25... | [
"0.83408093",
"0.6743048",
"0.66679394",
"0.65426666",
"0.5830782",
"0.5814086",
"0.57279277",
"0.5708531",
"0.56595886",
"0.5643894",
"0.5555529",
"0.543398",
"0.54100066",
"0.5398443",
"0.53943384",
"0.5374438",
"0.5370903",
"0.5363466",
"0.5319388",
"0.53090787",
"0.525582... | 0.8334127 | 1 |
Recover public key for this recoverable signature. | def recover_public_key(message)
ctx = Secp256k1::Context.new
recovery_id = Chains.to_recovery_id(@v, @chain_id)
recoverable_signature = ctx.recoverable_signature_from_compact(@signature, recovery_id)
public_key_bin = recoverable_signature.recover_public_key(message.hash).uncompressed
public_key_to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recover_public_key(message)\n ctx = Secp256k1::Context.new\n recovery_id = Chains.to_recovery_id(@v, @chain_id)\n\n recoverable_signature = ctx.recoverable_signature_from_compact(@signature, recovery_id)\n public_key_bin = recoverable_signature.recover_public_key(message.hash).uncompressed\... | [
"0.7536618",
"0.7122866",
"0.7122866",
"0.65999013",
"0.6570213",
"0.6533835",
"0.6470339",
"0.6466573",
"0.64627737",
"0.6386046",
"0.6366882",
"0.636468",
"0.633629",
"0.6240816",
"0.6231056",
"0.62149656",
"0.62113047",
"0.62022126",
"0.6178176",
"0.6178176",
"0.610329",
... | 0.7494389 | 1 |
GET /routed_generics GET /routed_generics.json | def index
# @cd = DisRoutedGeneric.all
c = DisRoutedGeneric.paginate(:page => params[:page], :per_page => 10)
e = c.count
c = c.as_json
d = [{"Count" => e}]
m = {"a" => c ,"b" => d}
# n = c.to_a << @m
respond_with m
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dis_routed_generics = DisRoutedGeneric.all\n end",
"def index\n @generics = Generic.all\n end",
"def set_routed_generic\n @routed_generic = DisRoutedGeneric.find(params[:id])\n end",
"def render_generals\n render json: GeneralsSerializer.new(@general_data).to_serialized_json... | [
"0.741224",
"0.6632719",
"0.5753447",
"0.5474821",
"0.5332024",
"0.52993345",
"0.52891546",
"0.52671736",
"0.5197613",
"0.514265",
"0.5108245",
"0.50842357",
"0.5058858",
"0.5048948",
"0.5041192",
"0.5001024",
"0.49954394",
"0.49934712",
"0.49824065",
"0.4946664",
"0.49115378... | 0.0 | -1 |
GET /routed_generics/1 GET /routed_generics/1.json | def show
respond_with DisRoutedGeneric.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dis_routed_generics = DisRoutedGeneric.all\n end",
"def index\n @generics = Generic.all\n end",
"def set_routed_generic\n @routed_generic = DisRoutedGeneric.find(params[:id])\n end",
"def render_generals\n render json: GeneralsSerializer.new(@general_data).to_serialized_json... | [
"0.7259766",
"0.65796185",
"0.5935687",
"0.54280716",
"0.5383515",
"0.52365535",
"0.5212953",
"0.52076775",
"0.5193498",
"0.51899695",
"0.5178748",
"0.5145463",
"0.50775844",
"0.5028758",
"0.49863493",
"0.49667707",
"0.49545923",
"0.49526504",
"0.4941746",
"0.49239102",
"0.49... | 0.53855205 | 4 |
POST /routed_generics POST /routed_generics.json | def create
@routed_generic = DisRoutedGeneric.new(routed_generic_params)
if @routed_generic.save
flash[:notice] = "Task was successfully created."
respond_with(@routed_generic)
else
flash[:notice] = "Task was not created."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dis_routed_generics = DisRoutedGeneric.all\n end",
"def create\n @dis_routed_generic = DisRoutedGeneric.new(dis_routed_generic_params)\n\n respond_to do |format|\n if @dis_routed_generic.save\n format.html { redirect_to @dis_routed_generic, notice: 'Dis routed generic was succe... | [
"0.63662535",
"0.591633",
"0.55584544",
"0.5373417",
"0.5356606",
"0.531299",
"0.5300933",
"0.52269626",
"0.5190265",
"0.5127292",
"0.5014867",
"0.5007133",
"0.5007133",
"0.498301",
"0.4938085",
"0.4938085",
"0.4938085",
"0.4938085",
"0.4938085",
"0.4930701",
"0.49065486",
... | 0.59152013 | 2 |
PATCH/PUT /routed_generics/1 PATCH/PUT /routed_generics/1.json | def update
respond_to do |format|
if @routed_generic.update(routed_generic_params)
format.html { redirect_to @routed_generic, notice: 'Combination dose was successfully updated.' }
format.json { render :show, status: :ok, location: @routed_generic }
else
format.html { render :edi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @dis_routed_generic.update(dis_routed_generic_params)\n format.html { redirect_to @dis_routed_generic, notice: 'Dis routed generic was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_routed_generic }\n else\n ... | [
"0.6002373",
"0.5915987",
"0.58117366",
"0.5420171",
"0.5375895",
"0.51829743",
"0.5129109",
"0.51289845",
"0.5128714",
"0.512636",
"0.50951356",
"0.509031",
"0.50391465",
"0.5023107",
"0.5016755",
"0.50063485",
"0.50063485",
"0.50063485",
"0.50063485",
"0.50063485",
"0.50063... | 0.5745963 | 3 |
DELETE /routed_generics/1 DELETE /routed_generics/1.json | def destroy
@routed_generic.destroy
respond_to do |format|
format.html { redirect_to routed_generics_url, notice: 'Combination dose was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @dis_routed_generic.destroy\n respond_to do |format|\n format.html { redirect_to dis_routed_generics_url, notice: 'Dis routed generic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @generic.destroy\n respond_to do |format|\n ... | [
"0.74299705",
"0.68910843",
"0.65051436",
"0.63371795",
"0.61489874",
"0.61206365",
"0.61011785",
"0.60976154",
"0.60950786",
"0.60678786",
"0.60518736",
"0.60431796",
"0.6019719",
"0.60107577",
"0.60094905",
"0.60006",
"0.5996215",
"0.5962129",
"0.59466785",
"0.5939755",
"0.... | 0.7046693 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_routed_generic
@routed_generic = DisRoutedGeneric.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def routed_generic_params
params.require(:routed_generic).permit(:name, :generic_id, :route_id, :is_combination, :pregnancy_category_id, :release_status_id, :status_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
GET /creditos/1 GET /creditos/1.json | def show
@credito = Credito.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @credito }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def credit\n handle_response(self.class.get(\"/credit.json\"))\n end",
"def index\n @creditos = Credito.all\n end",
"def show\n @credit = Credit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.e... | [
"0.7826902",
"0.7518978",
"0.7188962",
"0.68288267",
"0.68288267",
"0.67724746",
"0.67400825",
"0.6716587",
"0.6572061",
"0.64667046",
"0.6415303",
"0.6392466",
"0.6371003",
"0.6360766",
"0.63501275",
"0.63244206",
"0.63238",
"0.63011545",
"0.6272596",
"0.6272596",
"0.6266001... | 0.7013669 | 3 |
GET /creditos/new GET /creditos/new.json | def new
@credito = Credito.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @credito }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @credit = Credit.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credit }\n end\n end",
"def new\n @credit = Credit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @credit }\n end\n ... | [
"0.7846795",
"0.7845903",
"0.7845903",
"0.7526227",
"0.7277035",
"0.7258459",
"0.7255767",
"0.7202376",
"0.7198423",
"0.71937346",
"0.7191453",
"0.71802145",
"0.71795034",
"0.7164589",
"0.7140762",
"0.71316385",
"0.7130637",
"0.7122073",
"0.7122073",
"0.7122073",
"0.7122073",... | 0.7771047 | 3 |
POST /creditos POST /creditos.json | def create
@credito = Credito.new(params[:credito])
respond_to do |format|
if @credito.save
format.html { redirect_to @credito, notice: 'Credito was successfully created.' }
format.json { render json: @credito, status: :created, location: @credito }
else
format.html { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def create\n render json: ::Transaction::CreditSerializer.new( do_credit! ), status: :created\n end",
"def create\n @credit = Credit.new(params[:credit])\n\n respond_to do |format|\n if @credit.save\n format.html { redir... | [
"0.69115496",
"0.67622495",
"0.66359305",
"0.65493476",
"0.64731085",
"0.6374715",
"0.6372384",
"0.6370098",
"0.63262707",
"0.6241984",
"0.6210232",
"0.61877084",
"0.61448336",
"0.6133654",
"0.61064017",
"0.60991657",
"0.6076584",
"0.60357153",
"0.59854454",
"0.5966826",
"0.5... | 0.65499353 | 3 |
PUT /creditos/1 PUT /creditos/1.json | def update
@credito = Credito.find(params[:id])
respond_to do |format|
if @credito.update_attributes(params[:credito])
format.html { redirect_to @credito, notice: 'Credito was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @credit = Credit.find(params[:id])\n\n respond_to do |format|\n if @credit.update_attributes(params[:credit])\n format.html { redirect_to @credit, notice: 'Credit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ... | [
"0.6436726",
"0.6436726",
"0.6276703",
"0.62031746",
"0.60867226",
"0.6062803",
"0.6056282",
"0.60527873",
"0.60382855",
"0.60102195",
"0.60091585",
"0.59856784",
"0.5983963",
"0.59798783",
"0.5975496",
"0.5974734",
"0.5961142",
"0.5952903",
"0.5950382",
"0.59116167",
"0.5891... | 0.6117677 | 4 |
DELETE /creditos/1 DELETE /creditos/1.json | def destroy
@credito = Credito.find(params[:id])
@credito.destroy
respond_to do |format|
format.html { redirect_to creditos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @credit = Credit.find(params[:id])\n @credit.destroy\n\n respond_to do |format|\n format.html { redirect_to credits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @credit = Credit.find(params[:id])\n @credit.destroy\n\n respond_to do |format|\n... | [
"0.70946103",
"0.70946103",
"0.70946103",
"0.70050985",
"0.69432056",
"0.6929616",
"0.6915824",
"0.689856",
"0.68717384",
"0.68574774",
"0.6826208",
"0.6774339",
"0.6768252",
"0.675646",
"0.6754505",
"0.6744664",
"0.674134",
"0.67155606",
"0.67149544",
"0.66902137",
"0.668741... | 0.741992 | 0 |
Wrap code in a main method so we can rescue errors | def main
Puppet.initialize_settings
metrics_collector_setup
output_file = Time.now.utc.strftime('%Y%m%dT%H%M%SZ') + '.json'
@hosts.each do |host|
timestamp = Time.now
dataset = { 'timestamp' => timestamp.utc.iso8601, 'servers' => {} }
hostkey = host.tr('.', '-')
dataset['servers'][hostkey] = {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_run\n raise NotImplementedError\n end",
"def run_main\n end",
"def main; end",
"def main\n end",
"def main\n\n end",
"def run(args)\n raise \"not implemented\"\n end",
"def execute\n setup\n begin\n data = main\n rescue ArgumentError => e\n warn e.... | [
"0.7178919",
"0.7049736",
"0.6897484",
"0.68719375",
"0.68155026",
"0.67513484",
"0.66976243",
"0.66760546",
"0.6668922",
"0.66314906",
"0.6580821",
"0.6573106",
"0.654122",
"0.64046156",
"0.6314747",
"0.62966955",
"0.62722284",
"0.6215087",
"0.6215087",
"0.6212069",
"0.62068... | 0.0 | -1 |
Returns the Gravatar for the given pod. | def gravatar_for(pod)
gravatar_id = Digest::MD5::hexdigest(pod.description.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}"
image_tag(gravatar_url, alt: user.id, class: "gravatar")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gravatar\n anchor_title = \"#{source.username} GitHub Profile\"\n github_url = GitHub.profile_page(source.username)\n gravatar_url = Gravatar.url(source.gravatar_id)\n\n h.link_to(github_url, title: anchor_title) do\n\n h.image_tag(gravatar_url, alt: source.username,\n ... | [
"0.6439603",
"0.64156663",
"0.63440925",
"0.63398093",
"0.6306391",
"0.62279093",
"0.6216308",
"0.62101287",
"0.6196903",
"0.61908615",
"0.6190171",
"0.61866814",
"0.61338294",
"0.61299837",
"0.6118628",
"0.6104931",
"0.60714066",
"0.6044368",
"0.6044368",
"0.60364217",
"0.60... | 0.83514386 | 0 |
Examples: got_three? [1, 2, 2, 2, 3] => true got_three? ['a', 'a', 'b'] => false got_three? ['a', 'a', 'a'] => true got_three? [1, 2, 1, 1] => false | def got_three? array
array.each.with_index{|x,i| return true if (x == array[i+1] && x == array[i+2])}
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def got_three?(array)\n\tarray.each_with_index do |item, i|\n\t\tnext_item = array[i+1]\n\t\tnext_next_item = array[i+2]\n\t\treturn true if item == next_item && item == next_next_item\n\tend\n\tfalse\nend",
"def got_three?(array)\n\tarray.each_cons 3 do |x, y, z|\n\t\treturn true if x == y && y == z\n\tend\n\tr... | [
"0.7673041",
"0.7554113",
"0.74403715",
"0.74215096",
"0.7359609",
"0.73331326",
"0.73071384",
"0.7296551",
"0.7251156",
"0.70662725",
"0.70601976",
"0.7051146",
"0.7031135",
"0.70277977",
"0.7020516",
"0.7002054",
"0.690794",
"0.6896588",
"0.6866014",
"0.68637806",
"0.683612... | 0.74335974 | 3 |
Disguise a method as another language construct. | def BaseClass name
name == "string" ? String : Object
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip_method container\n meth = RDoc::AnyMethod.new \"\", \"anon\"\n parse_method_parameters meth\n parse_statements container, false, meth\n end",
"def method c\r\nend",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"... | [
"0.62085694",
"0.6123411",
"0.60648084",
"0.60648084",
"0.60648084",
"0.60648084",
"0.60648084",
"0.60648084",
"0.60648084",
"0.60648084",
"0.60648084",
"0.60648084",
"0.60648084",
"0.60648084",
"0.6057419",
"0.6024789",
"0.59863126",
"0.59836084",
"0.59763926",
"0.59429646",
... | 0.0 | -1 |
Returns an array of all the instances for this class. | def all
Maglev::PERSISTENT_ROOT[self].values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instances #:nodoc:\n r = []\n ObjectSpace.each_object(self) { |mod| r << mod }\n r\n end",
"def instances\n @instances ||= []\n end",
"def instances()\n return @instances\n end",
"def get_instances\n all_instances = Array.new()\n ... | [
"0.8531352",
"0.8287791",
"0.7994713",
"0.76045716",
"0.75513494",
"0.7424299",
"0.7319826",
"0.72626114",
"0.72563416",
"0.72062993",
"0.7183953",
"0.7182236",
"0.69807565",
"0.6903527",
"0.6903527",
"0.6790451",
"0.6666886",
"0.66424245",
"0.66048104",
"0.6579115",
"0.65790... | 0.0 | -1 |
Get an object by object id. If +id+ is not the id for an instance of the calling class, then no object will be found (even if +id+ is the valid id of soome instance of another class). | def get(id)
Maglev::PERSISTENT_ROOT[self][id.to_i]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end",
"def find(id)\n found_id = redis.get \"#{klass}:id:#{id}\"\n\n if foun... | [
"0.8648077",
"0.7813065",
"0.7628374",
"0.74776226",
"0.7389647",
"0.73833793",
"0.7356003",
"0.7352635",
"0.7323821",
"0.7227998",
"0.71968466",
"0.71863306",
"0.71819955",
"0.71584296",
"0.71419936",
"0.71313673",
"0.702349",
"0.70213586",
"0.7012934",
"0.6958419",
"0.69552... | 0.0 | -1 |
Stages +obj+ in the collection of persisted objects for this class. This method does not commit, so the object will not be committed until client code calls Maglevcommit_transaction. | def stage(obj)
Maglev::PERSISTENT_ROOT[self][obj.__id__] = obj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(obj)\n obj.raise_on_save_failure = false\n obj.save\n end",
"def add(obj)\n @set.addObject obj\n end",
"def insert_obj(obj) # :nodoc:\n chk_conn\n tx = @hibernate_session.begin_transaction\n @hibernate_session.save(obj)\n tx.commit\n obj\n end",
... | [
"0.56639826",
"0.5619132",
"0.5578228",
"0.5559299",
"0.5540809",
"0.5502961",
"0.54230344",
"0.5386419",
"0.53620493",
"0.5343704",
"0.5300545",
"0.5292017",
"0.5238853",
"0.52224153",
"0.5178811",
"0.5134593",
"0.51335436",
"0.5113204",
"0.5107756",
"0.50785",
"0.5076699",
... | 0.6673093 | 0 |
Iterate over all saved items | def each
all.each do |el|
yield el
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n\t\t\t@order.each { |key|\n\t\t\t\tyield(key, @storage[key]) if @storage.key?(key)\n\t\t\t}\n\t\tend",
"def each\n raise 'This is a generic store. Please use a subclass.'\n end",
"def each_item\n self.file.state.items.each_pair do |identifier, path|\n yield I... | [
"0.629149",
"0.62240475",
"0.616686",
"0.61367226",
"0.6130517",
"0.60998946",
"0.606335",
"0.6049748",
"0.6032098",
"0.592384",
"0.5920213",
"0.59160644",
"0.59071743",
"0.59026754",
"0.5860157",
"0.5855205",
"0.5853564",
"0.5853101",
"0.58092105",
"0.58033377",
"0.5801188",... | 0.0 | -1 |
Is this boot image a recovery image, or booted into recovery mode by the device firmware? | def is_recovery?()
# Check in /etc/boot/config for `is_recovery`, it's assumed to be set, and
# true, for recovery builds.
Configuration["is_recovery"] or firmware_wants_recovery?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def booted?\n !!@booted\n end",
"def reboot?\n !!@reboot\n end",
"def boot_from_iscsi?\n delegate(provider, :boot_from_iscsi?)\n end",
"def booted?\n IO.popen([\"systemctl\", \"is-system-running\"], &:read).chomp != \"offline\"\n end",
"def ami_bootstrapped?\n versi... | [
"0.629805",
"0.6280243",
"0.6034305",
"0.6021656",
"0.5924859",
"0.59162015",
"0.58691376",
"0.58603954",
"0.58590907",
"0.5831135",
"0.57871294",
"0.5724848",
"0.57091796",
"0.5574833",
"0.54944754",
"0.5489854",
"0.54691565",
"0.54691565",
"0.5443417",
"0.543981",
"0.543332... | 0.7170244 | 0 |
Is the normal boot flow interrupted by a key input? | def boot_interrupted?()
Evdev.keys_held(KEYS)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_pressed\n if STDIN.ready?\n input = STDIN.read_nonblock(1) rescue nil\n if input == \"\\e\" \n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n end\n # STDIN.cooked!\n input\n\nend",
"def get_key_down(char)\n STDIN.echo = false\n STD... | [
"0.6664386",
"0.6656015",
"0.64270025",
"0.6335584",
"0.6325922",
"0.6276696",
"0.6215907",
"0.6215907",
"0.6135761",
"0.6111236",
"0.60499823",
"0.6045591",
"0.6015622",
"0.6006839",
"0.59922194",
"0.5982616",
"0.59825826",
"0.5947314",
"0.59408355",
"0.59369755",
"0.5926535... | 0.77739686 | 0 |
(re)generate connections for all members of an organisation | def generate_all_connections!
organisation_level_connections = []
self.has_members.each do |member_uri|
member = Person.find(member_uri)
organisation_level_connections << member.get_connections!
end
organisation_level_connections.flatten
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_organizations\n PDEX::NPPESDataRepo.organizations.each do |nppes_data|\n PDEX::OrganizationGenerator.new(nppes_data).generate.each do |resource|\n write_resource(resource)\n end\n end\n end",
"def __rebuild_connections(arguments={})\n @hosts ... | [
"0.5686737",
"0.55794626",
"0.5519003",
"0.5513982",
"0.5503343",
"0.54658014",
"0.54555064",
"0.54347974",
"0.54330957",
"0.5425237",
"0.5416844",
"0.54141676",
"0.5399236",
"0.538253",
"0.5360911",
"0.53566206",
"0.53549546",
"0.52618533",
"0.5247315",
"0.52424204",
"0.5229... | 0.8158993 | 0 |
memoize :members_with_more_than_x_connections look at extension and take a punt | def best_guess_at_country
return self.country if !self.country.nil?
extension_possibilities = []
extension_possibilities << ".#{self.uri.to_s.gsub(/^.+organisations\/.+\-/, '')}"
extension_possibilities << self.uri.to_s.gsub(/^.+organisations\/[A-z]+/, '').gsub(/\-/, '.')
extension_possibilities <<... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_all_connections!\n organisation_level_connections = []\n\n self.has_members.each do |member_uri|\n member = Person.find(member_uri)\n organisation_level_connections << member.get_connections!\n end\n\n organisation_level_connections.flatten\n end",
"def nicks_connected_with\n ... | [
"0.6189174",
"0.5641627",
"0.5629175",
"0.55592847",
"0.55592847",
"0.55592847",
"0.55592847",
"0.55592847",
"0.55592847",
"0.55592847",
"0.55482686",
"0.554685",
"0.550665",
"0.54843134",
"0.543459",
"0.53932714",
"0.53810287",
"0.53718096",
"0.53600264",
"0.5345262",
"0.532... | 0.0 | -1 |
get all the strings that have been input for cities | def all_unique_city_values
sparql = "
SELECT DISTINCT ?city
WHERE
{
GRAPH <http://data.artsapi.com/graph/organisations> {
?org <http://data.artsapi.com/def/arts/locationCity> ?city .
}
}"
results = User.current_user.within { Tripod::SparqlClient::Query.sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def city_names\n cities.pluck(:name).join(\", \")\n end",
"def get_city_names(input)\n input.each_key\nend",
"def cities_helper\n [\n ['基隆市', '基隆市'],\n ['台北市', '台北市'],\n ['新北市', '新北市'],\n ['桃園縣', '桃園縣'],\n ['新竹市', '新竹市'],\n ['新竹縣', '新竹縣'],\n ['苗栗縣', '苗栗縣... | [
"0.708321",
"0.692072",
"0.68234",
"0.6820004",
"0.67922044",
"0.6785449",
"0.6766212",
"0.6719164",
"0.6553589",
"0.6478325",
"0.64328194",
"0.6420247",
"0.64197683",
"0.63825005",
"0.6372788",
"0.6344244",
"0.63300794",
"0.63188154",
"0.631537",
"0.6274264",
"0.6268952",
... | 0.6243041 | 22 |
get all orgs in a country and return their uri and label | def all_organisations_in_country(country)
sparql = "
SELECT DISTINCT ?uri ?label
WHERE
{
VALUES ?country { \"#{country}\" }
GRAPH <http://data.artsapi.com/graph/organisations> {
?uri <http://data.artsapi.com/def/arts/locationCountry> ?country .
?uri <http://w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country\n query = create_query(\n :Location, :regexp_search, regexp: \"#{params[:country]}$\"\n )\n show_selected_locations(query, link_all_sorts: true)\n end",
"def get_countries\n countries=[]\n @locations.each do |loc|\n countries << loc.country.capitalize if loc.country\n end... | [
"0.65980726",
"0.6339705",
"0.63387144",
"0.6238771",
"0.6216046",
"0.6150135",
"0.6146896",
"0.6146211",
"0.61329424",
"0.61080194",
"0.6091626",
"0.6024844",
"0.60226905",
"0.5990527",
"0.5976391",
"0.5965793",
"0.5962786",
"0.59261155",
"0.59156495",
"0.5908038",
"0.589885... | 0.72081345 | 0 |
get all orgs in a city and return their uri and label | def all_organisations_in_city(city)
sparql = "
SELECT DISTINCT ?uri ?label
WHERE
{
VALUES ?city { \"#{city}\" }
GRAPH <http://data.artsapi.com/graph/organisations> {
?uri <http://data.artsapi.com/def/arts/locationCity> ?city .
?uri <http://www.w3.org/2000/01/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cities\n galleries.map do |c|\n c.city\n end\n end",
"def cities\n gallaries.map{|place| place.city}\n\n end",
"def cities\n galleries.map do |gallery|\n gallery.city\n end\n end",
"def cities\n galleries.map do |gallery|\n gallery.city\n end\n end",
"def cities\... | [
"0.7072436",
"0.6872726",
"0.6846642",
"0.6846642",
"0.6822065",
"0.6810528",
"0.67968756",
"0.67968756",
"0.6766148",
"0.6762504",
"0.67369515",
"0.6687789",
"0.65960056",
"0.64374775",
"0.640534",
"0.6340899",
"0.63247937",
"0.62659776",
"0.6228387",
"0.6189185",
"0.6181859... | 0.71237487 | 0 |
get all orgs in a sector and return their uri and label expects a uri as input | def all_organisations_in_sector(sector)
sparql = "
SELECT DISTINCT ?uri ?label
WHERE
{
VALUES ?sector { <#{sector}> }
GRAPH <http://data.artsapi.com/graph/organisations> {
?uri <http://data.artsapi.com/def/arts/sector> ?sector .
?uri <http://www.w3.org/2000/0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_ontology(uri)\n case uri\n when CPO_URI\n file_path = \"/home/grosscol/workspace/ontologies/cpo/cpo.owl\"\n when PSDO_URI\n file_path = \"/home/grosscol/workspace/ontologies/psdo/psdo.owl\"\n else\n puts \"bad uri\"\n abort\n end\n\n #File.read file_path\nend",
"def retrieve_label_... | [
"0.53882456",
"0.5235852",
"0.5200348",
"0.51591647",
"0.5153562",
"0.51352555",
"0.50888646",
"0.5027745",
"0.50203943",
"0.49979198",
"0.49894837",
"0.49769005",
"0.49542165",
"0.4951676",
"0.49269608",
"0.49199423",
"0.49190906",
"0.49117196",
"0.4910003",
"0.49002665",
"0... | 0.6281494 | 0 |
takes a uri object or string | def write_link(org_one, org_two)
org_one = Organisation.find(org_one)
org_two = Organisation.find(org_two)
if org_one != org_two
org_one.linked_to = org_one.linked_to + [org_two.uri] # write org:linkedTo
org_two.linked_to = org_two.linked_to + [org_one.uri] # write org:linkedTo
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uri=(_arg0); end",
"def uri=(_arg0); end",
"def uri=(_arg0); end",
"def uri=(_arg0); end",
"def process_uri(uri)\n # empty --> this is like an abstract class method\n end",
"def URI(url); end",
"def uri string = nil\n string ? @uri = string : @uri\n end",
"def parse(uri); end"... | [
"0.7771053",
"0.7771053",
"0.7771053",
"0.7771053",
"0.7584813",
"0.757368",
"0.7192219",
"0.7179879",
"0.7112731",
"0.7112731",
"0.7112731",
"0.7112731",
"0.7112731",
"0.7112731",
"0.7112731",
"0.7112731",
"0.7112731",
"0.7112731",
"0.7112731",
"0.7112731",
"0.70645154",
"... | 0.0 | -1 |
for when you absolutely, positively need to process every dataset in the room bear in mind that asyncness might cause problems in the end anyway | def bootstrap_all!
User.bootstrap_sic_for_current_user!
User.bootstrap_keywords_for_current_user!
organisations = Organisation.all.resources
job_ids = []
organisations.each do |org|
job_ids << bootstrap_connections_and_vis_for(org.uri)
end
job_ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def async\n cached_dataset(:_async) do\n clone(:async=>true)\n end\n end",
"def in_parallel?; end",
"def process_data_requests\n # guard against recursive calls\n return if @processing_data_requests\n\n # guard against simultaneous calls\n @data_r... | [
"0.6479192",
"0.6458359",
"0.6325309",
"0.622119",
"0.61486673",
"0.6028462",
"0.6002915",
"0.5963558",
"0.59630054",
"0.5908486",
"0.5862145",
"0.58161527",
"0.5787984",
"0.5782296",
"0.5782296",
"0.5782296",
"0.57712185",
"0.5674496",
"0.56224287",
"0.5618602",
"0.56033117"... | 0.0 | -1 |
first, try and extract the owning org from current signed in user, else a more pragmatic version; the Org with the largest number of links will almost certainly be the owner organisation, and running through only their members will save a ton of processing | def bootstrap_owner_or_largest_org!
begin
User.bootstrap_sic_for_current_user!
User.bootstrap_keywords_for_current_user!
Rails.logger.debug "> [Bootstrap] Triggered by #{User.current_user.email}"
owner_org = User.current_user.find_org_from_self_in_data
owner_org.generate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def org\n user_id.present? ? User.includes(:org).find_by(id: user_id).org : nil\n end",
"def org\n object.user.org&.handle\n end",
"def current_org\n current_user&.org\n end",
"def org_users\n synchronize { return @org_users if @org_users }\n\n users = {}\n orgs = settings.github_orgs ||... | [
"0.71493804",
"0.69249904",
"0.6667756",
"0.6463135",
"0.63144463",
"0.62886137",
"0.6272106",
"0.62539995",
"0.620971",
"0.6126015",
"0.61253285",
"0.60862565",
"0.60657954",
"0.6053739",
"0.6041939",
"0.60379714",
"0.6020644",
"0.5978048",
"0.5957028",
"0.5953916",
"0.59369... | 0.59330606 | 22 |
constructor: from xml node | def initialize(node)
# get trajectory type
@trajectory = node.attributes["trajectory"].downcase
# check availability of trajectory type
unless TRAJTYPE.include?(@trajectory)
raise ArgumentError, 'Unknown trajectory type!'
end
# get element list
elist = node.elements
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def from_xml(xml)\n\t\tend",
"def from_xml_node(parent, opts=OPTS)\n new.from_xml_node(parent, opts)\n end",
... | [
"0.80908054",
"0.80908054",
"0.80908054",
"0.7795187",
"0.7726054",
"0.7448343",
"0.737993",
"0.73374134",
"0.7279395",
"0.71993643",
"0.7152966",
"0.7057356",
"0.69613135",
"0.68664366",
"0.68301994",
"0.6777891",
"0.67087984",
"0.66768163",
"0.6671887",
"0.6638686",
"0.6628... | 0.0 | -1 |
code: return the code of current object | def code
# create an Array to collect all fields
fields = [@trajectory, @eye, @target, @up, @params].map {|f| f.to_s}
# create code by trajectory and azcode of fields
return "#{@trajectory.upcase}-#{azcode(fields)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n self.class.code\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n @info.code\n end",
"def getCode()\n return @code\n end",
"de... | [
"0.85621935",
"0.85621935",
"0.854944",
"0.84958273",
"0.8484125",
"0.8484125",
"0.8198749",
"0.8004306",
"0.7914725",
"0.7909349",
"0.7909349",
"0.7909349",
"0.7909349",
"0.7909349",
"0.7909349",
"0.7909349",
"0.7878221",
"0.7866557",
"0.774563",
"0.7705932",
"0.7693846",
... | 0.0 | -1 |
path: return the output folder path | def path() File.join(@outfd,code) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_path(path)\n\t\t\tunless Pathname.new(path).absolute?\n\t\t\t\toutput = @variables['__OUTPUT__']\n\t\t\t\tif output\n\t\t\t\t\tDir.mkdir output unless Dir.exists? output\n\t\t\t\t\tpath = File.join(output, path)\n\t\t\t\tend\n\t\t\tend\n\t\t\tpath\n\t\tend",
"def get_output_folder\n File.join( Rail... | [
"0.83900344",
"0.78694415",
"0.7790012",
"0.7751409",
"0.76805174",
"0.75631654",
"0.7561418",
"0.7541444",
"0.7541444",
"0.73325366",
"0.73277634",
"0.7321384",
"0.7317254",
"0.7317254",
"0.7299738",
"0.7286451",
"0.72702557",
"0.7178203",
"0.7107608",
"0.70846087",
"0.70723... | 0.0 | -1 |
decompose multiple animation configuration | def each
# create Hash table to pack up settings
pack = Hash.new
@params.each do |key,value|
pack[key] = packed?(key,value) ? value : [value]
end
# create full permutation of each setting
confs = permute(pack)
# create clone of current animconfig
anim = self.clone... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_animations\r\n begin\r\n pbanims = load_data(\"Data/PkmnAnimations.rxdata\")\r\n rescue\r\n pbanims = PBAnimations.new\r\n end\r\n changed = false\r\n move2anim = [[],[]]\r\n=begin\r\n anims = load_data(\"Data/Animations.rxdata\")\r\n for anim in anims\r\n next if !a... | [
"0.5459197",
"0.51915795",
"0.5128285",
"0.5103552",
"0.5097576",
"0.5038342",
"0.5026133",
"0.49769792",
"0.49612573",
"0.48771554",
"0.48750716",
"0.48245665",
"0.48074841",
"0.48036",
"0.48030376",
"0.47839576",
"0.47830674",
"0.47688192",
"0.476502",
"0.476118",
"0.476073... | 0.51175123 | 3 |
Wait one second after loading a path Allows React to properly load the page Remove this after implementing serverside rendering | def js_visit(path)
visit path
sleep 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_until_page_loads(path)\n @wait.until { @driver.current_url == path}\n @wait.until { @driver.execute_script('return PAGE_RENDERED;') == true }\n $verbose ? puts(\"#{path} successfully loaded\") : nil\n end",
"def wait_loading\n puts \"[BrowserOperator] wait_loading\" << '..' * 10\n ... | [
"0.631647",
"0.58961904",
"0.57117206",
"0.56006175",
"0.5585851",
"0.5516355",
"0.5515651",
"0.5452083",
"0.54444236",
"0.54395753",
"0.5382483",
"0.5382483",
"0.5362721",
"0.5357748",
"0.53457636",
"0.5270463",
"0.52287805",
"0.51778615",
"0.51720643",
"0.5136844",
"0.51075... | 0.54999095 | 7 |
Compares the value of +self+ with the value of +other+. | def <=>(other)
other = other.value if other.is_a? self.class
return value <=> other
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ===(other)\n if other.is_a?(right_class)\n value === other.value\n else\n super\n end\n end",
"def ==(other)\n self.class == other.class && value == other.value\n end",
"def ==(other)\n super || other.class == self.class && other.value == val... | [
"0.74802154",
"0.74800915",
"0.7435413",
"0.73667455",
"0.7346897",
"0.73401433",
"0.7307396",
"0.72954863",
"0.7286971",
"0.7286971",
"0.7225466",
"0.72221625",
"0.7199887",
"0.7199887",
"0.7184894",
"0.7180266",
"0.71307653",
"0.7123318",
"0.71180075",
"0.71180075",
"0.7098... | 0.67918247 | 56 |
Returns whether the value of +self+ and the value of +other+ are equal. | def eql?(other)
other = other.value if other.is_a? self.class
return value.eql?(other)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eql?(other)\n self.class.equal?(other.class) && value == other.value\n end",
"def eql?(other)\n self.class.equal?(other.class) && value == other.value\n end",
"def eql?(other)\n self.class == other.class && value == other.value\n end",
"def eql?(other)\n self.cl... | [
"0.81212074",
"0.81212074",
"0.810495",
"0.810495",
"0.80985224",
"0.8084866",
"0.7946096",
"0.79108524",
"0.7903829",
"0.79018205",
"0.7893213",
"0.78920543",
"0.78906816",
"0.7883732",
"0.7881617",
"0.78671694",
"0.785307",
"0.7842371",
"0.7828332",
"0.7827803",
"0.7827803"... | 0.80190486 | 6 |
Returns the hashcode of +value+. | def hash
value.hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hexdigest(value)\n Digest::SHA256.new.update(value).hexdigest\n end",
"def hexdigest(value)\n Aws::Checksums.sha256_hexdigest(value)\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end... | [
"0.66462576",
"0.66462576",
"0.6599236",
"0.6478468",
"0.6332222",
"0.6171827",
"0.6146504",
"0.61114556",
"0.60966325",
"0.603981",
"0.6015896",
"0.59226125",
"0.59226125",
"0.5900227",
"0.5900227",
"0.5818001",
"0.580252",
"0.576492",
"0.576492",
"0.576492",
"0.576492",
"... | 0.6103229 | 8 |
Returns the name of the enumeration member. | def to_s
@name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n @enum_name\n end",
"def member_name\n ASF::Member.get_name(members_txt) if members_txt\n end",
"def name\n @attribute.name\n end",
"def to_s\n self.__enum_name__\n end",
"def name_sym\n self.__enum_name__.to_sym\n end",
"def n... | [
"0.7467812",
"0.6725171",
"0.659841",
"0.649311",
"0.638158",
"0.63766724",
"0.633643",
"0.6324378",
"0.6315154",
"0.6315154",
"0.6315154",
"0.6315154",
"0.6241807",
"0.62253594",
"0.6160843",
"0.61477876",
"0.61427134",
"0.6082291",
"0.60700107",
"0.60462886",
"0.60380125",
... | 0.0 | -1 |
Returns the +Enum+ instance for the given value. If no enumeration member has been created for this value, a new instance is created, setting +name+ to +value.to_s+. | def new(value)
return @enumvalues[value] if @enumvalues.has_key? value
_setup_enumvalue(value, value, allocate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enum(value)\n EnumValue.new(value)\n end",
"def __enum(value)\n EnumValue.new(value)\n end",
"def enum(name, value = nil, attributes = {})\n\t\t\t@enumvalues ||= {}\n\t\t\tvalue ||= (@enumvalues.values.max || -1) + 1\n\t\t\t\n\t\t\tenumvalue = allocate\n\t\t\tconst_set(name, enumvalue)\n\t\... | [
"0.79015297",
"0.7542298",
"0.7321682",
"0.67135274",
"0.64238334",
"0.64237404",
"0.6252074",
"0.6132982",
"0.6100802",
"0.600121",
"0.59781164",
"0.59771633",
"0.59256184",
"0.5922756",
"0.5921015",
"0.584959",
"0.584959",
"0.584959",
"0.584959",
"0.584959",
"0.584959",
"... | 0.66120523 | 4 |
Returns the default value for the attribute +attr+. If no default value has been set, +nil+ is returned. | def default_value(attr)
@defaults ||= {}
@defaults[attr.to_sym]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default\n attributes.default\n end",
"def get_attr(at, default=nil)\n if @data.nil?\n return default\n end\n \n return @data[at] || default\n end",
"def default_value\n self['default']\n end",
"def set_default(attr)\n return unless klass = self.class.a... | [
"0.6886427",
"0.64877254",
"0.6475743",
"0.63946635",
"0.6357473",
"0.6338886",
"0.6273168",
"0.6256243",
"0.6191883",
"0.6131058",
"0.6102001",
"0.60744",
"0.6047964",
"0.6042098",
"0.6009531",
"0.6001419",
"0.5942807",
"0.5903897",
"0.5878479",
"0.587044",
"0.587044",
"0.... | 0.76654583 | 0 |
Enumerates all known enumeration members. | def each
@enumvalues ||= {}
@enumvalues.each_value { |enumvalue| yield enumvalue }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enums(&block)\n values = get_enums\n if block\n values.each do |v|\n yield v\n end\n else\n values\n end\n end",
"def enums\n inject_block(:name, :value)\n end",
"def each(all: false)\n return to_enum(__method__, all: all) unless block_given?\n @map.each.wit... | [
"0.6087588",
"0.6040453",
"0.60070026",
"0.59865355",
"0.5984168",
"0.59665376",
"0.5908735",
"0.5884462",
"0.5884462",
"0.5874518",
"0.5861745",
"0.58185416",
"0.57715136",
"0.5715721",
"0.57129955",
"0.5628914",
"0.56265104",
"0.562477",
"0.56099766",
"0.5608383",
"0.558458... | 0.6076055 | 1 |
Adds a new enumeration member to the current enumeration. The generated member is accessible using the constant +name+. If +value+ is +nil+, it is set to the highest integer value in use \+ 1. | def enum(name, value = nil, attributes = {})
@enumvalues ||= {}
value ||= (@enumvalues.values.max || -1) + 1
enumvalue = allocate
const_set(name, enumvalue)
@enumvalues[value] = enumvalue
_setup_enumvalue(name, value, enumvalue, attributes)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(name, value = current_value)\n type.add(name.to_s, Integer(value))\n @current_value = Integer(value) + 1\n end",
"def add_member(name)\n @members[name] = 0.0\n end",
"def add(name, value = nil)\n symbols << [name.to_s, (Integer(value) if value... | [
"0.7114944",
"0.6349834",
"0.6155413",
"0.6124924",
"0.5923969",
"0.5879164",
"0.58559954",
"0.5847669",
"0.58271885",
"0.56262046",
"0.55649817",
"0.556277",
"0.5469479",
"0.54401827",
"0.54147506",
"0.5339884",
"0.53361744",
"0.5298958",
"0.52954286",
"0.5291672",
"0.529077... | 0.6577786 | 1 |
Sets the default values for the attributes of the enumeration members. There can be more than one call to +defaults+. | def defaults(defs = {})
@defaults ||= {}
@defaults.merge!(defs)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_values\n self.class.defaults.each do |key, default|\n self[key] ||= default\n end\n end",
"def set_defaults\n end",
"def set_defaults\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def ... | [
"0.7088924",
"0.68583167",
"0.68583167",
"0.67519426",
"0.67519426",
"0.67519426",
"0.67519426",
"0.67519426",
"0.67519426",
"0.67157215",
"0.66505206",
"0.6637924",
"0.6637924",
"0.6637924",
"0.6637924",
"0.6637924",
"0.6637924",
"0.6637924",
"0.6637924",
"0.6637924",
"0.663... | 0.6290372 | 42 |
Joins the result of +flags+ together. | def join(seperator = " | ")
flags.map { |flag| flag.name }.join(seperator)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pack_flags(flags)\n FLAGS.each_with_index.inject(0) do |memo,(key,i)|\n memo |= i if flags[key]\n memo\n end\n end",
"def add_flags(flags)\n metadata[:remove] ||= []\n metadata[:add] ||= []\n\n flags.each do |flag|\n if !self.flags.find_by_name(flag)\n f = self... | [
"0.7316655",
"0.67609185",
"0.65511423",
"0.6499761",
"0.6458424",
"0.64533585",
"0.6397065",
"0.632223",
"0.62922454",
"0.62512934",
"0.6234263",
"0.620038",
"0.620038",
"0.61979115",
"0.61968064",
"0.6168336",
"0.610822",
"0.607764",
"0.607764",
"0.60381186",
"0.6027079",
... | 0.63410044 | 7 |
Returns the combination of +self+ and +other+. | def |(other)
self.class.new(value | other)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat(other)\n other.each do |obj|\n add obj\n end\n self\n end",
"def union(other)\n self.class.from_a(to_a | other.to_a)\n end",
"def union(other)\n self.class.from_a(to_a | other.to_a)\n end",
"def join(other)\n new(entries.merge(other.entries) { |_... | [
"0.67848444",
"0.67296684",
"0.66558903",
"0.66527575",
"0.6634818",
"0.6613984",
"0.65753514",
"0.6566881",
"0.6507752",
"0.64988744",
"0.6489892",
"0.64702857",
"0.6342852",
"0.63211644",
"0.62976485",
"0.6294863",
"0.62774694",
"0.62581664",
"0.6255986",
"0.62377197",
"0.6... | 0.0 | -1 |
Returns the intersection of +self+ and +other+. | def &(other)
self.class.new(value & other)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection(other)\n self.class.from_a(to_a & other.to_a)\n end",
"def intersect(other)\n set_operation(other, :intersect, distinct: true)\n end",
"def intersect(other)\n Intersection.new(self, other)\n end",
"def intersect(other)\n new(to_ary & other)\n e... | [
"0.83248043",
"0.80765826",
"0.8001456",
"0.78415745",
"0.7791042",
"0.77428496",
"0.7670818",
"0.74858797",
"0.7467663",
"0.74485266",
"0.7259029",
"0.7252269",
"0.7214683",
"0.7151289",
"0.71129966",
"0.70767885",
"0.693444",
"0.6905674",
"0.6752992",
"0.6674773",
"0.656174... | 0.0 | -1 |
BitwiseXORs +self+ with +other+. | def ^(other)
self.class.new(value ^ other)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xor(other)\n @bits ^ bits_from_object(other)\n end",
"def xor(*others)\n self.class.xor(self, *others)\n end",
"def xor(a,b)\n (a | b) - (a & b)\n end",
"def execute_XOR(destination, source)\n\t\t# all flags are affected except AF is undefined\n\t\tdestination.value ^= source.value\n\... | [
"0.89531314",
"0.7957575",
"0.77374804",
"0.7403384",
"0.7254086",
"0.7242244",
"0.72115815",
"0.7129201",
"0.70384616",
"0.7024073",
"0.6892453",
"0.68718",
"0.6869301",
"0.6855245",
"0.6781963",
"0.6732826",
"0.67169696",
"0.6697583",
"0.6655863",
"0.6638726",
"0.6612734",
... | 0.7307474 | 4 |
GET /code_snippets GET /code_snippets.json | def index
@code_snippets = @language.code_snippets
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @codesnippet = Codesnippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @codesnippet }\n end\n end",
"def code_snippets\n raise Nanoc3::Errors::DataNotYetAvailable.new('Code snippets', false) unless @code_snippets_load... | [
"0.77191",
"0.7410084",
"0.718253",
"0.70960283",
"0.69645584",
"0.67797405",
"0.67725",
"0.6738405",
"0.6711491",
"0.66992825",
"0.66955334",
"0.6646425",
"0.6631159",
"0.65592134",
"0.64855814",
"0.64002526",
"0.6348682",
"0.6312698",
"0.63101125",
"0.62951267",
"0.6294841"... | 0.71956277 | 2 |
GET /code_snippets/1 GET /code_snippets/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @codesnippet = Codesnippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @codesnippet }\n end\n end",
"def show\n @languages = [\"c\", \"python\", \"css\", \"html\", \"javascript\", \"php\", \"lua\", \"ruby\", \"scheme\"]... | [
"0.7892095",
"0.7375237",
"0.73116606",
"0.7123636",
"0.7032359",
"0.6995138",
"0.69758314",
"0.69701505",
"0.6919412",
"0.6888677",
"0.687322",
"0.6790863",
"0.67423946",
"0.66903627",
"0.66903627",
"0.6628237",
"0.66133636",
"0.66133636",
"0.6611562",
"0.65941834",
"0.65690... | 0.0 | -1 |
POST /code_snippets POST /code_snippets.json | def create
@code_snippet = @language.code_snippets.new(code_snippet_params)
respond_to do |format|
if @code_snippet.save
format.html { redirect_to [@language,@code_snippet], notice: 'Code snippet was successfully created.' }
format.json { render :show, status: :created, location: @code_sn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @codesnippet = Codesnippet.new(params[:codesnippet])\n\n respond_to do |format|\n if @codesnippet.save\n format.html { redirect_to @codesnippet, notice: 'Codesnippet was successfully created.' }\n format.json { render json: @codesnippet, status: :created, location: @codesnippe... | [
"0.74370813",
"0.7177179",
"0.71313643",
"0.70968425",
"0.7094527",
"0.7057999",
"0.702708",
"0.6861364",
"0.68282837",
"0.6794222",
"0.67767316",
"0.6731337",
"0.66868746",
"0.6684044",
"0.65508676",
"0.65495986",
"0.6537012",
"0.6503809",
"0.6416893",
"0.64140564",
"0.63748... | 0.7576504 | 0 |
PATCH/PUT /code_snippets/1 PATCH/PUT /code_snippets/1.json | def update
respond_to do |format|
if @code_snippet.update(code_snippet_params)
format.html { redirect_to [@language,@code_snippet], notice: 'Code snippet was successfully updated.' }
format.json { render :show, status: :ok, location: @code_snippet }
else
format.html { render :edi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @codesnippet = Codesnippet.find(params[:id])\n\n respond_to do |format|\n if @codesnippet.update_attributes(params[:codesnippet])\n format.html { redirect_to @codesnippet, notice: 'Codesnippet was successfully updated.' }\n format.json { head :ok }\n else\n format.... | [
"0.7209474",
"0.7203663",
"0.7053057",
"0.69934976",
"0.69727767",
"0.69690204",
"0.68642455",
"0.68642455",
"0.68642455",
"0.6861744",
"0.67653424",
"0.67106444",
"0.6543356",
"0.6457731",
"0.6346394",
"0.63462555",
"0.62813306",
"0.6235136",
"0.6078667",
"0.60780555",
"0.60... | 0.6887037 | 6 |
DELETE /code_snippets/1 DELETE /code_snippets/1.json | def destroy
@code_snippet.destroy
respond_to do |format|
format.html { redirect_to language_code_snippets_url(@language), notice: 'Code snippet was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @codesnippet = Codesnippet.find(params[:id])\n @codesnippet.destroy\n\n respond_to do |format|\n format.html { redirect_to codesnippets_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @snippet = current_user.company.snippets.find(params[:id])\n @snippet.de... | [
"0.80235213",
"0.7773559",
"0.7770942",
"0.7770942",
"0.7644234",
"0.7641428",
"0.76268387",
"0.7612683",
"0.7522749",
"0.7522749",
"0.7426632",
"0.74097973",
"0.74097973",
"0.74097973",
"0.727882",
"0.72172517",
"0.7195537",
"0.7097016",
"0.6986905",
"0.69221896",
"0.6860285... | 0.7669923 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_code_snippet
@code_snippet = @language.code_snippets.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def code_snippet_params
params.require(:code_snippet).permit(:code)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_language
@language = current_user.languages.find(params[:language_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
check if request is stored in cache | def check_cache(key)
checksum = Digest::MD5.hexdigest(key)
node['data-bag-cache'][node['data-bag-cache']['__checksums__'][checksum]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cacheable_request?\n (request.get? || request.head?) && (request.params[:cache] != 'false')\n end",
"def cache?\n caching && true\n end",
"def cached?\n cache_path.exist?\n end",
"def cached?\n cache_path.exist?\n end",
"def may_cache?\n may_cache_field?(h... | [
"0.8472113",
"0.7907033",
"0.77391684",
"0.76631683",
"0.75939506",
"0.75864464",
"0.75864464",
"0.75864416",
"0.75605834",
"0.7515032",
"0.74459296",
"0.7439684",
"0.7436957",
"0.74220747",
"0.7402136",
"0.7392612",
"0.7357167",
"0.73552585",
"0.7354809",
"0.7351798",
"0.732... | 0.0 | -1 |
store cache for future use | def store_cache(key, name)
checksum = Digest::MD5.hexdigest(key)
node.default['data-bag-cache']['__checksums__'][checksum] = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_store; end",
"def cache_store; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache!\n @@cache\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||... | [
"0.8431864",
"0.8431864",
"0.8057086",
"0.8057086",
"0.8057086",
"0.8057086",
"0.8057086",
"0.8057086",
"0.8057086",
"0.8029177",
"0.79287684",
"0.79287684",
"0.7884915",
"0.7782751",
"0.7782751",
"0.774488",
"0.77162886",
"0.7659533",
"0.7659533",
"0.76286083",
"0.76286083",... | 0.0 | -1 |
array The Array that will be filtered. filter The Integer/String that will be used as filter. Examples filter([5,1,34,5,74], 5) => [5,5] Returns the absolute number of input. | def filter(array, filter)
i = 0
output = []
while i < array.length
if array[i] == filter
output << array[i]
end
i += 1
end
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtract(arr, filter)\n\n a = arr.length - 1\n f = filter.length - 1\n \n while a >= 0\n if (a >= 0 && f < 0) || arr[a][0] > filter[f] \n arr.delete_at(a)\n a -= 1\n elsif arr[a][0] < filter[f]\n f -= 1 \n else \n a -= 1\n f -= 1... | [
"0.65346956",
"0.6445814",
"0.5911298",
"0.577842",
"0.5755618",
"0.57536656",
"0.5721265",
"0.5715979",
"0.55838645",
"0.5578714",
"0.5565975",
"0.5561333",
"0.54868585",
"0.5458422",
"0.5457661",
"0.5457661",
"0.5457661",
"0.5451395",
"0.54375535",
"0.5422861",
"0.54082596"... | 0.6975144 | 0 |
included for completeness, should use day.xz (strip zero) | def H; cat @time.strftime('%H') end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yday() end",
"def first_xday( x )\n\t\to = offset( first_day.cwday )\n i = ( x - o ) + ( ( x < o ) ? Month::DPW : 0 )\n\n\t\t(first_day + i)\n end",
"def yday\n end",
"def w_day; end",
"def ord(day)\n\nend",
"def day() end",
"def day=(_arg0); end",
"def days_in_lunar_date(y)\n sum = 348... | [
"0.62370723",
"0.606047",
"0.5812659",
"0.5769363",
"0.576423",
"0.57249147",
"0.5700152",
"0.5674714",
"0.5668772",
"0.5656892",
"0.5643754",
"0.5585751",
"0.5585751",
"0.5585751",
"0.55751187",
"0.5572057",
"0.55144364",
"0.55006725",
"0.5466986",
"0.54656154",
"0.5454746",... | 0.0 | -1 |
%l hour, 12hour clock, blankpadded ( 0..12) included for completeness, should just use hour.xz (strip zero) | def j; cat @time.strftime('%j') end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clock_hour12(clock)\n to_clock12(clock).hour\nend",
"def parse_hour_12h(time)\n sounds_for_number(time.strftime(\"%l\"))\n end",
"def hour_12\n self.strftime(\"%I:%M %p\")\n end",
"def hour_12\n self.strftime(\"%I:%M %p\")\n end",
"def convert_to_usable_time(xanga_time)\n arr = ... | [
"0.71395534",
"0.7000013",
"0.6983168",
"0.6983168",
"0.66798913",
"0.6655831",
"0.6641592",
"0.6636",
"0.6595923",
"0.6570729",
"0.65455",
"0.6515312",
"0.6491314",
"0.64531773",
"0.64142025",
"0.63482887",
"0.63404197",
"0.6337473",
"0.63016796",
"0.6280202",
"0.62757117",
... | 0.0 | -1 |
%U Week number of the current year, starting with the first Sunday as the first day of the first week (00..53) | def W; cat @time.strftime('%W') end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def week_of_year date\n \tdate.strftime('%U').to_i\n end",
"def year_week\n @year_week ||= (((date-start_of_year)+1)/7.0).ceil\n end",
"def iso_week_num(wkst)\n iso_year_and_week_num(wkst)[1]\n end",
"def weeks_in_year\n return (self-(self.yday-1)).wday == 6 && self.leap? ? 5... | [
"0.82714254",
"0.8002065",
"0.7583053",
"0.7548668",
"0.7502347",
"0.7427149",
"0.7297769",
"0.72690374",
"0.7096596",
"0.7067019",
"0.7060865",
"0.70303154",
"0.69807905",
"0.6966921",
"0.69525784",
"0.6945703",
"0.69261736",
"0.68682617",
"0.6803419",
"0.6792586",
"0.67912"... | 0.6064262 | 98 |
%W Week number of the current year, starting with the first Monday as the first day of the first week (00..53) | def w; cat @time.strftime('%w') end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def week_of_year date\n \tdate.strftime('%U').to_i\n end",
"def year_week\n @year_week ||= (((date-start_of_year)+1)/7.0).ceil\n end",
"def week\n working_date = DateTime.new(self.year, 1, 1)\n working_date.week_day_start = self.week_day_start\n working_date = (working_date-working_date.... | [
"0.7972342",
"0.79655886",
"0.77541745",
"0.765743",
"0.75111264",
"0.74987036",
"0.7400217",
"0.7396324",
"0.73748946",
"0.7316185",
"0.72425586",
"0.72108406",
"0.71630347",
"0.7143087",
"0.7094844",
"0.70619434",
"0.70360506",
"0.7022389",
"0.69925183",
"0.69914436",
"0.69... | 0.6749636 | 39 |
%w Day of the week (Sunday is 0, 0..6) | def x; cat @time.strftime('%x') end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def day_of_week\n dnum = day\n dnum -= 10 if dnum > 20\n dnum -= 10 if dnum > 10\n dnum -= 1\n dnum\n end",
"def day_of_week\n # Zellers: 0 = Saturday, 1 = Sunday, 2 = Monday, ..., 6 = Friday\n # day_of_week: 1 = Sunday, 7 = Saturday\n (zellers_congruence + 6) % 7... | [
"0.84319824",
"0.8410513",
"0.8362469",
"0.813092",
"0.81055564",
"0.80841076",
"0.78828686",
"0.7839853",
"0.7834969",
"0.78181493",
"0.7773595",
"0.77553135",
"0.77263033",
"0.76660687",
"0.7626409",
"0.7620096",
"0.75804394",
"0.7574023",
"0.7539461",
"0.751452",
"0.749703... | 0.0 | -1 |
Symbols (couldn't decide between: t for text and s for symbol) | def space; txt ' ','' end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbols() @symbols end",
"def parse_typographic_syms; end",
"def symbol\n \n end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol\n @symbol\n end",
"def get_symbol\n token = @tokens.next\n\n c... | [
"0.6804003",
"0.677159",
"0.67456025",
"0.67078",
"0.67078",
"0.67078",
"0.67078",
"0.67078",
"0.67078",
"0.66147816",
"0.6550681",
"0.65170425",
"0.64618784",
"0.63225776",
"0.63036054",
"0.6296596",
"0.6288465",
"0.62547743",
"0.62272227",
"0.6225245",
"0.6225245",
"0.621... | 0.0 | -1 |
actually query HostIP.info with the 'IP address' | def locate
@result ||= self.class.get(
"/",
:query => {:ip => @ip},
:format => :xml
)['HostipLookupResultSet']['gml:featureMember']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hostip(ip)\n if GeoLocation::dev.nil? || GeoLocation::dev.empty?\n url = \"http://api.hostip.info/?ip=#{ip}\"\n uri = URI.parse(url) \n data_from_hostip_http_response(ip, Net::HTTP.get_response(uri).body)\n else\n data_from_maxmind_http_response(ip, GeoLocation::dev)\... | [
"0.77727956",
"0.7383782",
"0.7283",
"0.72427946",
"0.7040435",
"0.6997976",
"0.69859177",
"0.69451356",
"0.69087124",
"0.6886846",
"0.6873516",
"0.6849427",
"0.68053",
"0.6793948",
"0.6762664",
"0.67544067",
"0.67444247",
"0.673657",
"0.67167944",
"0.6715731",
"0.66983473",
... | 0.65397644 | 31 |
Token Authenticatable can be authenticated with params in any controller and any verb. | def valid_params_request?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate_with_token\n # get the token from the header\n # get the token from the post body\n # get the token from json post\n \n token = request.headers[\"HTTP_AUTHORIZATION\"]\n \n if (!token)\n if (not_protected self.controller_name, self.action_name)\n return nil\n ... | [
"0.7099298",
"0.7034181",
"0.6973243",
"0.69422877",
"0.6895773",
"0.6800357",
"0.67945313",
"0.67886645",
"0.67886645",
"0.6788641",
"0.6778383",
"0.67617553",
"0.67499566",
"0.67428005",
"0.67219186",
"0.67219186",
"0.67119867",
"0.67072946",
"0.66463745",
"0.6636788",
"0.6... | 0.0 | -1 |
Do not use remember_me behavior with token. | def remember_me?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remember_token; end",
"def remember_me; end",
"def remember_me?; end",
"def remember_me() return true; end",
"def forget_me!\n sorcery_config.remember_me_token_persist_globally || force_forget_me!\n end",
"def remember_me\n true\n end",
"def remember_me\n true\n end",
... | [
"0.79673845",
"0.75582904",
"0.7501965",
"0.735176",
"0.7327667",
"0.7160269",
"0.7160269",
"0.7160269",
"0.7063987",
"0.70177674",
"0.70105964",
"0.69965386",
"0.6960665",
"0.6945701",
"0.69423395",
"0.6925422",
"0.6924497",
"0.6924497",
"0.6924497",
"0.6924497",
"0.6924497"... | 0.7048898 | 10 |
Check if the model accepts this strategy as token authenticatable. | def token_authenticatable?
mapping.to.http_authenticatable?(:token_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\n end",
"def user_authorizes_token?\n params[:authorize] == '1'\n end",
"def user_authorizes_token?\n params[:authorize] == '1'\n end",
"def ... | [
"0.79231524",
"0.69519967",
"0.69519967",
"0.69519967",
"0.67741984",
"0.6765557",
"0.6728694",
"0.6717179",
"0.66831225",
"0.66403085",
"0.6636704",
"0.66151094",
"0.6608806",
"0.6596598",
"0.6587827",
"0.65872496",
"0.6585522",
"0.65824205",
"0.6549384",
"0.6536257",
"0.653... | 0.80277663 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.