query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
55de83dbca965a2299ce17761e6ee858
Constructs the specified class out of the supplied hash. If the first parameter is not a hash, simply returns it.
[ { "docid": "92638612e5bf363421b7af3de4681b1e", "score": "0.0", "text": "def build_request(request, building_class)\n request.is_a?(Hash) ? building_class.new(request) : request\n end", "title": "" } ]
[ { "docid": "6c641c148fb049518c716e2a6b970af6", "score": "0.7544085", "text": "def generate(hash)\n identifier = hash.delete('type')\n\n klass = retrieve(identifier)\n\n klass.new_from_hash(hash)\n end", "title": "" }, { "docid": "0edfe66783298694bddba724d0feea94", "scor...
acc963c4cc9ee80ffc6df85b5a56d7fe
only include worn equipment
[ { "docid": "c4e2220e522957471f72d5eb9d16029d", "score": "0.0", "text": "def query_equipment(position)\n if !self[:equipments]\n load_equipments\n end\n \n return self[:equipments][position.to_sym]\n \n end", "title": "" } ]
[ { "docid": "fa1dd2e607bb76dfeb43976c2c5d57c1", "score": "0.6695085", "text": "def current_inventory_weapons\n @inventory[:current_weapons].select { |weapon| !weapon.equipped }\n end", "title": "" }, { "docid": "201c23f5a7093b945d1689f53a4ddb20", "score": "0.6552559", "text": "def...
60c0e91635ccde68d223888decdc8d05
add a class to the HTM and other subs
[ { "docid": "08aa9d9f78443e899449ba8d14c66153", "score": "0.0", "text": "def subHTM(s)\n \ts.sub!('<p>','<dev>')\n \ts.sub!('</p>','</dev>')\n \ts.sub!('<table>',\"<table class='grayBorder'>\")\n \treturn s\n end", "title": "" } ]
[ { "docid": "3b28082a0f1ca04bcf06d0cab57fdb2a", "score": "0.65940475", "text": "def add_class(class_name)\n # self.class_name += \" #{class_name}\" unless has_class? class_name\n self\n end", "title": "" }, { "docid": "625032bbe75a9f22a4483340c73ca8dd", "score": "0.6464685", "t...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "6a6fd6f7b741802e92982d315ad3e31d", "score": "0.0", "text": "def set_publication\n @publication = Publication.friendly.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...
a790b1202f75b845200b529c533e29c6
Performs a HTTP GET request to the specified url applying the options supplied
[ { "docid": "aacd12ad633966a5c26118b78b0719a8", "score": "0.0", "text": "def get(url, options = @options)\n raise \"url cannot be nil\" if url.nil?\n uri = Addressable::URI.parse(url)\n uri.normalize!\n uri.fragment=nil\n url = uri.to_s\n\n # get the unique id for this request\n uniq...
[ { "docid": "7a2fa2f9c0200524d18b7a3dc7808a05", "score": "0.8448758", "text": "def get(url, options = {})\n do_request(:get, url, options)\n end", "title": "" }, { "docid": "0e0ee608ba28ccc10500fa7175946e48", "score": "0.84210885", "text": "def get(url, options = {})\n re...
77d797b7e555da28964f2b296a79fa22
POST /todo_items POST /todo_items.json
[ { "docid": "65fdd403639f4554b2d1727528ead0eb", "score": "0.7666567", "text": "def create\n @todo_item = TodoItem.new(params[:todo_item])\n\n respond_to do |format|\n if @todo_item.save\n format.html { redirect_to @todo_item, :notice => 'Todo item was successfully created.' }\n f...
[ { "docid": "fa1de5f6e7c662af0aa2740558c996e8", "score": "0.79918075", "text": "def create\n @todoitem = Todoitem.new(todoitem_params)\n if @todoitem.save\n render json: @todoitem, status: :created\n else\n render json: @todoitem.errors, status: :unprocessable_entity\n end...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0dc922bcba15c6f71eb1d967bb3586f0", "score": "0.0", "text": "def set_profil\n @profil = Profil.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...
79d22871186bf8f8d1c66b3bf04a4961
N is an integer within the range [1..100,000]; each element of array A is an integer within the range [1..1,000,000,000].
[ { "docid": "bd5f561ef08bd63bda2b75b0dace2960", "score": "0.0", "text": "def solution(a)\n permutation = (1..a.size).to_a\n (permutation - a).empty? ? 1 : 0\nend", "title": "" } ]
[ { "docid": "7486486d145945704d265f4b9c09cdf9", "score": "0.61884123", "text": "def solution(n, a)\n result = Array.new(n, 0)\n max_value = 0\n max_value_used = false\n\n a.each do |elem|\n if elem <= n\n result[elem-1] += 1\n if max_value < result[elem-1]\n max_value = result[ele...
89ae65d7f9a3c7ee49afb6d5c6823c8e
DELETE /mails/1 DELETE /mails/1.json
[ { "docid": "3ea145e9739706ab5195a322cc03d344", "score": "0.7311729", "text": "def destroy\n @mail.destroy\n respond_to do |format|\n format.html { redirect_to mails_url, notice: 'Mail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ...
[ { "docid": "7a8615c4f44914584d41f615d7c25be3", "score": "0.75192523", "text": "def destroy\n @mail = Mail.find(params[:id])\n @mail.destroy\n\n respond_to do |format|\n format.html { redirect_to mails_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
54e0d7f8228348797db2df66caf6325c
Reads an Unicode string from the offset position Return type: String
[ { "docid": "d2e5fde20dde937800f538d7957ad8f1", "score": "0.72688925", "text": "def unicode\n\t\tread_unicode(@ida, @offset)\n\tend", "title": "" } ]
[ { "docid": "146437838d0800cc84c8629e54863be6", "score": "0.8091775", "text": "def read_string(offset)\n read_until(offset, \"\\xFF\")\n end", "title": "" }, { "docid": "046eaed742bb7c2ed83ec66b8bc7b4bd", "score": "0.7700599", "text": "def read_unicode(ida, offset)\n\t\tread_s...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "2e7b8728017c6756b4f6f2cfa878835c", "score": "0.0", "text": "def update!(**args)\n @available = args[:available] if args.key?(:available)\n @failover_instance = args[:failover_instance] if args.key?(:failover_instance)\n @name = args[:name] if args.key?(:name)...
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.7307693", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72636455", "text": "def update(...
7aba2ed7a79cb6ac3f461fb8bf0b9920
Traverse the tre in a depth first manner.
[ { "docid": "ba8feea2426730325e8a661178b4df70", "score": "0.0", "text": "def depth_first_traversal(node = @root, &block)\n return if node.nil?\n\n depth_first_traversal(node.left, &block)\n yield(node.value)\n depth_first_traversal(node.right, &block)\n end", "title": "" } ]
[ { "docid": "59e3c7d64ea38cd40488707fa61c6ae9", "score": "0.7075947", "text": "def traverse; end", "title": "" }, { "docid": "67be6e6ba8ef83a76e7a265c6757e7d9", "score": "0.6905352", "text": "def traverse\n \n end", "title": "" }, { "docid": "5cc3addaf9b56f41ba4ff7e85b...
a4acc5637a974065e7d9852bbcea7093
Fetches the Ant property with the given name; raises an exception if it doesn't exist, unless you specify a default. We also transform the key passed in to make sure it contains only numbers, letters, and underscores; other characters will be replaced with underscores. This is because not all valid Ant property names a...
[ { "docid": "ea3fd7c09579dfd212c73192dae0a19b", "score": "0.77017325", "text": "def get_ant_property(key, default_value=:no_default_specified)\n begin\n key = key.gsub(/[^A-Za-z0-9_]/, '_')\n puts :warn, \"Attempting to include Ant property '%s'.\" % key unless key =~ /^[A-Za-z0-9_]+$/\n ...
[ { "docid": "b901161864b38bfa8d827f28a49c946e", "score": "0.6398973", "text": "def get_property(property_name)\n value = get() and value[property_name]\n end", "title": "" }, { "docid": "e146f41950cf7d24f229b7d837c56c22", "score": "0.63794404", "text": "def _property(p_name)\n...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5b55073f7dfb2268727402fa8a466c79", "score": "0.0", "text": "def set_building_message\n @building_message = BuildingMessage.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60320485", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6013371", "text": "de...
353480781a46a115b42b04417cdbd9b3
Scopes the eventual search to all entries prior to this point.
[ { "docid": "cd0c7a1fde2affd550909f179d0ca6bc", "score": "0.56494004", "text": "def before(scope_criteria)\n params = scope_criteria.merge({:direction => :before})\n within(params)\n end", "title": "" } ]
[ { "docid": "0f7131c74bb830aac93a10858fe23c13", "score": "0.6101821", "text": "def unscoped_current_and_previous_ancestors\n unscoped_where do |scope|\n scope.where scope.primary_key => (ancestor_ids + ancestor_ids_before_last_save).uniq\n end\n end", "title": "" }, { "doc...
6283e165101ffd2ae23bb3e571ed5a5e
The initial VirtualBox 7.0 release has an issue with displaying port forward information. When a single port forward is defined, the forwarding information can be found in the `showvminfo` output. Once more than a single port forward is defined, no forwarding information is provided in the `showvminfo` output. To work ...
[ { "docid": "7e2828e217beb5c4417bd37b4a7ae089", "score": "0.6504873", "text": "def read_forwarded_ports(uuid=nil, active_only=false)\n @version ||= Meta.new.version\n\n # Only use this override for the 7.0.0 release. If it is still broken\n # on the 7.0.1 release we can modify ...
[ { "docid": "286dc0f8fc58abfed459043d1de57083", "score": "0.7458261", "text": "def configure_port_forwarding(config, port_forwards)\n port_forwards.each do |name, forward|\n if is_local_port_open? forward['host_port']\n puts \"[WARN] Port #{forward['host_port']} is in use.\"\n end\n conf...
be9685c3e1a8305f3ec6f2e0d4b301c8
GET /due_dates/1 GET /due_dates/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "1eaed302435d9cbfd84fd3d7c7ff15af", "score": "0.72022444", "text": "def index\n @due_dates = DueDate.all\n end", "title": "" }, { "docid": "3e36f3981269099559bc1361f8bbad00", "score": "0.65811944", "text": "def dueDate\n Date.parse(@dueDate)\n end", "title": ""...
e9c8d172305c1b135eabc019634090f5
Builds a deposit charge detail
[ { "docid": "888cf40b514f2ba65c0db0aa07ad67ce", "score": "0.79307735", "text": "def build_deposit_charge_detail\n\n charge_detail = [{:item_reference => 'DEPOSIT',\n \t :item_description => booking.charge_item_detail,\n \t :item_units => 1,\n \t ...
[ { "docid": "37ee789823084e49a94f1336b3a8661b", "score": "0.67369896", "text": "def charge_detail\n \n @charge_detail ||= if booking\n if booking.total_cost > booking.booking_amount \n \t build_deposit_charge_detail\n \t ...
83bc257b52df059148cc96a9cc4a4e8d
Construct an XML fragment representing the subject
[ { "docid": "c89df5aeeb062a66f69a9bb3f3e56257", "score": "0.7601849", "text": "def to_xml(xml=Builder::XmlMarkup.new)\n xml.tag!('saml:Subject') {\n xml << identifier.to_xml unless identifier.nil?\n xml << subject_confirmations.map { |sc| sc.to_xml }.join\n }\n end", "title...
[ { "docid": "4d8058de5ee50494a343c536b1883767", "score": "0.6562659", "text": "def build_subject(uid, subject)\n return \"[TW-#\" + uid + \"] \" + subject\n end", "title": "" }, { "docid": "da5ed410e5556ad03e4b5715964d0ae7", "score": "0.6492176", "text": "def to_xml\n @thre...
fac435bab51553f9f1680120463f3e0e
GET /independants/1 GET /independants/1.json
[ { "docid": "8dd9eabe93682fb5bb85c7a2a64eff75", "score": "0.75948226", "text": "def show\n @independant = Independant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @independant }\n end\n end", "title": "" } ]
[ { "docid": "3ab17a351e089828325d3eb59806bfcc", "score": "0.64479923", "text": "def new\n @independant = Independant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @independant }\n end\n end", "title": "" }, { "docid": "124cab72a24...
b97ba668fdc66d5f3d9d407e9ebac062
Destroys the photo associated with this Photo's id
[ { "docid": "4b781b569bc16b3581fa09417475ae11", "score": "0.0", "text": "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "title": "" } ]
[ { "docid": "f557867bdf1f7427d45ce84ec6204a4b", "score": "0.79467523", "text": "def destroy\n # @photo is pulling Photo's information \n @photo = Photo.find(params[:id])\n # @photo_id is keeping the photos id\n @photo_id = @photo.id\n # Is destroying the photo\n @photo.destr...
ecb3e3957a250bed6f7b4234dee345e6
DELETE /travel_posts/1 DELETE /travel_posts/1.json
[ { "docid": "b5bfc889ee53cc5ba3045e60dd270afb", "score": "0.0", "text": "def destroy\n\t\ttravel_post = TravelPost.find(params[:id])\n\t if travel_post.destroy\n \t\tredirect_to travel_posts_path\n \telse\n \t\trender :edit\n \tend\n\tend", "title": "" } ]
[ { "docid": "f6d2b8c711e99ff668b654111f950317", "score": "0.72243315", "text": "def destroy\n @post_travel.destroy\n respond_to do |format|\n format.html { redirect_to post_travels_url, notice: 'Post travel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"...
12730ff1deab221bc7b5e057e2cf6c95
inits the questioning using the proper method in QuestionFormable
[ { "docid": "315e44fc6b53363bd16c1d12cc83ece0", "score": "0.74337953", "text": "def init_qing_with_form_id\n authorize! :create, Questioning\n strip_condition_params_if_empty\n init_qing(params[:questioning])\n end", "title": "" } ]
[ { "docid": "7afaa6deca6338acdc473d46750c51b9", "score": "0.78304607", "text": "def initialize_question\n\n Question.new\n\nend", "title": "" }, { "docid": "ae4d8989dd05fb90f210cc6e4635c1af", "score": "0.7423912", "text": "def init_qing_with_form_id\n authorize! :create, Questi...
500d83c354e3c694b31e2b2b44f6bfb7
GET /men/new GET /men/new.xml
[ { "docid": "a654cc232cad27c95fd05379896e9340", "score": "0.7207086", "text": "def new\n @man = Man.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @man }\n end\n end", "title": "" } ]
[ { "docid": "37339234f4fec48e5ce77156bd1b6b7f", "score": "0.75774115", "text": "def new\n @menutree = Menutree.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menutree }\n end\n end", "title": "" }, { "docid": "09659b5e0a0b570d5c...
cbc59b3070a7f3d221ad2dfd4e3e77dd
DELETE /tweeters/1 DELETE /tweeters/1.xml
[ { "docid": "02ec7b85e9899504782f3b3722c449c7", "score": "0.7288042", "text": "def destroy\n @tweeter = Tweeter.find(params[:id])\n @tweeter.destroy\n\n respond_to do |format|\n format.html { redirect_to(tweeters_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "2a11c70d57eebf5bbb273f7bc0e41601", "score": "0.7093113", "text": "def destroy\n @tweet = @site.tweets.find(params[:id])\n @tweet.destroy\n\n respond_to do |format|\n format.html { redirect_to(tweets_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, ...
519f15186d9241f1652beb972206aca5
ALl the pieces owned by the specified player.
[ { "docid": "99931ff7ef4bf2f0b6621c8fabf6974b", "score": "0.70071584", "text": "def pieces_owned_by_player(player_number)\n pieces.select { |p| p.player_number == player_number }\n end", "title": "" } ]
[ { "docid": "535179df866385a946c3bf1328378784", "score": "0.6194881", "text": "def white_pieces\n return [] unless white_player\n pieces.where(player_id: white_player.id)\n end", "title": "" }, { "docid": "b07c382adb9949e7329ebd2a6465f705", "score": "0.6101277", "text": "def ow...
2942bfc0e45d1f80fdbe186a8c64c653
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? Prime sifter
[ { "docid": "760e57bdc0775c86171999c6016a1556", "score": "0.0", "text": "def sieve_upto(top)\n sieve = []\n for i in 2 .. top\n sieve[i] = i\n end\n for i in 2 .. Math.sqrt(top)\n next unless sieve[i]\n (i*i).step(top, i) do |j|\n sieve[j] = nil\n end\n end\n return sieve.compact\n...
[ { "docid": "1618579a9cec13b25b4265ad6e250c5f", "score": "0.77641946", "text": "def p7\n require 'prime'\n puts \"The 10,001st prime number is: #{ Prime.take(10_001).last }.\"\n end", "title": "" }, { "docid": "2d07be9fc76e7a751b83bc4d58d294e0", "score": "0.74714035", "te...
ca121c20ad5b54662fd8a914a3153658
Strip .deb and the codename/arch from the package
[ { "docid": "75bb66b8ece102c837204204ea1235ed", "score": "0.0", "text": "def strip_end(str)\n str.split('.')[0..-3].join('.')\nend", "title": "" } ]
[ { "docid": "6be94e313ce74386b29d2a9bd2ff4242", "score": "0.6608925", "text": "def package_filename\n \"#{@package.name}_#{@package.version}_#{@package.architecture}.deb\"\n end", "title": "" }, { "docid": "06532f48d25bf09936a48b7b32b6d450", "score": "0.62361723", "text": "def...
7fb738154b0d238b079b5db847593460
additional searchable string made from categories TODO: Ueberhaupt notwendig, wenn es fuer Kategorien keine Synonyme mehr gibt?
[ { "docid": "6f83b68e54843bd0bb14177a5cee31ec", "score": "0.60258144", "text": "def category_string\n categories.pluck(:name).flatten.compact.uniq.join(', ')\n end", "title": "" } ]
[ { "docid": "7deff89e4e6d2ec2ebdf05746e8373ca", "score": "0.6810339", "text": "def categories(str)\n raise NotImplementedError\n end", "title": "" }, { "docid": "e9f0e0114a0660038fd4f536688f99ec", "score": "0.67241895", "text": "def category_friendly\n return self.category.gsub...
688516f347ddeb5b191643cc1fbde42e
GET /agents/1 GET /agents/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "02a9a0ea4e281d9cadf7a23b8d87f551", "score": "0.7348739", "text": "def agent(agent_id, options = {})\n get \"/agents/#{agent_id}\", options\n end", "title": "" }, { "docid": "02a9a0ea4e281d9cadf7a23b8d87f551", "score": "0.7348739", "text": "def agent(agent_...
073d81b3ee6a2f736b91d7d0b1f8c136
PUT /user_fields/1 PUT /user_fields/1.json
[ { "docid": "185219068da8409d60898a2805dbc613", "score": "0.6993329", "text": "def update\n @user_field = UserField.find(params[:id])\n\n respond_to do |format|\n if @user_field.update_attributes(params[:user_field])\n format.html { redirect_to @user_field, notice: 'User field was succe...
[ { "docid": "23e1e96345ae395c6cb129499b54d8ee", "score": "0.6840692", "text": "def add_user_fields(user_fields, client)\n user_fields.each_index do |uf_idx|\n client.users.update!(\n id:user_fields[uf_idx][5],\n time_zone:\"Arizona\",\n tags: [\"tag1\", \"tag2\"],\n user_fields:{\...
e17bc497b07b84a661ee626766d8e611
Returns a data element's value. Note that data elements of vr OB & OW have no value decoded, so value returned for these will be nil.
[ { "docid": "552970c84b53bbbf2b1a98004f5d92a8", "score": "0.56059307", "text": "def extract_value(element)\n # Read value as CouchDB value for that key:\n cdbvalue = element.value\n # Convert encoding to UTF-8 with Ruby 1.9 'encode' method\n cdbvalue = cdbvalue.encode('utf-8', 'iso-8859-1') if cdbval...
[ { "docid": "ceb91b436e66db4dd14c651eb17d5bee", "score": "0.7005567", "text": "def value\n data.value\n end", "title": "" }, { "docid": "d1443bfcd98744e3df69a695e501664b", "score": "0.69364387", "text": "def value\n data[1]\n end", "title": "" }, { "doc...
2690d84a7230dfb52991048fe2d53787
Initializes a Cryptic::Keypair object from a private/public keypair
[ { "docid": "effbe60434d53fa805fd783ebf8486cc", "score": "0.7063625", "text": "def initialize(private_key, opts = { public_key: nil, passphrase: nil })\n if private_key.is_a? OpenSSL::PKey::RSA\n @private_key = private_key\n elsif !private_key.to_s.eql?('')\n @private_key = OpenSS...
[ { "docid": "fecef7128cc066ced20eccc9b43b1879", "score": "0.7714261", "text": "def load_keypair(private_key, public_key)\n @private_key = private_key\n @public_key = public_key\n @private_rsa = OpenSSL::PKey::RSA.new @private_key\n @public_rsa = OpenSSL::PKey::RSA.new @public_key\n end", ...
01abf44c0cd2883691ce1246978b01f0
Constructs a client for the service given by tube_name.
[ { "docid": "ec1cb072a55295365d2d0757e46fe956", "score": "0.5586344", "text": "def initialize(tube_name, opts={})\n # Only respond to these messages\n @only = opts[:only] || proc { true }\n # These have answers (wait for the server to answer)\n @with_answer = opts[:with_answer]...
[ { "docid": "4a3316aa3e470de01e24af1a71d1d50a", "score": "0.628323", "text": "def initialize(tube_name, opts={})\n @server = opts[:server]\n @tube_name = tube_name\n\n if opts.has_key? :factory\n @factory = opts[:factory]\n elsif opts.has_key? :simple\n klass = opts[:sim...
1b11471dc8f41f327f46183005b9493d
Returns the charge of the battery. If the battery is not present or the information is not available, it will return nil.
[ { "docid": "42543aa1c60b74548903562f3cff4d08", "score": "0.6752021", "text": "def charge\n\t\t\t\treturn nil unless charge_now_readable?\n\t\t\t\tcharge_now = IO.read(File.join(PATH, 'charge_now')).to_i\n\t\t\t\tcharge_full = IO.read(File.join(PATH, 'charge_full')).to_i\n\n\t\t\t\tpercentage = charge_no...
[ { "docid": "ae37bf5f5a90b70145e5f06563e0299a", "score": "0.740245", "text": "def battery_info\n battery = self.battery\n key = battery.keys\n return nil if key.count <= 0\n battery[key.first]\n end", "title": "" }, { "docid": "9bad666617bec44725d4b0f95f131e46", "sc...
e91e3982c89c553ecc10bd3a7a990713
checks to see if the item is allowed
[ { "docid": "b2d80cf769c726627eb6ee13fe6c2a62", "score": "0.68399936", "text": "def allow?(item)\n return true if @all\n\n if @only.nil? == false\n # only filter\n allowed = @only.include?(item)\n else\n # except filter - note that we invert the includes with ! since we\n # a...
[ { "docid": "a778f8ded68361f7c6f623a3b40523cf", "score": "0.87136024", "text": "def allowed?(item)\n true\n end", "title": "" }, { "docid": "144e4b0d56b0900f46913f0f412fdc66", "score": "0.71165746", "text": "def item_usable?\n user.usable?(item) && item_effects_valid?\n end", ...
f4fe7a9b57d125565396dcc9a2b64aa8
Set defaults for any state values used
[ { "docid": "72d55fc82b21465952ecb5716574a6a0", "score": "0.69318205", "text": "def defaults\n super\n end", "title": "" } ]
[ { "docid": "4f8ead504572f8c159abcb8f3b6d595a", "score": "0.80407214", "text": "def set_defaults\n end", "title": "" }, { "docid": "b8beccccbbd86a5f0a7f0525f2646b30", "score": "0.7970405", "text": "def set_defaults; end", "title": "" }, { "docid": "ff88a99a81019731cf4...
92dc740aab324213abf7564fbe7ddaf6
PATCH/PUT /applications/1 PATCH/PUT /applications/1.json
[ { "docid": "a486cbf66d5d3adaca36ea8219227537", "score": "0.6719687", "text": "def update\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, s...
[ { "docid": "c46fe188e2f9b7019c2a94ea74853cb6", "score": "0.7152944", "text": "def update_app data={}\n put '/app', data\n end", "title": "" }, { "docid": "1e0e912f083d1220e8cb46996e52a9a2", "score": "0.7136675", "text": "def update\n if @application.update(application_...
8e4e4b42dd3d89988bfc73f5354506c1
grab the URL and pull down a response
[ { "docid": "73db3d3e80e44a56969deb8d55c5a90b", "score": "0.0", "text": "def grabResults(address, auth)\n request = Net::HTTP::Get.new address.request_uri\n\n # Set up Net::HTTP to use SSL, which is required by Twitter.\n http = Net::HTTP.new address.host, address.port\n http.use_ssl = true\n http.v...
[ { "docid": "58522c38c18bfac7ea8a60be47a9f605", "score": "0.77793896", "text": "def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend", "title": "" }, { "docid": "34cb485d0ca552a39a0815b1fd9723cf", "score": "0.75805247", "text": "def get\n @response = Net...
12d965be851277ea7a9f7f4b6898ba8d
DDL statement for creating a table with the given name, columns, and options
[ { "docid": "aeebb42fc6ef861bbeb2246de0415869", "score": "0.68803096", "text": "def create_table_prefix_sql(name, options)\n prefix_sql = if options[:temp]\n raise(Error, \"can't provide both :temp and :unlogged to create_table\") if options[:unlogged]\n raise(Error, \"can't prov...
[ { "docid": "d2c947c72d44c4a20945934c8da3ac1a", "score": "0.75814897", "text": "def create_table_sql_list(name, columns, indexes = nil, options = {})\n sql = [\"CREATE TABLE #{quote_schema_table(name)} (#{column_list_sql(columns)})\"]\n sql.concat(index_list_sql_list(name, indexes)) if indexes ...
eaf118f6a07ae9d5cdb10e359a29291a
whether this multiplex instance has any fd to wait on
[ { "docid": "7d0f24f454f0dd05a6c3a7605721e9d8", "score": "0.0", "text": "def working?\n @kq.instance_variable_get(:@memo).keys.length > 0\n end", "title": "" } ]
[ { "docid": "10b555074005ea3180b41f260eff84ac", "score": "0.7080072", "text": "def listening?\n !@terminated\n end", "title": "" }, { "docid": "d0b2e232241c7a5270840bdba98bd0c1", "score": "0.6890359", "text": "def listening?\n @sync_thread&.alive? == true\n end...
20ea1a9ce4d415c74b14cef9b938a97a
Data sent to the browser for JS interaction
[ { "docid": "e90385bc00c9634cdd7660138f837cf5", "score": "0.0", "text": "def to_js\n {\n fullname: self.fullname,\n email: self.email,\n expand_abstracts: self.expand_abstracts\n }.to_json\n end", "title": "" } ]
[ { "docid": "6a5fe4febbe715c88f06d80d5a4c4d37", "score": "0.70227754", "text": "def send_data( data )\n @shell.send_data data\n end", "title": "" }, { "docid": "f748dc9d82c9cc3faa39ee95398272a7", "score": "0.6940902", "text": "def send_data\n\t\t\n\tend", "titl...
2c346b2562a97046fe07ef7b02acaa49
POST /accounts POST /accounts.json
[ { "docid": "8b9437c1a78c4ba6378be42b04eaec8f", "score": "0.0", "text": "def create\n @account = current_user.accounts.new(account_params)\n\n respond_to do |format|\n if @account.save\n\n # Create corresponding entries\n date = (params[:date].blank? ? DateTime.current : DateTime...
[ { "docid": "77f307f64106f05b8f139085144085f2", "score": "0.7698442", "text": "def create\n @account = current_user.accounts.create!(account_params)\n @account.save\n render json: @account\n end", "title": "" }, { "docid": "345d97ffa21872a109a16575d6d574c6", "score": "0.7598518"...
58d74bc04f9e8947bb3b63fc6eb043cf
DELETE /to_do_lists/1 DELETE /to_do_lists/1.json
[ { "docid": "45b28af7861c7425348cb6cf0df6b4de", "score": "0.71628535", "text": "def destroy\n \t@to_do_list = ToDoList.find(params[:id])\n \t@to_do_list.destroy if @to_do_list.belongs_to_current_user?(current_user)\n\t redirect_to to_do_lists_url\n end", "title": "" } ]
[ { "docid": "95143bcc2d01f1049f03f73837d8ea91", "score": "0.7914519", "text": "def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end", "title": "" }, { "docid": "8cbe1191c93aa1d85c5255a35234557f", "score": "0.76183945", "text": "def destroy\n @mustdo_list.destroy\n ...
8064f6a203905f2b8f67157aa3efd602
Duplicated in Base, maybe move onto Hash and String with contrainsts
[ { "docid": "e1e2263ed8a190c3e95989e070886a0e", "score": "0.0", "text": "def options_has_value_and_display?\n options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"value\")\n } && options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"display\"...
[ { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.68811333", "text": "def hash() end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", "score": "0.68811333", "text": "def hash() end", "title": "" }, { "docid": "23cdf6a080837fbe407633be0799ea0e", ...
383e8f1eebd67ecb9f5d5d8c38f2fc44
GENERAL UTILITY METHODS FOR BOARD CLASS
[ { "docid": "44429989739089cde9d53d7239bd33fc", "score": "0.0", "text": "def get_start_index(points)\n # When preparing to enumerate between two cells, this method\n # gets the index for starting enumeration, whether the two cells\n # are in horizontal or vertical orientation. The starting cell\...
[ { "docid": "f159c01278ecbbf1f975ebad26579ed4", "score": "0.7310382", "text": "def board\n end", "title": "" }, { "docid": "458a08a02bae544ea337bc7f61f14dce", "score": "0.7140349", "text": "def board\n\n end", "title": "" }, { "docid": "458a08a02bae544ea337bc7f61f14dce",...
c80e3eee2b58c5eb9d7dbfbc382acda5
1. Players each take their top card 2. If the cards' rank is the same, first, take an additional card prisoner from each player. Then, repeat do_battle. 3. If the last drawn cards are different ranks, all the cards drawn in this round are awarded to the drawer of the higher ranked card.
[ { "docid": "f3726f6543148ed5f4076f770a43ad41", "score": "0.75359255", "text": "def do_battle(prisoners = [])\n return if game_over?\n prisoners = prisoners\n card1 = @player1.take_card\n card2 = @player2.take_card\n case card1 <=> card2\n when -1\n @player2.give_won_cards([card1, ...
[ { "docid": "4280a03bf3278445ee4b16af0c415fe1", "score": "0.72295403", "text": "def playTurn()\n puts \"*** START OF ROUND ***\"\n # Holds cards in current battle to be compared\n cardsInPlay = []\n # Holds ALL cards from the round to go to the winner\n cardsForWinner =...
d0ded8879a8bd0a568772e494b726849
Add and remove favorite listings for current_user
[ { "docid": "2c1046436db91f6c79b7409ca822d38a", "score": "0.0", "text": "def index\n @pictures = Listing.all\n @search = Listing.search(params[:q])\n @listings = @search.result(distinct: true).page(params[:page]).per(16)\n @hash = Gmaps4rails.build_markers(@listings) do |listing, marker|\n ...
[ { "docid": "27cc01c7747b1aa1795df335b5680ef6", "score": "0.7533509", "text": "def set_favoritelist\n @favoritelist = current_user.favoritelist || current_user.create_favoritelist\n end", "title": "" }, { "docid": "18b3d1a29cbb8642602e256ef4e3a60d", "score": "0.72544", "text":...
17d7b87e8bf65979af20b0e69461cc24
GET /students GET /students.json
[ { "docid": "3f4cc82ab37dca98500f2d2124be4586", "score": "0.0", "text": "def index\n @students = Student.all\n #@students = Student.where(:id => params[:id])\n ##@current_season = Season.where(:seasonNo=> Setting.where(:settingName => 'Aktiw_tapgyr')[0].settingValue)[0] # Get season number of c...
[ { "docid": "808860a584dc3bc32b26760cee06ae56", "score": "0.7931835", "text": "def students\n if usernames\n data = {}\n usernames.each {|u| data[u.username] = u.students}\n render json: data and return\n elsif current_user\n render json: {status: \"success\"...
005046839ee9ce421e11ec1143d2574f
set the failure flag and set an error message
[ { "docid": "bf8203de62736f30c2f2b70225d11381", "score": "0.81878823", "text": "def failure(err_msg)\n @fail = true\n @err_msg = err_msg\n end", "title": "" } ]
[ { "docid": "2d8a07edefa4cd16c21be1fb9b4ff13c", "score": "0.7799054", "text": "def failure\n @status = FAILURE_FLAG if @status == SUCCESS_FLAG\n end", "title": "" }, { "docid": "021d70ea64b0423abb33592501195838", "score": "0.75383574", "text": "def set_failure_message(msg)\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "9d002faec4f9cf7e62e5fd81a8450456", "score": "0.0", "text": "def set_element\n @element = Element.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...
f2532f095fcd44b2fe1881e0232fd7c3
If records have changed, it builds the relevant rrsets and submits them to the server. If there are errors found, exceptions are thrown.
[ { "docid": "cd124ad061276d05a66b67f9ee95e8bc", "score": "0.7563229", "text": "def update_records!\n changes = changed_rrsets\n\n return unless changes.any?\n\n unless changes.all?(&:valid?)\n record_errors = changes.inject({}) do |hash, rs|\n rs.records.each { |r| hash[r.i...
[ { "docid": "80916370187df49d9468ac11e5ad9125", "score": "0.61714095", "text": "def change_record_sets(set)\n tries = 0\n while true\n begin\n resp = @client.change_resource_record_sets(set)\n break\n rescue => e\n tries += 1\n if /rate exceed/i...
070e16b7bc9ba3112f845784a3f69d9d
Ensure all of the Social Security numbers use dashes for delimiters.
[ { "docid": "3d511964c37671cb3e30f3a275d5a63d", "score": "0.0", "text": "def format_ssns(string)\n matched_ssns = []\n ssns = string.scan(/(\\d{3})*\\D??(\\d{2})*\\D??(\\d{4})/)\n ssns.to_a.each do |m|\n matched_ssns << m.join(\"-\")\n end\n if matched_ssns.join(', ') =~ /(\\d{3})-(\\d{2})-(\\d{...
[ { "docid": "5825e04b3db47716ebc604d3afee6a1c", "score": "0.6871035", "text": "def normalize_cavc_docket_number\n cavc_docket_number.sub!(/[‐−–—]/, \"-\")\n end", "title": "" }, { "docid": "65531c83011e8a43d8179c4baf70d35d", "score": "0.6737412", "text": "def hide_all_ssns(string)...
d60717201bc3127f55d2c0e0da7d4ef4
PUT /haptic_fidelities/1 PUT /haptic_fidelities/1.json
[ { "docid": "fe71c03a1de5e5fcab724d80799c615e", "score": "0.66280663", "text": "def update\n @haptic_fidelity = HapticFidelity.find(params[:id])\n\n respond_to do |format|\n if @haptic_fidelity.update_attributes(params[:haptic_fidelity])\n format.html { redirect_to @haptic_fidelity, not...
[ { "docid": "e991143a2fac36d7f18457c977219488", "score": "0.6377629", "text": "def update\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n if @housing_feature.update_attributes(params[:housing_feature])\n format.html { redirect_to @housing_feature, noti...
9a94ccf33050104546b4f25990420f17
DELETE /auto_bill_payments/1 DELETE /auto_bill_payments/1.json
[ { "docid": "469d1630171453313818c323d562455f", "score": "0.7055469", "text": "def destroy\n @auto_bill_payment.destroy\n redirect_to account_auto_bill_payments_url, notice: 'Auto bill payment was successfully destroyed.'\n end", "title": "" } ]
[ { "docid": "3bbe532f009f1a184b0c02732cbe4aaf", "score": "0.70509917", "text": "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "title": "" }, { "docid": "6d4db9d1512f30356c3ada2d0724fb6f", "score": "0.7005136", "text": "def destroy\r\n ...
9ca39a587d754bb9a2739b9d424adf61
Return whether this is a path to a page
[ { "docid": "3c395f971793a52b41f9abbec1f3094e", "score": "0.6680367", "text": "def page?\n PAGE_EXTS.include? extname\n end", "title": "" } ]
[ { "docid": "1cecfa9eda25cf89f25d790f36549c8e", "score": "0.7659068", "text": "def in_path?(path); end", "title": "" }, { "docid": "36c77b191d2dcdcec63ba9729fdd25c6", "score": "0.7474515", "text": "def path_is?(path)\n @location.path_is?(path)\n end", "title": "" }, ...
2d366bb8fb3f06a4191ac748a78a332f
Add a state to the element. A state toggles a CSS class with the same (dasherized) name as the state. If the state is thruthy (not nil or true) the CSS class is added to the element. Otherwise the CSS class is removed.
[ { "docid": "192da9326409cd4c4a5c8c11d0a9bd43", "score": "0.6600299", "text": "def add_state(state, value = false)\n @states[state] = [\n factory.composite_state(self.class.name, state),\n value\n ]\n\n classify_state @states[state]\n end", "title": "" } ]
[ { "docid": "81a619363a314484521dc8342942e129", "score": "0.6904871", "text": "def classify_state(state)\n if state[1]\n state[0].each do |name|\n `#{@element}.classList.add(#{name})`\n end\n else\n state[0].each do |name|\n `#{@element}.classList.remove(#...
41189d757ae2045b520f8b4f30cdcae9
Returns whether a line item matches this selector or not. Arguments line_item The item to check for matching.
[ { "docid": "71c9448a2c337a00de510e8de09b2293", "score": "0.84490424", "text": "def match?(line_item)\n @selectors.all? { |selector| selector.match?(line_item) }\n end", "title": "" } ]
[ { "docid": "a0efa2d1ed50a9ca469070935bdaac29", "score": "0.6849015", "text": "def match?(line_item)\n line_item.variant.product.tags.include?(@tag)\n end", "title": "" }, { "docid": "ba131ac00ca599b33be940a9beee4dea", "score": "0.6746941", "text": "def actionable?(line_item)\n ...
bb16692af1c30abe47b780d05dc9ba29
Replace with real successful acknowledgement code
[ { "docid": "5a5defc5c590fdf22d9880a548193a13", "score": "0.0", "text": "def test_acknowledgement\n assert @megakassa.acknowledge\n end", "title": "" } ]
[ { "docid": "2e6041b1ef86b825c12cb85072f7f8ab", "score": "0.677", "text": "def ok_status_code\n 0\n end", "title": "" }, { "docid": "662670d6b408f5a30c308820884e13b5", "score": "0.66933024", "text": "def set_success(msg, status = nil)\n @success = true\n @code = STATUS_CODE[...
6c564445a814dc4df3aed2fbd6e513fe
attrs: limit field selector
[ { "docid": "3298285cf277e221680eafe612d02a43", "score": "0.0", "text": "def initialize(parent, attrs = {})\n @parent = parent\n attrs.each do |k, v|\n instance_variable_set(\"@#{k}\", v) unless v.nil?\n end\n end", "title": "" } ]
[ { "docid": "f34190385985f2fc4d4c545b8b505dad", "score": "0.5782049", "text": "def restrict_fields\n\n allowed_fields=Egg.new.attributes.keys\n @fields=allowed_fields & (params[:fields] || \"\").split(\",\")\n if @fields.present?\n @eggs=@eggs.select(@fields) \n else\n @...
8f2bdbc660c7d927b4e32fb4f95b300a
Returns the winner if there is one, +nil+ otherwise
[ { "docid": "d03700bd198f65db19bda540e813f9fb", "score": "0.0", "text": "def winner\n end", "title": "" } ]
[ { "docid": "04c715c13c25b1562c42c3300d306783", "score": "0.8540245", "text": "def winner\n won? ? (return @board[won?[0]]) : (return nil)\n end", "title": "" }, { "docid": "67a8f967604dfae56dbe5740447b109b", "score": "0.85325336", "text": "def winner\n if !won?\n return n...
3fba6ca57b892e7318917960f14ecfb1
=========================== = Public instance methods = ===========================
[ { "docid": "193b2d37bee4c61a0d4b4f7a6bdba565", "score": "0.0", "text": "def deep_copy(**options)\n copy = self.dup\n copy.modifiable = options.fetch(:modifiable, self.modifiable)\n copy.section_id = options.fetch(:section_id, nil)\n copy.save!(validate: false) if options.fetch(:save, false)...
[ { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.7357787", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b0869a4a8bd", "score": "0.7357787", "text": "def implementation; end", "title": "" }, { "docid": "3660c5f35373aec34a5a7b...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "42194bc75e242f0aaae191723b459bcf", "score": "0.0", "text": "def set_customersession\n @customersession = Customersession.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;...
25eafe50529b8c6801f4767791062d8f
Methods called from socket S > Gfx This methods are usually called from core_game to game_gfx In network case they core methods are coming from remote server, but because we are using a socket interface, some works is needed to rebuild variable and objects sent over the network. If an object is complex, like array of h...
[ { "docid": "c1b5912e774fc3a00b5d9500cd97dcc4", "score": "0.5719378", "text": "def onalg_new_match(gui_user_name, all_players, nal_core, options_remote)\n # this stuff happens because we start a new match, on a local game this is\n # implemented behind start_newgame on gui button. For network game ...
[ { "docid": "b2dc68f595653c41a6a234d2d2309de7", "score": "0.57862604", "text": "def process_protocol(cmds, vars)\n end", "title": "" }, { "docid": "32129cd50771fb8a9c3a57ce48342048", "score": "0.5695978", "text": "def object_parsed(obj)\n if obj[:type] == \"pass\"\n put...
c970e0f7a194917181cf97bde0b3e70b
Returns all descendants of instance.
[ { "docid": "65ee2f96d6be1e6f8ad451138982a6d2", "score": "0.75859326", "text": "def descendants\n results = children\n children.inject(results) { |r, c| r.concat(c.descendants) } unless children.empty?\n results\n end", "title": "" } ]
[ { "docid": "9f2f073a1d969fd78178362da7205271", "score": "0.8365109", "text": "def descendants\n _descendants self\n end", "title": "" }, { "docid": "8351a5a5e2a112d0e727e2648c696c69", "score": "0.8340837", "text": "def descendants\n base_class.descendants(self)\n end"...
eeda03efa75d03f781064fa2726e2860
syntax hilight the dsl / ruby code
[ { "docid": "d16402cba44e15d93781fd4eca7206af", "score": "0.6318257", "text": "def show_ruby(str)\n #TODO: use syntax\n # http://blog.wolfman.com/articles/2006/05/26/howto-format-ruby-code-for-blogs\n str2=str\n str2.gsub!(/('[^']*')/) {\"<span class='quote'>#{$1}</span>\"}\n str2.gsub!(/(...
[ { "docid": "51051bd5cf5ffa4316547c34f65df348", "score": "0.7741159", "text": "def syntax; end", "title": "" }, { "docid": "51051bd5cf5ffa4316547c34f65df348", "score": "0.7741159", "text": "def syntax; end", "title": "" }, { "docid": "51051bd5cf5ffa4316547c34f65df348", ...
e912810467291daca3708e9f15d53eb6
Redirect to home page after sign in
[ { "docid": "b8859b4509eeb67d1565d3d96414fee4", "score": "0.0", "text": "def after_sign_out_path_for(_resource)\n root_path\n end", "title": "" } ]
[ { "docid": "be24f67f7cb6ff639d752e919cf79702", "score": "0.8112753", "text": "def home\n redirect_to user_signed_in? ? user_home_path : new_user_session_path\n end", "title": "" }, { "docid": "f463e2c0be015faf8e8072582416c292", "score": "0.8063436", "text": "def redirect_if_auth\...
f22f5e17e20f3a86e1c2d23518e5d20a
DELETE /treinos/1 DELETE /treinos/1.json
[ { "docid": "57f2812fd3b9d3ac054bd232b73c2adc", "score": "0.71852565", "text": "def destroy\n @treino.destroy\n respond_to do |format|\n format.html { redirect_to treinos_url, notice: 'Treino was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": ...
[ { "docid": "c459d58cd0ec04b5a220418207554de3", "score": "0.71655744", "text": "def destroy\n @treinamento = Treinamento.find(params[:id])\n @treinamento.destroy\n\n respond_to do |format|\n format.html { redirect_to treinamentos_url }\n format.json { head :no_content }\n end\n end...
3954c05b55b06519eb318b5e72914cae
Same as darken(color, percentage) is SASS Usage: darken("80E619", 20) == "4D8A0F"
[ { "docid": "957764effb4f115d4a81dd620bbbe9fd", "score": "0.76784015", "text": "def darken(name_or_hex, percentage)\n hsl = Color::RGB.by_css(name_or_hex).to_hsl\n hsl.l -= normalize_percentage(percentage)\n hsl.to_rgb.hex.upcase\n end", "title": "" } ]
[ { "docid": "7ab24b4ec9ff83699e158553ccecc39b", "score": "0.7894398", "text": "def darken(hexcolor, amount = 0.5)\n amount /= 100 if amount > 1\n v = parse_hex(hexcolor)\n \"#{get_hex(v[:r] * amount)}#{get_hex(v[:g] * amount)}#{get_hex(v[:b] * amount)}\"\n end", "title": "" }, { "do...
de2139ec8f3ff18c53aded26c5f5958e
If desired, override this method to automatically dispute order details, during NotificationSenderperform. As an example, UMass overrides this method in UmassCorum::NotificationSenderExtension
[ { "docid": "027c7840f5c3bbd95b2c8fbca6306508", "score": "0.7751245", "text": "def auto_dispute_order_details\n nil\n end", "title": "" } ]
[ { "docid": "b64ad5a1ed92b6775d2c020f2e47b590", "score": "0.7355443", "text": "def order_received(order)\n @order = order\n\n mail :to => \"sandra_sovane@inbox.lv\", :subject => 'Pragmatic Store Order Confirmation'\n end", "title": "" }, { "docid": "4a123a680b567560eb9e94fddc21c872", ...
3bc6bb8af620e06f6a8d7905a5fd6c09
Returns the value of attribute restore_ownership. source://rubyzip//lib/zip/entry.rb9
[ { "docid": "3d00d0420f7f1d4c11c6178cfd0d98c5", "score": "0.6189937", "text": "def restore_ownership; end", "title": "" } ]
[ { "docid": "16e4a418c01961154752bdf87687685b", "score": "0.6079387", "text": "def ownership=(value)\n @ownership = value\n end", "title": "" }, { "docid": "f77f1fdc440a2cd930c8c0dc35d7e278", "score": "0.60114086", "text": "def get_entry(entry)\n selecte...
d08357d28fefbdb4143936e6c185f077
Update service insertion exclusion list Update the exclusion list for service insertion policy
[ { "docid": "c13d1e84ef7a99b795b157b0e9201484", "score": "0.56036663", "text": "def update_si_exclude_list_0_with_http_info(policy_si_exclude_list, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicySecurityServiceInsertionSettingsExclusionListA...
[ { "docid": "2b27e4797783a0d542e02a22e9ab59c4", "score": "0.68273556", "text": "def update_service_insertion_exclude_list(si_exclude_list, opts = {})\n data, _status_code, _headers = update_service_insertion_exclude_list_with_http_info(si_exclude_list, opts)\n data\n end", "title": "" ...
efba1db9ce3db5ef9ea80013cf748ec3
POST /places POST /places.json
[ { "docid": "0f4d64fa239c7be8dd2881c0a9b45d1c", "score": "0.63081765", "text": "def create\n @place = Place.new(user_id: params[:user_id], place_name: params[:place_name], latitude: params[:latitude], longitude: params[:longitude])\n\n if @place.save\n @trip_point = TripPoint.new(trip_id: para...
[ { "docid": "a90a21c460aa09d9221edfbbc592df88", "score": "0.7381607", "text": "def create\n place = Place.new(params[:place])\n\n if place.save\n render json: place, status: :created, location: place\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end", ...
3361f70567e2bdff8ea6d03477bdbd0e
Inserts "Track an Issue" button on a side
[ { "docid": "6ee9179b632920cb9ad310c6fe773992", "score": "0.56542426", "text": "def issues_list(type, company, product=nil, side='right', textColor='white', bgColor='#55B055')\n server = detect_bothers_server_name()\n\n button_script = %{\n <!-- Bothers.Me button -->\n <script>\n ...
[ { "docid": "f02c91977defe5d170a8a1c65946a205", "score": "0.62240064", "text": "def add_related_issue\n issue_id = params[:issue_id].to_s.sub(/^#/,'')\n @issue = @changeset.find_referenced_issue_by_id(issue_id)\n if @issue && (!@issue.visible? || @changeset.issues.include?(@issue))\n @issue...
c84211bb0fb44432c77f4d146ce24791
Documentation for options is left aligned. For example, a ARG Some description big Another bit of info c, class Yet more info See +option_align+.
[ { "docid": "0ce5a4f352f9dec3e644bf21e9fd7fbd", "score": "0.535075", "text": "def left_align\n @align = nil\n end", "title": "" } ]
[ { "docid": "fb99396cfcb600b77dc7278135474851", "score": "0.7482828", "text": "def option_align\n @align = true\n end", "title": "" }, { "docid": "2d54874d7ada8cf758d06bcd10899208", "score": "0.71320415", "text": "def docopt_options(width)\n @options['Options'] = {} unles...
2d6f06148d058d3402e048d3b14ec700
When using sed to replace in place, don't rely on i for POSIX compatibility
[ { "docid": "5ee55cbe2b808b423c08cacc01aa8ac0", "score": "0.5490373", "text": "def sed(command, filename)\n system \"sed '#{command}' #{filename} > #{filename}.tmp && mv #{filename}.tmp #{filename}\"\nend", "title": "" } ]
[ { "docid": "ec2f8c69bcebfbe162683c7140352631", "score": "0.7487206", "text": "def sed_i(file, pat, rep)\n File.write(file, File.read(file).gsub(pat, rep))\nend", "title": "" }, { "docid": "8c97eec0aa9cf339624b590733a997df", "score": "0.6966421", "text": "def sed_i\n @sed_format ||=...
51fcdc515a3da7e6735b9b5eef0a076c
duplicates get_product_category_taxon investigate (aslepak)
[ { "docid": "6ac41c5afc378dd98ea38406b6725a88", "score": "0.6275955", "text": "def category_taxon\n @category_taxon ||= self.taxons.find_by_taxonomy_id(Spree::Taxonomy.find_by_name('Categories'))\n end", "title": "" } ]
[ { "docid": "5759fbe7291e6d35f98536e2c9a56f97", "score": "0.70829916", "text": "def get_product_category_taxon\n self.taxons.find_by_taxonomy_id(Spree::Taxonomy.find_by_name(\"Categories\").id)\n end", "title": "" }, { "docid": "10c5e036d0c0b826f259f5124d8011f1", "score": "0.5967688",...
afc7dc755a9d2ed8352ed9f9316b90a4
Return the rest field for this class.
[ { "docid": "16244f42f2e66bc02fea532203e5cc4f", "score": "0.84727514", "text": "def rest_field\n self.class.rest_field\n end", "title": "" } ]
[ { "docid": "341fdb10e8d57da8627b457e3bdc4ff2", "score": "0.67788154", "text": "def rest_field\n @rest_field ||= ip - min\n end", "title": "" }, { "docid": "2985b0eac1e3120cd4181fd1c14b5cd1", "score": "0.6752069", "text": "def field\n return @field\n ...
c5c17fa2be6597991f80aa81268d9cd2
Checks to see if the game is over. Returns true when guess == answer
[ { "docid": "edff48c3dd4c06aa773c7c30e44c2d57", "score": "0.85909206", "text": "def game_over?\n @guess == @answer\n end", "title": "" } ]
[ { "docid": "ea76d4f7bf5a341037c975a2b38c7dd3", "score": "0.79575115", "text": "def check_win\r\n\t\tif @guess_word == @secret_word \r\n\t\t\t@is_over = true \r\n\t\t\tputs \"Congrats! You won!\"\r\n\t\telse\r\n\t\t\tfalse \r\n\t\tend \r\n\r\n\t\tif @num_guess == 0 \r\n\t\t\t@is_over = true\r\n\t\t\tputs...
d388b2f4fad149dd2c3f791f86aa7bcd
GET /foodcategories/1 GET /foodcategories/1.json
[ { "docid": "81286cae8956e6ffc6aa6ecbc262ec0e", "score": "0.73043865", "text": "def show\n @foodcategory = Foodcategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foodcategory }\n end\n end", "title": "" } ]
[ { "docid": "d0d388dcd9ffdaaceaa8b7fc85dd16b9", "score": "0.7453536", "text": "def index\n @foodcategories = Foodcategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodcategories }\n end\n end", "title": "" }, { "docid": "8...
a18e42a3762e0cf002b78d0cb374f887
PATCH/PUT /links/1 PATCH/PUT /links/1.json
[ { "docid": "4d1a93c4f070ba83e46c7ddde9a7b4a2", "score": "0.61458224", "text": "def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to user_links_path( current_user ), notice: 'Link was successfully updated.' }\n format.json { render :show, st...
[ { "docid": "f43d76ace9540a3706cd43a54ed926a3", "score": "0.70023555", "text": "def update\n url = get_url\n @link.update_attribute(:url, url)\n render json: { message: 'Link updated' }\n rescue => err\n render json: { error: err }, status: 422\n end", "title": "" }, { "docid": ...
6627e3e771aed8c8cf3373c88f349791
Explain matches with no template This is a 1 to 1 mapping of a ElasticSearch call to _explain. Further information can be found at their . Permissions Needed: SEARCH_ADMIN
[ { "docid": "c40797bd14632f84b718c1c522be9ac5", "score": "0.5155491", "text": "def search_explain_get(type, id, opts = {})\n data, _status_code, _headers = search_explain_get_with_http_info(type, id, opts)\n return data\n end", "title": "" } ]
[ { "docid": "b63d6d0341f718b051a2fe312f2860d8", "score": "0.65810287", "text": "def supports_explain?\n false\n end", "title": "" }, { "docid": "b63d6d0341f718b051a2fe312f2860d8", "score": "0.65810287", "text": "def supports_explain?\n false\n end", "title"...
5623a1e4bfde027f66dd13afff7faf35
Returns ALL items for this Mobile, including those within containers carried by this mobile, recursively.
[ { "docid": "d9e45b5744873e9beca3b3d990f169e6", "score": "0.78427225", "text": "def all_items\r\n results = []\r\n sub_items = self.items\r\n while sub_items.any? do\r\n results += sub_items\r\n sub_items = sub_items.select! { |i| i.is_a?(Container) }.map(&:item...
[ { "docid": "42416d4c5c0eb16efe15bf6c79a70c7e", "score": "0.6893085", "text": "def items\n @items ||= containers.collect(&:item).compact\n end", "title": "" }, { "docid": "ea37b88e11b12ddabf712339b5ca6243", "score": "0.66261953", "text": "def items\r\n\t\tItem.all(:conditions => {...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "c4fca2a99eba6a766fa78002c8c8e271", "score": "0.0", "text": "def url_params\n params.require(:url).permit(:url)\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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5fb03dd64bdf15ce6d3486649308c443", "score": "0.0", "text": "def set_applied_job\n @applied_job = AppliedJob.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...
0186122e6d4418e00250b61ad820a354
GET /admin/pledges GET /admin/pledges.json
[ { "docid": "a063ce84cf55a604d74c03f04ecbe77f", "score": "0.616608", "text": "def index\n @pledges = Pledge.sorted\n end", "title": "" } ]
[ { "docid": "33be907816a2e3802bd94b2dcb48a819", "score": "0.7452037", "text": "def project_pledges(project_id)\n return get(\"/projects/#{project_id}/pledges\")\n end", "title": "" }, { "docid": "f8a1896d46addba3aa37d908c4a208d9", "score": "0.66147166", "text": "def index\n @pl...
2490717a236e7d66ff4a511af2d98eea
POST /beings_happenings POST /beings_happenings.xml
[ { "docid": "0cbb307b815bc30ec0fca7409621a6db", "score": "0.6616601", "text": "def create\n @beings_happening = BeingsHappening.new(params[:beings_happening])\n\n respond_to do |format|\n if @beings_happening.save\n flash[:notice] = 'BeingsHappening was successfully created.'\n f...
[ { "docid": "5bf75c80b6c1afd029c4bd2222278299", "score": "0.5995988", "text": "def call(env)\n body = names.map {|name| \"<meow>#{name}</meow>\" }.join(\"\\n\")\n\n [200, {\"Content-Type\" => \"application/xml\"}, [body]]\n end", "title": "" }, { "docid": "98ecf24496c4a44eef15237f46a6c...
77887784a925293f6e3c98e958adf928
Only for tests purposes
[ { "docid": "f3ea6b7c176e863e9b6a646b010c4cb9", "score": "0.0", "text": "def fetch_test_feed\n logger.info 'FeedManager: env is test, fetching test data'\n data = Feedzirra::Feed.parse File.open(Rails.root.join('test', 'test_feeds', 'valid_feed.xml'), 'r').read\n return Feed.new :title => data.t...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7956906", "text": "def private; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", "score": "0.68082196", "text": "def specie; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "011f12665bc7de70bc50d7fb93e8fc7c", "score": "0.0", "text": "def spell_progression_params\n params.require(:spell_progression).permit(:adventuring_class_id, :subclass_id, :level_progression_id, :spell_level, :slots)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69795185", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782116", "text": "def strong_params\n params.requ...
4e1cac74577951a9c3c93e714fb1253b
Traverses the dependency graph and marks all items that (directly or indirectly) depend on an outdated item as outdated.
[ { "docid": "309ee0d2be36fe71ec9845121af45f86", "score": "0.8045218", "text": "def propagate_outdatedness\n # Unmark everything\n @items.each { |i| i.outdated_due_to_dependencies = false }\n\n # Mark new items as outdated\n added_items = @items - @previous_items\n added_items.eac...
[ { "docid": "1c615e05f66abf892b2a9c62349c96ce", "score": "0.7338134", "text": "def propagate_outdatedness\n # Unmark everything\n @objects_outdated_due_to_dependencies.clear\n\n # Mark new objects as outdated\n added_objects = @objects - @previous_objects\n @objects_outdated_due_...
374386e42289a578ead86bb7af9fe2a7
Method to process a transaction in the database It is meant to deduct the transaction amount from sender, and add the amount to receiver def processTransaction(sender, receiver, amount) senderAccount = Account.find_by_id(sender) receiverAccount = Account.find_by_id(receiver) senderAccount.balance = amount receiverAccou...
[ { "docid": "96cd1a837842a3e02f30cff9e6bd260b", "score": "0.0", "text": "def create\n\t\t@transaction = Transaction.new(transaction_params)\n\t\t@transaction.processTransaction(@transaction)\n\n\t\trespond_to do |format|\n\t\t if @transaction.save\n\t\t\tformat.html { redirect_to @transaction, notice: '...
[ { "docid": "56413fc535a0790b2f424e35cd811a1d", "score": "0.8717271", "text": "def processTransaction(transaction)\n\t\tsenderAccount = Account.find_by_id(transaction.account_id)\n\t\treceiverAccount = Account.find_by_id(transaction.transferee_id)\n\t\t\n\t\tsenderAccount.balance -= amount\n\t\treceiverA...
13567753eeb144557c4ceae97dc62077
If this is a preflight OPTIONS request, then shortcircuit the request, return only the necessary headers and return an empty text/plain.
[ { "docid": "7b901fc038c5c48e01298d8f68930dcd", "score": "0.68012625", "text": "def cors_preflight_check\n\t if request.method == :options\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'GET, OPTIONS'\n\t headers['Access-Control-Allow-Headers'] = ...
[ { "docid": "9e36f0e05c194cf638c1399a231c6c79", "score": "0.7639777", "text": "def handle_options_request\n head(:ok) if request.request_method == \"OPTIONS\"\n end", "title": "" }, { "docid": "18fd73266177c195768a536fc446d0e8", "score": "0.7633374", "text": "def handle_option...
47a6c9a589eb0f1e04cabc17fab40a5a
POST /profiles POST /profiles.json
[ { "docid": "2369f6054e5c22c51d06f665860a8940", "score": "0.6791492", "text": "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html {redirect_to @profile, notice: 'Profile was successfully created.'}\n format.json {render...
[ { "docid": "443f7ac6eb20f4026d28d4e500090204", "score": "0.7567471", "text": "def create\n @profile = current_user.profiles.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n f...
142e714e06f023b1a5f8f1e751cfc379
Get next option combination result.
[ { "docid": "f5f5cdeca5866bbdc20e95522470cf0d", "score": "0.49965915", "text": "def next\n return nil if finished?\n\n @left_generator.reset if @left_generator.finished?\n @right_generator.reset if @right_generator.finished?\n\n left = @left_generator.next\n right = @r...
[ { "docid": "24ef7d6af6b70f8208596b77e79980bc", "score": "0.6370892", "text": "def select_next_value\n self.choice = next_value.to_sym if next_value?\n self\n end", "title": "" }, { "docid": "9100264f33cd3b88c425ce74d5342939", "score": "0.61990035", "text": "d...
9cd63667f133ef47047291c422f6b266
Function to determine how much has the user purchased for the event
[ { "docid": "bcbf3b9bd34e69696dc1e77c1d6fb48a", "score": "0.816539", "text": "def total_user_event_purchases()\n\t\tevent = self.event\n\t\tuser = self.user\n\n\t\ttotal_user_event_purchase = 0\n\t\tif !user.purchases.find_all_by_event_id(event).nil?\n\t\t\tuser.purchases.find_all_by_event_id(event).each...
[ { "docid": "aaaf884586b0349eead48e60c6fdbc26", "score": "0.7818481", "text": "def total_event_purchases_share\n\t\t(self.event.purchases.sum('amount') / self.event.users.count).round(2)\n\tend", "title": "" }, { "docid": "8c60f02d6a7c7c3c3740d62f1e915c78", "score": "0.67640305", "tex...
cc6492efe9ab3d49f22f01063093569f
Get the list of records
[ { "docid": "9fcf53da14e4a9907bc3bafdfa744f80", "score": "0.0", "text": "def index\n if params[:search_string].present?\n @list = resource_class.search(current_user,params[:search_string]).paginate(page: params[:page], per_page: DEFAULT_PER_PAGE)\n else\n @list = resource_class.get_list(c...
[ { "docid": "e0fe00742882463a8dac05bec78be317", "score": "0.7966724", "text": "def records\n @records ||= []\n end", "title": "" }, { "docid": "ec8008cbbb13d839be85b85cb6a5974c", "score": "0.7711938", "text": "def records\n @records ||= search.records\n end", ...
290f1de91245c76ef3833fd1000f589f
Define your play method below
[ { "docid": "1a8110ebd36f1d14dbbacb0bda92ce4a", "score": "0.0", "text": "def play(board)\n until over?(board) == true\n input = turn(board)\n end\n\n if won?(board) != false\n puts \"Congratulations #{winner(board)}!\"\n else\n puts \"Cat's Game!\"\n end\nend", "title": "" } ]
[ { "docid": "68219f003a195d32dc813c3985175f6f", "score": "0.91277385", "text": "def play\n \n end", "title": "" }, { "docid": "4a47c84d511d91b9083a5b0a1d9eff85", "score": "0.9031555", "text": "def play; end", "title": "" }, { "docid": "b82d37ab1b312789b3b27c088b8af245"...
63e94f77683a55f876b0dd0cda1e9a87
Please use spree_faq/config/routes.rb instead for extension routes. def self.require_gems(config) config.gem "gemnamegoeshere", :version => '1.2.3' end
[ { "docid": "6bc2fcc04f00a1df4c730cac7cf37c0e", "score": "0.0", "text": "def activate\n Admin::ConfigurationsController.class_eval do\n before_filter :add_faq_links, :only => :index\n def add_faq_links\n @extension_links << {:link => admin_question_categories_path, \n ...
[ { "docid": "7a15aea0233e94db57465006fb8820dd", "score": "0.7065823", "text": "def require_gems; end", "title": "" }, { "docid": "9965ae0f1aedf4116d31600238801f20", "score": "0.64536893", "text": "def add_gem_paths; end", "title": "" }, { "docid": "e45b531f7d826f335261f771...
e7c55332f92b148ba9707f877b1ec278
POST /purchases POST /purchases.json
[ { "docid": "faf4310de35b0aab98d45287bae1aea8", "score": "0.58436865", "text": "def create\n @errors = []\n @compiled = []\n otp = params[:otp]\n totp = ROTP::TOTP.new(session[:secret_key])\n #Must be verified within 30 seconds\n respond_to do |format|\n\n unless totp.verify(otp, d...
[ { "docid": "cf2ffac24ec3d306262371e76081eed7", "score": "0.7372497", "text": "def do_purchase\n user.purchases.create!(\n amount_in_cents: purchase_amount,\n employee_id: purchase_params.dig(:employee_id),\n qty: purchase_params.dig(:qty).to_i,\n venue_id: purchase_params.dig(:ven...
ca2d0cfd820048b605ed173cdf84790d
DELETE /watchers/1 DELETE /watchers/1.xml
[ { "docid": "54ddd93fc3ee047bf89ddeace26650ad", "score": "0.0", "text": "def destroy\n @watcher = Watcher.find(params[:id])\n @item = @watcher.item\n puts \"going to redirect to '#{@item}'\"\n if @watcher.user == current_user\n @watcher.destroy\n flash[:notice] = \"You are no longer...
[ { "docid": "b228ac476308c82e3266a5f69363ffa6", "score": "0.693832", "text": "def destroy\n @watcher = Watcher.find(params[:id])\n @watcher.destroy\n\n respond_to do |format|\n format.html { redirect_to watchers_url }\n format.json { head :ok }\n end\n end", "title": "" }, ...