query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
2fd973018719284115bb25d4a08b7024
QQQ in the create method we seem to be ignoring this Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b9d5f536e222f56029976c424b11ad26", "score": "0.0", "text": "def enrollment_params\n params.require(:enrollment).permit(:student_id, :course_id)\n end", "title": "" } ]
[ { "docid": "e8c4e8dce8a9d9bf1fbfc136728abd8e", "score": "0.63502306", "text": "def create_allowed?\n true\n end", "title": "" }, { "docid": "90207edf12da28385c20fbd27327bf81", "score": "0.6287042", "text": "def create\n @qq = Qq.new(params[:qq])\n\n respond_to do |format|\n...
0697211b724a5a5bce8e8b16ebc2413c
=== Initialize. Class constructor. ==== Parameters host:: (String) It's the visitor IP. api_key:: (String) Mints instance api key. contact_token_id:: (Integer) Cookie 'mints_contact_id' value (mints_contact_token). ==== Return Returns a Client object.
[ { "docid": "dba6a4ad8ddfae97c917d72359dfcb8b", "score": "0.85415953", "text": "def initialize(host, api_key, contact_token_id = nil, visit_id = nil, debug = false)\n @client = Mints::Client.new(host, api_key, 'public', nil, contact_token_id, visit_id, debug)\n end", "title": "" } ]
[ { "docid": "55505ecf95f7ce6b8b6767639c76af33", "score": "0.8547484", "text": "def initialize(host, api_key, session_token = nil, contact_token_id = nil, debug = false)\n @contact_v1_url = '/api/contact/v1'\n @client = Mints::Client.new(host, api_key, 'contact', session_token, contact_token_id,...
4d3ef9085701b322878a660f1d41a556
Container show selected, redirect to proper controller
[ { "docid": "d7a220a9b282d0e33d0e5ce8144d1ad8", "score": "0.59163916", "text": "def show\n return if perfmenu_click?\n @sb[:action] = params[:display]\n @display = params[:display] || \"main\" unless pagination_or_gtl_request?\n\n identify_container(params[:id])\n if @display == \"performa...
[ { "docid": "ffdd6dc9f11625589b16b5f64a67cc9d", "score": "0.6461583", "text": "def show\n @container = Container.get!(params[:id])\n @dropbox = Dropbox.new(@container)\n @upload_url = upload_container_url(@container.id)\n if Ixtlan::Guard.check(self, :containers, :edit, nil) || @container.pub...
993e5327b932fcb07fe25942b9b33190
Use mounted_as parameter to give file predictable name
[ { "docid": "62b71f3c5eb915e5d34b2a9dc17e296d", "score": "0.6807667", "text": "def filename\n \"#{mounted_as}_#{timestamp_for_filename}#{File.extname(original_filename)}\" if original_filename\n end", "title": "" } ]
[ { "docid": "c7d34811562af896c2cb9a66ca02d847", "score": "0.7175132", "text": "def filename\n \"#{mounted_as}.#{file.extension}\" if file\n end", "title": "" }, { "docid": "986f67dac2ca411a169df18b734d2940", "score": "0.7060832", "text": "def filename\n return \"#{mounted_as}\"...
2fbf9cd28eea760f59848b056bc3b03d
The tag for an action made from this controller method
[ { "docid": "a2d602d6f2fbf6761a493b45b822435b", "score": "0.7155995", "text": "def action_log_tag_action\n case request.method\n when \"GET\" then params[:id] ? \"SHOW\" : \"LIST\"\n when \"POST\" then \"ADD\" \n when \"PUT\" then \"UPDATE\"\n when \"DELETE\" then \"DELET...
[ { "docid": "87153386a2acbb64698ff88b405ebd09", "score": "0.7234562", "text": "def tag_name_for(action)\n tag_name = \"#{controller_name.capitalize}#{action.capitalize}\"\n end", "title": "" }, { "docid": "6cd5ef13a8af431101f6d245ffd3a9dd", "score": "0.7048149", "text": "def t...
3287a365b1bf6895c7012ed9dc322615
Do two instances of entity represent the same
[ { "docid": "205a3d488bc4d8cfddbc7f0406479265", "score": "0.6631192", "text": "def ==(other)\n self.class == other.class && self.id == other.id\n end", "title": "" } ]
[ { "docid": "92f24d021cb60e06a5c04748f26ae3db", "score": "0.6899816", "text": "def ==(other)\n return false unless other.is_a?(Entity)\n uuid == other.uuid\n end", "title": "" }, { "docid": "625f951a74884ffac77925391c200a2c", "score": "0.673437", "text": "def is_same()\n ...
2dbb32f811141282b44d92b2ac522f79
0 [ VisionPrescription::Dispense ]
[ { "docid": "038f7862a3287af40db45afbe8422215", "score": "0.60098964", "text": "def resourceType\n 'VisionPrescription'\n end", "title": "" } ]
[ { "docid": "f367447686e2765f5fc78fb22447df98", "score": "0.5968092", "text": "def resourceType\n 'MedicationDispense'\n end", "title": "" }, { "docid": "4b6f4e68163a55bbef61636833130354", "score": "0.59074885", "text": "def resourceType\n 'MedicationDispense'\n en...
4681cc2c40e0524d534f76edcaa6730e
Make another request to reddit, yielding new elements.
[ { "docid": "8aed778c40ec2191ec2da009b93add3d", "score": "0.0", "text": "def next_request\n # Get the elements from the loader before the `latest` element\n listing = @loader.call(@previous)\n # If there's nothing new to process, request again.\n return if listing.empty?\n ...
[ { "docid": "a1360f305f2055d13a8c6b4bd14affd5", "score": "0.61521447", "text": "def scrape_posts query, tries = 0, **opts, &block\n\t\t\tbegin\n\t\t\t\t# Ask reddit to procure our items\n\t\t\t\tresponse = @client.get(query, opts)\n\t\t\t\tif response.success?\n\t\t\t\t\tpayload = response.body\n\t\t\t\t...
b2abae8994d0db0366a3c429a147efb0
process before each test method
[ { "docid": "a2f40c0e272af7a305176349e42507c2", "score": "0.0", "text": "def setup\n @l1 = Location.first\n end", "title": "" } ]
[ { "docid": "154f5c1f18576f3da8e2e0aa4e6600d9", "score": "0.7968784", "text": "def before_test(test); end", "title": "" }, { "docid": "154f5c1f18576f3da8e2e0aa4e6600d9", "score": "0.7968784", "text": "def before_test(test); end", "title": "" }, { "docid": "e3c66aee08c863fc...
2a57a329ceda66bb3e254cb6f3172816
Peek at the +depth+ event in the stack. The first element on the stack is at depth 0. If +depth+ is 1, will parse to the end of the input stream and return the last event, which is always :end_document. Be aware that this causes the stream to be parsed up to the +depth+ event, so you can effectively preparse the entire...
[ { "docid": "a472c0e59a6be24d0799c51a2ea335e1", "score": "0.6583522", "text": "def peek(depth = T.unsafe(nil)); end", "title": "" } ]
[ { "docid": "c1d26e4f189a940cd6067413d50fb669", "score": "0.5643731", "text": "def peek(src)\n ctx = src.is_a?(Context) ? src : Context.new(src)\n starting_pos = ctx.bio.pos\n begin\n parse ctx\n ensure\n ctx.bio.restore_to starting_pos\n end\n end", "title": "" }, { ...
31c358ddb0bc3d8d2610e873f65fba94
Returns the value of attribute sign. source://activesupport//lib/active_support/duration/iso8601_parser.rb32
[ { "docid": "a95a17eaa49f561f77cae8ecba47a238", "score": "0.5528342", "text": "def sign; end", "title": "" } ]
[ { "docid": "1eb29edd473dd0e805541713e4ffe325", "score": "0.6945788", "text": "def parse_sign(attr)\n attr.match(/\\A[+-]/).nil? ? '+': attr.slice!(0)\n end", "title": "" }, { "docid": "b14d1cb34b42f3e58ba394524456137a", "score": "0.6295058", "text": "def parse_sign(sign)\n (...
935907559eb53e94ec783e1489ca46be
Read header & image items information
[ { "docid": "40a44783ae3b7e4ed81f79e05bd1db9a", "score": "0.65974545", "text": "def fetch_image_structure\n if @encrypted\n File.open(@image, \"rb\") do |f|\n header = f.read(1024)\n header = FELHelpers.decrypt(header, :header)\n img_version = header[8, 4].unpack(\"V\").first...
[ { "docid": "5a08cc88d832fad08fdbf597880185ec", "score": "0.6595382", "text": "def header\n @header unless @header.nil?\n @image.pos=0\n @image.read(100)\n end", "title": "" }, { "docid": "ce7e7ec183c3984c1c6c2731278e995d", "score": "0.65841824", "text": "def read_header\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "ba52abccea6a0f4cfaa056e2b72b8218", "score": "0.0", "text": "def industrium_params\n params.require(:industrium).permit(:nombre)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
3d4b210f108cd16872775dc8df95f575
A userfriendly description of the dataset.
[ { "docid": "43b27eeadfdd8a0fe15813a45d0d1858", "score": "0.0", "text": "def description\n ensure_full_data!\n @gapi.description\n end", "title": "" } ]
[ { "docid": "fd3ec5ff86a144d7e1ed8a6e2a0115d1", "score": "0.7785322", "text": "def description\n metadata[dataset_uri][dct.description.to_s][0] rescue nil\n end", "title": "" }, { "docid": "043fb99d0b76e8f6c5c41e767f5b7697", "score": "0.7682737", "text": "def description\n...
57ea84beb135d43d1e98b6320e763f0b
Returns the correct bootstrap css class for a given flash type
[ { "docid": "b21e526507cf540c89a9df5276fed2c6", "score": "0.71695906", "text": "def bootstrap_flash_class_for(name)\n case name.to_sym\n when :notice then \"alert alert-info\"\n when :success then \"alert alert-success\"\n when :alert then \"alert alert-danger\"\n else \"alert aler...
[ { "docid": "838b18623435a03256f97f7c4c6e96e6", "score": "0.86063063", "text": "def bootstrap_class_for_flash(flash_type)\n case flash_type\n when \"success\" then \"alert-success\"\n when \"warning\" then \"alert-warning\"\n when \"error\" then \"alert-danger\"\n when \"alert\" then \"ale...
9f96d9f603f6616f8968c718bc7d75b9
being a personal service, we're storing the locale in the session. YES, we're breaking the web
[ { "docid": "3265ce7e4441fc36b302080a14988027", "score": "0.7623279", "text": "def extract_locale_from_session\n session[:locale] || nil\n end", "title": "" } ]
[ { "docid": "36cf78b1cd67498f9ac1ee7f98cd550e", "score": "0.7936122", "text": "def set_locale\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\">>>>\"}\n\t\t#puts \"set_locale:params[:locale]=#{params[:locale]}\"\n\t\tif params[:locale]\n\t\t\tI18n.locale = params[:locale]\n\t\t\t...
24e3de4c1373a15b37b3a00112e0974c
Set this deployment to gracefully stop by marking all nodes to the skipped state instead of running new tasks. Optionally, the reason of the stop can be provided.
[ { "docid": "cd0f3a7c43b170abf37e9e9b336305f6", "score": "0.68804497", "text": "def gracefully_stop!(reason='unknown reason')\n return if @emergency_brake\n warn \"Setting the deployment to gracefully stop. Reason: #{reason}\"\n @emergency_brake = true\n end", "title": "" } ]
[ { "docid": "1a5988c6a88b1b014ba91114895fe36f", "score": "0.5907325", "text": "def gracefully_stop(node)\n if gracefully_stop? && node.ready?\n node.set_status_skipped\n hook 'post_gracefully_stop', node\n end\n end", "title": "" }, { "docid": "43d36909429c8acf0b642...
712891e3dbf40167a01067c1c4c1e8ad
Rotates the wheel and returns self. Suitable for chaining
[ { "docid": "1533f4a751c09566fdf8b55a4fcc4883", "score": "0.5570198", "text": "def rotate!(count = 1)\n cycles.rotate!(count)\n self\n end", "title": "" } ]
[ { "docid": "8b75042a9a20bde5b260f05faf59af91", "score": "0.6934801", "text": "def rotate\n orientation.transform(self)\n self\n end", "title": "" }, { "docid": "599f54abf6b20046453d52285a61a462", "score": "0.64807945", "text": "def wheel\n @wheel ||= Wheel.new(rim, ti...
e2bd8ad6232e0cc720ad88cfa5c6ab4e
AKK Could this move into an RSpec let?
[ { "docid": "b145846c791f5763c1bdbb2e7bbc59f9", "score": "0.0", "text": "def connection\n @connection ||= Chronologic::Client::Connection.new('http://localhost:7979')\n end", "title": "" } ]
[ { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.6604848", "text": "def spec; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.6604848", "text": "def spec; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "sc...
92e51e4cd8c521ec9eb0b0f837c9c6e0
Key based access to query parameters. Keys can be strings or symbols.
[ { "docid": "ac6f1ba276fdb1a864f4d2719a6c2ee7", "score": "0.0", "text": "def params\n @params ||= begin\n hash = HashWithIndifferentAccess.new.update(get_params)\n hash.update(post_params) if form_data?\n hash\n end\n end", "title": "" } ]
[ { "docid": "ee89ba2c557895b86bca0a0ff254e155", "score": "0.7170897", "text": "def it_keys_to_get_param\n self.it_keys_to_sym\n self.get_url_params = '?'\n\n self.keys.each do |key|\n self.get_url_params = self.get_url_params+'&' unless self.get_url_params.length == 1\n\n # Nested obj_...
f81af3bce4ae929a2d010631ebe8fa8e
p remove_every_other [1,2,3,4,5,6] QQ 54 8 kyu if statement give some discount to rental cars 20 if 3 or more days , 50 more than 7 days
[ { "docid": "144c3e7a100cdad2619b9f774be66943", "score": "0.0", "text": "def rental_car_cost(d) \n\t40*d - (d>6 ? 50 : d>2 ? 20 : 0) \nend", "title": "" } ]
[ { "docid": "5b14e70f382c8d411f1bdbd6dff7044c", "score": "0.6189377", "text": "def trim_soucies(to_be_soucies)\n existing_soucies = SoucyResult.where(:year => @year).all\n to_remove = existing_soucies - to_be_soucies\n to_remove.each { |soucy| soucy.destroy }\nend", "title": "" }, { "docid...
93634cfbe3c3fa3309c09bd58fd7f531
Return NO_TRANSACTION, INVALID_TRANSACTION, OP_RETURN or TRANSACTION_MINED
[ { "docid": "be8538b8956d3074c4ceeba59a186403", "score": "0.55730677", "text": "def btc_status(source_id)\n url = \"https://blockchain.info/tx-index/#{source_id}?format=json\"\n\n # op_return values begin with 0x6a (op_return code) &\n # 0x20 (length in hex : 32 bytes)\n op_re...
[ { "docid": "a12de7f193a80524018a29cf30aa4006", "score": "0.6844205", "text": "def execute_transaction\n if @sender.balance < @amount || !valid?\n @status = \"rejected\"\n return \"Transaction rejected. Please check your account balance.\"\n elsif @status == \"complete\"\n puts \"Thi...
cf660837323c100485ec749870eb7b6c
Returns an array consisting of the fibonnaci sequence up to n. n must b
[ { "docid": "5035096e2cc6902eeb340fbea3f533d6", "score": "0.79325354", "text": "def fibonnaci(n)\n seq = []\n a = 1\n b = 1\n \n 1.upto(n) do\n seq << a\n c = b\n b = b + a\n a = c\n end\n \n seq\nend", "title": "" } ]
[ { "docid": "bf5119f8b75aea08315e8742ddab04e8", "score": "0.8442065", "text": "def fibo_array(n)\n f = []\n f[0] = 0\n f[1] = 1\n\n 2.upto(n) { |i| f[i] = f[i - 1] + f[i - 2] }\n\n f\nend", "title": "" }, { "docid": "bf5119f8b75aea08315e8742ddab04e8", "score": "0.8442065", "text"...
2321cf52db6bffac1cf19f008a23c8bd
Sets the attribute node
[ { "docid": "73c6b09c765a4b95a88e7204b958adc3", "score": "0.0", "text": "def node=(_); end", "title": "" } ]
[ { "docid": "8cdadc490663cf6822fa7667f9f91a34", "score": "0.7644235", "text": "def append_attribute(node, attribute, value); end", "title": "" }, { "docid": "8cdadc490663cf6822fa7667f9f91a34", "score": "0.7644235", "text": "def append_attribute(node, attribute, value); end", "titl...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "e7cc4baa936c4b3ed0971349fc60ab53", "score": "0.0", "text": "def report_params\n params.require(:report).permit(:issue_id, :description, :user_id, :picturelink, :latitude, :longitude)\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...
37bd23a7806b32268cad8dcbbdb6fbc8
Helper function: compact the list of arguments Also, remove anything after stop object
[ { "docid": "9ae3d7aaa263b073464faabba312bb77", "score": "0.53846425", "text": "def standarizeList(list)\n hasStopped = false\n list.map { |x|\n hasStopped = true if x.is_a?(Stop) \n hasStopped ? nil : x\n }.compact\nend", "title": "" } ]
[ { "docid": "0e1f559cc15af340ae58b04c66ef103c", "score": "0.67190456", "text": "def compact(*args)\r\n sep = :comma\r\n if args.size == 1 && args.first.is_a?(Sass::Script::List)\r\n list = args.first\r\n args = list.value\r\n sep = list.separator\r\n end\r\n Sass::Script::List....
478afd651a3c133335f828a18bce465d
How many comments per recipe?
[ { "docid": "451b2cdd8045b027177bb5bf724721b0", "score": "0.6855904", "text": "def comments_per_recipe\n db_connection do |conn|\n conn.exec(\"SELECT recipe_id, COUNT(*) FROM comments GROUP BY recipe_id\").to_a\n end\nend", "title": "" } ]
[ { "docid": "3fdec557d6e4b7909c25329083e80d5a", "score": "0.7925571", "text": "def comments_count; end", "title": "" }, { "docid": "79d0e20170882595b1ec5e5da196de39", "score": "0.7622228", "text": "def comment_count\n comments.size\n end", "title": "" }, { "docid": "79...
cf6367621080b7f1e04d3f461a6242c4
Harold is a kidnapper who wrote a ransom note, but now he is worried it will be traced back to him through his handwriting. He found a magazine and wants to know if he can cut out whole words from it and use them to create an untraceable replica of his ransom note. The words in his note are casesensitive and he must us...
[ { "docid": "340c9f70565282f6c5b0f4f6e00a6094", "score": "0.6188153", "text": "def checkMagazine(magazine, note)\n \n status = \"Yes\"\n mag = Hash.new\n last = \"\"\n # if note.uniq.sort == magazine.uniq.sort\n # p \"Yes\"\n # return status\n # end\n\n note_hash = note.uniq.each_with_object...
[ { "docid": "4291c5fcb696798e2f222e51ccdac9ab", "score": "0.74296284", "text": "def checkMagazine(magazine, note)\n note_arr = note.split\n magazine_arr = magazine.split\n p note_arr\n note_arr.each do |word|\n puts \"word is: #{word}, magazine include?: #{magazine_arr.include?(word)}\"\n if ma...
19d630c2e5d271da533784742c89a497
lexer rule t__90! (T__90) (in ANTLRv3Grammar.g)
[ { "docid": "e94ab8c6b33a6ea02dedbb0cf91b0392", "score": "0.7842338", "text": "def t__90!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 35)\n\n type = T__90\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -...
[ { "docid": "93fde6c044749d0a67baaceb673842f9", "score": "0.71191186", "text": "def t__30!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n\n\n\n type = T__30\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\...
7f86de5c45db2a9cee9981428ad778f3
Returns true because variable is a variable.
[ { "docid": "080c5012e54fad0dc7d26644f1689e77", "score": "0.7442939", "text": "def include_variable?\n true\n end", "title": "" } ]
[ { "docid": "5541db8db8394c5a0220ba328e7ed754", "score": "0.8132934", "text": "def invariable?\n true\n end", "title": "" }, { "docid": "a54b4de79cce31cbe9d10456ef20dae3", "score": "0.809465", "text": "def variable?\n return VARIABLE_TYPES.include?(@type)\n end", ...
50cf0f28071d1e8940c8fb4763179485
the amount clintsboard takes as a fee
[ { "docid": "266a07cb8aa1083e8e035fc27c1a9ec7", "score": "0.6668326", "text": "def calculate_fee_amount base_amount\n (base_amount * SITE_FEE_PERCENTAGE).round(2)\n end", "title": "" } ]
[ { "docid": "82847fef8c7c07c5a419920be4c13175", "score": "0.78185445", "text": "def fee\n (amount * 0.005) if amount\n end", "title": "" }, { "docid": "c15b0bcc5707ae93e446d4119270039f", "score": "0.7462014", "text": "def total_fee\n fee + fee2 + fee3 + fee4\n end", "title...
e4038b2820f98d3456beafbfa25e8a49
GET /valleys GET /valleys.json
[ { "docid": "2a5e90d197e3a1a56cc88d21604e7504", "score": "0.61682236", "text": "def index\n @valleys = Valley.all\n end", "title": "" } ]
[ { "docid": "ef3f79d876fa458e302ce4c4db20b37b", "score": "0.62771595", "text": "def index\n @valves = Valve.all\n end", "title": "" }, { "docid": "5ffab59fe64cb7cafe41c9dd4ec0d6c9", "score": "0.6091334", "text": "def values(params={})\n @client.get(\"#{path}/values\", params)\n...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "efc8ec2a160d0432a4b10509910a055f", "score": "0.0", "text": "def set_post\n @post = Post.find(params[:post_id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
50df801a8497432cbbdd6183826e03fa
POST /admin/mileages POST /admin/mileages.json
[ { "docid": "9cf89afeef10a56ffbcd5ef33f84347e", "score": "0.7717498", "text": "def create\n @admin_mileage = Admin::Mileage.new(params[:admin_mileage])\n\n respond_to do |format|\n if @admin_mileage.save\n format.html { redirect_to admin_mileages_url }\n format.json { render json...
[ { "docid": "d85c243f51cfd732c2705ffe391ea488", "score": "0.7023779", "text": "def new\n @admin_mileage = Admin::Mileage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_mileage }\n end\n end", "title": "" }, { "docid": "e31c2...
80b678538344694eda639ed5ce3f5deb
def on_entityref(ref) rep = PredefinedEntity[ref] if rep then
[ { "docid": "850dd57a2e62974be9a1f279d56a72f0", "score": "0.0", "text": "def on_stag(name, *a)\n @elem.push name\n @visitor.on_stag name\n @attr.clear\n end", "title": "" } ]
[ { "docid": "38089e65539e96d8daf010212347a242", "score": "0.65767723", "text": "def get_referent() get_entity_of_type(Entity::REFERENT) end", "title": "" }, { "docid": "4438e5828acc31d603d2f2325a4c7ee3", "score": "0.63055694", "text": "def resolve_reference; end", "title": "" },...
bd3a7dfddc30bc69012064ac1ec450c4
Given a hash with numeric values, return the key for the smallest value
[ { "docid": "e3b1783390880ebb52304cba6243c59c", "score": "0.0", "text": "def key_for_min_value(name_hash)\nlowestValue = 0\nlowestKey = nil \n\nname_hash.each do |key, value|\n if lowestValue == 0 || value < lowestValue\n lowestValue = value\n lowestKey = key\n end\n end\nlowestKey\nend", "t...
[ { "docid": "187165074e32a7573ee53a9cabb44ed4", "score": "0.8880233", "text": "def key_for_min_value(hash)\n lowest_key=nil \n lowest_value= Float::INFINITY\n hash.each do |name,number|\n if number < lowest_value\n lowest_value=number\n lowest_key= name\n end \n end\n lowest_key\nend...
ef40a0b3a26678ace360d990830433df
GET /design_directories/new GET /design_directories/new.xml
[ { "docid": "4d256ebca68b3b43657016d0db09876e", "score": "0.77857566", "text": "def new\n @design_directory = DesignDirectory.new\n logger.info \"In new\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @design_directory }\n end\n end", "tit...
[ { "docid": "7d6e2f34ecc7065e384ad9fd69c541c8", "score": "0.7125259", "text": "def new\n @directory = Cmtool::Directory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @directory }\n end\n end", "title": "" }, { "docid...
005b889c47318e030589b8770ad713c0
provide definition for the report method in associable
[ { "docid": "d3fbb4686b2c9cc09887f5b6eb2ac567", "score": "0.6517547", "text": "def report_definition\n\t\treport_def = {\n\t\t\tname: {difficulty: 40, approximator: \"none\", field_name:\"name\", max_datum:nil},\n\t\t\tdescription: {difficulty: 40, approximator:\"none\", field_name:\"description\", max_d...
[ { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.7848885", "text": "def report; end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", "score": "0.7848885", "text": "def report; end", "title": "" }, { "docid": "eae69c38dabf6ad22757d37c721037ae", ...
f0bc75d7a527bd2258c8e7d28b3d5b8b
Public: Creates a json partial and defines the format so we don't get a deprecation warning. Returns the rendered json partial.
[ { "docid": "d03a610b05e959b1d02f82a3b9d629a5", "score": "0.7420757", "text": "def json_partial!(json, template, locals)\n json.partial!(partial: template, formats: :json, locals: locals)\n end", "title": "" } ]
[ { "docid": "5a469b82edfc39a0c8619bbcadd3ca7f", "score": "0.75140464", "text": "def json_partial!(json, template, locals)\n json.partial!(partial: template, formats: [:json], handlers: [:jbuilder], locals: locals)\n end", "title": "" }, { "docid": "71aa0fc9db6becc0fa8045d510e336ff", "...
0e4c0fedc8cef002f54489d6dccc2ae4
DELETE /showcase_items/1 DELETE /showcase_items/1.json
[ { "docid": "c7c9ac37d26fe7564e8447f93bc004f1", "score": "0.77248055", "text": "def destroy\n @showcase_item.destroy\n respond_to do |format|\n format.html { redirect_to showcase_items_url, notice: 'Showcase item was successfully destroyed.' }\n format.json { head :no_content }\n end\n...
[ { "docid": "7ba3ffc3f842560fa1fbcad79adc92a0", "score": "0.7455394", "text": "def delete_item\n @item.destroy!\n render json: { }\n end", "title": "" }, { "docid": "85de423f1f24305391029737d0265f61", "score": "0.7360406", "text": "def destroy\n item = Item.find(params[:id])...
cbc326d7b1f49aec0a4c8189e4826bad
changes color by t=true/false Returns whatever color is given in the 2nd and 3rd attribute Defaults to tcolor="green" and fcolor="gray" Useful for changing background/foreground colors on object lists with boolean attributes.
[ { "docid": "d802edef6587ff1dccbc87d6f12ba209", "score": "0.7833494", "text": "def set_color(t,tcolor=\"green\",fcolor=\"gray\")\n if t\n tcolor\n else\n fcolor\n end\n end", "title": "" } ]
[ { "docid": "fae7aff8fed266d19126330e2623dced", "score": "0.62972", "text": "def green=(value)\n end", "title": "" }, { "docid": "d00128c16b23f21ccb56755c489907f4", "score": "0.62703776", "text": "def green?\n\t\t@color == 'green'\n\tend", "title": "" }, { "docid": "851...
321ccb30377b0d9bb4c185bb3f368e3c
PUT /admin/rs_imports PUT /admin/rs_imports.json
[ { "docid": "01066a606aab471636b60ec0f2fcb9e0", "score": "0.0", "text": "def create\n @playlist = Admin::RsImport.create_playlist\n @admin_rs_import = Admin::RsImport.new(params[:admin_rs_import])\n\n if @admin_rs_import.valid?\n @album = @admin_rs_import.create_album!\n\n respond_to d...
[ { "docid": "422e03eab69cea2c3d2aceab3cfbdbc7", "score": "0.66018057", "text": "def member_imports\n imports = params[:imports].nil? ? [] : params[:imports]\n head :ok, format: :json if imports.empty?\n #\n # binding.pry\n # 1\n begin\n imports.each do |import|\n doc = Docum...
0f54768fc0f63b9c78e9388b33752760
resource_provider should not be allowed.
[ { "docid": "f8ef6974af24f975e6fa317e75f0642b", "score": "0.0", "text": "def test_resource_provider_not_ok\n assert_raises(ArgumentError) { AzureEventHubEventHub.new(resource_provider: \"some_type\") }\n end", "title": "" } ]
[ { "docid": "4a1e1e586d4e19114f529220dddc75de", "score": "0.68951213", "text": "def resource_provider?\n true\n end", "title": "" }, { "docid": "6e66880c7d214d343c297c44b11eadef", "score": "0.6641168", "text": "def resource_consumer?\n false\n end", "title"...
2c4469da0cb6a04c82ad2f37fe5e280d
DELETE /prospectts/1 DELETE /prospectts/1.json
[ { "docid": "2fa757b9119e6753971dee493b42e81d", "score": "0.75173926", "text": "def destroy\n @prospectt.destroy\n respond_to do |format|\n format.html { redirect_to prospectts_url, notice: 'Prospectt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "c84d63c237f591ab20c28f80f0c3a1e3", "score": "0.77521116", "text": "def destroy\n @prospect = Prospect.find(params[:id])\n @prospect.destroy\n\n respond_to do |format|\n format.html { redirect_to prospects_url }\n format.json { head :no_content }\n end\n end", "titl...
d22dd8f63972a0991422fa779653248b
define the arguments that the user will input
[ { "docid": "1c40390c1abb04971a93a430d8021e63", "score": "0.0", "text": "def arguments(model)\n args = OpenStudio::Ruleset::OSArgumentVector.new\n \n #populate choice argument for constructions that are applied to surfaces in the model\n air_loop_handles = OpenStudio::StringVector.new\n ai...
[ { "docid": "c62750f6e8d591e4a244028ec8cd5a7a", "score": "0.7418197", "text": "def arguments\n end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c268e6fd", "score": "0.73753476", "text": "def arguments; end", "title": "" }, { "docid": "49665d066ffcf52f2c37b2b1c26...
75b02462719f784e70a609ac35ba0276
before_action :check_user, only: [:destroy, :create]
[ { "docid": "70de7b4fd9e89ac8475f13664605fb9c", "score": "0.0", "text": "def show\n @message = Message.find(params[:id])\n @picks = @message.picks.all\n end", "title": "" } ]
[ { "docid": "05e40a59fc9ed55434449bfe5229854c", "score": "0.7012128", "text": "def destroy\n before_action :authenticate_user\n @user.destroy\n end", "title": "" }, { "docid": "a686e8b5f0dff82bb0f523686d25fb87", "score": "0.6830848", "text": "def delete_user\n end", "tit...
693c33e85a8317a0c9ef2abd9cbeacb5
Reload translations def reload! reset_stats! super end
[ { "docid": "ad6588fa34e25366d74ee208846ca693", "score": "0.6048182", "text": "def reset_stats!\r\n @@available_locales = nil\r\n @@enabled_locales = nil\r\n @@language_completion = nil\r\n @@all_translation_info = nil\r\n @@datetime_vars = nil\r\n end", "title...
[ { "docid": "034ac1a14159272d09f1e71184d64834", "score": "0.83229727", "text": "def reload!\n @initialized = false\n @translations = nil\n super\n end", "title": "" }, { "docid": "8ecc0bd85d8155dfe067b9da934a60c8", "score": "0.6985637", "text": "def l...
d8020ae32e1f03e77165c5480b2cf4c3
Public: Add a twoway interconnect between the local country, and another. The merit order will be calculated twice; once without accounting for export to the other country, and again including said export. other A Convergence::Archive containing data for the other country. capacity The capacity of the interconnect. Ret...
[ { "docid": "c457268268ddf968056f93be0bd21204", "score": "0.72221065", "text": "def add_interconnect(other, capacity)\n if @interconnects.any?\n fail 'You can currently only add one interconnect!'\n end\n\n @interconnects[other.area] = { archive: other, capacity: capacity }\...
[ { "docid": "3d3a27b785a114118d1ed43d2ed87ff2", "score": "0.5624714", "text": "def connect(other, weight)\n raise ArgumentError.new('Invalid city.') unless other && other.kind_of?(City) && !eql?(other)\n raise ArgumentError.new('Non numeric weight.') unless weight.kind_of?(Numeric)\n \n ...
a6b28be5287cd911f3c7f999dc74aeb3
Returns a list of countries List of possible countries to be used in any other API method. Indended to be used in case you want to restrict results for several countries.
[ { "docid": "d049d6143b3e8dc80b9ada060c1da921", "score": "0.75654864", "text": "def countries_list(opts = {})\n data, _status_code, _headers = countries_list_with_http_info(opts)\n data\n end", "title": "" } ]
[ { "docid": "0ae1a7d60b71589eb24c4e1645621763", "score": "0.7995563", "text": "def list_countries()\n path = '/locale/countries'\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n ...
7c0bb8448066d03f3cbf948836a3334e
Returns true if the user is logged in, false otherwise.
[ { "docid": "be70d9e2f2572b85d49bb87417a80770", "score": "0.0", "text": "def logged_in?\n !current_user.nil?\n end", "title": "" } ]
[ { "docid": "31fb4132def094f5ed9925db932d58eb", "score": "0.89972186", "text": "def user_is_logged_in\n if session[:current_user] != nil\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "5e8797ab67adadcb571fb446716121fe", "score": "0.8901693"...
3e357f23ea72ec4ae7e758ff7afb6620
linear momentum of mass at velocity_ (vector in kg m^2)
[ { "docid": "7fad3ec1af07fd5082acd40e6beeb27b", "score": "0.8157048", "text": "def momentum_(mass, velocity_)\n mass * velocity_\n end", "title": "" } ]
[ { "docid": "8d7e76d53f2863a3e9e3f8523f926f18", "score": "0.6906949", "text": "def momentum_relativistic(mass, speed)\n lorentz_factor(speed) * mass * speed\n end", "title": "" }, { "docid": "240974d21b73b5d0ed36b619fab4d6d4", "score": "0.66441774", "text": "def angular_momentum_r...
bf15b69dde6111df5fe3cbfe29775483
Call block for every tuple removed from this set in the future. In other words, the block may be called even after this method returns. The block will be called with two parameters, the index of the tuple followed by the tuple itself. If both parameters are nil, everything has been removed (cleared) Note: Only one +blo...
[ { "docid": "d0991b56da4f7ec6ab220181dc6343a4", "score": "0.63110995", "text": "def on_remove_with_index(&block)\n @onRemoveBlockWithIndex = block\n end", "title": "" } ]
[ { "docid": "9546e894572856261e77de2b4082ef55", "score": "0.60327524", "text": "def keep_if( &blk )\n del = []\n length.times { |i|\n del << i unless blk.call at(i)\n }\n # Do it in reverse order so earlier removals don't muck\n # with the indices\n del.reverse.each {...
23084b50a10afdaeeec2f35a86d21cf5
GET /Locator GET /Locator.json
[ { "docid": "acbaee63ddd5bb1056fbdbaeb7686ec0", "score": "0.0", "text": "def index\n if(params[:search])\n case params[:type]\n when \"brand\"\n @locators = search(params[:type],params[:searchcontent])\n when \"css\"\n @locators = search(params[:type], params[:searchconten...
[ { "docid": "3dc276ec5c56588b75d8c41a4b6217fc", "score": "0.65286124", "text": "def locations\n get('locations')\n end", "title": "" }, { "docid": "2f65d9405d24f343bd6784696053f912", "score": "0.6471151", "text": "def get_location\n as_json(get_results('/locations.json'))\n en...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "007d94d9ee412be4103668bf0b7ea73f", "score": "0.0", "text": "def set_travel_leg\n @travel_leg = TravelLeg.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
60aa76c7db672fb3e02898ae1f2ce555
Temporarily register sets of objects Use this method to marshal sets of objects that could be referencing each other. Using this method ensures that the crossreferences are marshalled using IDs instead of full objects
[ { "docid": "bb4fe6f7bddb55f214138700f60ec0a4", "score": "0.0", "text": "def dump_groups(*groups)\n current_context = context_objects.dup\n mappings = groups.map do |collection|\n mapping = []\n collection.each do |obj|\n ...
[ { "docid": "2b8cd0802609af9bc7dceb7ade5d41cd", "score": "0.6641124", "text": "def register_references_to(live_objects, options = Hash.new)\n orig_options = options # to exclude it from the graph\n options = Kernel.validate_options options,\n :roots => [Object], :excl...
62d5d8800df92e0bb8236a95468e394a
Returns the options hash
[ { "docid": "6ed74dba296959aab9f4c8db61819588", "score": "0.0", "text": "def options\n @options ||= Options.new\n end", "title": "" } ]
[ { "docid": "734a3035c8ca1021602843bd3e3053aa", "score": "0.8584957", "text": "def options\n Hash[*OPTIONS_KEYS.map{ |key| [key, send(key)] }.flatten(1)]\n end", "title": "" }, { "docid": "9c557f07fa3a5e421bd755530c756337", "score": "0.8504009", "text": "def options\r\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f98d7b583679a7207e8aedb18bed1668", "score": "0.0", "text": "def set_dummy2\n @dummy2 = Dummy2.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f0f8dd815005bc4a3007f95e9d1d2600", "score": "0.0", "text": "def set_notegood\n @notegood = Notegood.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;...
780aea9589f2f7d8b2bff3775ef06f52
model The model to perform queries on. options A hash of options for the iterator. query An array of nested queries. filters A hash of filters (only/except). current_page The current page to be paginated.
[ { "docid": "74942934fccf75d9ff5f3759bb081bc9", "score": "0.6251094", "text": "def initialize(model, options = {})\n @model = model\n @options = options\n @queries = @options[:query] || []\n @filters = @options[:filters] || {}\n end", "title": "" } ]
[ { "docid": "64fc0b7a35458fdbb6a7748d2fad3877", "score": "0.66926926", "text": "def get_paginated(options = {})\n begin\n select = options[:select] || \"*\"\n items_per_page = options[:items_per_page].to_i || 10\n model = options[:model]\n count = model.count.to_i\n number_of_...
249a06988da57db196204c3903b337d0
Iterates over the results collection
[ { "docid": "518d9282abebccdeb4a9b704a49cf7f5", "score": "0.0", "text": "def each(&block)\n hits.each(&block)\n end", "title": "" } ]
[ { "docid": "bf9931477428e018be07a70feb87356c", "score": "0.7894247", "text": "def each\n @results.each { |x| yield x }\n end", "title": "" }, { "docid": "5ae62b6cb1155018fa41ec8b9e44fe69", "score": "0.78509086", "text": "def each(&block)\n @results.each(&block)\n ...
18f4d3651b936004bfff6f46f81931f1
GET /store_items GET /store_items.json
[ { "docid": "7e354fc86c5c526ade1ae1eae9718bdf", "score": "0.7447529", "text": "def index\n @store_items = StoreItem.all\n end", "title": "" } ]
[ { "docid": "1e5fd7abd858114b131dde3467b11f7a", "score": "0.77908856", "text": "def index\n\t\t@store_items = StoreItem.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @store_items }\n\t\tend\n\tend", "title": "" }, { "docid": "5971c6d31...
9ac767a90732d2656652c1a824881e2e
0 examples, 0 failures?? all examples filtered out? STRETCH croon seperates word characters with dashes preserves whitespace between words
[ { "docid": "f6e71971e34588de50a673504ed81ae2", "score": "0.0", "text": "def croon sentence\n separate = sentence.split(\" \").map do |word|\n word.split(\"\").join(\"-\")\n end\n separate.join(\" \")\nend", "title": "" } ]
[ { "docid": "f9a0062e821758e4738093713386b91c", "score": "0.6909171", "text": "def sub_bad_words\n\n end", "title": "" }, { "docid": "bfffee5d1e933839a38f122313119e12", "score": "0.6904851", "text": "def test_words_without_spaces\n @words = @tester.words(number: 1000)\n @words....
c2a02232d42db8b79f9629074a91fcf7
Delete courses marked for destroy
[ { "docid": "6b84e6b104a332577e172c56f231551f", "score": "0.7239525", "text": "def delete_courses(courses_array)\n courses_array.each do |course|\n course_id = course[\"id\"]\n if course[\"user_deleted\"] == \"1\"\n Course.where(id: course_id).delete\n reservations = ...
[ { "docid": "649142710bf4cb91e5e916b61c763c9e", "score": "0.8061569", "text": "def destroy\n @course.destroy\n end", "title": "" }, { "docid": "649142710bf4cb91e5e916b61c763c9e", "score": "0.8061569", "text": "def destroy\n @course.destroy\n end", "title": "" }, { ...
c53841e9e02c08d4259ad240d0691ed6
water, food, hill, ant, row, col
[ { "docid": "c12d8df6c9554abe9de6a48ed64ef6f0", "score": "0.60684913", "text": "def initialize(opts)\n @water = opts[:water]\n @food = opts[:food]\n @hill = opts[:hill]\n @ant = opts[:ant]\n @row = opts[:row]\n @col = opts[:col]\n end", "title": "" } ]
[ { "docid": "146fc25486aa5ad040130471e6d12702", "score": "0.6471291", "text": "def animal_housing\n result = []\n tiles_with_type(:stabled).each do |position,tile|\n result << {row: position[0], column: position[1], capacity: 1}\n end\n result\n end", "title": "" }, { "docid...
56b31e277d1387c121f6f6e5611427b2
returns randomly generated 6 character code
[ { "docid": "f6408bb6a579f557a70d8789c849fe2f", "score": "0.757985", "text": "def generate_accessCode\n return ((0..9).to_a + (\"a\"..\"z\").to_a).shuffle[0..5].join(\"\")\n end", "title": "" } ]
[ { "docid": "8661c39deb3d774e5d5c9c71ce7e128b", "score": "0.8225227", "text": "def generate_string\n (0...6).map{(65+rand(26)).chr}.join\n end", "title": "" }, { "docid": "4e4beda6986deca3d7922aa69c485849", "score": "0.7939632", "text": "def random_string\n (0...8).map { (6...
93cfb30ff3bb992842cac146927099c6
Remove contacts from a group
[ { "docid": "6567e2f06403d960250ae2d15ef0b001", "score": "0.6688948", "text": "def remove_contacts_from_group(group_id, update_group_contacts, opts = {})\n data, _status_code, _headers = remove_contacts_from_group_with_http_info(group_id, update_group_contacts, opts)\n data\n end", "titl...
[ { "docid": "281abf0e19778418cf6a1d55bbef1eff", "score": "0.728502", "text": "def contact_remove_from_group(contact_id, group_id)\n response = xmlrpc('ContactService.removeFromGroup', contact_id, group_id)\n end", "title": "" }, { "docid": "2f6c94051fd62ffc4c6595ca85b7677c", "...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "06a8167f9df80c5be4408ef21b3d7956", "score": "0.0", "text": "def set_my_thing\n @my_thing = MyThing.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "021c10deb1b3fc66b23889ce7d597b80", "score": "0.0", "text": "def user_params\n params.require(:user).permit(:username, :name, :email)\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...
7e610e22ea86de937a71226f63d86a36
e.g.: [3, 4, 2]
[ { "docid": "cad4cdb5182f7c0190f63e577c7426e4", "score": "0.0", "text": "def init_weights\n @weights = Array.new(@layers.length-1) do |layer_index|\n from_len = @neurons[layer_index].length\n to_len = @layers[layer_index+1]\n Array.new(from_len) do |i|\n Array...
[ { "docid": "314d6f119c71646bf39f365dd40e7a36", "score": "0.74240035", "text": "def array_list\n a=[3,2,2,1]\nend", "title": "" }, { "docid": "2aee378be36713170aaedddb363e1264", "score": "0.6170966", "text": "def test_collect_int\n assert_equal [4, 3, 10], @triple.collect { |e...
174e4238b45a935b5a58e0751bd98623
Creates a new colorizer using the given colors
[ { "docid": "e6775fe5cf8dcadc9ce7f4f91de4abda", "score": "0.64694667", "text": "def initialize (*colors)\n @colors = colors.flatten\n @colors = [nil] if @colors.empty?\n @count = -1\n end", "title": "" } ]
[ { "docid": "c9809e1530d741bcb4047c4ab2467176", "score": "0.6468703", "text": "def colorize(* colors)\n buff = []\n colors.each{|color| buff << color_code(color)}\n buff << self << color_code(:off)\n buff.join\n end", "title": "" }, { "docid": "d615be44ddb9caa05bbb4eed4d7ad5bd", ...
15e744862a0b2b459badab81a8aebfa2
DELETE /book_categories/1 DELETE /book_categories/1.json
[ { "docid": "1635522d888a8f8aef611b28ceb0f01d", "score": "0.77174795", "text": "def destroy\n @book_category = BookCategory.find(params[:id])\n @book_category.destroy\n\n respond_to do |format|\n format.html { redirect_to book_categories_url }\n format.json { head :no_content }\n en...
[ { "docid": "3e2cde3ef473b76d3b8417e6613341be", "score": "0.77236176", "text": "def destroy\n @books_category = BooksCategory.find(params[:id])\n @books_category.destroy\n\n respond_to do |format|\n format.html { redirect_to books_categories_url }\n format.json { head :no_content }\n ...
19989031c4aeef772bba54ff92e454de
from 8 out of ten cats
[ { "docid": "64ab41390c1162ba599d4336e0fdca79", "score": "0.0", "text": "def test_can_solve_connundrum\n @solver.solve(\"randybush\")\n assert_equal('husbandry', @solver.connundrum)\n end", "title": "" } ]
[ { "docid": "c07ccf92e098b674156bb2dd5b19e0c4", "score": "0.6698981", "text": "def cats_n_hats\n cats = Array.new(100, false)\n round = 1\n\n while round <= 100\n cats.each_with_index do |cat, i|\n if i % round == 0\n cats[i] = !cats[i]\n end\n end\n round += 1\n end\n\n resu...
9aabfeb5cf7186e8ea8cdb225ff56df0
DELETE /book_rented_infomations/1 DELETE /book_rented_infomations/1.json
[ { "docid": "ee21d3f1728417a360d5b3d4f4aedf1b", "score": "0.7850654", "text": "def destroy\n @book_rented_infomation.destroy\n respond_to do |format|\n format.html { redirect_to book_rented_infomations_url, notice: 'Book rented infomation was successfully destroyed.' }\n format.json { hea...
[ { "docid": "f7771f37fe32885f557aa9a5c8d185e1", "score": "0.7071782", "text": "def destroy\n @book.book_identifier.delete rescue nil\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "title": "" }...
6810be50f9e7bd817c9f1d9ef82ee51a
Install a package from a specified dmg
[ { "docid": "1d1a07a71f022ffb8726f7780cc4c51e", "score": "0.79490393", "text": "def generic_install_dmg(dmg_file, pkg_base, pkg_name)\n execute(\"test -f #{dmg_file}\", :accept_all_exit_codes => true) do |result|\n execute(\"curl -O #{dmg_file}\") unless result.exit_code == 0\n end\n dmg_na...
[ { "docid": "389bce2d7033fac617f930b92c318bd5", "score": "0.79390496", "text": "def install!\n src = package_source\n chk = package_checksum\n dmg_package 'Chef Development Kit' do\n app ::File.basename(src, '.dmg')\n volumes_dir 'Chef Development Kit'\n ...
12fe80c3864c7d0eea435802343845bb
GET /calculatos/1 GET /calculatos/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "b2c1181347b0d0d4140c9ae81a0335a2", "score": "0.71827716", "text": "def show\n @calcmecanico = Calcmecanico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calcmecanico }\n end\n end", "title": "" }, { "d...
871de4c380d8962939ab591c5913d205
Deletes a [custom attribute]($m/CustomAttribute) associated with a customer profile. To delete a custom attribute owned by another application, the `visibility` setting must be `VISIBILITY_READ_WRITE_VALUES`. Note that sellerdefined custom attributes (also known as custom fields) are always set to `VISIBILITY_READ_WRIT...
[ { "docid": "76109a49067d46f1483ea3b07b5c713c", "score": "0.63219243", "text": "def delete_customer_custom_attribute(customer_id:,\n key:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::DELETE,\n ...
[ { "docid": "13edaaaa57f420a3d9eb35f0ae28fa3a", "score": "0.6566492", "text": "def destroy\n @customizable_attribute.destroy\n respond_to do |format|\n format.html { redirect_to(admin_customizable_attributes_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_use...
d9067ab0f1b6555a22ca16ffab67fb1f
DELETE /assert_accounts/1 DELETE /assert_accounts/1.xml
[ { "docid": "780c3e51d884e4ed7eb25b793696c774", "score": "0.75093114", "text": "def destroy\n @assert_account = AssertAccount.find(params[:id])\n @assert_account.destroy\n\n respond_to do |format|\n format.html { redirect_to(assert_accounts_url) }\n format.xml { head :ok }\n end\n ...
[ { "docid": "3feaeabdf61312a33502b61af2c19927", "score": "0.6891719", "text": "def destroy\n @assertion = Assertion.find(params[:id])\n @assertion.destroy\n\n respond_to do |format|\n format.html { redirect_to(assertions_url) }\n format.xml { head :ok }\n end\n end", "title": ...
9aadff37ec74e85e2872debd915fd00f
create XML parameters needed for upload_document
[ { "docid": "01afc95725a71d222b9cf1fd6696985a", "score": "0.70263886", "text": "def create_pdf_xml_params(first_name, last_name, file_name, bytes_read,\n offset, upload_done, docs_guid, encounter_id, organization_name=\"TouchWorks\")\n xml = Builder::XmlMarkup.new(:inden...
[ { "docid": "1dfd1ead4d0b28bf7c1d8c45aa70704c", "score": "0.6917446", "text": "def xml_upload_params\n if user_signed_in? and current_user.admin?\n params.require(:transcription_xml).permit xml: []\n else\n redirect_to new_user_session_path\n end\n end", "title": "" ...
96eddbd4aeaf361336cb429831df4842
Validator Expression tree is valid in case their children are valid if any
[ { "docid": "42fe358ebd9ab6ff2bee5b712f657981", "score": "0.6812691", "text": "def valid?\n children.inject(true) {|result, el| result && el.valid?}\n end", "title": "" } ]
[ { "docid": "7376938a77cff0435ae5f03e248505f9", "score": "0.6582111", "text": "def rec_valid_tree(tree)\n \tvalid = true\n \ttree.for_each_instance do |x| \n \t\tvalid_parent_child(tree,x)\n \t\trec_valid_tree(x) \n \tend\n \treturn valid\n end", "title": "" }, { "docid": "d99f6559adfe...
97f83db119f3be6b2b997819d29e6a7f
Sends password reset email.
[ { "docid": "8fe79939ec14f8b90a55608683d8e197", "score": "0.0", "text": "def send_password_reset_email\n # self is an instance of User, aka a row/entry in the User table\n UserMailer.password_reset(self).deliver_now\n end", "title": "" } ]
[ { "docid": "65d563a0c2f974f94de3f9623c238910", "score": "0.8790497", "text": "def send_password_reset_email\n\t\tUserMailer.password_reset(id, self.reset_token).deliver_later\n \tend", "title": "" }, { "docid": "d82937c4c1cc57921864ccbd6751518c", "score": "0.86796135", "text": "def ...
b20b5686c024073cff6892c9d91083f2
Returns a boolean indicating whether the colour provided is a valid named colour.
[ { "docid": "88a4f75b6881d80771a3715891f03472", "score": "0.76717937", "text": "def valid_name?\n Vedeu::EscapeSequences::Esc.codes.keys.include?(colour)\n end", "title": "" } ]
[ { "docid": "459113d517a6bd75a46f3e6bf7dafa79", "score": "0.7995459", "text": "def valid_name?\n Esc.codes.keys.include?(colour)\n end", "title": "" }, { "docid": "15d4c5db6277d65739677a1c05bdd7c9", "score": "0.7847293", "text": "def is_valid_color?(color)\n color == color....
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "98bc7a3df399817e68e23ea8b8cae3ec", "score": "0.0", "text": "def enter_params\n params.require(:enroll).permit(:promotion_id, :name,:tel, :content)\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...
e7513ae9b309b0092b6601e3f6b4d2be
START JOURNEY AND FINISH JOURNEY
[ { "docid": "bddaa340f65ba70503fae80dd975f5d4", "score": "0.0", "text": "def start(entry_station, zone)\n @journey_class = Journey.new(entry_station, zone)\n end", "title": "" } ]
[ { "docid": "c93da0932f31a73151965da63c60ebde", "score": "0.65445566", "text": "def run\n start\n jetty.join\n end", "title": "" }, { "docid": "9991e122637394b416b7d60f5fd7c897", "score": "0.62825525", "text": "def begin!\n start_server\n end", "title": "" }...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "94bb06b069e0a9bedb9b583c60b61d31", "score": "0.0", "text": "def set_tweet\n @tweet = Tweet.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.61642385", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60448", "text": "def action_hook; ...
7764726b04451341cd32916ceded831a
no input bufs, only output bufs
[ { "docid": "5f2ec0c427395652afd371b2041f6920", "score": "0.0", "text": "def local_flush\n flush_output\n end", "title": "" } ]
[ { "docid": "869acb11a569f23df21056e69aee0ed8", "score": "0.69744855", "text": "def output_buffer; end", "title": "" }, { "docid": "8dd757166920951e3debe3402075f30a", "score": "0.6876274", "text": "def output_buffer=(_arg0); end", "title": "" }, { "docid": "231767707924829...
5316c4cddc770804c844e4a12e2e317e
B L O C K E X T E N S I O N
[ { "docid": "58edef019113c6271db748afb3245d06", "score": "0.0", "text": "def test_should_take_a_block_containing_ar_extention\n assert_equal authors(:larry), page_versions(:welcome_1).author\n end", "title": "" } ]
[ { "docid": "afbc4c54dabf4c09a70792d90ead3525", "score": "0.595392", "text": "def sn\n end", "title": "" }, { "docid": "14b1e93abb94798f11ca7e1be0745929", "score": "0.5888839", "text": "def sn(*) end", "title": "" }, { "docid": "ca46c12d90b88c8a101b179c5ed44708", ...
44aa5abb6657c83455c449aeb900864e
When an invalid token is provided, it responds with 401 Unauthorized When an invalid token is provided, it does not call the downstream app
[ { "docid": "a1b17d80507bab36077f491df505fe26", "score": "0.7474396", "text": "def test_invalid_token\n downstream_called = false\n user_repo = UserRepo.new\n app = TestApp.new(Authorize, user_repo) do |env|\n downstream_called = true\n [200, {}, ['Downstream called']]\n end\n\n ...
[ { "docid": "c35acd2cebb881be29099c6f7005f8c9", "score": "0.76165175", "text": "def rescue_invalid_auth_token\n render plain: \"Invalid authenticity token.\", status: :bad_request\n end", "title": "" }, { "docid": "83b57a829749bdcca7befd4393d9be37", "score": "0.75854015", "text": ...
c444e85b49e20d128019e6ca53126210
Gets the percent complete of the current live install processes. Note: You may wish to use get_software_status instead of this method as it returns more information, such as the product, version, and build, along with the "percent complete"/status field.
[ { "docid": "6389d5d85836d38b9a0b6948590f57a6", "score": "0.0", "text": "def live_install_completion(opts)\n opts = check_params(opts,[:installation_ids])\n super(opts)\n end", "title": "" } ]
[ { "docid": "65c10e97f8b780e9ffabc6e37e71e51a", "score": "0.64021105", "text": "def percent_complete\n xml = @client.get_request(\"/services/search/jobs/#{@sid}\")\n doc = Nokogiri::XML(xml)\n progress = doc.xpath(\"//s:key[@name='doneProgress']\").text\n return \"#{progress}/...
45c1e92635fb8071a44e2d1cc4b3677b
Helper method to provide a simple way of performing requests with support for partial failures. Executes a block of code with partial failures enabled and/or returns the current status of the property. Args: accepts a block, which it will execute as a partial failure operation Returns: block execution result, if block ...
[ { "docid": "dbf93f1339740daef8f889e91bd7dce7", "score": "0.7360487", "text": "def partial_failure(&block)\n return (block_given?) ?\n run_with_temporary_flag(:@partial_failure, true, block) :\n @credential_handler.partial_failure\n end", "title": "" } ]
[ { "docid": "2ee8c8381cc2c7dd25244b5f73d8f8ea", "score": "0.73627204", "text": "def partial_failure(&block)\n return (block_given?) ?\n run_with_temporary_flag(:@partial_failure, true, block) :\n @credential_handler.partial_failure\n end", "title": "" }, { "docid": "e2f5...
61c89fe86fa279e1cc341a74a40b358d
Deserializes the data based on type
[ { "docid": "c4f37dc03d8b98306d3ae89411050717", "score": "0.0", "text": "def _deserialize(type, value)\n case type.to_sym\n when :Time\n Time.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n ...
[ { "docid": "8310779c7783e884ba8c96184c4c100f", "score": "0.7330926", "text": "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n valu...
2de99a0aa001122a837138d5e0b30cca
string interpolation is auto doing conversion to proper format for injecting it in this string the CASE statement in Ruby. case
[ { "docid": "0c77edc022884335ee0ef2d40f56dc9f", "score": "0.0", "text": "def rate_food(food)\n case food\n when \"Steak\"\n \"Pass the stack sause! Delicious!\"\n when \"Sushi\"\n \"Great choise, my favouirete food!\"\n when \"egss\", \"pizza\", \"barbecue\"\n \"even bett...
[ { "docid": "f6104ebf84ce268320cdccf41f0144ea", "score": "0.6235178", "text": "def map_format(str)\n case str\n when \"article\", \"newspaper_article\", \"review\"\n then \"Article\"\n when \"book\" then \"Book\"\n when \"dissertation\" then :dissertation\n end\n end", ...
f8882c845527446a23ed2b1ec1aeb25d
Allow comparison with an Array, otherwise do the normal thing
[ { "docid": "74e5e8093b3f7a28fa8f679742422f2c", "score": "0.6745925", "text": "def ==(other)\n\t return @elements == other if other.is_a?(Array)\n\t super other\n\tend", "title": "" } ]
[ { "docid": "af3c3a9e4623ab32a3b225e206405481", "score": "0.7475854", "text": "def ==(array); end", "title": "" }, { "docid": "41498d6e2400d3368f7ed076e3f13fb4", "score": "0.7240807", "text": "def array_equals(array1, array2)\n raise NotImplementedError\nend", "title": "" }, ...
991f87d82cf2c78c77004660bd5b89d6
WHEN TESTING DELAYED JOBS, REMEMBER TO START DAEMON IN COMMAND LINE WITH bin/delayed_job start (or status, stop) Run "rake jobs:clear" to clear all DJs Run Delayed::Job.all in Rails Console to see DJs
[ { "docid": "a01a28daae561133079880e32a95c185", "score": "0.0", "text": "def sms # Send SMS to task recipients\n @task = Task.find_by_id(params[:id]) # SMS get view\n\n # Action itself\n @task.schedule_sending_text \n flash[:notice] = \"Task scheduled!\"\n end", "title": "" } ]
[ { "docid": "5e46eeb9b080290acbba32061a7c188d", "score": "0.67136806", "text": "def wait_for_delayed_job_to_start\n sleep(0.5)\n pid = Daemons::PidFile.new(\"#{Rails.root}/tmp/pids\", 'delayed_job.0')\n count = 0\n while !pid.running? && (count < 10)\n sleep(0.5)\n count += 1\n e...
8533199bcdf2c3701ee997ab669565f7
Run a Task or Taskset
[ { "docid": "db99dccf11d13689a0f1f9e73da17b1f", "score": "0.0", "text": "def run(taskset, timeout = nil, async = false)\n timeout ||= 0\n use_em_stop = EM.reactor_running?\n EM.run do\n @taskset ||= Taskset.new\n @taskset += Taskset.create(taskset)\n\n job_servers = @j...
[ { "docid": "178596aed1afc7c1db5563e9332efbae", "score": "0.6996137", "text": "def run_set(set)\n set_tasks = @tasks[set]\n\n return true if set_tasks.empty?\n\n @playbook.in_context(set) do\n Log.info(\"About to run task set %s with %d task(s)\" % [set, set_tasks.si...
d804d05406b477055689c08ac5b0a839
PATCH/PUT /r_property_definitions/1 PATCH/PUT /r_property_definitions/1.json
[ { "docid": "a0039fee3220459e7d26362b452ec393", "score": "0.7202442", "text": "def update\n respond_to do |format|\n if @r_property_definition.update(r_property_definition_params)\n format.html { redirect_to @r_property_definition, notice: 'R property definition was successfully updated.' ...
[ { "docid": "231370ed2400d22825eba2b5b69e7a67", "score": "0.68113583", "text": "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "title": "" }, { "docid": "f6c4eafa4f48a0c81157fb03ff350901", "score": "0.6...
c047e5a2b40d95c64bbb15d96c78e630
Copy Solr config from Lando mount to Solr configset dir
[ { "docid": "6c10ca200a3aefc1cf2eaa941992e89c", "score": "0.8009257", "text": "def copy_config(name)\n solr_run \"cp -r /app/tmp/solr_conf/#{name} /opt/solr/server/solr/configsets/#{name}\"\n end", "title": "" } ]
[ { "docid": "e08867cc8660362b5a912fc7e6a0ccfc", "score": "0.8134023", "text": "def copy_solr_config\n copy_file 'config/solrconfig.xml', 'solr_conf/conf/solrconfig.xml', force: true\n end", "title": "" }, { "docid": "6f5111f1a190651404947347f6c4e1ce", "score": "0.6829063", "text":...
90b843b527eeba1181d4bd14a57f11d7
Add a Single Rule in a Section Adds a new PBR rule in existing PBR section.
[ { "docid": "21ad804221d55ae559608be9f70b4733", "score": "0.6163925", "text": "def add_pbr_rule_in_section_with_http_info(section_id, pbr_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesPolicyBasedRoutingApi.add_pbr_...
[ { "docid": "c350471e318f526dfa6df1406a89f781", "score": "0.7250414", "text": "def add_pbr_rule_in_section(section_id, pbr_rule, opts = {})\n data, _status_code, _headers = add_pbr_rule_in_section_with_http_info(section_id, pbr_rule, opts)\n data\n end", "title": "" }, { "docid":...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "af1088f67ba22f2676313d5f9a94e34d", "score": "0.0", "text": "def set_template\n @template = TemplateElement.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
f8c26206c616f7284ba1f2cf9019ac8c
A helper method to grab Msruns from the database.
[ { "docid": "b6680a20d8c47bd8d1c4100d6218ed4e", "score": "0.6263882", "text": "def get_msruns_from_array_of_ids(ids)\n Msrun.all(:id => ids)\n end", "title": "" } ]
[ { "docid": "6b0d71c8c71a894f58d5848abffa55cd", "score": "0.5376117", "text": "def find_all_by_MSSName db, mss\n db.query <<-SQL\n SELECT MSISDN_BEGIN, MSISDN_END, HLR_NUM, LastUpdated\n FROM #{@table}\n WHERE MSSName = '#{mss}'\n ORDER BY MSISDN_BEGIN\n SQL\n d...
65b708fd1b6e9f183549e83974c0aa28
three = always(3) three.call returns 3 There are so many solutuons just understand the concept 1
[ { "docid": "a1e99dcc0af2637020dab1abf19b89a7", "score": "0.58516", "text": "def always(n=nil)\n Proc.new { n }\nend", "title": "" } ]
[ { "docid": "e98cc71a7e8f36997cbf44f7e0cd20c3", "score": "0.7212446", "text": "def third!; end", "title": "" }, { "docid": "82b5239c4012f923e4a1763a5946aae5", "score": "0.710982", "text": "def three\n 3\n end", "title": "" }, { "docid": "1ea205cf0c350943fd3eaf62c30d9...