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 |
|---|---|---|---|---|---|---|
fetch a record by id | def fetch_by_id(model, id, filters = {})
get_resource("/v1/public/#{model}/#{id}", filters) if model_exists?(model) && validate_filters(filters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(id)\n search(id: id)[:records].first\n end",
"def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.class.name} with ID=#{id}\")\n end",
"def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end",
"def fetc... | [
"0.8655304",
"0.7863461",
"0.7854279",
"0.7760492",
"0.7732283",
"0.77105683",
"0.7705241",
"0.7705241",
"0.76743686",
"0.76327205",
"0.7577479",
"0.75692695",
"0.7553585",
"0.7548614",
"0.74867016",
"0.7485244",
"0.74837154",
"0.7454468",
"0.7454468",
"0.7433893",
"0.7431364... | 0.0 | -1 |
validate arguments when creating a specific BotSender type instance | def validate(args = {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_widget_type_invalid\n widget = @twizo.create_registration_widget(nil)\n widget.params.allowed_types = 'sms'\n\n test_recipient = NUMBER1\n\n widget.params.recipient = test_recipient\n\n assert_raise Twizo::TwizoError do\n widget = widget.send\n end\n end",
"def test_widget_type\n... | [
"0.66375005",
"0.6378322",
"0.61547875",
"0.5846923",
"0.5737405",
"0.57290936",
"0.5684336",
"0.5681586",
"0.5679167",
"0.5675719",
"0.56529987",
"0.5627741",
"0.5541405",
"0.5526377",
"0.5516385",
"0.55076975",
"0.5444916",
"0.5443517",
"0.5382488",
"0.5363923",
"0.53461534... | 0.519395 | 33 |
Match a path without bothering whether they are formatted the same way. can also take several parameters, any number of which may be regexes | def match_path(*expected)
MatchPath.new(*expected)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches_path?(pattern, path); end",
"def path_regex\n Regexp.new path_pattern, 'i'\n end",
"def match?( path )\n path_matcher =~ path\n end",
"def match(path, *rest, &block); end",
"def matcher_for_path(path)\n\n path = path.to_s\n\n if path.include?('*')\n quoted_path = path.g... | [
"0.7398965",
"0.71917033",
"0.70089155",
"0.69547004",
"0.6781509",
"0.66846025",
"0.66842455",
"0.6613974",
"0.6569321",
"0.6430662",
"0.64297444",
"0.6406278",
"0.6352139",
"0.62972486",
"0.62465036",
"0.6220445",
"0.6116323",
"0.60916823",
"0.6060752",
"0.60581803",
"0.603... | 0.6797613 | 4 |
Render a label/value constraint on the screen. Can be called by plugins and such to get applicationdefined rendering. Can be overridden locally to render differently if desired, although in most cases you can just change CSS instead. Can pass in nil label if desired. options: [:remove] url to execute for a 'remove' act... | def render_constraint_element(label, value, options = {})
render(:partial => "catalog/constraints_element", :locals => {:label => label, :value => value, :options => options})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_element(field, options = {}, html_options = {})\n return '' if options.has_key?(:label) && options[:label].nil?\n text = options.delete(:label) || field.to_s.humanize\n suffix = options.delete(:suffix) || label_suffix\n value = text + suffix\n if (required = mandatory?(... | [
"0.6164786",
"0.6068957",
"0.605619",
"0.60523176",
"0.6045528",
"0.6045528",
"0.60402656",
"0.6020185",
"0.5964262",
"0.59623575",
"0.5919202",
"0.59115297",
"0.5885086",
"0.58532536",
"0.58254665",
"0.57959247",
"0.5779648",
"0.5771453",
"0.57611376",
"0.57381773",
"0.57327... | 0.6888831 | 0 |
Authenticate with HTTP Digest, returns true or false | def authenticate_with_http_digest(realm = "Application", &password_procedure)
HttpAuthentication::Digest.authenticate(self, realm, &password_procedure)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digest_auth(opts={})\n cnonce = make_cnonce\n nonce_count = 0\n\n to = opts['timeout'] || 20\n\n digest_user = opts['username'] || \"\"\n digest_password = opts['password'] || \"\"\n\n method = opts['method']\n path = opts['uri']\n iis = true\n if (opts['DigestAuthIIS'] == false or ... | [
"0.7825627",
"0.77417403",
"0.75783646",
"0.7364507",
"0.70363754",
"0.7004558",
"0.68971467",
"0.688415",
"0.6882904",
"0.6849538",
"0.68401515",
"0.6804138",
"0.6720226",
"0.6700968",
"0.66024005",
"0.659892",
"0.657017",
"0.65633464",
"0.65065914",
"0.65051794",
"0.6492954... | 0.73171735 | 4 |
Render output including the HTTP Digest authentication header | def request_http_digest_authentication(realm = "Application", message = nil)
HttpAuthentication::Digest.authentication_request(self, realm, message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digest\n @request.header('Authorization')\n end",
"def digest_authenticate(req, url, param_string = \"\")\n raise \"Digest authentication requires a WWW-Authenticate header\" if param_string.empty?\n\n params = parse_wwwauth_digest(param_string)\n qop = params[:qop]\n\n us... | [
"0.6952318",
"0.68745",
"0.63900197",
"0.63634825",
"0.62976676",
"0.62936425",
"0.62301993",
"0.6181657",
"0.6166217",
"0.6104558",
"0.59890246",
"0.58412385",
"0.5837258",
"0.58332974",
"0.5755094",
"0.574093",
"0.56808335",
"0.5657058",
"0.56538314",
"0.56361395",
"0.56348... | 0.58824176 | 11 |
Returns false on a valid response, true otherwise | def authenticate(controller, realm, &password_procedure)
authorization(controller.request) && validate_digest_response(controller.request, realm, &password_procedure)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_response?(message)\n return true\n end",
"def valid_response?\n return false unless response\n\n valid_hmac? && valid_amount? && valid_account?\n end",
"def valid?\n @http_response.is_a?(Net::HTTPSuccess) && @errors.blank?\n end",
"def response?\n !!respons... | [
"0.8165654",
"0.8165222",
"0.782038",
"0.7784168",
"0.7769321",
"0.7754371",
"0.7713953",
"0.77037716",
"0.76291484",
"0.7602009",
"0.7593815",
"0.75324434",
"0.75235504",
"0.7507188",
"0.74812454",
"0.74453837",
"0.74329096",
"0.7389819",
"0.73420495",
"0.7330318",
"0.732737... | 0.0 | -1 |
Raises error unless the request credentials response value matches the expected value. First try the password as a ha1 digest password. If this fails, then try it as a plain text password. | def validate_digest_response(request, realm, &password_procedure)
credentials = decode_credentials_header(request)
valid_nonce = validate_nonce(request, credentials[:nonce])
if valid_nonce && realm == credentials[:realm] && opaque == credentials[:opaque]
password = password_procedure.call(cre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_password username, password\n user = User.find_by_username username\n return nil unless (user and user.password_digest)\n if user.password == password\n return user\n else\n return nil\n end\n end",
"def validate_password(password)\n return false unless... | [
"0.64105374",
"0.6370486",
"0.6316586",
"0.6307315",
"0.62743145",
"0.62646973",
"0.6256927",
"0.62504023",
"0.624753",
"0.6230171",
"0.6230171",
"0.6144593",
"0.6143826",
"0.6127772",
"0.6122184",
"0.6112892",
"0.60920006",
"0.60811055",
"0.60740936",
"0.5998636",
"0.5996508... | 0.6508533 | 0 |
Returns the expected response for a request of +http_method+ to +uri+ with the decoded +credentials+ and the expected +password+ Optional parameter +password_is_ha1+ is set to +true+ by default, since best practice is to store ha1 digest instead of a plaintext password. | def expected_response(http_method, uri, credentials, password, password_is_ha1=true)
ha1 = password_is_ha1 ? password : ha1(credentials, password)
ha2 = ::Digest::MD5.hexdigest([http_method.to_s.upcase, uri].join(':'))
::Digest::MD5.hexdigest([ha1, credentials[:nonce], credentials[:nc], credentials[:c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expected_response(http_method, uri, credentials, password, password_is_ha1 = T.unsafe(nil)); end",
"def validate_digest_response(request, realm, &password_procedure)\n credentials = decode_credentials_header(request)\n valid_nonce = validate_nonce(request, credentials[:nonce])\n\n if valid_non... | [
"0.74690676",
"0.6302371",
"0.6087421",
"0.5718689",
"0.57073003",
"0.5698709",
"0.56346315",
"0.56236416",
"0.5612385",
"0.555585",
"0.55543417",
"0.5519058",
"0.550833",
"0.55057436",
"0.5470781",
"0.54688346",
"0.54515",
"0.5438698",
"0.5431648",
"0.5415059",
"0.54043853",... | 0.82599556 | 0 |
Uses an MD5 digest based on time to generate a value to be used only once. A serverspecified data string which should be uniquely generated each time a 401 response is made. It is recommended that this string be base64 or hexadecimal data. Specifically, since the string is passed in the header lines as a quoted string,... | def nonce(time = Time.now)
t = time.to_i
hashed = [t, secret_key]
digest = ::Digest::MD5.hexdigest(hashed.join(":"))
ActiveSupport::Base64.encode64("#{t}:#{digest}").gsub("\n", '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_nonce(time = Time.now)\n return Digest::MD5.hexdigest( time )\n end",
"def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end",
"def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end",
"def nonce; end",
"def nonce\n @nonce |... | [
"0.6402323",
"0.6193746",
"0.6188168",
"0.6104061",
"0.6097904",
"0.6097904",
"0.6072013",
"0.6041828",
"0.59572977",
"0.59125143",
"0.5802237",
"0.5782411",
"0.576852",
"0.57067484",
"0.57041246",
"0.55515707",
"0.5517772",
"0.5482837",
"0.5479541",
"0.5462485",
"0.5462374",... | 0.6434829 | 0 |
Might want a shorter timeout depending on whether the request is a PUT or POST, and if client is browser or web service. Can be much shorter if the Stale directive is implemented. This would allow a user to use new nonce without prompting user again for their username and password. | def validate_nonce(request, value, seconds_to_timeout=5*60)
t = ActiveSupport::Base64.decode64(value).split(":").first.to_i
nonce(t) == value && (t - Time.now.to_i).abs <= seconds_to_timeout
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_nonce(secret_key, request, value, seconds_to_timeout = T.unsafe(nil)); end",
"def nonce(secret_key, time = T.unsafe(nil)); end",
"def nonce_validation_timeout(value = nil)\n rw_config(:nonce_validation_timeout, value, 600)\n end",
"def nonce\n ((Time.now.to_f * 1000000).to_i <... | [
"0.7116626",
"0.6708589",
"0.6705843",
"0.6649465",
"0.6622308",
"0.64273196",
"0.642471",
"0.642471",
"0.63014895",
"0.6260875",
"0.62407446",
"0.6230407",
"0.6141073",
"0.6137968",
"0.61070883",
"0.60909635",
"0.6066556",
"0.6055709",
"0.59169036",
"0.5915994",
"0.58659625"... | 0.68315613 | 1 |
Opaque based on random generation but changing each request? | def opaque()
::Digest::MD5.hexdigest(secret_key)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random()\n \n end",
"def get_random()\n \n end",
"def random_id\n rand(1000000) + 20000\nend",
"def random\n RandomJam.jam(@api_key, @https)\n end",
"def generate_uuid\n t = Thread.current\n\n unless t.key? :opaque_id_base\n t[:opaque_id_base] ... | [
"0.6998069",
"0.6998069",
"0.66365904",
"0.66183066",
"0.6493398",
"0.6464243",
"0.6464243",
"0.6464243",
"0.6464243",
"0.6446106",
"0.64204365",
"0.6396252",
"0.637449",
"0.63706535",
"0.63672084",
"0.6365049",
"0.635056",
"0.6324851",
"0.6317115",
"0.6276371",
"0.6249168",
... | 0.0 | -1 |
Set in /initializers/session_store.rb, and loaded even if sessions are not in use. | def secret_key
ActionController::Base.session_options[:secret]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session(session_store = nil)\n session_store ||= default_session_store\n if class_name = self.class.registered_session_types[session_store]\n session_stores[session_store] ||= Object.full_const_get(class_name).setup(self)\n elsif fallback = self.class.registered_session_types.keys... | [
"0.71022135",
"0.70758396",
"0.70422894",
"0.6873391",
"0.6730586",
"0.65799564",
"0.64389306",
"0.63580835",
"0.6333663",
"0.6325332",
"0.6221751",
"0.62183875",
"0.6156935",
"0.6142352",
"0.60902655",
"0.6004094",
"0.5967161",
"0.5952638",
"0.5946267",
"0.5930872",
"0.59288... | 0.0 | -1 |
This method generates an array of all moves that can be made after the current move. | def children
new_arr = []
i == 0
j == 0
while i < board.length
j = 0
while j < board.length
if !board[i][j].empty?
dupe = board.dup
dupe[i, j] = self.next_mover_mark
self.prev_move_pos = [i, j]
if self.next_mover_mark == :x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_positio... | [
"0.7454557",
"0.74482566",
"0.7408133",
"0.7375647",
"0.7239078",
"0.72347915",
"0.7216581",
"0.72132635",
"0.72058386",
"0.7181087",
"0.7141603",
"0.71172655",
"0.70901144",
"0.7079941",
"0.70734614",
"0.7062227",
"0.7034742",
"0.7027884",
"0.6985238",
"0.69765544",
"0.69542... | 0.6086774 | 98 |
Never trust parameters from the scary internet, only allow the white list through. | def reset_password_params
params.require(:reset_password).permit(:email)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /people GET /people.json | def index
respond_with(@people)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend",
"def people\n Sifter.\n get(api_people_url).\n fetch(\"people\", []).\n map { |p| Sifter::Person.new(p... | [
"0.75080985",
"0.7490487",
"0.7490487",
"0.73151547",
"0.72153556",
"0.7154834",
"0.7154834",
"0.71427387",
"0.7037789",
"0.70082515",
"0.699553",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.6980208",
"0.69641876"... | 0.672547 | 32 |
GET /people/1 GET /people/1.json | def show
respond_with(@person)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end",
"def person(id)\n get(\"/catalog/people/#{id.to_s}\")\n end",
"def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html #... | [
"0.7365069",
"0.7294043",
"0.72786033",
"0.72786033",
"0.72346365",
"0.72162867",
"0.716024",
"0.716024",
"0.716024",
"0.716024",
"0.716024",
"0.716024",
"0.716024",
"0.716024",
"0.716024",
"0.71353817",
"0.70798934",
"0.70749295",
"0.70646334",
"0.7022336",
"0.6997603",
"0... | 0.0 | -1 |
GET /people/new GET /people/new.json | def new
respond_with(@person)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @person = Person.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n... | [
"0.79893994",
"0.7953678",
"0.7880772",
"0.7880772",
"0.7880772",
"0.7880772",
"0.7880772",
"0.7880772",
"0.7880772",
"0.7614816",
"0.7449357",
"0.7358435",
"0.7346382",
"0.73143524",
"0.7311912",
"0.7262768",
"0.7262768",
"0.7262768",
"0.7224765",
"0.72192407",
"0.72023267",... | 0.6793425 | 96 |
POST /people POST /people.json | def create
@person.save
respond_with(@person, :location => people_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @person = current_user.created_people.new(person_params_with_school)\n if @person.save\n render :show, status: :created, location: api_v1_person_url(@person)\n else\n render json: @person.errors, status: :unprocessable_entity\n end\n end",
"def create\n @person = Person.new... | [
"0.6787028",
"0.67639786",
"0.67471504",
"0.67430043",
"0.6740321",
"0.6729967",
"0.6695623",
"0.66938925",
"0.66387355",
"0.6607146",
"0.6599289",
"0.6555189",
"0.6555189",
"0.6555189",
"0.6555189",
"0.65208775",
"0.65106755",
"0.6495074",
"0.6495074",
"0.6495074",
"0.649507... | 0.6437779 | 28 |
PUT /people/1 PUT /people/1.json | def update
@person.update_attributes(params[:person])
respond_with(@person)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_requ... | [
"0.72186595",
"0.7087179",
"0.6802835",
"0.6772892",
"0.675633",
"0.6738609",
"0.6681792",
"0.6681792",
"0.664689",
"0.6627083",
"0.6627083",
"0.6622332",
"0.6607516",
"0.6607516",
"0.6607516",
"0.6607516",
"0.6607516",
"0.6564653",
"0.6525528",
"0.64972544",
"0.6489222",
"... | 0.6605444 | 17 |
DELETE /people/1 DELETE /people/1.json | def destroy
@person.destroy
respond_with(@person)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to peop... | [
"0.7566967",
"0.7553448",
"0.7553448",
"0.7553448",
"0.7553169",
"0.7543093",
"0.7527414",
"0.7527414",
"0.7527414",
"0.7527414",
"0.7442293",
"0.74221706",
"0.7410429",
"0.7410429",
"0.7410429",
"0.7410429",
"0.7410429",
"0.73950803",
"0.73519367",
"0.7280329",
"0.7271195",
... | 0.67782843 | 98 |
Gets a reference's state, combining results from both the Status API, Checks API | def github_combined_status
expires_in = ->(reply) { cache_duration(reply) }
Samson::DynamicTtlCache.cache_fetch_if true, cache_key(@commit), expires_in: expires_in do
results = Samson::Parallelizer.map(
[
-> { octokit_error_as_status('checks') { github_check_status } },
-> { oc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(ref = main_branch)\n statuses = statuses(ref)\n\n sha = statuses['values'].map {|x| x.dig('commit', 'hash') }.compact.first\n states = statuses['values'].map { |status| status['state'] }\n\n state = if states.any? { |x| ['STOPPED', 'FAILED'].include?(x) }\n B... | [
"0.6576681",
"0.65584683",
"0.64049613",
"0.6367278",
"0.63510484",
"0.63454205",
"0.6307586",
"0.62726355",
"0.6203946",
"0.61880934",
"0.6174908",
"0.61640084",
"0.60936046",
"0.6086814",
"0.6064607",
"0.6059277",
"0.60512435",
"0.60399395",
"0.6012913",
"0.60058844",
"0.59... | 0.55598783 | 80 |
Gets commit statuses using GitHub's check API. Currently parsing it to match status structure to better facilitate transition to new API. See and for details | def github_check_status
base_url = "repos/#{@project.repository_path}/commits/#{@commit}"
preview_header = {Accept: 'application/vnd.github.antiope-preview+json'}
check_suites = GITHUB.get("#{base_url}/check-suites", headers: preview_header).to_attrs.fetch(:check_suites)
check_runs = GITHUB.get("#{base... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def github_check\n base_url = \"repos/#{@project.repository_path}/commits/#{@reference}\"\n preview_header = {Accept: 'application/vnd.github.antiope-preview+json'}\n\n check_suites = GITHUB.get(\"#{base_url}/check-suites\", headers: preview_header)[:check_suites]\n checks = GITHUB.get(\"#{base_url}/ch... | [
"0.7229237",
"0.6624522",
"0.6530344",
"0.64977604",
"0.62019104",
"0.61376876",
"0.6071329",
"0.6035492",
"0.6017202",
"0.59870857",
"0.5854372",
"0.5848452",
"0.5824055",
"0.5791447",
"0.5784469",
"0.57730013",
"0.5772257",
"0.57717526",
"0.57715225",
"0.5712451",
"0.568892... | 0.7811053 | 0 |
convert github api url to html url without doing another request for the PR | def github_pr_checks_url(suite)
return unless pr = suite.fetch(:pull_requests).first
"#{pr[:url].sub('://api.', '://').sub('/repos/', '/').sub('/pulls/', '/pull/')}/checks"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issue_url(api_url)\n # \"https://api.github.com/repos/typed-ember/ember-cli-typescript/issues/322\"\n api_index = api_url.index(\"api\")\n repos_index = api_url.index(\"repos\")\n\n # https://github.com/typed-ember/ember-cli-typescript/issues/322\n html_url = api_url[0..api_index - 1] +\n ... | [
"0.7640762",
"0.7565304",
"0.7026849",
"0.69159883",
"0.68903434",
"0.68523395",
"0.6790327",
"0.67801595",
"0.676279",
"0.6735352",
"0.66081524",
"0.65691966",
"0.6482836",
"0.6474617",
"0.64193034",
"0.6379442",
"0.63389724",
"0.6325725",
"0.6319719",
"0.6300785",
"0.629273... | 0.6392319 | 15 |
Show if included PRs are missing risks There can be lots of PRs, so only use a single status Ignore if all PRs are "None" risk or no PRs (return nil) TODO: pass in commit to changeset to avoid extra commit resolution TODO: parse risk level and display "pending" for "High" risks | def changeset_risks_status
return unless ENV["COMMIT_STATUS_RISKS"]
return unless previous = @stage.deploys.succeeded.first
pull_requests = Changeset.new(@stage.project, previous.commit, @reference).pull_requests
count = pull_requests.count(&:missing_risks?)
if count > 0
{
state: "err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pr_description\n danger_file.warn('Please provide a summary in the Pull Request description') if danger_file.github.pr_body.length < 3 && danger_file.git.lines_of_code > 10\n end",
"def work_in_progress\n has_wip_label = danger_file.github.pr_labels.any? { |label| label.include? 'WIP' }\n has_wip_t... | [
"0.638614",
"0.6253619",
"0.61323655",
"0.5950381",
"0.59032834",
"0.58770305",
"0.58134425",
"0.5744029",
"0.56994104",
"0.5681181",
"0.56776005",
"0.56633043",
"0.56465364",
"0.5610419",
"0.55885017",
"0.55751264",
"0.556662",
"0.5544584",
"0.55127805",
"0.5491382",
"0.5411... | 0.72732884 | 0 |
merges multiple statuses into a single status | def merge_statuses(statuses)
statuses[1..].each_with_object(statuses[0].dup) do |status, merged|
merged[:state] = [merged.fetch(:state), status.fetch(:state)].max_by { |s| STATE_PRIORITY.index(s.to_sym) }
merged.fetch(:statuses).concat(status.fetch(:statuses))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def consolidate(status_list)\n status_list ||= []\n status_list.compact!\n \n return :unknown if status_list.empty?\n \n status = collect_min_priority(:status_list => status_list)\n PRIORITY.invert[status]\n end",
"def statuses\n calculated = Array(read_attribute(:statuse... | [
"0.6556058",
"0.6156454",
"0.6107245",
"0.6029844",
"0.5966533",
"0.59173065",
"0.5902956",
"0.5857039",
"0.58469886",
"0.57970995",
"0.57646316",
"0.57226574",
"0.5708472",
"0.56966877",
"0.56789696",
"0.5667965",
"0.55895674",
"0.55820787",
"0.55551505",
"0.55425125",
"0.55... | 0.791234 | 0 |
checks if other stages that deploy to the same hosts as this stage have deployed a newer release | def release_status
return unless DeployGroup.enabled?
return unless current_version = version(@reference)
return unless higher_references = last_deployed_references.select { |n| version(n)&.> current_version }.presence
# code above is hot ... so keep it optimized and re-fetch here only if something bad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_pushed_rhn_stage?\n return true if rhnqa? || rhnqa_shadow?\n\n has_pushed_since_last_respin?(RhnStagePushJob)\n end",
"def should_notify_release_stage?\n @release_stage.nil? || @notify_release_stages.nil? || @notify_release_stages.include?(@release_stage)\n end",
"def no_change_in_versio... | [
"0.6798948",
"0.64174455",
"0.63443947",
"0.6332299",
"0.6279421",
"0.62711966",
"0.622773",
"0.61157477",
"0.60918045",
"0.60872626",
"0.6068227",
"0.60148716",
"0.6003375",
"0.5997826",
"0.5979842",
"0.59793985",
"0.5943416",
"0.59146786",
"0.58011025",
"0.5800842",
"0.5778... | 0.66302586 | 2 |
Check if ref has been deployed to any nonproduction stages first if deploying to production | def only_production_status
return if !@stage.production? || @stage.project.deployed_to_non_production_stage?(@commit)
{
state: "pending",
statuses: [{
state: "Production Only Reference",
description: "#{@reference} has not been deployed to a non-production stage."
}]
}
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy_requires_approval?\n super || pipeline_next_stages.any?(&:deploy_requires_approval?)\n end",
"def staging?\n self.environment == ENV_STAGE\n end",
"def deployed?\n git_info[\"deployed_commit_sha\"].present?\n end",
"def staging?\n status == \"STAGING\"\n end",
... | [
"0.6873387",
"0.6701032",
"0.6668316",
"0.65655905",
"0.6527119",
"0.649146",
"0.6480425",
"0.6451295",
"0.64399093",
"0.64399093",
"0.64391726",
"0.6435415",
"0.6378921",
"0.6373746",
"0.63725406",
"0.6359555",
"0.63500774",
"0.63477784",
"0.63068837",
"0.6298903",
"0.629890... | 0.7265062 | 0 |
optimized to sql instead of AR fanciness to make it go from 1s > 0.01s on our worst case stage | def last_deployed_references
last_deployed = deploy_scope.pluck(Arel.sql('max(deploys.id)'))
Deploy.reorder(id: :asc).where(id: last_deployed).pluck(Arel.sql('distinct reference, id')).map(&:first)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimize_every; end",
"def base(table, column, where='1=1')\n count = DB[\"SELECT COUNT(*) FROM #{table} WHERE #{column} IS NULL AND (#{where})\"].first[:count]\n $times[[table, column]] << [Time.now, count]\n t = $times[[table, column]]\n\n vel = 0\n time_remaining = 0\n interval = [10, t.size].min\n ... | [
"0.59284484",
"0.55226827",
"0.527652",
"0.52250916",
"0.5176669",
"0.5176669",
"0.5176669",
"0.5118721",
"0.5109853",
"0.5105883",
"0.5092404",
"0.5092404",
"0.509077",
"0.5061294",
"0.5051529",
"0.5040985",
"0.5032827",
"0.5027113",
"0.5004181",
"0.5003361",
"0.4995458",
... | 0.0 | -1 |
don't blow up when github is down, but show a nice error | def octokit_error_as_status(type)
yield
rescue Octokit::ClientError => e
Rails.logger.error(e) # log error for further debugging if it's not 404.
{
state: "missing",
statuses: [{
context: "Reference", # for releases/show.html.erb
state: "missing",
description: "Unable t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_rescue\n @logger.error \"Branch or ref does not exist\"\n end",
"def github_check\n begin\n unless github.blank?\n RestClient.get \"https://github.com/#{github}\"\n end\n rescue\n errors.add :base, \"Invalid Github account.\"\n end\n end",
"def check_github_respo... | [
"0.6966307",
"0.6501219",
"0.6429163",
"0.6345146",
"0.6336105",
"0.6325084",
"0.62735766",
"0.6210458",
"0.62031275",
"0.6188246",
"0.6175362",
"0.5909453",
"0.59009486",
"0.58862484",
"0.5885911",
"0.58722985",
"0.5799674",
"0.5787357",
"0.57814956",
"0.57320017",
"0.573200... | 0.5676871 | 25 |
items(a: Scale::Types::Type1, b: "Type2") | def items(**items)
const_set(:ITEMS, items)
item_names = items.keys
attr_accessor *item_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_item_should_be_of_proper_type\n assert_kind_of Product, items(:uranium_portion)\n assert_kind_of Product, items(:lightsaber)\n assert_kind_of Product, items(:holy_grenade)\n assert_kind_of Product, items(:chinchilla_coat)\n assert_kind_of Product, items(:towel)\n assert_kind_of Product, ... | [
"0.59351",
"0.59158194",
"0.57093894",
"0.56900895",
"0.5610356",
"0.56019974",
"0.5587156",
"0.5535847",
"0.5527022",
"0.5506914",
"0.5419537",
"0.54191047",
"0.5391967",
"0.5391967",
"0.5374748",
"0.53738016",
"0.5371998",
"0.5347069",
"0.53337026",
"0.53069353",
"0.5270733... | 0.5102593 | 42 |
items(Item1: Scale::Types::Compact, Item2: "Hex") | def items(**items)
const_set(:ITEMS, items)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marw_format_item_array(item_array)\n if item_array.is_a?(RPG::BaseItem)\n return [item_array.icon_index, item_array.name]\n elsif item_array.is_a?(Array)\n amount = (item_array[2].is_a?(Integer) ? sprintf(MARW_CONFIGURATION[:vocab_amount], item_array[2]) : \"\")\n return case item_array[0]... | [
"0.5818961",
"0.5748583",
"0.5709026",
"0.56852263",
"0.5670587",
"0.56691444",
"0.56691444",
"0.55864304",
"0.55864304",
"0.55860436",
"0.55860436",
"0.55860436",
"0.55802774",
"0.55488294",
"0.5523557",
"0.5521103",
"0.5500315",
"0.54846144",
"0.54407525",
"0.5426642",
"0.5... | 0.5737998 | 2 |
GET /viagens GET /viagens.json | def index
@viagens = Viagem.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @vitricongviecs = Vitricongviec.all\n end",
"def index\n @ivas = Iva.all\n\n render json: @ivas\n end",
"def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"def i... | [
"0.62777585",
"0.6277514",
"0.6201161",
"0.6119704",
"0.60383546",
"0.6022225",
"0.60134035",
"0.6001247",
"0.5999099",
"0.5923075",
"0.59011054",
"0.58999854",
"0.5897125",
"0.5892312",
"0.58880377",
"0.58116966",
"0.5808163",
"0.578195",
"0.5767293",
"0.5763384",
"0.575721"... | 0.6417397 | 0 |
GET /viagens/1 GET /viagens/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def show\n @vocalium = Vocalium.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { re... | [
"0.67297477",
"0.672716",
"0.66893435",
"0.6664016",
"0.6643288",
"0.6602846",
"0.6508361",
"0.6486",
"0.64199954",
"0.63943315",
"0.63807434",
"0.6379443",
"0.63775903",
"0.6349257",
"0.63387734",
"0.63387734",
"0.63387734",
"0.63323796",
"0.6327618",
"0.63262665",
"0.623258... | 0.0 | -1 |
POST /viagens POST /viagens.json | def create
@viagem = Viagem.new(viagem_params)
respond_to do |format|
if @viagem.save
format.html { redirect_to @viagem, notice: 'Viagem was successfully created.' }
format.json { render :show, status: :created, location: @viagem }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @vik = Vik.new(vik_params)\n\n respond_to do |format|\n if @vik.save\n format.html { redirect_to @vik, notice: 'Vik was successfully created.' }\n format.json { render :show, status: :created, location: @vik }\n else\n format.html { render :new }\n format.js... | [
"0.5778071",
"0.5726063",
"0.5712026",
"0.55780256",
"0.55402964",
"0.54661006",
"0.5457579",
"0.5435416",
"0.5410522",
"0.5384501",
"0.5379041",
"0.5359857",
"0.5298103",
"0.5289493",
"0.5277907",
"0.52716863",
"0.52702826",
"0.52677864",
"0.52608865",
"0.5258294",
"0.525108... | 0.52011085 | 26 |
PATCH/PUT /viagens/1 PATCH/PUT /viagens/1.json | def update
respond_to do |format|
if @viagem.update(viagem_params)
format.html { redirect_to @viagem, notice: 'Viagem was successfully updated.' }
format.json { render :show, status: :ok, location: @viagem }
else
format.html { render :edit }
format.json { render json: @vi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aos... | [
"0.65337104",
"0.6330059",
"0.62686044",
"0.621841",
"0.6199197",
"0.6184018",
"0.6166669",
"0.613231",
"0.61249274",
"0.6091522",
"0.60689074",
"0.6058001",
"0.6052418",
"0.6049312",
"0.60383165",
"0.6031781",
"0.6031417",
"0.6023434",
"0.6013424",
"0.6001009",
"0.59984386",... | 0.5837434 | 40 |
DELETE /viagens/1 DELETE /viagens/1.json | def destroy
@viagem.destroy
respond_to do |format|
format.html { redirect_to viagens_url, notice: 'Viagem was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_u... | [
"0.7182659",
"0.7071874",
"0.69625497",
"0.68911034",
"0.68763983",
"0.68572146",
"0.6836519",
"0.6820858",
"0.67974865",
"0.67808616",
"0.6763095",
"0.675513",
"0.67489177",
"0.6739261",
"0.6730353",
"0.6727434",
"0.67246795",
"0.67246795",
"0.6723464",
"0.6723464",
"0.67234... | 0.666029 | 28 |
Use callbacks to share common setup or constraints between actions. | def set_viagem
@viagem = Viagem.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.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 |
Never trust parameters from the scary internet, only allow the white list through. | def viagem_params
params.require(:viagem).permit(:veiculo_id, :origem, :destino, :data_inicio, :data_fim)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
OSXFuse is automatically loaded. Just check if it is installed | def bindfs_fuse_loaded(machine)
machine.guest.capability(:bindfs_fuse_installed)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefer_indep_over_os_packages?; @prefer_indep_over_os_packages end",
"def has_os?\n delegate(provider, :has_os?)\n end",
"def installed?\n false\n end",
"def esxi_installed?\n os_image_type == \"vmware_esxi\" && os_installed?\n end",
"def system_load_ok?\n true\n ... | [
"0.64658296",
"0.6407387",
"0.6125986",
"0.60728925",
"0.59976906",
"0.59190404",
"0.59186816",
"0.5880054",
"0.5874162",
"0.5868112",
"0.58561486",
"0.58214104",
"0.57887805",
"0.57413745",
"0.57181567",
"0.56693625",
"0.5668626",
"0.56526124",
"0.56227726",
"0.55893743",
"0... | 0.56486815 | 18 |
POST /products POST /products.json | def create
@recommendation = current_user.recommendations.build(params[:recommendation])
@users=User.all
@products=Product.all
@occasions=Occasion.all
respond_to do |format|
if @recommendation.save
format.html { redirect_to occasion_path(@recommendation.occasion_id)}
format.js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n if params[:products]\n params[:products].each do |product|\n @... | [
"0.7675882",
"0.7592818",
"0.75621015",
"0.75331664",
"0.7532739",
"0.75086707",
"0.7422893",
"0.7392729",
"0.7375317",
"0.7357385",
"0.73245543",
"0.7288638",
"0.714639",
"0.70522964",
"0.7049654",
"0.7042963",
"0.70394176",
"0.70394176",
"0.70394176",
"0.7034378",
"0.702755... | 0.0 | -1 |
PUT /products/1 PUT /products/1.json | def update
@recommendation = Recommendation.find(params[:id])
@users=User.all
@products=Product.all
@occasions=Occasion.all
respond_to do |format|
if @recommendation.update_attributes(params[:recommendation])
format.html { redirect_to occasion_path(@recommendation.occasion_id) }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_cou... | [
"0.7537158",
"0.718361",
"0.7076738",
"0.6947068",
"0.6933706",
"0.69250435",
"0.6899786",
"0.6838226",
"0.6820647",
"0.6802406",
"0.6754015",
"0.67253315",
"0.6626227",
"0.6580288",
"0.65785605",
"0.65553606",
"0.6545574",
"0.6541611",
"0.6541611",
"0.6541202",
"0.65288335",... | 0.0 | -1 |
DELETE /products/1 DELETE /products/1.json | def destroy
@recommendation = Recommendation.find(params[:id])
@recommendation.destroy
respond_to do |format|
format.html { redirect_to recommendations_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end",
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
"def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end",
... | [
"0.7716767",
"0.7593029",
"0.7548404",
"0.75026053",
"0.7501899",
"0.74741083",
"0.7439505",
"0.7417943",
"0.74088925",
"0.7370336",
"0.73533446",
"0.73478407",
"0.73357344",
"0.73357344",
"0.73357344",
"0.73308176",
"0.73308176",
"0.73308176",
"0.73308176",
"0.73308176",
"0.... | 0.0 | -1 |
deletes from the database | def delete
table_name = self.class.to_s.pluralize.underscore
DATABASE.execute("DELETE FROM #{table_name} WHERE id = #{@id};")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n\n DB.execute(\"DELETE FROM #{table_name} WHERE id = #{@id};\")\n end",
"def delete\n DB.exec(\"DELETE FROM users WHERE id = #{@id};\")\n # DB.exec(\"DELETE FROM checkouts WHERE user_id = #{@id};\") --> delete books from users checkout history, but does not delete the books from the databas... | [
"0.74456567",
"0.7412255",
"0.73919207",
"0.737135",
"0.73683876",
"0.73504335",
"0.733292",
"0.7296953",
"0.7243181",
"0.71778953",
"0.71730566",
"0.7165128",
"0.7130758",
"0.7129444",
"0.712917",
"0.7117026",
"0.71007967",
"0.70792687",
"0.7077576",
"0.7068497",
"0.7059074"... | 0.6884797 | 66 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.contact_us_mailer.email_cory.subject | def email_cory(user)
@user_info = user_info
mail to: "rachavez1974@gmail.com"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_subject=(value)\n @message_subject = value\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\... | [
"0.7334237",
"0.7294179",
"0.7263367",
"0.72625834",
"0.72539127",
"0.7251853",
"0.71446055",
"0.7132657",
"0.70991725",
"0.70318323",
"0.6890369",
"0.6872956",
"0.68688065",
"0.67872375",
"0.67843264",
"0.67790586",
"0.6721251",
"0.67053926",
"0.6703321",
"0.6693727",
"0.669... | 0.0 | -1 |
method that, unless a current_user is signedin, will flash an alert upon an unwarranted action. As an example, see before_action within controllers Since method is created within ApplicationController, method is warranted throughout all controllers | def require_sign_in
# if you are not signed in as a current_user via Session, return to new_session_path
# with an alert
unless current_user
flash[:alert] = 'You must be logged in to do that'
redirect_to new_session_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_not_authorized\n flash[:alert] = \"You are not authorized to perform this action.\"\n redirect_to root_path\n end",
"def user_not_authorized\n #flash[:alert] = \"You are not cool enough to do this - go back from whence you came.\"\n redirect_to root_path\n end",
"de... | [
"0.74717087",
"0.7377348",
"0.7336132",
"0.7212056",
"0.71805876",
"0.71493155",
"0.71169823",
"0.705448",
"0.69161433",
"0.69000524",
"0.6885747",
"0.6842804",
"0.6838566",
"0.6826443",
"0.6806134",
"0.679808",
"0.6778618",
"0.67752546",
"0.6769768",
"0.6729624",
"0.6729336"... | 0.0 | -1 |
GET /codesnippets/1 GET /codesnippets/1.json | def show
@codesnippet = Codesnippet.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @codesnippet }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @languages = [\"c\", \"python\", \"css\", \"html\", \"javascript\", \"php\", \"lua\", \"ruby\", \"scheme\"]\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @snippet }\n end\n end",
"def user_snippet(id)... | [
"0.7382245",
"0.716674",
"0.70114964",
"0.6993372",
"0.6934333",
"0.6831469",
"0.6809768",
"0.6778523",
"0.6770267",
"0.6702841",
"0.6700034",
"0.66689235",
"0.66689235",
"0.66357285",
"0.65314466",
"0.65292704",
"0.64713407",
"0.64713407",
"0.64403087",
"0.6438134",
"0.64192... | 0.7871139 | 0 |
GET /codesnippets/new GET /codesnippets/new.json | def new
@codesnippet = Codesnippet.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @codesnippet }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n end\n end",
"def new\n @snippet = Snippet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snippet }\n ... | [
"0.80016357",
"0.80016357",
"0.76884115",
"0.7413945",
"0.7330157",
"0.7303115",
"0.72819597",
"0.71853316",
"0.717626",
"0.71530676",
"0.71337557",
"0.7104517",
"0.70994544",
"0.7003129",
"0.69611317",
"0.69032395",
"0.6779201",
"0.6732239",
"0.67199886",
"0.67173547",
"0.66... | 0.8171324 | 0 |
POST /codesnippets POST /codesnippets.json | def create
@codesnippet = Codesnippet.new(params[:codesnippet])
respond_to do |format|
if @codesnippet.save
format.html { redirect_to @codesnippet, notice: 'Codesnippet was successfully created.' }
format.json { render json: @codesnippet, status: :created, location: @codesnippet }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @code_snippet = @language.code_snippets.new(code_snippet_params)\n\n respond_to do |format|\n if @code_snippet.save\n format.html { redirect_to [@language,@code_snippet], notice: 'Code snippet was successfully created.' }\n format.json { render :show, status: :created, locatio... | [
"0.7439806",
"0.7056375",
"0.7018455",
"0.69865",
"0.69553035",
"0.69120884",
"0.6895568",
"0.67924255",
"0.6780566",
"0.67427653",
"0.6649274",
"0.6635059",
"0.65357906",
"0.64864933",
"0.6458272",
"0.64159274",
"0.636084",
"0.6295211",
"0.6295211",
"0.6284511",
"0.62776536"... | 0.7400028 | 1 |
PUT /codesnippets/1 PUT /codesnippets/1.json | def update
@codesnippet = Codesnippet.find(params[:id])
respond_to do |format|
if @codesnippet.update_attributes(params[:codesnippet])
format.html { redirect_to @codesnippet, notice: 'Codesnippet was successfully updated.' }
format.json { head :ok }
else
format.html { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @snippet = Snippet.find(params[:id])\n\n respond_to do |format|\n if @snippet.update_attributes(params[:snippet])\n format.html { redirect_to @snippet, notice: 'Snippet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ac... | [
"0.71951056",
"0.7157175",
"0.7047654",
"0.6973148",
"0.69586694",
"0.6936995",
"0.6899359",
"0.6899359",
"0.6899359",
"0.6892765",
"0.6801165",
"0.67874485",
"0.651988",
"0.6463115",
"0.6436623",
"0.6326927",
"0.6262413",
"0.625014",
"0.624142",
"0.62242556",
"0.6213266",
... | 0.73045665 | 0 |
DELETE /codesnippets/1 DELETE /codesnippets/1.json | def destroy
@codesnippet = Codesnippet.find(params[:id])
@codesnippet.destroy
respond_to do |format|
format.html { redirect_to codesnippets_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy\n\n respond_to do |format|\n format.html { redirect_to snippets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @snippet = Snippet.find(params[:id])\n @snippet.destroy\n\n respond_to do |fo... | [
"0.7741427",
"0.7741427",
"0.7698657",
"0.76573557",
"0.764997",
"0.7632055",
"0.7616739",
"0.761652",
"0.7504347",
"0.7504347",
"0.7427101",
"0.7427101",
"0.7427101",
"0.7394016",
"0.73020554",
"0.7258622",
"0.71912444",
"0.7107356",
"0.7060044",
"0.6960913",
"0.6945671",
... | 0.80472946 | 0 |
These applications will need extra configuration to enable them to work with groups of projects | def project_only_application?
Clusters::Cluster::PROJECT_ONLY_APPLICATIONS.include?(application_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_projects\n # noop\n end",
"def set_app_groups\n @sys_app_groups = bc_sys_app_groups\n @usr_app_groups = bc_usr_app_groups\n @dev_app_groups = bc_dev_app_groups\n @apps_menu_group = bc_custom_apps_group\n end",
"def addApplication(app)\n super(app)\n eachGroup { |g... | [
"0.6455937",
"0.6356585",
"0.6330611",
"0.61474437",
"0.60387343",
"0.60387343",
"0.5896453",
"0.5717443",
"0.5707967",
"0.5629853",
"0.5543058",
"0.55236673",
"0.5511943",
"0.5494647",
"0.54743147",
"0.54530114",
"0.5449602",
"0.54176855",
"0.5395875",
"0.53751075",
"0.53726... | 0.55396235 | 11 |
input1 One Integer to check. input2 Another Integer to check. Examples max_of_two(3, 4) => 4 max_of_two(4, 3) => 4 Returns the largest of the two numbers. | def max_of_two(input1,input2)
if input1 > input2
output = input1
else output = input2
end
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_of_two(number1, number2)\n if number1 > number2\n return number1\n else \n return number2\n end\nend",
"def max_of_two(num1, num2)\n if num1 >= num2\n output = num1\n else output = num2\n end\n return output\nend",
"def max_of_two(number1,number2)\n if numbe... | [
"0.85016805",
"0.8499684",
"0.84968865",
"0.8477988",
"0.8432639",
"0.84294146",
"0.8417891",
"0.8417891",
"0.83562195",
"0.82932466",
"0.8289306",
"0.8198725",
"0.8197767",
"0.81550235",
"0.8113508",
"0.8076451",
"0.7921844",
"0.78098065",
"0.7742899",
"0.7593318",
"0.757360... | 0.8692428 | 0 |
Lazy initialization of default config | def configuration
@configuration ||= Configuration.new()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end",
"def default_config\n self.class.default_config\n end",
"def default_config\n {}\n end",
"def init_default_config\n configuration.project_id ||= Debugger.default_project_id\n configuration.credentials ||= Debugge... | [
"0.77411115",
"0.7606605",
"0.74456316",
"0.7374174",
"0.7374055",
"0.73385274",
"0.73146254",
"0.728196",
"0.721618",
"0.7181575",
"0.7117697",
"0.7095641",
"0.7029126",
"0.70152694",
"0.6996216",
"0.6993877",
"0.6979604",
"0.69076234",
"0.6864491",
"0.685366",
"0.6845058",
... | 0.0 | -1 |
Specify the configuration defaults and support configuration via hash .configuration.new(config_hash) | def initialize(options={})
@values = @@defaults.merge(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(configuration = {})\n @config = configuration\n end",
"def initialize(configuration = {})\n @config = configuration\n end",
"def initialize\n @config = DEFAULT_CONFIG.deep_dup\n end",
"def default_configuration=(_arg0); end",
"def initialize(config=nil)\n @config = Util.to_h... | [
"0.73121583",
"0.73121583",
"0.72791487",
"0.7256339",
"0.7236796",
"0.72240126",
"0.7168407",
"0.70695674",
"0.70223886",
"0.6983429",
"0.69793993",
"0.69603795",
"0.69271976",
"0.69271976",
"0.69271976",
"0.68841445",
"0.68841445",
"0.68393874",
"0.6836269",
"0.6822575",
"0... | 0.0 | -1 |
All buld update of configuration | def update(options)
@values.merge!(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_all_config\n @admin.updateConfiguration\n end",
"def configure(update); end",
"def config_updated(config)\n puts green(\"Config updated at: #{config}\")\n end",
"def sync_configuration\n end",
"def update_config(current, new)\n current.merge! new\n end"... | [
"0.79669684",
"0.7523475",
"0.7163646",
"0.6920351",
"0.6914256",
"0.6711111",
"0.6699323",
"0.6643201",
"0.6576175",
"0.6531276",
"0.647831",
"0.6470016",
"0.6461545",
"0.6453269",
"0.6390303",
"0.6389934",
"0.6387444",
"0.6351883",
"0.6310684",
"0.63073766",
"0.6304334",
... | 0.0 | -1 |
Bracket style accessor to values | def [](field)
@values[field.to_sym]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](value); end",
"def [](value)\n self.send value.to_sym\n end",
"def [](value)\n self.send value.to_sym\n end",
"def [](name)\n value(name)\n end",
"def [](index)\n value = self.value\n value = value.value if value.is_a?(Value)\n \n case value\n w... | [
"0.6455045",
"0.6323116",
"0.6323116",
"0.60829633",
"0.6072093",
"0.6065386",
"0.6027862",
"0.60135037",
"0.59917593",
"0.5916276",
"0.5906379",
"0.5852985",
"0.5852985",
"0.5852985",
"0.5852985",
"0.5852985",
"0.58304965",
"0.58304965",
"0.57749283",
"0.5755531",
"0.5740706... | 0.53268987 | 85 |
Bracket style setter to values | def []=(field, value)
@values[field.to_sym] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(string, value); end",
"def []=(string, value); end",
"def brackets=(value)\n raise ArgumentError, \"Unknown value #{value.inspect}\" if not [true, false, :auto].include? value\n @brackets = value\n end",
"def []=(name, value); end",
"def []=(name, value); end",
"def []=(name, value); end",... | [
"0.642493",
"0.642493",
"0.6365957",
"0.62417305",
"0.62417305",
"0.62417305",
"0.62085307",
"0.6171865",
"0.61430943",
"0.6127812",
"0.6109495",
"0.6040374",
"0.60346013",
"0.59800893",
"0.5965253",
"0.594969",
"0.59471697",
"0.5913767",
"0.5885923",
"0.5867844",
"0.586646",... | 0.0 | -1 |
Create config field accessor and setter to avoid calling method_missing more than once | def define_dynamic_config_field(method_sym)
class_eval <<-RUBY
def #{method_sym}
@values[:#{method_sym}]
end
def #{method_sym}=(value)
@values[:#{method_sym}] = value
end
RUBY
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method_name, *args, &block)\n setter = method_name.to_s.end_with?('=')\n key = method_name.to_s.chomp('=').to_sym\n\n if config.key?(key)\n setter ? config[key] = args.shift : config[key]\n else\n super\n end\n end",
"def config_accessor(*names)\n ... | [
"0.6812165",
"0.6774873",
"0.67642146",
"0.67536914",
"0.6688975",
"0.6673415",
"0.65483",
"0.64728236",
"0.64222145",
"0.6344999",
"0.6293039",
"0.62677646",
"0.62677646",
"0.6239072",
"0.62349266",
"0.62349266",
"0.62017405",
"0.6191442",
"0.6182727",
"0.6154421",
"0.614973... | 0.6237919 | 14 |
GET /spikings GET /spikings.json | def index
@spikings = Spiking.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end",
"def index\n @listings = Listing.all\n r... | [
"0.69912547",
"0.68513536",
"0.67213106",
"0.6710898",
"0.6633295",
"0.6562187",
"0.6542397",
"0.64018077",
"0.6401558",
"0.6292816",
"0.62592715",
"0.6251607",
"0.62229747",
"0.621392",
"0.62114984",
"0.6211195",
"0.62025887",
"0.619761",
"0.6164166",
"0.61562026",
"0.615581... | 0.71790016 | 0 |
GET /spikings/1 GET /spikings/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @spikings = Spiking.all\n end",
"def index\n @sightings = Sighting.all\n render json: @sightings\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def show\n render json: @sighting\n end",
"def set_spiking\n @spiking = Spiking.find(param... | [
"0.69116694",
"0.6688456",
"0.66723907",
"0.64721876",
"0.63857627",
"0.63777035",
"0.6349202",
"0.6344701",
"0.6302721",
"0.6229091",
"0.6197329",
"0.61846656",
"0.6181939",
"0.6181853",
"0.6177696",
"0.61626244",
"0.61626244",
"0.61626244",
"0.61451334",
"0.6129032",
"0.611... | 0.0 | -1 |
POST /spikings POST /spikings.json | def create
@spiking = Spiking.new(spiking_params)
respond_to do |format|
if @spiking.save
format.html { redirect_to @spiking, notice: 'Spiking was successfully created.' }
format.json { render action: 'show', status: :created, location: @spiking }
else
format.html { render a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spiking_params\n params.require(:spiking).permit(:spik_short_name, :spik_long_name, :spik_process_description, :spik_device_needed, :pros, :cons, :reference_id, :user_id)\n end",
"def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status:... | [
"0.6473333",
"0.62261075",
"0.6145788",
"0.60779846",
"0.5997612",
"0.5969738",
"0.59599763",
"0.59069556",
"0.58985865",
"0.5897351",
"0.5879335",
"0.57525855",
"0.56922746",
"0.5683134",
"0.5671775",
"0.5661928",
"0.5615566",
"0.5591483",
"0.55661446",
"0.5520181",
"0.54613... | 0.6894267 | 0 |
PATCH/PUT /spikings/1 PATCH/PUT /spikings/1.json | def update
respond_to do |format|
if @spiking.update(spiking_params)
format.html { redirect_to @spiking, notice: 'Spiking was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @spiking.errors, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put!\n request! :put\n end",
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n ... | [
"0.64086235",
"0.63366556",
"0.6270303",
"0.62442446",
"0.6179019",
"0.6114444",
"0.6112783",
"0.6101424",
"0.6063097",
"0.6057211",
"0.6053133",
"0.6021081",
"0.5969744",
"0.5953854",
"0.5920525",
"0.5918912",
"0.5885031",
"0.5884428",
"0.5882964",
"0.587512",
"0.58714515",
... | 0.69364023 | 0 |
DELETE /spikings/1 DELETE /spikings/1.json | def destroy
@spiking.destroy
respond_to do |format|
format.html { redirect_to spikings_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @sing.destroy\n respond_to do |format|\n format.html { redirect_to sings_url, notice: 'Sing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sailing.destroy\n respond_t... | [
"0.7071721",
"0.68777484",
"0.6758774",
"0.6741524",
"0.6738969",
"0.6732006",
"0.6730304",
"0.67285746",
"0.6723988",
"0.67217463",
"0.67016155",
"0.66722506",
"0.6664287",
"0.6656272",
"0.6654706",
"0.66429013",
"0.66427505",
"0.66427505",
"0.6624464",
"0.662078",
"0.662070... | 0.74873906 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_spiking
@spiking = Spiking.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.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def spiking_params
params.require(:spiking).permit(:spik_short_name, :spik_long_name, :spik_process_description, :spik_device_needed, :pros, :cons, :reference_id, :user_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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
CREATION METHODS INFO METHODS | def users
#book_a.users
#returns all the users that checked out this book
checkout_array = Checkout.all.select {|checkout| checkout.book == self}
checkout_array.map {|checkout| checkout.user}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def create\n \n end",
"def create\r\n\r\n\r\n end",
"def create #:doc:\n end",
"def create\n \n end",
"def create\n \t\n end",
"def create\r\n end",
"def create\n raise NotImplementedError\n ... | [
"0.75825155",
"0.75825155",
"0.75825155",
"0.75825155",
"0.7444576",
"0.72383136",
"0.7140594",
"0.7117576",
"0.70802355",
"0.7075559",
"0.70221484",
"0.70221484",
"0.6954989",
"0.69128525",
"0.6907947",
"0.69074386",
"0.6883805",
"0.68818027",
"0.68777716",
"0.6842688",
"0.6... | 0.0 | -1 |
GET /studens GET /studens.json | def index
@studens = Studen.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stundent }\n end\n end",
"def show\n @studnet = Studnet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.... | [
"0.69333607",
"0.6929925",
"0.6410448",
"0.64026093",
"0.6396246",
"0.63297045",
"0.63140875",
"0.6292976",
"0.62566966",
"0.6228507",
"0.6225591",
"0.6212874",
"0.6163651",
"0.61451197",
"0.6115642",
"0.60683984",
"0.6045253",
"0.60339326",
"0.6020851",
"0.6010994",
"0.60094... | 0.72720265 | 0 |
GET /studens/1 GET /studens/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stundent }\n end\n end",
"def show\n @studnet = Studnet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.... | [
"0.7236727",
"0.71648693",
"0.70023805",
"0.6835201",
"0.6665347",
"0.66091555",
"0.6570533",
"0.65205765",
"0.6473137",
"0.64689565",
"0.63855106",
"0.6375037",
"0.6371731",
"0.6358578",
"0.635708",
"0.6355783",
"0.63520885",
"0.63462245",
"0.633669",
"0.6336176",
"0.6320036... | 0.0 | -1 |
POST /studens POST /studens.json | def create
@studen = Studen.new(studen_params)
respond_to do |format|
if @studen.save
format.html { redirect_to @studen, notice: 'Studen was successfully created.' }
format.json { render :show, status: :created, location: @studen }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @studnet = Studnet.new(params[:studnet])\n\n respond_to do |format|\n if @studnet.save\n format.html { redirect_to @studnet, notice: 'Studnet was successfully created.' }\n format.json { render json: @studnet, status: :created, location: @studnet }\n else\n format.... | [
"0.6673298",
"0.6587072",
"0.6504791",
"0.63108593",
"0.6207819",
"0.6134907",
"0.60046005",
"0.59828454",
"0.59792995",
"0.59696925",
"0.5968551",
"0.5942262",
"0.591918",
"0.5878084",
"0.58579636",
"0.5852399",
"0.58379024",
"0.58345246",
"0.5801663",
"0.5798032",
"0.578380... | 0.70265836 | 0 |
PATCH/PUT /studens/1 PATCH/PUT /studens/1.json | def update
respond_to do |format|
if @studen.update(studen_params)
format.html { redirect_to @studen, notice: 'Studen was successfully updated.' }
format.json { render :show, status: :ok, location: @studen }
else
format.html { render :edit }
format.json { render json: @st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n if @stundent.update_attributes(params[:stundent])\n format.html { redirect_to @stundent, notice: 'Stundent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ren... | [
"0.6531575",
"0.6447551",
"0.6433122",
"0.64227974",
"0.6403173",
"0.63697106",
"0.6344164",
"0.6303047",
"0.630205",
"0.6261919",
"0.62478995",
"0.624266",
"0.6241901",
"0.62407",
"0.62381625",
"0.6226269",
"0.6223594",
"0.62033755",
"0.61879724",
"0.6171397",
"0.616436",
... | 0.66754144 | 0 |
DELETE /studens/1 DELETE /studens/1.json | def destroy
@studen.destroy
respond_to do |format|
format.html { redirect_to studens_url, notice: 'Studen was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @stundent = Stundent.find(params[:id])\n @stundent.destroy\n\n respond_to do |format|\n format.html { redirect_to stundents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |form... | [
"0.7266991",
"0.71996075",
"0.7098305",
"0.7080382",
"0.7068289",
"0.7058277",
"0.70259553",
"0.7002035",
"0.69875747",
"0.69290984",
"0.6908579",
"0.69025874",
"0.6891992",
"0.68401563",
"0.68401563",
"0.6833004",
"0.6829927",
"0.68268985",
"0.6823524",
"0.68173176",
"0.6802... | 0.7311894 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_studen
@studen = Studen.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.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def studen_params
params.require(:studen).permit(:name, :age)
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.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
7kyu I wrote a method that accepts 3 integer values a, b, c. The method returns true if a triangle can be built with the sides of given length and false in any other case. | def is_triangle(a,b,c)
if a + b <= c || a + c <= b || b + c <= a
false
else
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend",
"def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend",
"def valid_triangle?(a, b, c)\n a + b > c && a + c > b && b + c > a\nend",
"def valid_triangle?(a, b, c)\n if a == 0 or b == 0 or c == 0\n return false\n... | [
"0.8490986",
"0.8490986",
"0.8490986",
"0.84884197",
"0.8472237",
"0.84612453",
"0.8453592",
"0.84315485",
"0.84189826",
"0.8393483",
"0.8384063",
"0.83612764",
"0.8325798",
"0.8319352",
"0.830609",
"0.82947224",
"0.8279737",
"0.8276815",
"0.82760936",
"0.8241055",
"0.8219760... | 0.84337246 | 7 |
List does not have ivars | def __ivars__ ; nil ; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n self.list = []\n end",
"def list\n @list ||= []\n end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def initialize(list)\n @list = list\n end",
"def list\n @list ||= []\n end",
"def list\n @list ||= []\n... | [
"0.694085",
"0.6805139",
"0.6741118",
"0.6741118",
"0.6741118",
"0.6741118",
"0.6741118",
"0.6633019",
"0.66244465",
"0.66244465",
"0.65912473",
"0.65492064",
"0.6520007",
"0.65103656",
"0.6505002",
"0.64626396",
"0.6430295",
"0.63813",
"0.6377837",
"0.6359327",
"0.63293993",... | 0.0 | -1 |
Node does not have ivars | def __ivars__ ; nil ; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node=(_); end",
"def node=(_); end",
"def node=(_arg0); end",
"def variable_node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def node; end",
"def n... | [
"0.7627984",
"0.7627984",
"0.728476",
"0.71668524",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
"0.69880867",
... | 0.0 | -1 |
i like this idea, but view[0] = view doesn't look like an insertion, it lookes like a replacement... it should be written as view[0] += sub_view or view[0] << sub_view def []=(index, view) self.insertSubview(view, atIndex:index) end | def to_s
"{#{self.class.name} @ x: #{self.frame.origin.x} y:#{self.frame.origin.y}, "\
"#{self.frame.size.width}×#{self.frame.size.height}}"\
"#{self.superview ? ' child of ' + self.superview.class.name : ''}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(index, element); end",
"def add_view( view = new_view(10, 10, self.width - 20, self.height - 20), *views)\n self.addSubview(view) \n view.snap_to_top\n\n views.map do |view|\n if view.nil?\n view = NSTextField.new\n view.frame = [[0,0], [80,20]]\n view.stringValue = \... | [
"0.6198684",
"0.61806107",
"0.6134169",
"0.6079823",
"0.6077303",
"0.58810747",
"0.5865435",
"0.5842365",
"0.5776345",
"0.5766834",
"0.5750735",
"0.5748602",
"0.57224846",
"0.57161593",
"0.57100713",
"0.5706788",
"0.5683804",
"0.5642638",
"0.55339086",
"0.5486204",
"0.5464229... | 0.0 | -1 |
access and define configuration this is used while loading your environment (initializers) | def configuration
@configuration ||= Configuration.new
if block_given?
yield @configuration
else
@configuration
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def configuration\n @config ||= setup\n end",
"def config\n @config ||= load_config\n end",
"def config\n boot.config\n end",
"def setup_config\n # To be Extended\n end",
... | [
"0.756853",
"0.756853",
"0.756853",
"0.756853",
"0.75040346",
"0.7431651",
"0.7388415",
"0.7376719",
"0.7341318",
"0.7341318",
"0.7250823",
"0.7245224",
"0.7233412",
"0.7213374",
"0.7172139",
"0.715501",
"0.71382374",
"0.7098769",
"0.7093586",
"0.70833343",
"0.70727557",
"0... | 0.0 | -1 |
simply reset the configuration NOTE : avoid to use this if you're not resetting anything afterwards | def reset
@configuration = Configuration.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_config\n\t\t\t@config = {}\n\t\tend",
"def reset\n @config = nil\n end",
"def reset_config\n config.reset_to_defaults\n end",
"def reset\n @config = empty_config\n end",
"def reset!\n @config = Configuration.new\n end",
"def reset\n @config = Config.new\n end",
... | [
"0.8890702",
"0.88423896",
"0.8804188",
"0.8797733",
"0.8661305",
"0.8653049",
"0.84960157",
"0.8490654",
"0.84797263",
"0.83610266",
"0.8359971",
"0.8334127",
"0.83212495",
"0.8315039",
"0.8266328",
"0.8266328",
"0.80464923",
"0.79697776",
"0.78973156",
"0.7892875",
"0.78818... | 0.82830596 | 14 |
10x16 array of 0.01.0 rows represent midi channels, columns sixteenth notes | def initialize_probabilities
@probabilities = (0..9).map{Array.new(16, @default_probability)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def midi_encoder(bytes)\n raise \"Invalid data length #{bytes.size}\" unless bytes.size % 7 == 0\n result = []\n (0...bytes.size).step(7).each do |start|\n chunk = bytes[start, 7]\n msbits = 0\n chunk.each_with_index do |b, i|\n msbits |= (b & 0x80) >> (7 - i)\n end\n result << msbits\n r... | [
"0.5841629",
"0.5732277",
"0.563237",
"0.5479634",
"0.5434348",
"0.5419389",
"0.5378647",
"0.53221923",
"0.5286943",
"0.51868147",
"0.51746744",
"0.51517177",
"0.51276714",
"0.51207304",
"0.5110847",
"0.5107918",
"0.50794166",
"0.50778127",
"0.5075117",
"0.50467867",
"0.50345... | 0.0 | -1 |
Just call the JSON gem's parse method with a modified :max_nesting field | def from_json(source, opts = {})
obj = ::Yajl::Parser.parse(source)
# JSON gem requires top level object to be a Hash or Array (otherwise
# you get the "must contain two octets" error). Yajl doesn't impose the
# same limitation. For compatibility, we re-impose this condition.
un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_nesting=(depth)\n #This is a stub, used for indexing\n end",
"def max_nesting()\n #This is a stub, used for indexing\n end",
"def parse_root_in_json(value=nil)\n return @parse_root_in_json if value.nil?\n @parse_root_... | [
"0.6718033",
"0.66739446",
"0.5546821",
"0.5531578",
"0.5506488",
"0.5468324",
"0.5382427",
"0.5258108",
"0.5258108",
"0.52455723",
"0.49823853",
"0.49639505",
"0.49508628",
"0.494648",
"0.49435872",
"0.4920266",
"0.48858047",
"0.4883277",
"0.488166",
"0.48779103",
"0.4877012... | 0.0 | -1 |
Look at an object that's a basic type (from json parse) and convert it to an instance of Chef classes if desired. | def map_to_rb_obj(json_obj)
case json_obj
when Hash
mapped_hash = map_hash_to_rb_obj(json_obj)
if json_obj.has_key?(JSON_CLASS) && (class_to_inflate = class_for_json_class(json_obj[JSON_CLASS]))
class_to_inflate.json_create(mapped_hash)
else
mapped_h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_instance_from(parsed_json, chef_class)\n if Gem::Version.new(Chef::VERSION) < Gem::Version.new('12.0.0')\n chef_class.json_create(parsed_json)\n else\n chef_class.from_hash(parsed_json)\n end\n end",
"def find_and_cast_into_type(klass, data)\n return if... | [
"0.6881847",
"0.66040814",
"0.6383797",
"0.6365241",
"0.63650084",
"0.6256588",
"0.6253882",
"0.60194534",
"0.60129935",
"0.5967542",
"0.59107864",
"0.59083855",
"0.59080136",
"0.5845821",
"0.5830337",
"0.57395685",
"0.57231027",
"0.5718938",
"0.56940794",
"0.56882644",
"0.56... | 0.5704076 | 18 |
Map +json_class+ to a Class object. We use a +case+ instead of a Hash assigned to a constant because otherwise this file could not be loaded until all the constants were defined, which means you'd have to load the world to get json, which would make knife very slow. | def class_for_json_class(json_class)
case json_class
when CHEF_APICLIENT
Chef::ApiClient
when CHEF_COOKBOOKVERSION
Chef::CookbookVersion
when CHEF_DATABAG
Chef::DataBag
when CHEF_DATABAGITEM
Chef::DataBagItem
when CHEF_ENVIRONMENT
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_for_json_class(json_class)\n case json_class\n when MEGAM_ERROR\n Megam::Error\n when MEGAM_AUTH\n Megam::Auth\n when MEGAM_ACCOUNT\n Megam::Account\n when MEGAM_NODE\n Megam::Node\n when MEGAM_APPDEFNS\n Megam::Appdef... | [
"0.74810594",
"0.7100425",
"0.600317",
"0.5800305",
"0.56584513",
"0.55876446",
"0.55507475",
"0.5541327",
"0.55007976",
"0.55002683",
"0.5488565",
"0.54339033",
"0.53891206",
"0.53769",
"0.5366199",
"0.5320986",
"0.5262761",
"0.5242418",
"0.52420706",
"0.5239488",
"0.5234507... | 0.74758464 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_cart_product
@cart_product = CartProduct.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.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.533008... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def cart_product_params
params.require(:cart_product).permit(:item_id, :cart_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.71207976",
"0.705222",
"0.69488335",
"0.69021654",
"0.67362636",
"0.6717561",
"0.6689192",
"0.6678948",
"0.66622657",
"0.6555007",
"0.6527569",
"0.64588845",
"0.64522904",
"0.6450812",
"0.6448551",
"0.6434285",
"0.6412147",
"0.6412147",
"0.6393719",
"0.6381976",
"0.6381976... | 0.0 | -1 |
GET /spielers/1 GET /spielers/1.json | def show
@spieler = Spieler.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @spieler }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @spiel = Spiel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spiel }\n end\n end",
"def show\n @spdatum = Spdatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { re... | [
"0.72103435",
"0.6809371",
"0.6577845",
"0.6573927",
"0.6556512",
"0.6510175",
"0.6508568",
"0.64975125",
"0.6408778",
"0.6406369",
"0.63984567",
"0.6381083",
"0.6368704",
"0.63662106",
"0.63657117",
"0.63647014",
"0.6347806",
"0.6341795",
"0.63327307",
"0.6326601",
"0.631354... | 0.7570858 | 0 |
GET /spielers/new GET /spielers/new.json | def new
@spieler = Spieler.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @spieler }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spiel }\n end\n end",
"def new\n @spdatum = Spdatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spdatum }\n end\n... | [
"0.7856191",
"0.76811975",
"0.7456194",
"0.73840386",
"0.7244535",
"0.7171274",
"0.71587366",
"0.7090917",
"0.70825124",
"0.7081681",
"0.70782673",
"0.7063588",
"0.7036884",
"0.7023383",
"0.7009171",
"0.7009167",
"0.70080334",
"0.6993881",
"0.6989476",
"0.6966928",
"0.6962915... | 0.803976 | 0 |
POST /spielers POST /spielers.json | def create
@spieler = Spieler.new(params[:spieler])
respond_to do |format|
if @spieler.save
format.html { redirect_to @spieler, notice: 'Spieler was successfully created.' }
format.json { render json: @spieler, status: :created, location: @spieler }
else
format.html { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @spiel = Spiel.new(params[:spiel])\n\n respond_to do |format|\n if @spiel.save\n format.html { redirect_to @spiel, notice: 'Spiel was successfully created.' }\n format.json { render json: @spiel, status: :created, location: @spiel }\n else\n format.html { render ac... | [
"0.67110294",
"0.6431641",
"0.63486725",
"0.61435825",
"0.6108683",
"0.6108683",
"0.6004514",
"0.59893113",
"0.598736",
"0.5957727",
"0.59466153",
"0.5935518",
"0.5925747",
"0.59098065",
"0.58854944",
"0.58756876",
"0.5857124",
"0.5825117",
"0.58209383",
"0.5818846",
"0.58086... | 0.7207522 | 0 |
PUT /spielers/1 PUT /spielers/1.json | def update
@spieler = Spieler.find(params[:id])
respond_to do |format|
if @spieler.update_attributes(params[:spieler])
format.html { redirect_to @spieler, notice: 'Spieler was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @spiel = Spiel.find(params[:id])\n\n respond_to do |format|\n if @spiel.update_attributes(params[:spiel])\n format.html { redirect_to(@spiel, :notice => 'Spiel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\... | [
"0.6100839",
"0.6085706",
"0.60580003",
"0.60501796",
"0.6026827",
"0.6000036",
"0.5983432",
"0.5977366",
"0.59675026",
"0.5939787",
"0.59355724",
"0.5928756",
"0.59020436",
"0.588712",
"0.58726615",
"0.5863103",
"0.58586454",
"0.5849854",
"0.5836198",
"0.5835948",
"0.5832649... | 0.68908244 | 0 |
DELETE /spielers/1 DELETE /spielers/1.json | def destroy
@spieler = Spieler.find(params[:id])
@spieler.destroy
respond_to do |format|
format.html { redirect_to spielers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @spiel = Spiel.find(params[:id])\n @spiel.destroy\n\n respond_to do |format|\n format.html { redirect_to spiels_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @prueba_json.destroy\n respond... | [
"0.74965227",
"0.71794313",
"0.71456134",
"0.7096852",
"0.70961505",
"0.708373",
"0.7081656",
"0.7013554",
"0.69962245",
"0.6994698",
"0.69869924",
"0.69841826",
"0.69830173",
"0.6964452",
"0.6962515",
"0.6954897",
"0.6947467",
"0.6940991",
"0.6938268",
"0.6922191",
"0.691131... | 0.7572251 | 0 |
if klass.property_name is a CLR enum, parse the value to translate it into the CLR enum value | def parse_enum_if_enum(klass,property_name,value)
type = klass.to_clr_type.get_property(classify(property_name.to_s)).property_type
type.is_enum ? Enum.parse(type, classify(value.to_s)) : value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_from_hash(value)\n constantValues = PropertyType.constants.select { |c| PropertyType::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #PropertyType\" if constantValues.empty?\n value\n end",
"def visit_enum(binding_type)\n #VAPI.log.debug \"VERBOSE: ... | [
"0.6656439",
"0.5979767",
"0.59204626",
"0.5877763",
"0.58034825",
"0.5802854",
"0.5789417",
"0.5788946",
"0.57655",
"0.5732507",
"0.57031226",
"0.56954527",
"0.5688164",
"0.5683974",
"0.5678129",
"0.5664965",
"0.5629002",
"0.5627048",
"0.56074053",
"0.5605236",
"0.55952126",... | 0.84159267 | 1 |
instanciate the given class and set the properties passed as options support both values and procs for options | def build_instance_with_properties(klass,*args)
properties = args.last.is_a?(Hash) ? args.delete_at(args.size-1) : {}
instance = klass.new(*args)
properties.keys.inject(instance) do |instance,k|
v = properties[k]
v.is_a?(Proc) ? instance.send(k,&v) : instance.send("#{k}=", parse_enum_if_enum(kla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(options={}) #define method to take in an argument of options, which defaults to an empty hash\n options.each do |property, value| #iterate over the options hash...\n self.send(\"#{property}=\", value) #and use our fancy metaprogramming #send method to interpolate the name of each hash key a... | [
"0.70957583",
"0.69434524",
"0.68524295",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.68524045",
"0.6764782",
"0.6705712",
"0.6684326",
"0.6646352",
... | 0.6409808 | 33 |
Get root => .~/appiumtestrunner/ | def root_dir
__FILE__.match(%r{.*(appium-test-runner)}).to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root\n File.dirname(__FILE__)\n end",
"def root\n File.expand_path(File.dirname(__dir__))\n end",
"def root; Pathname(__dir__).parent; end",
"def root\n Pathname.new File.expand_path('../../', File.dirname(__FILE__))\n end",
"def root\n Dir.pwd\n end",
"def root\n Pathname.new(... | [
"0.6841621",
"0.68186873",
"0.681356",
"0.67696583",
"0.6742545",
"0.6741486",
"0.67114395",
"0.6696056",
"0.6694112",
"0.6684606",
"0.66767365",
"0.66767365",
"0.6653727",
"0.66065294",
"0.6590912",
"0.6579691",
"0.6578428",
"0.651943",
"0.6502785",
"0.65027267",
"0.64964885... | 0.7628471 | 0 |
GET /casefiles GET /casefiles.json | def index
@casefiles = Casefile.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files\n db = Database.find(params[:id])\n @files = Dir.entries(db.path)\n @files.delete_if{|f| !f.include?'.dat'}\n @results = []\n @files.each do |entry|\n @results << {:name=>entry,:version=>db.version}\n end\n respond_to do |format|\n format.html\n format.json { render js... | [
"0.6569683",
"0.6330222",
"0.6266535",
"0.6263138",
"0.61313146",
"0.6130786",
"0.60975003",
"0.6092848",
"0.6061571",
"0.6051542",
"0.60432464",
"0.60302585",
"0.6022749",
"0.59882104",
"0.5943061",
"0.59143895",
"0.59130675",
"0.5911217",
"0.5903048",
"0.5900804",
"0.584004... | 0.70294696 | 0 |
GET /casefiles/1 GET /casefiles/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @casefiles = Casefile.all\n end",
"def read\n status = 200\n\n # File path\n fpath = filepathById params[:id]\n\n if nil == fpath\n # File description does not exists\n result = {status: 'error', message: 'Bad request'}\n status = 400\n elsif File.exists? fpath\n ... | [
"0.6822615",
"0.67481756",
"0.66582674",
"0.6501812",
"0.64681",
"0.6440687",
"0.63889116",
"0.63500965",
"0.63384247",
"0.631556",
"0.6310694",
"0.63080156",
"0.6303618",
"0.62656736",
"0.62447745",
"0.623886",
"0.6231421",
"0.62204903",
"0.61984426",
"0.61335707",
"0.611434... | 0.0 | -1 |
POST /casefiles POST /casefiles.json | def create
@casefile = Casefile.new(casefile_params)
respond_to do |format|
if @casefile.save
format.html { redirect_to @casefile, notice: 'Casefile was successfully created.' }
format.json { render :show, status: :created, location: @casefile }
else
format.html { render :ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @case = Case.new(case_params)\n @case.user_id = current_user.id\n @case.e_status = params[:e_status]\n # @multi_file = params[:case][:file]\n @case.filename = params[:file].original_filename if !@case.filename.nil?\n @case.content_type = params[:file].content_type if !@case.content_... | [
"0.65140486",
"0.63683224",
"0.62390846",
"0.6098913",
"0.6049638",
"0.5904955",
"0.5895494",
"0.5893594",
"0.5771774",
"0.577099",
"0.576336",
"0.5745099",
"0.5740194",
"0.57282954",
"0.57049793",
"0.56793594",
"0.56562966",
"0.5649358",
"0.56451803",
"0.56448036",
"0.564145... | 0.7041032 | 0 |
PATCH/PUT /casefiles/1 PATCH/PUT /casefiles/1.json | def update
respond_to do |format|
if @casefile.update(casefile_params)
format.html { redirect_to @casefile, notice: 'Casefile was successfully updated.' }
format.json { render :show, status: :ok, location: @casefile }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @case_data = Case.find(params[:format])\n if params[:file].nil?\n @case_data.update_attributes(case_params)\n else \n @multi_edit_file = params[:file]\n @case_data.filename = @multi_edit_file.original_filename\n @case_data.content_type = @multi_edit_file.content_type\n ... | [
"0.663354",
"0.65488464",
"0.6498621",
"0.6448793",
"0.63045263",
"0.6290062",
"0.6249346",
"0.6188978",
"0.6182656",
"0.6163974",
"0.616148",
"0.61418825",
"0.6133857",
"0.61257815",
"0.61213887",
"0.61138004",
"0.6102398",
"0.60806006",
"0.6062359",
"0.60460186",
"0.5998907... | 0.6949255 | 0 |
DELETE /casefiles/1 DELETE /casefiles/1.json | def destroy
@casefile.destroy
respond_to do |format|
format.html { redirect_to casefiles_url, notice: 'Casefile was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n return false unless authorize(permissions = [\"destroy_casefile\"])\n\n @case_file = CaseFile.find(params[:id])\n @case_file.destroy\n\n respond_to do |format|\n format.html { redirect_to(patient_case_files_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n ... | [
"0.70177895",
"0.69843936",
"0.6957137",
"0.6938908",
"0.6841275",
"0.682951",
"0.68280953",
"0.6826197",
"0.68025494",
"0.68001306",
"0.6788661",
"0.67757267",
"0.6768498",
"0.6759179",
"0.6748364",
"0.67441",
"0.67372626",
"0.67247903",
"0.67193824",
"0.67116976",
"0.670025... | 0.7538024 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_casefile
@casefile = Casefile.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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.