query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
2f06ec44f62bd2dda8b6287c5c32d4ec
has_many :character_notes has_many :character_goals
[ { "docid": "094e0bbc2e95cfa18fa842b9382a27dd", "score": "0.5836912", "text": "def character_notes\n self.object.character_notes.map do |note|\n {\n c_note_id: note.id,\n c_note_title: note.title,\n c_note_content: note.content,\n visible_to_other_players: note.visible...
[ { "docid": "18e7558bfd05d16876dbbcc5a0ab9ee7", "score": "0.5592288", "text": "def relatedChallenges\n Challenge.all(:select => \"challenges.*,skill_challenges.parent_id\",\n :joins => :skill_challenges,\n :conditions => { \n :skill_challenges =>...
175b0e3cf87e39db10dc9dd57720e4eb
adjust the display numbers (ordering numbers) of a secondary publication based on the study id
[ { "docid": "81d82675f068fcc54c70344c029314c9", "score": "0.78955173", "text": "def shift_display_numbers(study_id)\n myNum = self.display_number\n hi_pubs = SecondaryPublication.find(:all, :conditions => [\"study_id = ? AND display_number > ?\", study_id, myNum])\n hi_pubs.each { |p...
[ { "docid": "f19d11bf8730a5667b99b6e9e3dbc3db", "score": "0.67729294", "text": "def shift_display_numbers(study_id, ef_id)\n myNum = self.display_number\n high_things = Arm.find(:all, :conditions => [\"study_id = ? AND display_number > ? AND extraction_form_id = ?\", study_id, myNum, ef_id]...
7b8d715c3f6cee0341ff53dd56e1feba
boolean Allow uploaders to set `provided_modified_at` for uploaded files?
[ { "docid": "689454b064e2dc33122bec0227ee6398", "score": "0.7101692", "text": "def use_provided_modified_at\n @attributes[:use_provided_modified_at]\n end", "title": "" } ]
[ { "docid": "fa028a2457935ecffee9218a1667891f", "score": "0.7618188", "text": "def requires_modified_files?\n false\n end", "title": "" }, { "docid": "dcc3f175d1562a67f038c4a4d7fb9914", "score": "0.6946516", "text": "def modified?\n file_modification_time.to_s != last_m...
1cbed9b17cd8c827ac398e94d5e0652f
GET /store/manager/reviews/new GET /store/manager/reviews/new.json
[ { "docid": "0a5c09bd71230344d4ff3331fd4f1a04", "score": "0.7786833", "text": "def new\n @store_manager_review = Store::Manager::Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_review }\n end\n end", "title": "" } ]
[ { "docid": "4e332acab47989be36b61489590e1f9a", "score": "0.81043017", "text": "def new\n @review = @reviewable.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end", "title": "" }, { "docid": "fbd148ef75a99...
e3ff99bf8d4ad261293e75edf5e33d71
Demo save_open without blocks
[ { "docid": "06552e5cd230aec3e5be34f0b07b18ea", "score": "0.0", "text": "def print_file2(filename)\n\tbegin\n\t\tfile = File.save_open(filename)\n\t\tdata = file.read\n\t\tputs data\n\t\tfile.close\n\t\tprint_separator\n \trescue StandardError => e\n\t\tputs \"Error: Could not read file \\'#{filename}\\'...
[ { "docid": "753774cbf875039ce1181e473f2e1b03", "score": "0.6769537", "text": "def open_for_write\n end", "title": "" }, { "docid": "65073bce718ae80bec395a1c19e89261", "score": "0.64422387", "text": "def save\n ensure_file_open!\n @file.commit\n true\n end", "title"...
597d66fcbf61484c95072a5ad1384047
rails r "SlackAgent.error_send(Exception.new)" rails r "SlackAgent.error_send((1/0 rescue $!))"
[ { "docid": "e547e80571ea8ec979987d277cac7aaf", "score": "0.58502907", "text": "def error_send(error)\n message_send(key: \"ERROR\", body: [\"#{error.message} (#{error.class})\", error.backtrace].compact.join(\"\\n\"))\n end", "title": "" } ]
[ { "docid": "41d537c42ca976946a95b3b7a132b9d3", "score": "0.66842365", "text": "def sendError(msg)\n sendCmd \"ERROR #{msg}\"\nend", "title": "" }, { "docid": "4d39812641282aa0d09ef5e89fc0c536", "score": "0.64314", "text": "def invoke_internal_error msg = \"???\"\n @return_val...
cf2ac6a391cd622e10f7a977d7c7fc26
TODO: should this be abstracted?
[ { "docid": "e31255b089d6e4ef4e1fa4f18feec9bf", "score": "0.0", "text": "def height\n case target\n when :editable then height_for_editable_target\n when :cc, :kiddom, :qti, :schoology then image_height\n end\n end", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7562533", "text": "def private; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", "score": "0.64998645", "text": "def specie; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", ...
b33a93dac146ecafcd7bec3056559f59
secret_key is used like any other property by devise. The getter initializes the secret key entry in the registrations form.
[ { "docid": "202e38c716c0e6d51f8693ae9da9cfac", "score": "0.74037915", "text": "def secret_key\n \"\"\n end", "title": "" } ]
[ { "docid": "9ae404efa5f5cdaaa3c5f50dfb570d5a", "score": "0.7523233", "text": "def secret_key; end", "title": "" }, { "docid": "449f94d060363c95a66934c5b451be51", "score": "0.74140817", "text": "def secret_key\n credentials['secret_key']\n end", "title": "" }, { "d...
9244c58c8332d600b02348905df054cd
Check whether the user has liked a post.
[ { "docid": "9fe3a798260ef16da0cdc3f2b6b91d69", "score": "0.71613", "text": "def liked?(likeable)\n if likeable.likes.loaded?\n if self.like_for(likeable)\n return true\n else\n return false\n end\n else\n Like.exists?(user_id: self.id, likeable_type: likeable.clas...
[ { "docid": "a0f7b01c4da7ea68c1281b5f10eaddd4", "score": "0.86522037", "text": "def liked?(post)\n logged_in? &&\n current_user.likes.where(post_id: post.id).any?\n end", "title": "" }, { "docid": "6c301d3fbe246d5a2098a4829aa1f0dc", "score": "0.8533018", "text": "def liked_by...
c38091e9a4aebaee35130627791d6826
Set the value of the OrderBy input for this Choreo.
[ { "docid": "e68285446c934687bb12544f154fd68a", "score": "0.60150206", "text": "def set_OrderBy(value)\n set_input(\"OrderBy\", value)\n end", "title": "" } ]
[ { "docid": "ac29ffa31c2dbfe1d4876f1e29f20d89", "score": "0.64372575", "text": "def order_by(*props)\n @query[:order_by] = props.join(',')\n self\n end", "title": "" }, { "docid": "fb8014da43ee4742141a757a6f43d338", "score": "0.6408833", "text": "def order_by(order_by)\n ...
893964d19ff7f4bfae9971064307fd6a
Splits PowerPoint presentation slides from the specified range into separate files and exports them in the specified file format. If the range is not provided all slides will be processed.
[ { "docid": "b26bf2ea1ac94df36fc40f1e86e70e5f", "score": "0.438122", "text": "def split_and_save_online(document, format, dest_folder = nil, width = nil, height = nil, from = nil, to = nil, password = nil, storage = nil, fonts_folder = nil, options = nil)\n data, _status_code, _headers = split_and_s...
[ { "docid": "e92ee2cc25cf550376cf4a17f9cdb30a", "score": "0.5509363", "text": "def export\n date = current_date\n if params['excel_layout'] == 'scoring_sheet'\n file_name = 'scoring_sheet.xls'\n elsif params['include'] == 'print_cards'\n file_name = 'print_cards.xls'\n elsif params[...
b8f6415457117766bac342140a8fbff3
methode qui inflige des degats : damage
[ { "docid": "a8a74c1a736cc2d946e27d3bb91d3529", "score": "0.7694113", "text": "def get_damage(damage)\n @life_points = @life_points - damage\n #on verife si le joueur est mort \n #initialise la vie a 0 pour ne pas avoir de nombre negatif\n if @life_points <= 0\n @li...
[ { "docid": "30b4a16b761fd2c9a20bb168fe230c09", "score": "0.7818884", "text": "def gets_damage(damage) \n @life_points -= damage\n\n if @life_points <= 0 \n puts \"Déso #{@name} t'es mort !\"\n end\n end", "title": "" }, { "docid": "36c02f729e80b3abac70a0f0730d24b5", "score...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "8459ffd897c0832698121f8e46c69150", "score": "0.0", "text": "def client_params\n params.require(:client).permit(:nombre, :tipo_identificacion, :identificacion, :razon_social, :regimen, :actividad_comercial,\n :direccion, :ciudad, :telefono, :email, acc...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
81a41b6dc74e536c4155b166433ecbf4
TODO Work out what the min packet size really is
[ { "docid": "ca0283caaf76450a9750292f6c727bcf", "score": "0.0", "text": "def initialize\n @buffer = String.new().force_encoding('binary')\n end", "title": "" } ]
[ { "docid": "0e13615e77021c6122353d70c4b2eb3c", "score": "0.6800629", "text": "def min_size\n data[:min_size]\n end", "title": "" }, { "docid": "4f9b6c392b0b492c9663ac5705cd5294", "score": "0.66406304", "text": "def min_size\n data.min_size\n end", "title": "" },...
4f690f11f7d2c0ac6fcfbd64d47e2d85
make sure that persona is capitalized
[ { "docid": "eee180b7f385a91622e42fc2358dd44a", "score": "0.0", "text": "def persona=(s)\n\t\twrite_attribute(:persona, s.to_s.capitalize)\n\tend", "title": "" } ]
[ { "docid": "6426bf8102e999ab3307ee06976e739a", "score": "0.7825145", "text": "def name_must_be_titleized\n # Make sure first char is uppercase\n first_char = name[0]\n first_char_is_not_upcased = (first_char != first_char.upcase)\n # If first character is not uppercase, add an error\...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "e716037c0d330470bf928c09c205b75d", "score": "0.0", "text": "def batch_params\n params.require(:batch).permit(:item_id, :name, :comment, :in_price, :distributor_price, :retail_price, :expire_at, :refined_at)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
4cc43cadd24aca96fad6a2b84a4dcbd9
Define any customized permissions here.
[ { "docid": "63e04a64c4e1c0b3b13e8b6dfc1d7583", "score": "0.80175394", "text": "def custom_permissions\n alias_action :pdf, :show, :manifest, to: :read\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end", "title": "" } ]
[ { "docid": "e7fa55c996c89a154f6ff748543f9ee3", "score": "0.8672363", "text": "def define_permissions\n end", "title": "" }, { "docid": "9414be29752fb67f99b3187e2c835691", "score": "0.846895", "text": "def custom_permissions\n end", "title": "" }, { "docid": "9414be297...
35f384b715f230d51837f6ee41c4d90a
Returns a move tree of legal move positions.
[ { "docid": "63d67976f2417613e406003c271c16e1", "score": "0.7800998", "text": "def possible_moves\n row, col = @position\n @move_tree = @move_tree_template.clone || move_tree\n @move_tree.each do |node|\n r, c = node.loc\n potential_space = [row + r, col + c]\n node.loc = potentia...
[ { "docid": "e1ffc215b389ad06f3519bacfe9c36de", "score": "0.7241513", "text": "def build_pawn_move_tree\n move_tree = MoveTree.new([0, 0])\n\n # Create changes based on @direction because pawns can only move one\n # direction.\n move_tree.root.add_child([@direction, 0])\n move_tree.root.ad...
fbe2c75ed56742490a872d7a956fae22
Takes in points, P/A, sub, etc. and Calculates the probability in the OC card.
[ { "docid": "b70b67788ab573ba3aaf187c211bae86", "score": "0.0", "text": "def calculate_oc_subtotal(wrestler)\n\t\t\n\t\t# Sum up points per roll * probability\n\t\toc_points = 0\n\t\twrestler.each { |k,v| \n\t\t\tk = remove_attribute_from_key(k)\n\t\t\tprob = return_rational(calculate_probability(symbol_...
[ { "docid": "8a9a9ed8f178ca967e19168d7409ada7", "score": "0.6177207", "text": "def calculate_points(cards_in_hands)\n points = 0\n cards_without_ace = cards_in_hands.select {|card| card[1] != 'A'}\n cards_with_ace = cards_in_hands.select {|card| card[1] == 'A'}\n cards_without_ace.each do |card|\n ...
122a8fe36cdf5fc9ec3efc32cbecb0f6
POST /official_identities POST /official_identities.json
[ { "docid": "10ab00c084fd45a13fc4d925c5918554", "score": "0.6723793", "text": "def create\n @official_identity = OfficialIdentity.new(official_identity_params)\n\n respond_to do |format|\n if @official_identity.save\n format.html { redirect_to @official_identity, notice: 'Official ident...
[ { "docid": "fabe317f43fdfd3f315cc910d2bdc191", "score": "0.64103466", "text": "def index\n @official_identities = OfficialIdentity.all\n end", "title": "" }, { "docid": "18b67780753362a8a39bde15ca235604", "score": "0.59002614", "text": "def set_official_identity\n @official_...
592a4bd9f51ebb648f54cb84ead4eb6e
===================================================== extract csv file and return array of game data
[ { "docid": "61cdcf199d0b2c02513c33842d3b6763", "score": "0.65151536", "text": "def export_csv(filename)\n game_matchups = []\n CSV.foreach(filename, headers: true) do |row|\n game_matchups << row.to_hash\n end\n game_matchups\nend", "title": "" } ]
[ { "docid": "08abb6945d5c07ffc55d2900e4481232", "score": "0.7090718", "text": "def load_csv(csv_filepath)\n gifts = []\n CSV.foreach(csv_filepath) do |row|\n gifts << row[0] # Nosso csv só tem uma coluna\n end\n return gifts\nend", "title": "" }, { "docid": "aa4fcb39e8dffb52e4fba301cf2...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c514fbd1e99fc5cb8cd1a89745ad9afc", "score": "0.0", "text": "def set_trainer_pokemon\n @trainer_pokemon = TrainerPokemon.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60322535", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6012846", "text": "de...
bd46655487e116043045eba954b82754
POST /jsons POST /jsons.json
[ { "docid": "d44012b1d30d2477b0a5e7ca342a2227", "score": "0.6225652", "text": "def create\n @json = Json.new(json_params)\n\n respond_to do |format|\n if @json.save\n format.html { redirect_to @json, notice: 'Json was successfully created.' }\n format.json { render :show, status:...
[ { "docid": "234e0cd2c934cd0f44645f586f380f78", "score": "0.66106015", "text": "def post_json(url, data)\n JSON.parse(post(url, data, :json, :json))\n end", "title": "" }, { "docid": "a9bcbeb132f75be6f14edcf5169e243b", "score": "0.6603012", "text": "def post(json)\n with_endp...
0f12dfbeb7cfc2c4ad5be4609e3dc91a
Creates a start time object
[ { "docid": "1849b12e602dbbdc71ea9e5f5247efd2", "score": "0.7045201", "text": "def start\n @start_time = Time.now\n end", "title": "" } ]
[ { "docid": "9af3f6313d516b5093e8d1213fb8a9bb", "score": "0.7691116", "text": "def init\n @start_time = Time.now \n end", "title": "" }, { "docid": "ecfbedd7a8b419a4ed97a9c00bef7d38", "score": "0.76088333", "text": "def start_time=(value)\n @...
c1e2de8f6c18369a88cb8a3be3841a37
GET /coupon_designs/new GET /coupon_designs/new.json
[ { "docid": "b05d3ea3a50d96388c314a30aa816ccd", "score": "0.8404147", "text": "def new\n @coupon_design = CouponDesign.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon_design }\n end\n end", "title": "" } ]
[ { "docid": "9e850bc5e06d2dcb77aa53db168c0f37", "score": "0.7832543", "text": "def create\n @coupon_design = CouponDesign.new(params[:coupon_design])\n\n respond_to do |format|\n if @coupon_design.save\n format.html { redirect_to @coupon_design, notice: 'Coupon design was successfully c...
008ad0a329595861f01dca5a7fdc1e3b
Sets the onPremisesSecurityIdentifier property value. Contains the onpremises security identifier (SID) for the user that was synchronized from onpremises to the cloud. Readonly. Returned only on $select. Supports $filter (eq including on null values).
[ { "docid": "2de3ad9d6dfddd4f55a5f073a7dc085e", "score": "0.8133679", "text": "def on_premises_security_identifier=(value)\n @on_premises_security_identifier = value\n end", "title": "" } ]
[ { "docid": "790a4e732a8c34616ced0999035fadab", "score": "0.7020967", "text": "def on_premises_security_identifier\n return @on_premises_security_identifier\n end", "title": "" }, { "docid": "790a4e732a8c34616ced0999035fadab", "score": "0.7020967", "text": "d...
f9b73fad02d1de4f65de919fd8b68f6c
GET /issues/1 GET /issues/1.json
[ { "docid": "0de852f45fc350daa19f14d5fb9d1d56", "score": "0.0", "text": "def show\n \n @comments = Comment.where(issue_id: @issue).order(\"created_at DESC\")\n end", "title": "" } ]
[ { "docid": "a301822fbe1d079022fa7529293c5db9", "score": "0.76324594", "text": "def index\n a = URI.parse(\"https://api.github.com/repos/nnluukhtn/employment_bot/issues?state=all\").read\n @gitissue = JSON.parse(a)\n end", "title": "" }, { "docid": "4c7f71ef1304137ac2477268b7ff9966", ...
7dde2dd1014c015164748bdd7ff26985
This method will parse some SSMS stuff, such as GO
[ { "docid": "82f0e8f1a18542f6d8d0716c5a212e94", "score": "0.55299604", "text": "def parse_sql(sql)\n sql.split(/go\\n/i)\n end", "title": "" } ]
[ { "docid": "f3b453ea58f595f07701e41aeec2d8d2", "score": "0.5412424", "text": "def parse(statement)\n # (1) split into nuggets -> something.something.something\n nugz = statement.split(\".\")\n\n # (2) grok each nugget into buds -> anything(?anything)[?anything]\n budz = nugz.map{ |nugget| /(...
7fd3722636075510c67232e21a0d0deb
Same thing but truncate in the dom
[ { "docid": "dfd813b8a5c312e52b34c1a3d7dda700", "score": "0.5857668", "text": "def span_with_title_truncated(full_text, truncate_length=100)\n content_tag :span, title: full_text do\n truncate(full_text, length: truncate_length, separator: ' ')\n end\n end", "title": "" } ]
[ { "docid": "bff9455225bbb6506e2af58dd971b558", "score": "0.8048757", "text": "def truncate() end", "title": "" }, { "docid": "a00ec5ce6870f7b5086f0cc7d07e9efe", "score": "0.74506915", "text": "def truncate\n end", "title": "" }, { "docid": "990fdbc719fa26c98da70fe7853b56...
8bcca5053ac1bac299901863ff79ae57
Triangulate whole file and save to original file
[ { "docid": "adeca48cad4cdea6e3c72bdda05dd71e", "score": "0.0", "text": "def post_triangulate_original(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = post_triangulate_original_with_http_info(name, opts)\n rescue ApiError => error\n if error.c...
[ { "docid": "d8bc598e7935ea6aa47903a86ec89077", "score": "0.6342562", "text": "def to_disk\n @file.close\n tmp = open(@file.path)\n final = Tempfile.new('codestrap')\n strip_modeline(tmp, final)\n\n tmp.close\n File.unlink(@file.path)\n final.close(unlink_...
03748c3131c4c0b8702e6580879dcc00
GET /occaisions GET /occaisions.json
[ { "docid": "9831593f1d8c360e0635e0b012dc366d", "score": "0.7719728", "text": "def index\n @occaisions = Occaision.all\n end", "title": "" } ]
[ { "docid": "766504de33a927cdcfc69a5b07268586", "score": "0.6310068", "text": "def index\n @competences = Competence.all\n authorize! :read, Competence\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competences }\n end\n end", ...
77613ac9c590efbedefc46f0da466303
GET /specializations/new GET /specializations/new.xml
[ { "docid": "a8a7467b79c0bc10abe33303ca174045", "score": "0.7432959", "text": "def new\n @specialization = Specialization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specialization }\n end\n end", "title": "" } ]
[ { "docid": "6f7a4c900b0b10e925072578d6cca4ea", "score": "0.71622145", "text": "def new\n @specie = Species.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specie }\n end\n end", "title": "" }, { "docid": "83598f47d29b2b98365c01e...
e7dc53463ed43fc0f9868a209fc7a052
rubocop:enable Metrics/MethodLength rubocop:enable Metrics/LineLength rubocop:enable Metrics/AbcSize
[ { "docid": "95f13881f91ef26e0fca8e31b3698dd4", "score": "0.0", "text": "def visits_by_day\n render json: Ahoy::Visit.this_month.group_by_day(:started_at).count\n end", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.77017593", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.63603234", "text": "def probers; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd",...
4e30da98d51a1d3bab6b772ee418d813
GET /weights/new GET /weights/new.xml
[ { "docid": "555a12554506d6f4e93d1995fad18607", "score": "0.7308551", "text": "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight }\n end\n\n end", "title": "" } ]
[ { "docid": "2ce98f102a7db16554e8e56265c56f65", "score": "0.7425958", "text": "def new\n #NO LONGER USED!!\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight }\n end\n end", "title": "" }, { "docid": "7d...
0afdac46b35a00d3f429489742dbc84d
=begin rdoc Updates the key, returns self for call chaining =end
[ { "docid": "865f7852b0f746c604a0efbd7a0bf7e0", "score": "0.84973776", "text": "def updateKey; @key = getKey; self end", "title": "" } ]
[ { "docid": "2fd359dca5e43e365ff9d29b1788baf1", "score": "0.7406922", "text": "def key=(new_key)\n @key = new_key\n end", "title": "" }, { "docid": "e22966a7dce516e63be52357d4a8f97c", "score": "0.71827906", "text": "def key=(key); end", "title": "" }, { "docid": "7...
8b94716d8192501036f7e1a183781b5e
Apply gravity to the specified objects.
[ { "docid": "b353ad04f3f8f57a58e2a39b590f2211", "score": "0.88652205", "text": "def apply_gravity_to(objects)\n objects.each {|object| object.body.apply_force *gravitational_forces }\n end", "title": "" } ]
[ { "docid": "52d2bb694198efc71c56f4eec2077e2e", "score": "0.69898224", "text": "def apply_gravity(other_moon)\n apply_gravity_to_dimension(X, other_moon)\n apply_gravity_to_dimension(Y, other_moon)\n apply_gravity_to_dimension(Z, other_moon)\n end", "title": "" }, { "docid": "1b1f75...
48577e9a97f6efcdf12487d5dcbd0228
Use existing for multiple nondestructive actions
[ { "docid": "0fc4cfc607418d034847402fdf178a5d", "score": "0.0", "text": "def existing(field)\n case field\n when :org then 'rspec-api'\n when :user then 'rspecapi'\n when :owner then 'rspecapi'\n when :assignee then 'rspecapi'\n when :repo then 'guinea-pig' # has heads, tails, pull, notes\n when :...
[ { "docid": "6b2989c0ec29165b94162baedf060ea3", "score": "0.5935099", "text": "def ignore_actions(actions); end", "title": "" }, { "docid": "6b2989c0ec29165b94162baedf060ea3", "score": "0.5935099", "text": "def ignore_actions(actions); end", "title": "" }, { "docid": "caf6...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "9d882719ca03a446a9ce00a32d045b76", "score": "0.0", "text": "def set_page\n @page = Page.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
e42f860f8937c1d4c1bdd806f5c22bc4
Extract link info from URL
[ { "docid": "b670343061d6b351f0abdfbeae95365f", "score": "0.8568127", "text": "def extract_link_info(url)\n link = url.scan /<[a|A]\\b[^>]*>(.*?)<\\/[a|A]>/\n (link[0] && link[0][0]) || url\n end", "title": "" } ]
[ { "docid": "1732ee493c62105bb0e8d1be763de79b", "score": "0.7518928", "text": "def extract_link_info link_obj\n # match all shortlinks and standard links to tiddlers, spaces and revisions\n # using named captures. Don't match links to lists of things.\n link_matcher = /^(?:(?:(?:(?:\\/u\\/...
184bbf9bf66f132d86a11b0a4d804798
Finds link relations from 'Link' response header Returns an array of Relations
[ { "docid": "cf41cb7ba73093514b707312964479e2", "score": "0.71089524", "text": "def process_rels\n links = ( @headers[\"Link\"] || \"\" ).split(', ').map do |link|\n href, name = link.match(/<(.*?)>; rel=\"(\\w+)\"/).captures\n\n [name.to_sym, Relation.from_link(@agent, name, :href => ...
[ { "docid": "66187af217fa737d5ec43dcaffafd332", "score": "0.71400267", "text": "def links\n relationships = map_relationships\n children = ( relationships.nil? )? [] : relationships\n children.unshift( response_block.call( model, 'self') )\n end", "title": "" }, { "docid": "...
30adea292b7350819d8556be3c187f9c
Initialize this instance by pushing its initial context into the binding stack. If no target is given, start at the top level. source://pry//lib/pry/pry_instance.rb118
[ { "docid": "387500ee64ab4166b191ab2a5ecaa429", "score": "0.62641376", "text": "def push_initial_binding(target = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "58e338a8114f9b717b07ed2360f413c0", "score": "0.6788859", "text": "def initialize(context={})\n self.context = context\n self.target = context[:target]\n self.output = context[:output]\n self.eval_string = context[:eval_string]\n self.command_set = ...
e11e782be5533698a2ee8a61db9f7177
How many blocks are we hashing per second? This will be zero unless we're trying to generate a block.
[ { "docid": "aeaf64e18da9581b2c09756e3b72ddd1", "score": "0.6609969", "text": "def hashes_per_second\n\t\t\t@jr.gethashespersec()\n\t\tend", "title": "" } ]
[ { "docid": "59d1487d1044314c42e5d1826df2c88c", "score": "0.7849956", "text": "def blocks_needed\n (key_length.to_f / hash_function.digest_length).ceil\n end", "title": "" }, { "docid": "3df60a52d9aec6b671f997ec298edc2d", "score": "0.76360583", "text": "def block_length\n ...
c4b36ba1a26b8b571ce77826eefa13b6
Set/Get for Task ID.
[ { "docid": "0fd750b27b1200ff434712b512fa400e", "score": "0.0", "text": "def id=(updated_id)\r\n @id = updated_id\r\n end", "title": "" } ]
[ { "docid": "58823bbd9fc643a1a8518c2e4ac003e5", "score": "0.7636074", "text": "def set_task\n @task = Task.find(params[:id] || params[:task][:id])\n end", "title": "" }, { "docid": "14a676d6387fda60078d726228ea2d17", "score": "0.7545955", "text": "def id\r\n return @task_...
d0bdd93d92a8e0bc78123df1a8858990
Play this sound once
[ { "docid": "079268ba5b580df42be283f18dab9bcc", "score": "0.619624", "text": "def play\n raise \"Sound #{path_or_url} is not loaded yet\" unless @decoded\n source = nil\n %x{\n var context = #{Sound.audio_context};\n source = context.createBufferSource();\n source.buff...
[ { "docid": "20b6fbbccbefb364c5b7854e527ea044", "score": "0.79071873", "text": "def on\n @snd = sound.dup\n @snd.play\n end", "title": "" }, { "docid": "e298e56912f7bc0f615c3771c3acf5f7", "score": "0.7051631", "text": "def play_one\r\n\t\tend", "title": "" }, { ...
f8a263d6268ebd28032ef6aeca5456f1
Time complexity: O(n) Space complexity: O(n)
[ { "docid": "629a4e6c8fb2a4f51f40bb480df08330", "score": "0.0", "text": "def factorial(n)\n if n < 0\n raise ArgumentError\n end\n return 1 if n <= 1\n return n * factorial(n-1)\nend", "title": "" } ]
[ { "docid": "9bfaea331eedce3072d8464bb5cccee1", "score": "0.65358865", "text": "def fast_two_sum?(arr)\n # O(n) in time and space\n result = []\n complements = {}\n\n arr.each_with_index do |el, i|\n if complements[el]\n result.push([complements[el], i])\n else\n complements[-el] = i\...
1779ca4c40dac95a34877186372ae750
string Password if needed.
[ { "docid": "ef33d01ddcdc985225d590bda266f56c", "score": "0.0", "text": "def password\n @attributes[:password]\n end", "title": "" } ]
[ { "docid": "077fec1c8bba6f223eaa618672c9da24", "score": "0.80493224", "text": "def password\n \"\"\n end", "title": "" }, { "docid": "b1a17a6b032d6bae8767c701d086e332", "score": "0.79217845", "text": "def password\n ''\n end", "title": "" }, { "docid": "dd4ac4ba1c...
29a3c887b4fac0957ff249c5e688f516
Dirty implementation of the element replacing method Repalace element using css selector to link
[ { "docid": "19fe7214ebd785ce3a86c8d01ad03851", "score": "0.48290956", "text": "def el_to_link(cmd)\n link = '<a style = \\\"text-decoration: underline\\\" class=\\\"link\\\"> Link instead of button </a>'\n @browser.execute_script(\"#{o_html(cmd[1])} = '#{link}' \")\n end", "title": "" } ]
[ { "docid": "2b3e3aa1a8bea994675ede859ec3d421", "score": "0.63888955", "text": "def selector_replace(selector, original, replacement); end", "title": "" }, { "docid": "ea1733bbad69c668b39845211be9a531", "score": "0.5687916", "text": "def replace_tag(tag, html_string)\n links = gene...
681352ac20b75eddcf994ec1fdc944bd
This code is based directly on the Text gem implementation Returns a value representing the "cost" of transforming str1 into str2
[ { "docid": "7177d0d53f6aab3e01dbd02e1666780e", "score": "0.62878233", "text": "def levenshtein_distance(str1, str2)\n s = str1\n t = str2\n n = s.length\n m = t.length\n\n return m if (0 == n)\n return n if (0 == m)\n\n d = (0..m).to_a\n x = nil\n\n str1.each_char.each_with_in...
[ { "docid": "9013c482c636841bb63c11ad5abfbee5", "score": "0.7139104", "text": "def transformation_distance(str1, str2)\n # puts \"#{@count += 1}\"\n\n str1,str2 = str1.downcase, str2.downcase\n # Dont need to compute if it has already been computed earlier, return from the aux hash.\n return @aux[\"#...
7955ad6abefce6eade5f6ed91ba94601
Add more fields make sure they follow the custom field naming conventions _d, _i, _k, _t
[ { "docid": "b7cc339a38d2e70ab828a5f0238d9066", "score": "0.0", "text": "def assemble_collection_specific\n # @json[\"fieldname_k\"] = some_value_or_method\n end", "title": "" } ]
[ { "docid": "514bf8c50471d07092180029adf347f0", "score": "0.7139017", "text": "def set_extra_fields\n return unless challenge\n\n challenge.challenge_idea_fields.each_with_index do |field, i|\n field_name = \"cfield#{i}\"\n unless respond_to? field_name\n self.class.send :hstore_co...
2ec5063d214bcfc80ca846161d48e324
Did I have published this message? Return: true|false
[ { "docid": "1ed60c1e1e656e584a21a95a31812919", "score": "0.0", "text": "def isSelfMessage?\n if(@fromNick==@selfNick)\n return true\n else\n return false\n end\n end", "title": "" } ]
[ { "docid": "880c526bf1ae3460a92e677b5c0388a5", "score": "0.7748866", "text": "def publish?\n false\n end", "title": "" }, { "docid": "bca7cdd0eb2267683c108d90c2e7da3d", "score": "0.7674823", "text": "def published?\n if self.publish_at < Time.now.utc\n true\n else\...
c5117a0ceaa747132e9540726786e937
def household_first_phone Phone.find(:first, :conditions => ['phonable_id = ?', self.household_id]) end
[ { "docid": "f99f3095f91e997d466b621fca218801", "score": "0.0", "text": "def first_email\n\t Email.find(:first, :conditions => ['emailable_id = ?', self.id])\n\tend", "title": "" } ]
[ { "docid": "351ceb714c3f3ae43d8a89c7b2339df4", "score": "0.77081347", "text": "def primary_phone\n phone_numbers.find(:first, :conditions => {:preferred => true}) || phone_numbers.first\n end", "title": "" }, { "docid": "ccae77145b3b8805a891069bb4f00270", "score": "0.68381274", "...
d74f50a9070f2302cd6b4c1e9c33ea77
Renders the enum section.
[ { "docid": "6aa15876e4857edd8e8da7b056cf60bb", "score": "0.6467181", "text": "def enum\n erb(:enum)\nend", "title": "" } ]
[ { "docid": "eba6296996274dfd713e785a47724354", "score": "0.7086042", "text": "def render_enum(width)\n # TODO: Also refactor args here\n args_texts = self.descrs.empty? ? [\"\"] : descrs.map(&:text)\n args_texts.map { |args_text| render_single(width, args: [args_text]) }\n end"...
0ebf584bd001cf1b3a94a5d9fea36795
Parse event date with utc offset
[ { "docid": "3f45299d7f286c9fa27f0e69521bb984", "score": "0.7133712", "text": "def event_date(event)\n Time.at((event['time'] + event['utc_offset'] ) / 1000).utc.to_datetime\nend", "title": "" } ]
[ { "docid": "91e898480f177b605e018032a249d37c", "score": "0.64908534", "text": "def utc_offset; end", "title": "" }, { "docid": "91e898480f177b605e018032a249d37c", "score": "0.64908534", "text": "def utc_offset; end", "title": "" }, { "docid": "91e898480f177b605e018032a249...
8ce4070b1261f456bab4ccb6f8c68cd0
Notify the appropriate group when something is shared
[ { "docid": "1b45f03c642b230613b144b2d5e2f0d1", "score": "0.528041", "text": "def share_notification(share, user)\n @recipient = user\n @share = share\n @user = @share.user\n @item = @share.owner\n @paper = @item.get_paper\n @item_name = @item.longname\n @item_summary =...
[ { "docid": "c3b3da5ed518c4667a2d1933ab1929a5", "score": "0.6146221", "text": "def notify_my_share(share)\n return if (share.visible_to==Share::VISIBLE_TO_SELF)\n\n if share.visible_to\n # share to people in visible to list\n receivers = share.visible_to\n else\n # share to all pe...
67cde22e54b159919113139da5d4b67d
This method is used to get progress of an process. It will find model name based on its id and return percentage of this input Args : +id+ > id of the input record Returns : 1 if failure if success Written: DuongDN Date: Aug 22, 2012 Modified: Date:
[ { "docid": "dfe047c955138f820b80b3c1cdb2968a", "score": "0.6494727", "text": "def get_percent_of_input\n input_id = params[:id]\n begin\n input = Input.find(:first,:conditions => ['id = ? and status <> ?', input_id,Input::KILLED])\n value = input.percentage \n rescue \n value = ...
[ { "docid": "450ba8bfce7548cd423d2dfe52d5b03f", "score": "0.7055463", "text": "def task_progress (id) \n\t\t\txr=task_get_raw(\"task_id\"=>id,\"details\"=>0)\n\t\t\txr.elements.each('//get_tasks_response/task') do |task|\n\t\t\t\treturn task.elements[\"progress\"].text.to_i()\n\t\t\tend\n\t\tend", "t...
e2270f99c84a4e617e23b236d4251424
PUT /address_types/1 PUT /address_types/1.xml
[ { "docid": "bcf662a488221570998e6b7385827664", "score": "0.6913181", "text": "def update\n @address_type = AddressType.find(params[:id])\n\n respond_to do |format|\n if @address_type.update_attributes(params[:address_type])\n format.html { redirect_to(@address_type, :notice => 'Address...
[ { "docid": "98904cad1edeb04dc0e7db0f34d0d84c", "score": "0.64624953", "text": "def set_address_type\n\n end", "title": "" }, { "docid": "9e906386d76fa132693d4fb1eddb0243", "score": "0.6281556", "text": "def set_address type, key, params={}\n opts = {:single_quoted => false}\n...
1282c4f2f1f2929a1b72c1a0a261ab04
=begin For example: minutes 3: for a 3 minute timer =end
[ { "docid": "e7062a460aded4fc2385638cdaa1cbb2", "score": "0.62869245", "text": "def start_timer(minutes)\n # Don't change -- based metric, seconds\n length = 60.0\n # Number of minutes\n number_of_minutes = minutes\n passed = 0\n while (number_of_minutes > 0)\n timer(number_of_minutes,Time.now, ...
[ { "docid": "54a1eabcb55b97260f16885e47a0cd58", "score": "0.68429124", "text": "def beginning_of_minute; end", "title": "" }, { "docid": "54a1eabcb55b97260f16885e47a0cd58", "score": "0.68429124", "text": "def beginning_of_minute; end", "title": "" }, { "docid": "54a1eabcb5...
603607850bfe3bf548980779c8349d1a
creates 20 recipes, one for each user
[ { "docid": "3e03ea79e322850ec0070b013afb7209", "score": "0.6184878", "text": "def associate_ingredients_to_recipes\n Recipe.all.each do |recipe|\n 5.times do\n recipe.ingredients << Ingredient.all.sample\n end\n \n recipe.ingredients = recipe.ingredients.uniq\n \...
[ { "docid": "8e2e1afa1545e8107d2cd72e7806d261", "score": "0.71042645", "text": "def userFill(holder)\n holder.each do | x |\n a_user = User.create!(x)\n recipeMaker(3, a_user)\n end\n # call recipeMaker like 3 times here, which will call subcategories\nend", "title": "" }, ...
da4a2687e887ebb54b386f809f8837d3
Look up the values of a user's attributes
[ { "docid": "a1c068fb6543d32eec6813268d6ce6b6", "score": "0.0", "text": "def get_attributes(attributes:, govuk_account_session:)\n querystring = nested_query_string({ attributes: attributes }.compact)\n get_json(\"#{endpoint}/api/attributes?#{querystring}\", auth_headers(govuk_account_session))\n ...
[ { "docid": "818a374fb34ef38d3650ae91708408a8", "score": "0.73987615", "text": "def user_attributes\n self.attribute_names.select{|a| Profile::USER_FIELDS.include?(a)}\n end", "title": "" }, { "docid": "f6acf8e186b0a4a43785d83a3686163e", "score": "0.7309964", "text": "def retrieve...
ea2868894baab4762f220c14a75eae22
New method : Store targets in array
[ { "docid": "650c331054b9f54d251407358a531d86", "score": "0.816748", "text": "def target_array=(targets)\n @target_array = targets\n @ori_targets = targets.clone\n end", "title": "" } ]
[ { "docid": "e9aa655c7fa1125cc501e9814ab62043", "score": "0.77810246", "text": "def targets\n @targets ||= []\n end", "title": "" }, { "docid": "d738838acc7d4d7ee436c871cde82d21", "score": "0.7453504", "text": "def targets=(value)\n @targets = value\n ...
dbdd2d0102791dd5e0a0d109f201472f
Load the initial state for the script. Abstract method to be implemented by extending classes.
[ { "docid": "587d22cdc8bf74e22a0d6b9e431592a9", "score": "0.6524608", "text": "def load_initial_state()\n CopySnapshotState.load_state(@input_params)\n end", "title": "" } ]
[ { "docid": "40baa6255b638c3fd98a3e534d94735f", "score": "0.689019", "text": "def run_init_script; end", "title": "" }, { "docid": "7f2cdf3febdc549f87fccb12e9faf163", "score": "0.65803856", "text": "def load_initial_state()\n CopyMsWindowsSnapshotState.load_state(@input_params)\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1308a9fdeb00aa36e1bb9bbbcb745aae", "score": "0.0", "text": "def set_serviceprovider\n @serviceprovider = Serviceprovider.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "de...
b9f425e8c69559150792c51a6b8d90c5
if the key is present, return func(key), else default
[ { "docid": "d9704350b1a69a3df5954146deab0cde", "score": "0.7535849", "text": "def get_arg_func(key, func, default) \n if (@args == nil) \n return default\n elsif @args[0].instance_of? Hash\n if @args[0][key]\n return func.call(@args[0][key])\n else\n return default\n ...
[ { "docid": "63bffd5393a260d3974acc425f913757", "score": "0.7376692", "text": "def default(key) end", "title": "" }, { "docid": "d395347ecf552fc34390e0750ff11702", "score": "0.68715024", "text": "def get_with_default(hash, key, default)\n hash.key?(key) ? hash[key] : default\n ...
fdbe101b82dda9ca5391ea21c29191d6
I worked on this challenge with William Pangestu. 1. Solution Write your comments on what each thing is doing. If you have difficulty, go into IRB and play with the methods.
[ { "docid": "5b19b3252b545521165c724afc854479", "score": "0.0", "text": "def north_korean_cipher(coded_message) # Creating the method with a string as parameter.\n input = coded_message.downcase.split(\"\") # Takes inputted string and downcases all letters and splits each element into an array.\n decod...
[ { "docid": "6979036015fac47c519d3834b2c5c971", "score": "0.6463458", "text": "def sort_string(string)\r\n # your code here\r\n a = string.split(\" \")\r\n b = a.sort{|x,y| x.length <=> y.length}\r\n b[0]<<' '<<b[1]<<' '<<b[2]\r\nend\r\n\r\n\r\n# Select random elements from an array\r\n\r\ndef random...
e1ced019a5dc1836fc65dd435d40fdac
Return the array of account box items
[ { "docid": "9ee6db05f25fce4f36eb3defcd7d6636", "score": "0.786853", "text": "def sidebar_account_box_items()\n sidebar_box_items_by_id(\"account\")\n end", "title": "" } ]
[ { "docid": "6a599e611231f762be7ea25f8b4e1fdf", "score": "0.67195636", "text": "def accounts\n []\n end", "title": "" }, { "docid": "dd3a946f21d0cfeae107637c7b9c9c65", "score": "0.6557076", "text": "def items\n Item.where(box: name)\n end", "title": "" }, { ...
38598beb670b978c755314d4d0e9b434
Formats name for display by capitalizing the first word and using space instead of ''
[ { "docid": "3ac3f3f7f988d87a668f530ad89415ff", "score": "0.8639868", "text": "def display_name(name)\n name.gsub('-', ' ').capitalize\n end", "title": "" } ]
[ { "docid": "dae18b9f70d4bb621dff422de76d5cc9", "score": "0.8377745", "text": "def name_text_formatted\n h.simple_format(name.capitalize)\n end", "title": "" }, { "docid": "e13d6b81a76f995be2cee3a4167ac2a9", "score": "0.8117585", "text": "def format_name\n self.name = self....
ee5b7305a8fe96c9cd18c6a8c390a322
AUTHENTICATE Authenticates a subscriber's userid and password
[ { "docid": "6ef1f872f9909cbd19e3e018b9d755de", "score": "0.6719387", "text": "def authenticate\n\n @transcriber_id = params[:transcriberid]\n @transcriber_password = Devise::Encryptable::Encryptors::Freereg.digest(params[:transcriberpassword],nil,nil,nil)\n @user = UseridDetail.where(:userid =>...
[ { "docid": "5fd9c46620eda9f0d2544d89b9027813", "score": "0.6884524", "text": "def receive_plain_auth(user, password); end", "title": "" }, { "docid": "94a37fe1eef1c235292311433dfb9407", "score": "0.6748565", "text": "def authenticate_inviter!\n end", "title": "" }, { "...
6272a1f1934fc1c5efb28eb1426cbd29
The on_line? method is used to determine if the point is on a line. See module Geom for the various ways to specify a line.
[ { "docid": "563df4b7c474ce385be901af8444607e", "score": "0.68241256", "text": "def on_line?(line)\n end", "title": "" } ]
[ { "docid": "8791bb463290b31d084290712a3a2e34", "score": "0.8088679", "text": "def point_is_on_line?(point)\n ((@x_coefficient * point.x + @y_coefficient * point.y + @free_coefficient) - 0.0).abs < 0.0001\n end", "title": "" }, { "docid": "5a43b03b29bf8991ca078d8a1cc82ce2", "s...
7a32d7849ee232161bf10830734f9863
POST /dias POST /dias.xml
[ { "docid": "6d894e711f933e703631b71265171ca6", "score": "0.580463", "text": "def create\n @dia = Dia.new(params[:dia])\n\n respond_to do |format|\n if @dia.save\n #flash[:notice] = 'Dia was successfully created.'\n @dias = Dia.find(:all,:order=> \"num\")\n format.html { r...
[ { "docid": "040b1dcc9c0431f2a79f0e6876ea2be5", "score": "0.6287026", "text": "def post( path, body = nil )\n body ? length = body.length.to_s : length = '0' \n parse( @access_token.post( DOSSIA_URL + '/dossia-restful-api/services/v3.0' + path, body, { 'Content-Type' => 'application/xml', 'Cont...
ce3c5e733f9d674c86e3b0880a840d50
When passed a block, yields AppInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached. source://twilioruby//lib/twilioruby/rest/microvisor/v1/app.rb66
[ { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.0", "text": "def each; end", "title": "" } ]
[ { "docid": "8510b02019c3ea6c88ddc9179865acc5", "score": "0.6029344", "text": "def each(&block)\n @apps.each(&block) if @apps\n end", "title": "" }, { "docid": "2ffd26b5f5fd669a5e4846ec0fc4d690", "score": "0.58095443", "text": "def index\n @app_instances = AppInstance.a...
d7fec1b0a292efa67c729d7d61976c15
Field setter method, accpet args and &block to be passed. For details how to pass args and block see Lolita::Configuration::Field. Return field itself.
[ { "docid": "d04f426dc1ab661d20f9bf7df5679be1", "score": "0.62729025", "text": "def field *args, &block\n field=Lolita::Configuration::Factory::Field.add(self.current_dbi,*args,&block)\n field.field_set = current_fieldset\n if self.current_dbi!=self.dbi\n field.neste...
[ { "docid": "20eef49caaebe4019fc2e6e7526c60e4", "score": "0.69422084", "text": "def set_field(field)\n\t\tend", "title": "" }, { "docid": "20eef49caaebe4019fc2e6e7526c60e4", "score": "0.69422084", "text": "def set_field(field)\n\t\tend", "title": "" }, { "docid": "2b366518...
2a5d28f49a3a772cd374f30f4afc81b1
Create a bag from scratch yo'
[ { "docid": "b93f17429a67ab3dc066d21606df7fa2", "score": "0.531401", "text": "def build(opts)\n uuid = SecureRandom.uuid\n\n bag = BagIt::Bag.new File.join(@output_directory, uuid)\n path = File.join File.expand_path(opts[:location]), \"**\", \"*\"\n Dir.glob(path).each do |filepath|\...
[ { "docid": "c7107a23c0e7fff2a88745ea065955d6", "score": "0.6748993", "text": "def make_bag\n move_files_to_bag\n bag.write_chipmunk_info(common_tags.merge(audio_metadata))\n bag.download_metadata\n bag.manifest!\n end", "title": "" }, { "docid": "69a0117f51fbe116e42cc6...
de25bdeba3ba376a3b152ef383804f06
Update an item's state. ==== Return On response returns true. Failure on incorrect item id. ==== Parameters item_id:: the external id of the items whose state to set. state:: state will be set to 'activated' if state is true. Otherwise state will be set to 'suspended'.
[ { "docid": "e87f4eac6e0d2a69a51a4d929ee018f7", "score": "0.85662454", "text": "def update_item_state(item_id, state)\n !send_pairwise_request(\"items/#{item_id}/#{state ? 'activate' : 'suspend'}\", nil, 'Get').nil?\n end", "title": "" } ]
[ { "docid": "8d05489a0da1c75f5800fc9242a83663", "score": "0.6487289", "text": "def offer_an_item(item)\r\n item.status = true\r\n end", "title": "" }, { "docid": "748346392d0fcf725b79b496a90a933f", "score": "0.62296295", "text": "def set_item_status\n @item_status = ItemS...
344f8725c8979827594ed85e4becf361
POST /supplier_categories POST /supplier_categories.json
[ { "docid": "ea84dcf007d2f480d7083aaae3df75eb", "score": "0.7046655", "text": "def create\n @supplier_category = SupplierCategory.new(supplier_category_params)\n\n respond_to do |format|\n if @supplier_category.save\n format.html { redirect_to admin_supplier_category_path(@supplier_cate...
[ { "docid": "7e576fc88fa7852c520ed28909d3591e", "score": "0.7684449", "text": "def create\n get_supplier\n @supplier_category = @supplier.categories.create(params[:supplier_category])\n end", "title": "" }, { "docid": "b91b948a7de0305ac4ad698b74ba08f5", "score": "0.6661895", "t...
c7fb724858446d5b6a1d70e6f5d1f1d3
setup form context to allow child components like inputs to access the form configuration
[ { "docid": "a2f4850bfc46d4be166872252fe27bc1", "score": "0.6145664", "text": "def initialize(html_tag = nil, text = nil, options = {}, &block)\n previous_form_context = Matestack::Ui::VueJs::Components::Form::Context.form_context\n Matestack::Ui::VueJs::Components::Form::Contex...
[ { "docid": "adcf99ccfd064a0e96428363c9ccc1ed", "score": "0.7157151", "text": "def context\n unless @instance_context\n @instance_context = FormContext.new(@version , @params['form_type'])\n end\n @instance_co...
64cff00e023ab79006dbed842e221fcf
Return a hash containing the defaults for command line parser. Returns: hash of default options
[ { "docid": "4cf01d37d759b1abc9880a943120d92f", "score": "0.6396172", "text": "def default_options\n options = {\n :endpoint => nil,\n :certificates => [],\n :servers => [],\n :log_level => Logger::INFO,\n :renew_days => nil,\n :dry_run => false,\n :check_config => f...
[ { "docid": "c42cfe6865a7c2322ffac0ff3336cc88", "score": "0.7507207", "text": "def default_options\n\t\toptions = OpenStruct.new({\n\t\t\t:command => nil,\n\t\t\t:loglevel => :warn,\n\t\t})\n\n\t\treturn options\n\tend", "title": "" }, { "docid": "5e27e7cd292b9e09b4514dbc00a5ebc0", "scor...
5bdae8164ca020f8dcb8dcd757d013e0
GET /insertion_orders GET /insertion_orders.json
[ { "docid": "b1e7c3929e9b7aecf88faefef2748b14", "score": "0.72218746", "text": "def index\n @insertion_orders = InsertionOrder.all\n end", "title": "" } ]
[ { "docid": "4519c4984f3d701c2f52f2db172695b3", "score": "0.690942", "text": "def orders\n get_request 'orders'\n end", "title": "" }, { "docid": "ecb872e9703937b98762917512895cd5", "score": "0.66372174", "text": "def create\n @insertion_order = InsertionOrder.new(insertion...
2b41e90c3c63d710f36be1409832b0c8
DELETE /course_applications/1 DELETE /course_applications/1.json
[ { "docid": "c66600c83a7345e6d10875f49eb5ec8f", "score": "0.78258574", "text": "def destroy\n @course_application.destroy\n respond_to do |format|\n format.html { redirect_to course_applications_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "35db10a2bb6e1ee9f8b5399eb9103109", "score": "0.7526927", "text": "def destroy\n @course_application.destroy\n respond_to do |format|\n format.html { redirect_to course_applications_url, notice: 'Course application was successfully destroyed.' }\n format.json { head :no_conten...
b6ad3d00ab18a50cf64bf3c44d78bd27
POST /users POST /users.json
[ { "docid": "94af237fe61d9ea5f5c358200b9b80d3", "score": "0.0", "text": "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'Пользователь успешно создан.' }\n format.json { render :show, status: :create...
[ { "docid": "24c5e44d772da89269600975eeebdfda", "score": "0.71918935", "text": "def create\n @user = User.new(user_params)\n @user.save\n json_response(@user, :created)\n end", "title": "" }, { "docid": "6e1490da4a56756e02c8de2a503a156e", "score": "0.7185745", "text": "def c...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "e89d69926be40576e8ae7e9812b02fd0", "score": "0.0", "text": "def user_answer_params\n params.required(:user_answer).permit(:user_id, :question_id, :potential_answer_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
6741d73188643cca4a62a34532fb5af2
Create a replication agent instance.
[ { "docid": "c5e094c376fa7938a365141f141d8514", "score": "0.7118133", "text": "def replication_agent(run_mode, name)\n RubyAem::Resources::ReplicationAgent.new(@client, run_mode, name)\n end", "title": "" } ]
[ { "docid": "c888d37645280f10d8e3e3d67d711980", "score": "0.6292559", "text": "def create_replication(request, &block)\n post \"/replicate/\", request, &block\n end", "title": "" }, { "docid": "209027f78f4d350bef7c87a72919db59", "score": "0.6010549", "text": "def outbo...
1c5f30dfc8a78d640c0d3bd5ecb7168b
Helper for creating / removing bridgedomain configs 1. Remove any existing bridgedomain config unless it contains our test_bd 2. Remove vlan with test_bd id 3. Add bridgedomain configs
[ { "docid": "08823607224eb5e03c7ef724f25377d8", "score": "0.77183324", "text": "def config_bridge_domain(agent, test_bd, stepinfo='bridge-domain config:')\n step stepinfo do\n # Find current bridge-domain\n # NOTE: This should convert to using puppet resource, however, the cli\n # does ...
[ { "docid": "d7e367a43266f342ca859538c861a1f2", "score": "0.6236179", "text": "def create_bridge\n return if @bridges.keys.include? @nic[:bridge]\n\n if @nic[:bridge_type] == 'openvswitch_dpdk'\n @nic[:ovs_bridge_conf] = {} unless @nic[:ovs_bridge_conf]\n @nic[:ovs_bri...
be05d0e0c1c5c671cb1edba98c7d529d
Lines that start with a Colon are Comments and will be ignored
[ { "docid": "90f647a5b99e775003066192a555dd41", "score": "0.0", "text": "def send_ping\n @connections.each do |socket|\n begin\n socket << \":\\n\"\n rescue Reel::SocketError\n @connections.delete(socket)\n end\n end\n end", "title": "" } ]
[ { "docid": "a6a9d647781630cb7091bd9be551a72e", "score": "0.7017745", "text": "def lex_comment line\n # do nothing\n end", "title": "" }, { "docid": "6b4c1a45f8a72b6d15b5dfb20c3ec50f", "score": "0.6943724", "text": "def verify_comment(line) \n end", "title": "" }, { ...
d796f988a7185c6534f2a8ef85d504bd
destroy Delete and item from the play list DELETE http method
[ { "docid": "49a18add7e42ccf118f918ecb4a16bd3", "score": "0.0", "text": "def destroy()\n\tdeleteId = $cgi['id']\n\tdeleteItem = nil\n\tfileName = nil\n\t$playlistItems.each { |item|\n\t\tif deleteId == item['id']\n\t\t\tdeleteItem = item\n\t\t\tfileName = item['file']\n\t\tend\n\t}\n\t# look for duplicat...
[ { "docid": "9df5493612b7cad981e008bd4513cd2b", "score": "0.7664058", "text": "def destroy\n @api_item.destroy\n end", "title": "" }, { "docid": "9df5493612b7cad981e008bd4513cd2b", "score": "0.7664058", "text": "def destroy\n @api_item.destroy\n end", "title": "" }, { ...
09dc0412c029bde48130a92926fcf4d7
Get all dedicated numbers
[ { "docid": "20c26619dcbfbeec6a99fd496a81ee75", "score": "0.6423855", "text": "def get_dedicated_numbers\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/numbers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare...
[ { "docid": "08cabcd913873c8999d5a0213ace957d", "score": "0.6636389", "text": "def available_numbers\n\t\tif number\n\t\t\tSet[]\n\t\telse\n\t\t\t@groups.inject(OneThruNine) { |res, group|\n\t\t\t\tres - group.numbers\n\t\t\t}\n\t\tend\n\tend", "title": "" }, { "docid": "d9f14857f74dd1a3c5d8f...
c287431f3f8b854de0cb1a5976667df2
GET /breeds/1 GET /breeds/1.json
[ { "docid": "a27e85726c3eb1f957540bd1441215ea", "score": "0.0", "text": "def show\n @feed_backs = @breed.feed_backs\n @average_rate = FeedBack.where(breed_id: @breed.id).average(:rate)\n\n if params[:view] == \"all\"\n @feed_backs = @breed.feed_backs.order(created_at: :desc)\n elsif para...
[ { "docid": "da0294067c8342a3ebbcf8cbc40996ea", "score": "0.68855876", "text": "def breeds(animal_type)\n response = perform_get(\"/breed.list\", { :animal => animal_type })\n Breeds.new(response).breeds\n end", "title": "" }, { "docid": "b3f5d17ae3d715c6b7a674c4c32d95e8", "s...
d550f5ac07dfbb70faa67a77ed9a3121
True only if the reciprocal is a one_to_one association.
[ { "docid": "5c4b3e8c8b96271f3aaa00388c225f67", "score": "0.76532215", "text": "def set_reciprocal_to_self?\n reciprocal\n reciprocal_type == :one_to_one\n end", "title": "" } ]
[ { "docid": "20187728e862bf778e5daf632a421ac7", "score": "0.7350777", "text": "def has_one?\n true\n end", "title": "" }, { "docid": "0766753e2384ed9af8dbae15fe57ff06", "score": "0.73433095", "text": "def one?\n [Referenced::HasOne, Embedded::EmbedsOne].any? { |...
32889738a7dd42d0ac7d88e6c05a6947
TODO: filter included items by display?
[ { "docid": "7528791f6a992c76a37d32a908dbe5bc", "score": "0.0", "text": "def marshal_dump # :nodoc:\n attrs = attributes.sort.map do |attr|\n next unless attr.display?\n [ attr.name, attr.rw,\n attr.visibility, attr.singleton, attr.file_name,\n ]\n end.compact\n\n method_ty...
[ { "docid": "fcc723fc73ab31a3fa5af7aded69ce07", "score": "0.68828523", "text": "def displayable_items(items)\n items.select do |item|\n display_item? item\n end.sort { |i1, i2| priority_for(i1) <=> priority_for(i2) }\n end", "title": "" }, { "docid": "a7dd7e4969f54dc3656ae39d21d35...
8557e6ea2498ea2f5acf4aa60bc55ea0
DELETE /suppliers/1 DELETE /suppliers/1.json
[ { "docid": "f842d90bc6b75028fdd1f95dcd77301e", "score": "0.72896796", "text": "def destroy\n @supplier.destroy\n respond_to do |format|\n format.html { redirect_to suppliers_url, notice: 'Supplier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "ti...
[ { "docid": "63d4c91feeb17aeb79253c1cedc6a2c7", "score": "0.758882", "text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to suppliers_url }\n format.json { head :ok }\n end\n end", "title": "" }...
bc00c1fa28d0dd29a4567bae7d197871
NOTE: call this before format and open
[ { "docid": "6fbad814d085cdbfe8da90fc6c16131b", "score": "0.0", "text": "def set_passphrase\n @pass = get_passphrase()\n end", "title": "" } ]
[ { "docid": "2b8546ebac55b2f2e16e77a2e31ae03f", "score": "0.6522595", "text": "def formats; end", "title": "" }, { "docid": "2b8546ebac55b2f2e16e77a2e31ae03f", "score": "0.6522595", "text": "def formats; end", "title": "" }, { "docid": "0dde32d6e7b86e9eff60e29b897f748b", ...
9843ddfbf498aff6f72be46944cd9c4e
I worked on this challenge by myself. Your Solution Below
[ { "docid": "bc3a1c244420891c87396daeeb7e6e7a", "score": "0.0", "text": "def array_concat(array_1, array_2)\n #avoiding array_1 + array_2 in order to use iteration\n result = []\n\n array_1.each do |el|\n result << el\n end\n\n array_2.each do |el|\n result << el\n end\n\n result\nend", ...
[ { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.66699874", "text": "def solution4(input)\n end", "title": "" }, { "docid": "f712d49ec6c615538b2e2aa846391fda", "score": "0.65802413", "text": "def challenge; end", "title": "" }, { "docid": "aa89b26c8848588848ff6...
7dab4d4ed5e9b8d1ef3dfc36fa680350
getReportID(insightID, reportName) Gets Report ID for a given report
[ { "docid": "2fc6d8dafa2d021bf951c99d91471c36", "score": "0.88231665", "text": "def getReportID(insightID, reportName)\n if insightID.nil? || reportName.nil?\n log(\"DEBUG\", \"insight id and report name is needed to get report id\")\n return nil\n end\n\n paramHash = Hash.new\n par...
[ { "docid": "8a5191e7a2bbbac50334683cd2ec85dd", "score": "0.7819614", "text": "def getReportCardID(insightID, reportID, cardName)\n if insightID.nil? || reportID.nil? || cardName.nil?\n log(\"DEBUG\", \"insight id, report id and card name is needed to get report card id\")\n return nil...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "b95cfd69cc7a8e2012ec547e6cb93b85", "score": "0.0", "text": "def update!(**args)\n @locations = args[:locations] if args.key?(:locations)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
9a7a627589b49fa036b4639885024be7
Returns true if the node has round/square/curly brackets.
[ { "docid": "27aed121be5a1cb388d560d6716c0361", "score": "0.78960484", "text": "def brackets?(node); end", "title": "" } ]
[ { "docid": "4000b42dff2dd805aab5db867e91d67b", "score": "0.7207159", "text": "def brackets?(node)\n node.loc.end\n end", "title": "" }, { "docid": "561e558fa1c3f18669e3638f79bfdc54", "score": "0.70166457", "text": "def inside_empty_brackets?\n bracket?(prev_char) && ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "215e247ec23e153668686e3c1c276a44", "score": "0.0", "text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012568", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
25a8c985b29679870ff81e6e9a3e4c4b
GET /mangakas or /mangakas.json
[ { "docid": "924ed178c6e28ca10c9b04c0f1f3e2e4", "score": "0.6431781", "text": "def index\n @mangakas = Mangaka.all\n end", "title": "" } ]
[ { "docid": "fd5133db7b786c5ff6d791caf515696c", "score": "0.69160306", "text": "def show\n @manga = Finder.find_manga_by_id params[:id]\n @manga ||= KiWi.show_manga params[:id]\n\n render json: @manga\n end", "title": "" }, { "docid": "06df5d73d0d966c2500245b69f8ef57b", "score":...
3abb6f865d2af36f494922921c0eeaef
Returns a hash of the changed attributes with the new values
[ { "docid": "ae013c90c40e6c0340934bcf064c18c2", "score": "0.7006782", "text": "def new_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).last\n attrs\n end\n end", "title": "" } ]
[ { "docid": "6547db99002dabb7076cc299ce8a6454", "score": "0.8571037", "text": "def changed_attributes\n changed_attributes_names.each_with_object({}) do |attr, hash|\n hash[attr] = attribute_value(attr)\n end\n end", "title": "" }, { "docid": "e3e0719a70c734def7800...
899bc511437db30ff275901f5102e34c
generate a female name +frequency+ :common, :rare, :all +surname+ true if you want a full name, false if you just want a first name
[ { "docid": "3842348cc4091fd2459dcfe1d5b207da", "score": "0.81182027", "text": "def female(frequency = :common, surname = true)\n generate(:type => :female, :frequency => frequency, :with_surname => surname) \n end", "title": "" } ]
[ { "docid": "494a06d9b5cf76beaefc3025bddbcb54", "score": "0.81948256", "text": "def female_name\n case rand(9)\n when 0, 5 then \"#{first_name(:female)} #{middle_name(:female)}\"\n else first_name(:female)\n end\n end", "title": "" }, { "docid": "aecdcbd244bb89e659e...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "8a44c0139cb33323be5d9428334518a0", "score": "0.0", "text": "def course_params\n params.require(:course).permit(:name, :prerequisite,:description,:image,:user_id,category_ids:[],location_ids:[])\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
54e0750f49c42aae728ed01456f328db
Time Complexity: log(n) Space Complexity: log(n)
[ { "docid": "ab1bdf7a343770dd3c6ac42a7c0bcdb9", "score": "0.0", "text": "def add(key, value)\n new_node = TreeNode.new(key, value)\n\n if @root.nil?\n @root = new_node\n else\n add_helper(@root, new_node, key)\n end\n end", "title": "" } ]
[ { "docid": "876b1577ae1ba612137db52a7a2ae711", "score": "0.6761441", "text": "def dec2FactString(nb)\n facts = []\n current = 1\n while nb > (fact = fact(current)) do # QUESTION: is this O(logn) or O(n)?\n facts << fact\n current += 1\n end\n\n result = []\n facts.reverse_each do |factorial|...