query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
e1b89b245954d9e136807e125f289f7d
Method to add more planets
[ { "docid": "7dae7ad39434843a2bd4eb6399eee61c", "score": "0.76527435", "text": "def add_planet(planet)\n @planets << planet\n end", "title": "" } ]
[ { "docid": "44d85273093920945443a0d41d92dd97", "score": "0.81429875", "text": "def add_planets(planet)\n @planets << planet\n end", "title": "" }, { "docid": "bbdc20410f75215a7f95ebccbd0f51d8", "score": "0.8097891", "text": "def add new_planet\n @planets << new_planet\n end",...
f37dc5979c6f8336e5646796deed1c88
methods to get data from mobile device and update it
[ { "docid": "c663c69c2d7ede477649afc294245357", "score": "0.69037443", "text": "def update_mobile_stats\n\tend", "title": "" } ]
[ { "docid": "cfd1e58be02f5ee22bcc3da86ea0c079", "score": "0.6800914", "text": "def update_data\n\n end", "title": "" }, { "docid": "908dd1859b1ec36395f791814850f866", "score": "0.6424799", "text": "def update\n @device.touch # when the default device function is clicked really...
01952ca9872b00d4c14e8b7835803e1b
Add an instantmessaging/point of presence address field, IMPP. The address is a URL, with the syntax depending on the protocol. Attributes of IMPP are: preferred: true set if this is the preferred address location: home, work, mobile location of address purpose: personal,business purpose of communications All attribute...
[ { "docid": "22dbd937a11031672d4264e0362a8e21", "score": "0.60952216", "text": "def add_impp(url) # :yield: impp\n params = {}\n\n if block_given?\n x = Struct.new( :location, :preferred, :purpose ).new\n\n yield x\n\n x[:preferred] = \"PREF\" if x[:preferred]\n\n...
[ { "docid": "3c7bc8501bbed0fa3c01b99ad6f6a1dd", "score": "0.6209523", "text": "def to_impp\n impp = Field.parse(\"IMPP:\")\n impp.params = Param::deep_copy(@params)\n impp.text = \"#{protocol}:#{text}\"\n impp\n end", "title": "" }, { "docid": "ccaa4cdfa2fc6dcdd20a6b38f...
f21752c41dd8ca764e37f85a2a622525
Devuelve decimal sin separador de miles
[ { "docid": "c11a69bbbc5399a741c343ec93c7bce3", "score": "0.5804963", "text": "def decimal_pelado(num)\n num.sub! ',', '' if num.is_a?(String) && num.include?(',')\n num.to_f\nend", "title": "" } ]
[ { "docid": "c52e21cda769ce9db8537500bd95f7b4", "score": "0.7605982", "text": "def m_to_km (miles)\n km = miles * 1.63\n return \" #{miles} %.2f\" % km\nend", "title": "" }, { "docid": "9a1073f7c75029130f895667b9783e5e", "score": "0.73847055", "text": "def miles_to_kilometers(mi...
3c43fda6672bf6c00bfbedcffe2ea9eb
should accept a recipe instance as an argument, as well as a date and rating, and create a new recipe card for this user and the given recipe
[ { "docid": "f1b396442332f31f8729cc913c88b4c7", "score": "0.8173066", "text": "def add_recipe_card(recipe, date, rating)\n RecipeCard.new(recipe, self, date, rating)\n end", "title": "" } ]
[ { "docid": "afe4b4042061ca3eb43958f64e63c2e8", "score": "0.82952553", "text": "def add_recipe_card(date, recipe, rating)\n RecipeCard.new(date, self, recipe, rating)\n end", "title": "" }, { "docid": "c03002b0a18872cba10cc0b6f06f1f44", "score": "0.8240248", "text": "def add_recip...
df25ad83258d81c2b69a7a12462b38e4
GET /log_sqls/1 GET /log_sqls/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "1938dcb2f733296d3197eaff8e80da24", "score": "0.70371974", "text": "def index\n @log_sqls = LogSql.all\n end", "title": "" }, { "docid": "6d2cc1c92cfe50f0e2eeb1623f71866b", "score": "0.6387509", "text": "def getLogs()\n\tbegin\n\t\tdbc = Mysql.new(DB_SERVER, DB_USER, D...
a841453b4d524f15ebc338401ce94e71
GET /liquidations/1 GET /liquidations/1.json
[ { "docid": "24181a2c761ef540fbdc40629d2fd2e2", "score": "0.0", "text": "def show\n @liquidation = Liquidation.find(params[:id])\n liq = Liquidation.find(params[:id])\n @driver = Driver.find(liq.driver_id)\n \n\n end", "title": "" } ]
[ { "docid": "4ee899a1b1a2f1679365f63e3ff2032e", "score": "0.7000766", "text": "def index\n @liquidaciones = Liquidacion.all\n end", "title": "" }, { "docid": "68a010339d34d8fa38afc746f19a93b2", "score": "0.6986897", "text": "def index\n @liquidacions = Liquidacion.all\n end", ...
eeead46cae13be31592bf8cbcb03a735
POST /gears POST /gears.json
[ { "docid": "51a426ec1aa62d0de4aea94e3cecdbb9", "score": "0.0", "text": "def create\n @current_usinfo\n @usinfo=Usinfo.all\n @usinfo.each do |elt|\n if(elt.user.email==current_user.email)\n @current_usinfo=elt\n end\n end\n @gear = @current_usinfo.gears.new(gear_params)\n\n ...
[ { "docid": "598011dd4dc9d1dd1dc75b907a9b645a", "score": "0.58995456", "text": "def create\n @hoge = Hoge.new(params[:hoge])\n\n respond_to do |format|\n if @hoge.save\n format.html { redirect_to @hoge, notice: 'Hoge was successfully created.' }\n format.json { render json: @hoge...
8df441cd2e8db42367c897906793df05
Drops a PostgreSQL view.
[ { "docid": "25458eb2bb3c58f62449c0f470f50a40", "score": "0.84563094", "text": "def drop_view(view)\n repository.adapter.execute <<-SQL.compress_lines\n drop view if exists #{quote_name(view.name)} cascade\n SQL\n end", "title": "" } ]
[ { "docid": "eb932232a9800220b8f07be720a4af14", "score": "0.8449911", "text": "def drop!\n conn = @conn_proc.call\n views.each do |_name, view|\n conn.execute SchemaStatements.drop_view view\n end\n end", "title": "" }, { "docid": "97f21656191542f65d18af16f8d59468", ...
6ee70b13779340b245a8efb1b6435096
Launch the server, but not before doing some checks and making sure we ask it to "prepare". This will set the server options such as port and static files folder.
[ { "docid": "4fad5f6270a11d19d3911533864445c6", "score": "0.73336196", "text": "def launch_server\n unless File.directory? config.path\n STDERR.puts \"Invalid path (#{config.path})\" \n return\n end\n\n show_status\n Server.prepare\n Server.run!\n end", "titl...
[ { "docid": "8528fe04f52e84b529cee574f645de56", "score": "0.7473222", "text": "def setup_server\n opts = { :Port => 8808, :DocumentRoot => @source_path }\n unless $DEBUG\n require 'logger'\n opts[:Logger] = Logger.new('/dev/null')\n opts[:AccessLog] = Logger.new('/dev/null'...
1d82d85347371a9c5183eb741a566610
Delete a 'capability.SiocModuleManufacturingDef' resource.
[ { "docid": "59bba23f0b7e12693ff1880d11cfc6ad", "score": "0.76605546", "text": "def delete_capability_sioc_module_manufacturing_def(moid, opts = {})\n delete_capability_sioc_module_manufacturing_def_with_http_info(moid, opts)\n nil\n end", "title": "" } ]
[ { "docid": "89ea2e2e0684f43522477910148412b6", "score": "0.70067173", "text": "def delete_capability_io_card_manufacturing_def(moid, opts = {})\n delete_capability_io_card_manufacturing_def_with_http_info(moid, opts)\n nil\n end", "title": "" }, { "docid": "ea35479d82825c943c867...
9406a810b2807c16d986f02c0d859f5d
Initialize the item description window graphisms and texts
[ { "docid": "fcb5c6590eb2a0de6ae8c3dd19201ccb", "score": "0.67860144", "text": "def initialize(viewport)\n super(viewport, 7, 184)\n @item_desc_window = add_background('shop/pkm_desc_window')\n @item_desc_name = add_text(20, 9, 150, 9, nil.to_s)\n @item_desc_name.draw_shadow =...
[ { "docid": "9dbb3181915f58c33735402f582805ab", "score": "0.7170127", "text": "def create_item_desc_window\n @item_desc_window = ItemDesc.new(@viewport)\n update_item_desc\n end", "title": "" }, { "docid": "c279cf8ceb863fcc1db76022af27848a", "score": "0.6502118", "text": ...
61ab95d04a2268f5954e916ac377e0de
GET /issue_checklists/1 GET /issue_checklists/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "f44d6692fe3294346e32f7479af287b8", "score": "0.78257877", "text": "def index\n @issue_checklists = IssueChecklist.all\n end", "title": "" }, { "docid": "85665d37f3e4ac0651bf4d202fd810fa", "score": "0.73253375", "text": "def checklists()\n json_call Net::HTTP::Get.n...
f00965fa93ea33c29b0fb30640e52957
if live neighbours are greater than 3 then satisfies rule2
[ { "docid": "79c5b0ab2062e9cb2ca1811405233537", "score": "0.8500317", "text": "def check_rule_2(neighbours)\n if get_live_neighbours_count(neighbours) > 3\n return true\n end\n end", "title": "" } ]
[ { "docid": "20226a33079348e68c600de595eef4b4", "score": "0.8485238", "text": "def check_rule_3(neighbours)\n if 2 <= get_live_neighbours_count(neighbours) || get_live_neighbours_count(neighbours) <= 3\n return true\n end\n end", "title": "" }, { "docid": "445cbaab45ef38bbef73f3e86...
14868d78615777c2855789e09ae63dc8
Returns extension found in URL
[ { "docid": "9a6ea4dc31d7d7bbd492bd233e189336", "score": "0.0", "text": "def image_url_provided?\n matchdata = @link.match(PreviewScrapper::ALLOWED_EXTENSIONS)\n matchdata ? true : false\n end", "title": "" } ]
[ { "docid": "08eb7b41408748ac99cb71ddd4fcb874", "score": "0.78316164", "text": "def extname(video_url)\n File.extname(video_url).split(%r{[?&]}).first\n end", "title": "" }, { "docid": "dbe46fa4e00a3c62852bebe31e083fe6", "score": "0.7823078", "text": "def extname\n return n...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "0c11ccb708095c4902061bd9247bc9ff", "score": "0.0", "text": "def event_params\n params.require(:event).permit(:title, :status, :description, :start_date, :end_date, :location, :start_time, :end_time, :age_limit, :price, :host_id, event_photos_attributes: [:id, :event_id, :image])\n en...
[ { "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...
a52d8dc33d25e7c1b6e9debba74a2e50
Mark the current buffer as having been used, effectively moving it to the top of the stack. Has no effect on unlisted buffers or buffers without names.
[ { "docid": "ab5e37879e775a0d0e6702f144aee6cc", "score": "0.68263245", "text": "def touch\n number = $curbuf.number\n return unless ::VIM::evaluate('buflisted(%d)' % number) == 1\n return unless $curbuf.name\n\n stack.delete number\n stack.push number\n end", "...
[ { "docid": "bafca51cd3702c63f0eb723367873a40", "score": "0.72312796", "text": "def mark_used\n @used = true\n end", "title": "" }, { "docid": "26df72a9bda85e3af879efdcd8f66bd0", "score": "0.6680771", "text": "def token_buffer_stash(buf)\n @buffers.push(buf)\n ...
96c6f7c61aaad72b152ec43e057203ca
POST /encrypters POST /encrypters.json
[ { "docid": "808f47fa0875ea223e4e36d5084848f7", "score": "0.6994636", "text": "def create\n @encrypter = Encrypter.new(encrypter_params)\n\n respond_to do |format|\n if @encrypter.save\n format.html { redirect_to @encrypter, notice: 'Encrypter was successfully created.' }\n forma...
[ { "docid": "414bca7951d26c0cbe1f1419c2282bf1", "score": "0.61342245", "text": "def index\n @encrypters = Encrypter.all\n end", "title": "" }, { "docid": "3da109821b95329222e1a1cf249a1236", "score": "0.6045207", "text": "def ceaser_encrypt\n\n\t\t@alphabet = [*'A'..'Z',*'a'..'z',*...
39d17760645a7fe8caf92a04382e8d6e
Instantialize a Cuboid with: origin: to set starting point [x, y, z], width: to track xaxis width, height: to track yaxis height, length: to track zaxis length, current_pos: to track cuboid position as it moves around.
[ { "docid": "f239af5a05a91e8223c53653324a5c55", "score": "0.7195978", "text": "def initialize(origin, x_width, y_height, z_length)\n @origin = origin\n @width = x_width\n @height = y_height\n @length = z_length\n @current_pos ||= origin\n end", "title": "" } ]
[ { "docid": "6842498a941983e6e6c6cc6ba24d6108", "score": "0.6423386", "text": "def initialize(origin:, length:, width:, height:)\n @origin = Coordinate.new(*origin)\n @length = length # x\n @width = width # z\n @height = height # y\n end", "title": "" }, { "docid": "5b4f4f34abcea...
beaab488f01463b5e4d87119eac943e8
Convert PDF to Word DOCX Document based on rasterized version of the PDF Convert standard PDF to Office Word Documents (docx), but first rasterize the PDF. Converts a PDF at high fidelity into Word format.
[ { "docid": "b201d45724f09e7f6e8a143f8a47b015", "score": "0.7151521", "text": "def convert_document_pdf_to_docx_rasterize(input_file, opts = {})\n data, _status_code, _headers = convert_document_pdf_to_docx_rasterize_with_http_info(input_file, opts)\n data\n end", "title": "" } ]
[ { "docid": "5c54bd0d51c3c9d2f12ce7ea888eb1b6", "score": "0.63742733", "text": "def convert_document_pdf_to_docx_rasterize_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDocumentApi.convert_document_pdf_to_docx_ra...
b647533dccf2bb073acfcbdb93dbd2a0
I could be an End event, no step
[ { "docid": "619091e4174a212f8f9de179f17238bc", "score": "0.0", "text": "def error_required(ctx, **)\n ctx[:error] = \"Fragment :unit_price not found\"\n false\n end", "title": "" } ]
[ { "docid": "4344874607ea61160369478f6d708bf9", "score": "0.7487906", "text": "def ended\n end", "title": "" }, { "docid": "45592fe7e45a936f41da32ac7759c3cd", "score": "0.72436774", "text": "def on___end__(value); end", "title": "" }, { "docid": "ce77ca141af90cafaa584938f...
95bbb5d40f240f3f90306f20175add58
GET /shift_types/1 GET /shift_types/1.json
[ { "docid": "4a55fca3166768676c27c80a90484402", "score": "0.73969924", "text": "def show\n @shift_type = ShiftType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @shift_type }\n end\n end", "title": "" } ]
[ { "docid": "30d54229f33a705233a63efd0efff70e", "score": "0.7613668", "text": "def index\n @shift_types = ShiftType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @shift_types }\n end\n end", "title": "" }, { "docid": "abbac4a...
4ee86bd582ccbc2befdd9867f1d4e1b5
Function to check if a number is palindrome or not
[ { "docid": "7ce7a539fc6af9e22ce939385147c47b", "score": "0.8113695", "text": "def isPalindrome(number)\n numberString = number.to_s\n\n if numberString == numberString.reverse\n return true\n else\n return false\n end\n end", "title": "" } ]
[ { "docid": "aa671bfe4c20cad5c1d590441375b249", "score": "0.8658985", "text": "def palindromic_number?(number)\n palindrome?(number.to_s)\nend", "title": "" }, { "docid": "be8e6af745d1911c6797f80e7c8edd83", "score": "0.8624051", "text": "def palindromic_number?(num)\n num = num.to_s...
1afd48f3ad8673f762ce4da27286fbad
Called after each lex is finished. The default implementation is a noop.
[ { "docid": "184a0950909a31a88127bcada91ce547", "score": "0.0", "text": "def reset!; end", "title": "" } ]
[ { "docid": "405706916944d082e6db8507f10b6657", "score": "0.63024276", "text": "def assert_done\n @lexer.unpeek!\n end", "title": "" }, { "docid": "405706916944d082e6db8507f10b6657", "score": "0.63024276", "text": "def assert_done\n @lexer.unpeek!\n end", "...
16ca545a8f519051f59d895cd7fea80a
DELETE /holes/1 DELETE /holes/1.json
[ { "docid": "3dc716a3b70ab0133f9b62acf59ca13b", "score": "0.70733976", "text": "def destroy\n @hole.destroy\n respond_to do |format|\n format.html { redirect_to holes_url, notice: 'Hole was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }...
[ { "docid": "ec94400f30de363b2660ab6e0c84ada7", "score": "0.733305", "text": "def destroy\n @hole = Hole.find(params[:id])\n @hole.destroy\n\n respond_to do |format|\n format.html { redirect_to holes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "cd946ef6354c1872eadd552d8f668a8c", "score": "0.0", "text": "def editor_params\n params.require(:editor).permit(:title, :description,\n problems_attributes: [:question,:answer, :_destroy])\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980384", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782743", "text": "def strong_params\n params.requi...
bd3a7dfddc30bc69012064ac1ec450c4
Given a hash with numeric values, return the key for the smallest value
[ { "docid": "b94f004e5e73cee374191b6f29e3e4f3", "score": "0.0", "text": "def key_for_min_value(name_hash)\n#name_hash = {:blake => 500, :ashley => 0, :adam => 5}\n smallest_value = nil\n smallest_name = nil\n name_hash.each {|name, number|\n # smallest_value = number\n if smallest_value == nil\n ...
[ { "docid": "187165074e32a7573ee53a9cabb44ed4", "score": "0.8881132", "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...
855b36b70b6d1d324bacffa034ac74ec
nonrecursively find the index of a pattern matching `pattern`
[ { "docid": "905d1f1cf64c83b4b2f23e68b54cf6e7", "score": "0.0", "text": "def match match_array\n if self =~ match_array\n ArrayMatchData.new(self, match_array, @first_index, @last_index)\n else\n false\n end\n end", "title": "" } ]
[ { "docid": "806b24f0d9db7bc4731ec2d90f31a9bd", "score": "0.75854295", "text": "def index(pattern)\n if pattern.class == String\n if i = @text.index(pattern, @cursor+1)\n return (i+1)\n end\n elsif pattern.class == Regexp\n if m = @text[@cursor+1..@text.length].match(pattern)\...
6ddae37a7eecf0312c94dc0dd56a134c
PATCH/PUT /teams/1 PATCH/PUT /teams/1.json
[ { "docid": "12a30e5a5396cf5cdd818305304a8f66", "score": "0.6816778", "text": "def update\n respond_to do |format|\n if @team.update(team_params)\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n for...
[ { "docid": "555b6bd116d1f3a4d47cec062f720056", "score": "0.73927844", "text": "def update\n render json: Team.update(params[\"id\"], params[\"team\"])\n end", "title": "" }, { "docid": "ca341bd1773af925e24be57cf8927a6e", "score": "0.7176823", "text": "def update\n team = T...
654fdf75bd041476f7eee5026b584d6a
Given two lists of significant groups, determine the commonality / significance factor.
[ { "docid": "7b6cc64edd845f3390f5d6adc3ebc09a", "score": "0.6038716", "text": "def significance_factor cuisines\n size_of_intersection = (cuisines[0] & cuisines[1]).length\n total = (cuisines[0].length + cuisines[1].length - size_of_intersection)\n (size_of_intersection.to_f/total) / 2\n ...
[ { "docid": "1a58058a82f1cfc7be3a2ad53977cb15", "score": "0.69390124", "text": "def significance_factor significant_groups\n size_of_intersection = (significant_groups[0] & significant_groups[1]).length\n total = (significant_groups[0].length + significant_groups[1].length - size_of_intersectio...
f79e65be2bb3c703e259a919f1a7809c
Determine what percent toward goal has been achieved
[ { "docid": "aa21825fa6056b0beae775398b830bd1", "score": "0.724782", "text": "def percent_complete\n\t\t# If goal reached, set percent to 100\n\t\tdays_complete < self.goal ? days_complete*100/self.goal : 100\n\tend", "title": "" } ]
[ { "docid": "ce62fe9e4ef3bb494c3ccdfc0276e37b", "score": "0.7453637", "text": "def goal_progress\n if goal_amount == 0\n 0.0\n else\n (collected_donations(true).total / goal_amount).to_f\n end\n end", "title": "" }, { "docid": "b229b4d7fe8bf5e5c7d5ad6ec90cc986", "score...
3bb7401874664ec87c0169504bde7654
GET /recibo_sueldos/1 GET /recibo_sueldos/1.xml
[ { "docid": "a86360d490fb51b716888f87b53d0394", "score": "0.0", "text": "def show\n @recibo_sueldo = @liquidacion.recibo_sueldos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recibo_sueldo }\n format.pdf do\n dump_t...
[ { "docid": "3dc96b2a01f420b09aa39d85a47472bd", "score": "0.67013615", "text": "def show\n @recibo = Recibo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recibo }\n end\n end", "title": "" }, { "docid": "2bc475cd...
145582970cc944a3d62d6b080e7a7c07
Runs the chefclient with specified cookbook and json attributes
[ { "docid": "80bbd32d7daeece8a4db9fa17ba8ce2e", "score": "0.82396704", "text": "def run\n raise 'Chef-client failed' unless system(\"sudo -E chef-client -z -l error -c #{@client_rb.path} -o '#{@cookbook}' #{@json_attributes}\")\n end", "title": "" } ]
[ { "docid": "ef81f04e76dbc5269ca9fde05c1a65ba", "score": "0.71452117", "text": "def run_chef_client\n @chef_client = Chef::Client.new(\n @chef_client_json, \n :override_runlist => config[:override_runlist]\n )\n @chef_client_json = nil\n\n @chef_client.run\n @chef_client = nil\n ...
1a8db5bd968716ed491f104f4c96f028
skip_before_action :check_profile_exists, :only => [:index]
[ { "docid": "1abf796e174786cce3c8a1267e6658ea", "score": "0.0", "text": "def index\n\t\t@posts = Post.all.limit(5).order(\"created_at DESC\")\n end", "title": "" } ]
[ { "docid": "eed16edda92e461e60f4ae944c94e50b", "score": "0.6926979", "text": "def restrict_access\n render :\"/home/http_404\" unless @profile && @profile.user == current_user\n end", "title": "" }, { "docid": "7b115e4f94c0fedcc2b17f04e3623f3d", "score": "0.64860874", "text": "d...
2502297dcbaca3d78007597cd1e27b02
Creates Jekyll compatible filename YEARMONTHDAYTITLE.md
[ { "docid": "33d40849e44ccf3f9da64c9e5ba06113", "score": "0.6724844", "text": "def createFilename(publishDate, anchor)\n filename = publishDate.strftime(\"%Y-%m-%d\") + \"-\" + anchor + \".md\"\n end", "title": "" } ]
[ { "docid": "dff807e5b108b2eabd5d2df43b49e5e9", "score": "0.74746567", "text": "def default_name\n\t\t@date ||= Time.now.strftime \"%Y-%m-%d\"\n\t\ttitle_copy = @title.dup\n\t\t\n\t\ttitle_copy.gsub! ' ', '-'\n\t\ttitle_copy = @date[0..(@date.include?(' ') ? @date.index(' ') : @date.length)].concat '-'.c...
df079ac19a014794402ca7f120ee241e
Iteratively builds a linked list, value incremented by 1
[ { "docid": "74c876f95f5b50747a1487a5081dae71", "score": "0.80115277", "text": "def build_iterative_linked_list(len)\n ll = LinkedList.new\n node = Node.new(0, nil)\n\n (1..len).each do |val|\n node = Node.new(val, node)\n ll.add_node(node)\n val += 1\n end\n\n ll.head = node\n ll\nend", ...
[ { "docid": "a43f59593d13ed226964d9062a79cfb8", "score": "0.7252977", "text": "def build_recursive_linked_list(l, i)\n return nil if l <= 0 \n node = Node.new(i, build_recursive_linked_list((l-1), i+1))\n l -= 1\n\n node\nend", "title": "" }, { "docid": "426aae40a05ac1e807c7e3e50ed71a9d"...
6b55986f51ee38fa88d379b0a630a447
Updates the enduser whenever it is clicked. It should only update to a value if the end user is part of a group. AJAX POST request Params: enduser id of enduser to update the sesion with
[ { "docid": "4fc6b2b34f106ad36e93eda8b3d603ed", "score": "0.0", "text": "def session_enduser\n session[:enduser] = params[:enduser]\n\n respond_to do |format|\n format.json { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "614858e525d97bc8fb703260937bfca1", "score": "0.6973512", "text": "def edit_added_group_user\n @nsu = NonSiteUser.find(params[:id])\n if request.post?\n old = @nsu.email\n if old != params[:nsu][:email]\n @added = true if @nsu.update_attributes(:email=> params[:nsu][:em...
75831632a649a3a375b0434a55c84037
returns array of propkeys
[ { "docid": "1b2f33570f8128c081bf2d17a24b7933", "score": "0.0", "text": "def propfind_propname(xml)\n liveprops.propname(xml)\n properties.each { |p| p.propkey.xml(xml) }\n end", "title": "" } ]
[ { "docid": "b5fb25ca8ba5f5abc5f2311b5c1dc132", "score": "0.83091336", "text": "def property_keys\n []\n end", "title": "" }, { "docid": "5e3a2954e2dddbbd0c2a6eab0458d057", "score": "0.81484467", "text": "def keys\n @properties.keys\n end", "title": "" },...
7158c6c153f71514620588abda8f2491
GET /cars GET /cars.json
[ { "docid": "854bcfd4ffb0ae3ebadf7389213be5d6", "score": "0.0", "text": "def index\n #cars = Car.new\n @cars = Car.search(params[:search])\n\n ## if params[:search].blank?\n ## @cars = Car.all\n ## else\n ## @parameter = params[:search].downcase\n # @results = Car.joins(:user).where...
[ { "docid": "dc754b39f960845e16e9e525813cdfd7", "score": "0.7958042", "text": "def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end", "title": "" }, { "docid": "46097e444d865fdeb9b4fda674de15d4", "score": "0.7839653", "text": "def index\n ...
5aeb3541d5f49e7eae3263de063c152d
Don't need to pass in bracket_id, but I kept it for ease of understanding
[ { "docid": "a4bab86bb01e39c83d8bd18d67f73343", "score": "0.0", "text": "def create_next_round(bracket_id, entrants_array)\n # Of a given array of game_sets, create next round (next_round)\n # with the entrants provided\n\n next_round = Round.create(\n bracket_id: bracket_id,\n ...
[ { "docid": "5e338ac5a6aa3b8b64df10f092ca89db", "score": "0.63882613", "text": "def bracket_params\n params.require(:bracket).permit(:id, :tournament_id, :age_group_id)\n end", "title": "" }, { "docid": "3dec1da90b96837b8961105c84dc6027", "score": "0.6286108", "text": "def par...
dd140e6095470fb552f492c2e9a2ced1
=> Management API Interface
[ { "docid": "74a228b25c1878ae294694ef168ef519", "score": "0.0", "text": "def do(operation, path = [], params = {}, op_headers = {})\n request = Net::HTTP::Post.new('/management')\n request.body = {\n 'operation' => operation,\n 'address' => path,\n 'recursive' => true,\n ...
[ { "docid": "976e0e27c46961ad22a9820be189e708", "score": "0.7224863", "text": "def managementinterfaceaccess\n\t\n\tend", "title": "" }, { "docid": "e223b6498b42a8245c5e113225590b5b", "score": "0.720734", "text": "def api; end", "title": "" }, { "docid": "f4259cc6757c72288...
40efc92de914345cb4830c20e715525e
ActiveModel needs to explicitly run this to get the validation callbacks
[ { "docid": "dae0d822c290201c270ac7c8baf1aecb", "score": "0.7057798", "text": "def valid?\n run_callbacks(:validation) { super }\n end", "title": "" } ]
[ { "docid": "809957c7781dc68a0af1efcd4d96b9b2", "score": "0.8097738", "text": "def run_validations!\n run_callbacks(:validation) do\n super\n end\n end", "title": "" }, { "docid": "4e1c9a10266be51e636e1f1c6c8274b2", "score": "0.80617106", "text": "d...
619f168f0cf38ef28cf93385d1bb83ac
PATCH/PUT /user_records/1 PATCH/PUT /user_records/1.json
[ { "docid": "58535f0f3dd210ba5e5fa34801b47eb1", "score": "0.62178725", "text": "def update\n return redirect_to root_url unless @user_record.user_id == current_user.id\n respond_to do |format|\n if @user_record.update(user_record_params)\n format.html { redirect_to user_records_url, not...
[ { "docid": "9f567e459e0d661c66fef3e41b351c68", "score": "0.6423965", "text": "def update\n @user_record = UserRecord.find(params[:id])\n\n respond_to do |format|\n if @user_record.update_attributes(params[:user_record])\n format.html { redirect_to @user_record, :notice => 'User record ...
177c196220430cc7970d871619dc8439
`Location::address` returns the value of `self.addressable`
[ { "docid": "7bb4a193a5c711deb84dc38665185be3", "score": "0.82868934", "text": "def address\n self.addressable\n end", "title": "" } ]
[ { "docid": "0190199f16799277978fced4c2d2cc53", "score": "0.76724267", "text": "def address\n return self.address\n end", "title": "" }, { "docid": "73f06cc65bdbe03eebf45b030057978e", "score": "0.76565963", "text": "def address\n return @addr...
4205402a7f9ee2132f4cd2839c8da549
output method creates a new output target
[ { "docid": "b088ac039fc237510e170f1e19e82ed6", "score": "0.616658", "text": "def test_output_method_creates_a_new_output_target\n Crd::Spec.new 'Testing' do |s|\n s.output = 'some/output/File.swf'\n assert_instance_of( Crd::Target, s.output )\n end\n end", "title": "" } ]
[ { "docid": "1f4f4a0c385b7955c5210ba605a49a02", "score": "0.7339337", "text": "def output\n @output ||= Output.new\n end", "title": "" }, { "docid": "a6142521f73c376476df18cb22eaf3d9", "score": "0.7195374", "text": "def output; end", "title": "" }, { "docid": "a6142521...
d1f90b6ebb08a2a1aeeb44c43f43dfa2
POST /productfamilies POST /productfamilies.xml
[ { "docid": "b84ed8b45209e0b2904d3d092f834745", "score": "0.6345531", "text": "def create\n @productfamily = Productfamily.new(params[:productfamily])\n\n respond_to do |format|\n if @productfamily.save\n flash[:notice] = 'Productfamily was successfully created.'\n format.html { ...
[ { "docid": "0c895768680c483319f676a2a2a2083b", "score": "0.6413238", "text": "def create\n admin_store_url\n \n @product_family = ProductFamily.create(params[:product_family])\n leaf_ids = params[:leaf_ids]\n \n unless leaf_ids.blank?\n leaf_ids.each do |lid|\n cat = Catego...
69656a5449ecb2d3e0748467ee8ff965
Breadcrumbs for this page are hardcoded because it doesn't have a content item with parents.
[ { "docid": "9d67557bfddae4b6ba107ffaee9f8e39", "score": "0.7799221", "text": "def hardcoded_breadcrumbs\n [\n {\n title: t(\"shared.breadcrumbs_home\"),\n url: \"/\",\n },\n {\n title: subtopic.parent.title,\n url: subtopic.parent.base_path,\n },\n ...
[ { "docid": "4957243488e95331af0b69b83c34c0d3", "score": "0.79119295", "text": "def breadcrumbs; end", "title": "" }, { "docid": "4957243488e95331af0b69b83c34c0d3", "score": "0.79119295", "text": "def breadcrumbs; end", "title": "" }, { "docid": "4957243488e95331af0b69b83c...
f67265804ffbf1a9ac90a6362ca52599
coding: utf8 =begin 002: Find the sum of all the evenvalued terms in the Fibonacci sequence which do not exceed four million. =end
[ { "docid": "8e535a814a98565514ba4b6ce4461f0a", "score": "0.70342636", "text": "def fibsum(n)\n\tsum = 0\n\tfib = [1,2]\n\ttest = fib[-1]\n\twhile test <= n:\n\t\tsum += test if test % 2 == 0\n\t\tfib << test + fib[-2]\n\t\tfib.shift\n\t\ttest = fib[-1]\n\tend\n\tp sum\nend", "title": "" } ]
[ { "docid": "52842216c5aa4d82f0db80233fe58ad2", "score": "0.7808691", "text": "def four_million_fibonacci()\n arr = [1, 2]\n num = 0\n even_sum = 2\n\n while num < 4000000 do\n num = arr[-1] + arr[-2]\n arr << num\n if num % 2 == 0 \n even_sum += num \n end\n end\n\n puts even_sum\...
f21904172b5237c137a184670634ede6
TODO(shouichi): Currently master branch only. Make it configurable.
[ { "docid": "d312a8ee0b28eef36612c64efcb8c793", "score": "0.0", "text": "def match?\n source_repo_match? && @build.master_branch?\n end", "title": "" } ]
[ { "docid": "73f003107995c6f96c9336a4b6c78a35", "score": "0.69531393", "text": "def branch\n 'refs/heads/master'\nend", "title": "" }, { "docid": "d5eeea33ba28a0074d1d53909282e137", "score": "0.6904256", "text": "def current_branch; end", "title": "" }, { "docid": "d5eeea...
9aec58ba30ab842cea3f90659a0a214a
Public: Gets a list of virtual machine images from the server returns both user generated and public images by default Returns an array of Azure::VirtualMachineImageManagementService objects
[ { "docid": "bf7c935fe0ee0bf28670afb78714f9f8", "score": "0.85539603", "text": "def list_public_virtual_machine_images\n request_path = '/services/images'\n request = ManagementHttpRequest.new(:get, request_path, nil)\n response = request.call\n Serialization.virtual_machine_i...
[ { "docid": "bf1b504c8ff2f0bb211dc110c9844159", "score": "0.8093734", "text": "def list_virtual_machine_images(imageType=:all)\n images = Array.new\n if imageType == :public or imageType == :all\n public_images = list_public_virtual_machine_images\n images.concat public_im...
0463e388e74fcc194684a428d59ebe6a
Get a pretty printed address inspection.
[ { "docid": "52a9e90d89ff31c6f776700833fdb83f", "score": "0.6820287", "text": "def inspect\n \"#<Mongo::Address:0x#{object_id} address=#{to_s}>\"\n end", "title": "" } ]
[ { "docid": "8e84586937301ca6c18e813567f14368", "score": "0.7103137", "text": "def formatted_address\n self.dig_for_string(\"officeSummary\", \"officeAddress\", \"formattedAddress\")\n end", "title": "" }, { "docid": "1d3dec85c6f82b4465920b010fe8d425", "score": "0.7053143", "text"...
f6fbdd314ba8cf823c1845ec36da368d
Handles iteration of each headline
[ { "docid": "2182a893723c99c3266c55268a1cdc30", "score": "0.6190905", "text": "def process_news(total = 25)\n items.map.with_index do |item, num|\n @headlines << format_headline(item, num) if total_met?(total)\n end.compact || nil\n end", "title": "" } ]
[ { "docid": "5a7ca7d61feda73751e61976f4d2f8ee", "score": "0.69073224", "text": "def list_headlines\n \n \n NprCliProject::Scraper.make_stories\n @news = NprCliProject::NPR.all\n #binding.pry \n \n count = 1 \n @news.each do |news_stories|\n puts \"#{count}. \" + news_stories.headline...
c8ebc42ed5852b7a544903b2a9aeaaf7
checks if the user can modify organisation templates
[ { "docid": "3568a9c7618a8ca46a56cfad984a1416", "score": "0.75625193", "text": "def can_modify_templates?\n roles.include? Role.find_by(name: constant(\"user_role_types.modify_templates\"))\n end", "title": "" } ]
[ { "docid": "3b03906436c0c5b1149c72b4dce91636", "score": "0.7976704", "text": "def admin_show?\n user.can_modify_templates? && (phase.template.org_id == user.org_id)\n end", "title": "" }, { "docid": "656f8eed92765d38d921707701b1ff0c", "score": "0.78836083", "text": "def can_modi...
b46369bbab194419196c3d06a28b3a12
Run the passed suite. Calls run_all with the toplevel suite as argument and a block that calls run_suite with the yielded argument (which should be the toplevel suite). Options accepted: :extenders: An Array of Modules, will be used as argument to self.extend, useful e.g. for mock integration :format: A string with the...
[ { "docid": "728e31b7dd833d8e42146c43be46f8e2", "score": "0.6548738", "text": "def initialize(suite, opts=nil)\n @suite = suite\n @inits = []\n @options = opts || {}\n @count = @options[:count] || Hash.new(0)\n\n (BareBench.extender+Array(@options[:extender]...
[ { "docid": "f5c73cf741b832cf8fc115c265a74551", "score": "0.6836742", "text": "def run_all\n run_suite(@suite)\n end", "title": "" }, { "docid": "7a1d823009440009fa4e9c46e2867af9", "score": "0.6699271", "text": "def run_suite(suite)\n missing_tags = @include_tags && @...
10305b312b349e8a17e7634f3881e4e8
Get IP address block information. Returns information about the IP address block with specified id. Information includes id, display_name, description & cidr.
[ { "docid": "404d80a3dfaedc96b34f628af0fcdb08", "score": "0.6913144", "text": "def read_ip_block_with_http_info(block_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PoolManagementApi.read_ip_block ...\"\n end\n # verify the required...
[ { "docid": "c7ffae0dda6bd9cb0d3d55710071b551", "score": "0.7294817", "text": "def block(id)\n Coda::BlockDetails.new(get(\"/blocks/#{id}\"))\n end", "title": "" }, { "docid": "2b6f861a07521f717de233d58bd2637d", "score": "0.71643555", "text": "def read_ip_block(block_id, opts ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "d4e21ec7a26ff6be93e236162ec9e575", "score": "0.0", "text": "def set_journal\n @journal = Journal.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...
ade50f4974df0302f0681a91f4820327
POST /arduino_devices POST /arduino_devices.json
[ { "docid": "278fdd3be5330e7409ec6eefe10b148f", "score": "0.738692", "text": "def create \n\n respond_to do |format|\n if current_user.arduino_devices.create(arduino_device_params)\n format.html { redirect_to arduino_devices_url, notice: 'Arduino device was successfully created.' }\n ...
[ { "docid": "e737e7248f991fad70137f98d4a2038d", "score": "0.69400424", "text": "def add_device(serial)\n @client.post(\"#{path}/devices\", serial: serial)\n end", "title": "" }, { "docid": "80039627aef78fcb29d663f2972bd480", "score": "0.68696994", "text": "def create\n @arduino...
bd64af3b191caa8b190c88af8317e22a
Returns a list of all firstlevel ResourceRefs that are not virtual
[ { "docid": "fb4dcb4d0e2b9363375d3ac2209143a4", "score": "0.79423463", "text": "def nonvirtual_rrefs(object)\n object.all_resourcerefs\n .reject { |prop| prop.resource_ref.virtual }\n end", "title": "" } ]
[ { "docid": "7a7f0721b21afbaeeb21ede6da56562f", "score": "0.7184866", "text": "def collect_virtual_resources\n return [] unless defined?(@resources) and ! @resources.empty?\n result = @resources.dup.collect do |ref|\n if res = @scope.findresource(ref.to_s)\n @resources.delete(ref)\n ...
3850d81dbfc601b7de2030d5953e812a
If the table has a header, draw it at the current position.
[ { "docid": "72a0dd8d15d96002e84f0609da526fde", "score": "0.8266351", "text": "def draw_header\nif @header\ny = @pdf.cursor\nrow(0).each do |cell|\ncell.y = y\ncell.draw\nend\n@pdf.move_cursor_to(y - row(0).height)\nend\nend", "title": "" } ]
[ { "docid": "f00184bf0347a53c7bb2249753b4ac84", "score": "0.6911852", "text": "def draw_header\n draw_text(0,0, contents.width, line_height, Vocab::ITEM_USE, Bitmap::ALIGN_CENTER)\n end", "title": "" }, { "docid": "cb0a06196031a3ccccea2d6f7399f047", "score": "0.6763942", "text": "...
2ca5dc2ed1e835216ea831a1f402e787
PUT /globes/1 PUT /globes/1.xml
[ { "docid": "a88e6600863c8e31462ceb7d2d56563e", "score": "0.0", "text": "def update\n @globe = Globe.find(params[:id])\n\n respond_to do |format|\n if @globe.update_attributes(params[:globe])\n format.html { redirect_to(@globe, :notice => 'Globe was successfully updated.') }\n fo...
[ { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.6220505", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "title": "" }, { "docid": "38979984bdedacd95706689e25f09f9e...
1097a7e7758f08d32addfc88ea3fdcab
GET /users GET /users.json
[ { "docid": "4956590c2fd509e99796d7177c70c69e", "score": "0.0", "text": "def index\n @users = User.where(active: true)\n\n respond_with(@users)\n end", "title": "" } ]
[ { "docid": "9f7c735ace683c5c2b12c914cc9ad8a8", "score": "0.84081405", "text": "def get\n users = User.all.as_json\n render(json: users.as_json, status: :ok)\n end", "title": "" }, { "docid": "543509c6588e2f79a8dbcd1cdcdaf7b9", "score": "0.836071", "text": "def users\...
ed128576237eef5de0a0023ce5625cac
GET Doc Used for getting profile information of a user Params id: string or integer auth_token: string
[ { "docid": "734c9f08cf33e1297944c73a40e86f08", "score": "0.0", "text": "def show\n user = load_user\n expose user, serializer: UserProfileSerializer\n end", "title": "" } ]
[ { "docid": "6f70db9346515e0874af8c03e1038b7f", "score": "0.7926245", "text": "def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end", "title": "" }, { "docid": "c88e5e0aa4632a4826507b7cdba98a9b", "score": "0.782385", "text": "def profile(user...
af83a55f74a6460b6d7d626684be2d07
Uploads an IO to
[ { "docid": "adb031152886a5f7cf24cc740eefaf9d", "score": "0.7292762", "text": "def upload_io(io, size, filename = 'io.data')\n raise \"#{io.inspect} must respond to #read\" unless io.respond_to?(:read)\n check_quota\n authorize\n t1 = Time.now\n execute\n t2 = Time.now\n ...
[ { "docid": "edfdca28f924db9cad755a56f9dd93b4", "score": "0.79322034", "text": "def upload(io, context = {})\n io = processed(io, context) || io\n store(io, context)\n end", "title": "" }, { "docid": "3c2e035a74ef898bd8e15a5ebe8a2710", "score": "0.7864628", "t...
44ffb647bd68bf8b7f8c62b69cca71ef
Create a new scheduled task.
[ { "docid": "eb8bb245950f1fce39969bb8dde73751", "score": "0.0", "text": "def initialize(body:, time_frame: nil, start_time: nil, tags: Array.new)\n @body, @time_frame, @start_time, @tags = body, time_frame, start_time, tags\n\n raise ArgumentError, \"Body cannot be empty.\" if body.empty?\n\n ...
[ { "docid": "503295de5f73baf8e09893a47294a5a4", "score": "0.7479242", "text": "def create_task(args)\n Task.create(scheduled_date: args[:date],\n onfleet_id: args[:onfleet_id],\n status: args[:status],\n driver: self.driver_id,\n location_id:...
fb8f5cfe5a8493b288609842f2318fc5
POST /products POST /products.json
[ { "docid": "2dfdca2df82005f8e3e4d1799540ad54", "score": "0.0", "text": "def create\n @product = Product.new(params[:product])\n @manufacturers = Manufacturer.all\n @categories = Category.all\n respond_to do |format|\n if @product.save\n \n format.html { redirect_to @produc...
[ { "docid": "6e6e22738994035234ed86fee8433fa8", "score": "0.7675232", "text": "def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", ...
9254e07eda9208106421d833127cc564
Constructor que asigna los atributos pasados por parametro e invoca al constructor del padre pasandole los parametros pertinentes
[ { "docid": "6073921414471799888fc6af5bfae3bd", "score": "0.0", "text": "def initialize(autor, titulo, editorial, numEdicion, fecha, codISBN, serie = 'null')\n\t\t@serie, @editorial, @numEdicion, @codISBN = serie, editorial, numEdicion, codISBN \n\t\tsuper(autor, titulo, fecha)\n \tend", "title": ""...
[ { "docid": "ecea9d60f5ae744a6b1d739aa7dbfbd3", "score": "0.7406641", "text": "def initialize(titulo, porciones, tiempo, ing, pasos)\n @titulo, @porciones, @tiempo, @ing, @pasos = titulo, porciones, tiempo, ing, pasos #variables de instancia\n end", "title": "" }, { "docid": "ea755a...
2e036be4ebd4300cb1605cdae7126c0d
POST /activites POST /activites.json
[ { "docid": "81688182c918d1ea1fbca48c3b739ad7", "score": "0.57884234", "text": "def create\n @activite = Activite.new(activite_params)\n # link the current user to the combi it create\n @activite[:user_id] = current_user[:id]\n\n\n respond_to do |format|\n if @activite.save\n form...
[ { "docid": "88bca9ae10cddec357b9a8d5c82df843", "score": "0.60355574", "text": "def create\n @activation = current_user.activations.build(params[:activation])\n\n respond_to do |format|\n if @activation.save\n format.html { redirect_to @activation, notice: 'Activation was successfully c...
262af4f2bef29ce221a1f7060620dfbe
Dice roles 1 2 3 4 5 6 1 2 3 4 5 6 7 2 3 4 5 6 7 8 3 4 5 6 7 8 9 4 5 6 7 8 9 10 5 6 7 8 9 10 11 6 7 8 9 10 11 12
[ { "docid": "6370bf626de09dcb44216603b8844ecd", "score": "0.0", "text": "def test_dice_roll_distribution\n@values = Array.new(100_000) { |_| DiceRoll.new.value }\n @counts = Array.new(13) { 0 }\n @values.each do |v|\n\t @counts[v] += 1\n\t end\n\t\t \n\t\t def test_one...
[ { "docid": "26f14916523c07cef5d130cb40e4f7d2", "score": "0.75123066", "text": "def roll_dice\n puts (1..@number_of_dice).to_a.map { |x| x=Random.rand(@die_sides) + 1 }\n end", "title": "" }, { "docid": "ea6b2af1dd2bcdf8ccec47632b248723", "score": "0.73792046", "text": "def die_ro...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "12455fab19ccfc0f29985a96b324a103", "score": "0.0", "text": "def set_properting_layer\n @properting_layer = Properting::Layer.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...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "f332b3bead2e11d91fa8218645d58871", "score": "0.0", "text": "def my_dairy_params\n params.require(:my_dairy).permit(:content)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permi...
cbc1f7dd2d29607c271ae5273f8e2fae
GET /urls/1RjJRC/delete GET /urls/1RjJRC/delete.json
[ { "docid": "a860d99cfb28f6db9530a66dbcd28e3c", "score": "0.0", "text": "def delete\n end", "title": "" } ]
[ { "docid": "e1516a76c03a1a8f79c0c6b1ff5cf920", "score": "0.7734964", "text": "def delete(url)\n req(url, :delete)\n end", "title": "" }, { "docid": "822ddea2e45bf78350003645efcbdb54", "score": "0.76823646", "text": "def delete uri, args = {}; Request.new(DELETE, uri, args)....
8b21a9fce50c074723a9ab05990a6f58
Check if the program is loaded within the kernel
[ { "docid": "73f090dbbbe17a8563e4cdad03944bb1", "score": "0.58983505", "text": "def exist?\n BpfFs.prog_pinned?(@name)\n end", "title": "" } ]
[ { "docid": "8e71e5af8a4a0daa356a3c1f2a864d5e", "score": "0.70678455", "text": "def loaded?; %x{#{ServicesCli.launchctl} list | grep #{label} 2>/dev/null}.chomp =~ /#{label}\\z/ end", "title": "" }, { "docid": "5c4cf975328658e54b8d472f54e4dbf1", "score": "0.7041994", "text": "def load...
fc4326228d4d803dbd8035cc0b40fd1d
If there is a timestamp for this line, return its content_tag. Otherwise, just a blank string.
[ { "docid": "c29db512c9fe87c5933233ad4d2d74fa", "score": "0.6264047", "text": "def timecode_content_tag_for_line(line_number)\n tc = timecode_for_line(line_number)\n return '' unless tc\n content_tag(\n \"a\",\n format_ohms_timestamp(tc[:seconds]),\n href: \"#t=#{tc[:s...
[ { "docid": "02043567ac10de3aef695ee9d8f3d2e5", "score": "0.6188478", "text": "def get_timestamp\r\n\t\ttime = comment.at_css('time')[\"datetime\"]\r\n\tend", "title": "" }, { "docid": "b2ff3169677b25d279f1c33fac822e99", "score": "0.59124506", "text": "def since_tag(text); end", "...
10043945e55f0877f1c69ce082696d33
Battle can lose test
[ { "docid": "254fbcdb01a3ab1b8a77003ce0107a23", "score": "0.6837485", "text": "def battle_can_lose\r\n result = $game_temp.nil? ? false : $game_system.battle_simulator.on\r\n return seph_battlesimulator_gmtmp_bcl || result\r\n end", "title": "" } ]
[ { "docid": "7cedf760dcc324510b704e3a06a74cea", "score": "0.72236854", "text": "def lose\n self.remaining_guesses == 0\n end", "title": "" }, { "docid": "43ea73eb4b2e0b86e087d6e299c56fc5", "score": "0.7030449", "text": "def lose(over)\n @boxer.motivation -= rand(30 + 10 * over)...
8118a2a092a93ab72e73feb4f4288979
A singleton that creates some users:
[ { "docid": "f88c3b02748b87ca9a2eb919f67b515a", "score": "0.0", "text": "def bootstrap_users\n @@bootstrap_users ||= []\n return @@bootstrap_users unless @@bootstrap_users.length == 0\n 12.times do\n u = User.gen\n @@bootstrap_users << u\n u.build_watch_collection\n end\n return @@bootstrap...
[ { "docid": "22d470027bac638b0e84e757f34c5888", "score": "0.7445097", "text": "def initialize\n @users = Hash.new { |hash, name| hash[name] = User.new(name) }\n end", "title": "" }, { "docid": "27850fb313603de0692ded1b889762ca", "score": "0.7193529", "text": "def users() @user...
ab92b2e86b8ea4826fe8580dd6003fd2
Who Won Helper Method
[ { "docid": "bbacc37580b2d46ce72f01fb51cbc9f1", "score": "0.0", "text": "def winner(board)\n\tif won?(board) != nil\n\t\twon?(board).each do |win_num|\n\t\t\treturn board[win_num][0]\n\t\tend\n\tend\nend", "title": "" } ]
[ { "docid": "254e59677a72c0264b3cf535ee9a1a28", "score": "0.6896282", "text": "def send_who target\n send_command 'WHO', target\n end", "title": "" }, { "docid": "4cdfc28b009725cd767a3edeaea0eb4c", "score": "0.67463505", "text": "def whoWon\r\n if @board.winCondition(@p...
c21b053edbb2882ccb368565ed431be7
Keeps only the nonscoring dice
[ { "docid": "5a6079ce57e5cfcee5e6288d237a2aea", "score": "0.5806102", "text": "def get_valid_dice_count(num_dice, values)\n valid_dice = values.select { |e| e != 1 && e != 5 && values.count(e) >= 3 }\n num_dice -= 3 if valid_dice.size >= 3\n\n valid_dice = values.select { |e| e == 1 || e == 5 }\...
[ { "docid": "f25aa3c9333069ffa7d3a5e3bd300f75", "score": "0.63718086", "text": "def reset\n @dice.each(&:reset)\n if @dice.size > 2\n @dice.slice!(-2..-1)\n end\n end", "title": "" }, { "docid": "b77775a53ee70a2e2b0068d3e54ad2c7", "score": "0.6293605", "text":...
92c6fcd5183e5d479a5761d2cacf637c
with recursive helper method: group solution:
[ { "docid": "15182c7b3fe862f9e597d23e44e336c5", "score": "0.0", "text": "def find_index(nums, target)\n index = recursive_find_index(nums, target, 0, nums.length - 1)\n index || -1\nend", "title": "" } ]
[ { "docid": "08de766c3aa9ce01608aa15f9aa2c871", "score": "0.7255534", "text": "def recursive; end", "title": "" }, { "docid": "08de766c3aa9ce01608aa15f9aa2c871", "score": "0.7255534", "text": "def recursive; end", "title": "" }, { "docid": "115f0358715636a4e7b59a4d1f6a4784...
23c1d7022e7bad31d50747d8404709af
Little things to do to capture STDOUT
[ { "docid": "32aba8e30d445eb3c99c2140e2049c31", "score": "0.68711054", "text": "def capture_stdout(&block)\n\traise ArgumentError, \"No block given\" if !block_given?\n\told_stdout = $stdout\n\t$stdout = sio = StringIO.new\n\tyield\n\t$stdout = old_stdout\n\tsio.rewind\n\tputs sio.read\n\tsio.rewind\n\ts...
[ { "docid": "a2d70fc1589dc4ba5d94abcbd9312fe1", "score": "0.7624389", "text": "def stdouts; end", "title": "" }, { "docid": "4816abd7c2528f974a1d55cf0f88584c", "score": "0.75704414", "text": "def capture_stdout\n output = StringIO.new\n $stdout = output\n yield\n $stdout = STDOUT\...
28f747abbe126f355c469ccf610beaef
Allow users to edit their personal appointments
[ { "docid": "75c60493bbbc0b22ef903cbd5fafda76", "score": "0.0", "text": "def edit\n @edit_appointment=Appointment.find(params[:id])\n @edit_appointment.invitations.build\n end", "title": "" } ]
[ { "docid": "3869322dee5935f84b50850013446811", "score": "0.78444487", "text": "def edit\n authorize! :edit, @appointment\n render 'form'\n end", "title": "" }, { "docid": "86501054ecd78984cfe242e52574ddc7", "score": "0.74918973", "text": "def set_appointments\n @use...
13a25936c2741d8f5701758f15cd1777
State transition tables end reduce 0 omitted
[ { "docid": "64c169fd241aa01ace74cdeee34f2724", "score": "0.0", "text": "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "title": "" } ]
[ { "docid": "d2362715c0c3f16e1ed729405858e4b3", "score": "0.6470521", "text": "def transitions; TRANSITIONS end", "title": "" }, { "docid": "d2362715c0c3f16e1ed729405858e4b3", "score": "0.6470521", "text": "def transitions; TRANSITIONS end", "title": "" }, { "docid": "4881...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "af07b1f82e9e9304ed996d3c21fe355c", "score": "0.0", "text": "def set_student\n @student = Student.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;...
b38b0c0e944020003de9f8a3e3020b31
end of initialize class_name, options
[ { "docid": "9921498b2fedc095444ccbfe24919b1a", "score": "0.0", "text": "def build\n klass = create_class(@class_name, @options)\n klass.new\n end", "title": "" } ]
[ { "docid": "9b4ef137d55bb89952cd9b91ba8dc959", "score": "0.8324343", "text": "def initialize(options)\n @classes = options[:classes]\n super\n end", "title": "" }, { "docid": "40e04d8129f9d2608862c05dc2f1ec3f", "score": "0.8194062", "text": "def initialize(options); end"...
d3d9a56ac57792c8143452dacdc1d0ab
Removes loaded constants and configured autoloads. The objects the constants stored are no longer reachable through them. In addition, since said objects are normally not referenced from anywhere else, they are eligible for garbage collection, which would effectively unload them. This method is public but undocumented....
[ { "docid": "3babac7b8700e46c2099a88a86c384df", "score": "0.72774655", "text": "def unload\n mutex.synchronize do\n # We are going to keep track of the files that were required by our\n # autoloads to later remove them from $LOADED_FEATURES, thus making them\n # loadable by Kern...
[ { "docid": "57daa63d575358f70c1cb0ef94b6a9f4", "score": "0.800774", "text": "def remove_unloadable_constants!\n log(\"removing unloadable constants\")\n autoloaded_constants.each { |const| remove_constant const }\n autoloaded_constants.clear\n Reference.clear!\n explicitly_unloa...
7b27c65f1a39a8737333b7647ecf5477
create and update deal wizard and its relvent deal_compaign_objectives table
[ { "docid": "362f78a6b22b40e1a47d6cf8d7ca645b", "score": "0.5660744", "text": "def create_update_deal_wizard(new = false, deal_wizard = nil)\n\n if session[:deals_wizard].present?\n case new\n when true\n session[:deals_wizard][:deal_id] = @deal.id\n @deals_wizard = Deals...
[ { "docid": "40c3f9483def1ed363553cfb2313f5ac", "score": "0.5550946", "text": "def create\n @deal = Deal.new(params[:deal])\n\n respond_to do |format|\n if @deal.save\n\n case params[:commit]\n when \"Next\"\n format.html { redirect_to set_params_path(:deal_id => @de...
756dbad5506f565cff02f69d667c8ed4
PUT /tastingnotes/1 PUT /tastingnotes/1.json
[ { "docid": "9f1d09c5404d10388fc2cea8c1e7136b", "score": "0.6899875", "text": "def update\n @tastingnote = Tastingnote.find(params[:id])\n\n respond_to do |format|\n if @tastingnote.update_attributes(params[:tastingnote])\n format.html { redirect_to @tastingnote, notice: 'Tastingnote wa...
[ { "docid": "cf7f6f92c18960b1170e1aa92cd7b41a", "score": "0.6662207", "text": "def update\n @tokyo_note = TokyoNote.find(params[:id])\n\n respond_to do |format|\n if @tokyo_note.update_attributes(params[:tokyo_note])\n flash[:notice] = 'TokyoNote was successfully updated.'\n form...
7a9336304f93537f56f89c44ad54892b
Code to print the list
[ { "docid": "a5fa598d9a5d4d5bf6029273443cb603", "score": "0.0", "text": "def printList(arr)\n\tfor i in 0..arr.length() - 1 do\n\tputs(arr[i].to_s)\n\tend\n\tputs()\nend", "title": "" } ]
[ { "docid": "277d504adc12aacb3ef21ec2994d2bdd", "score": "0.8791449", "text": "def print_list; end", "title": "" }, { "docid": "054dc6c5bd634d4fe75428b899023f49", "score": "0.8205006", "text": "def print_list\n @list.each { |item, qty| puts \"#{qty} #{item}\" }\n end", "titl...
cb9216ca7a1342d2886e616c2a28695f
class Event_creator attr_accessor :name1, :date8, :lenght8, :attendees8
[ { "docid": "bcec9bc4c21596924ddcc8b0b3df6f55", "score": "0.0", "text": "def event_name\n \tputs \"Salut, tu veux créer un événement ? Cool !\"\n puts \"Commençons, quel est le nom de l'événement ?\"\n titre = gets.chomp\n return titre\n end", "title": "" } ]
[ { "docid": "687b223f9cf77220ed543c8272e5e531", "score": "0.67856973", "text": "def initialize(start_date_to_save, duration_to_save, title_to_save, attendees_to_save)\n @start_date = Time.parse(start_date_to_save)\n @duration = duration_to_save.to_i #The duration in minutes\n @title = title_to_s...
6786281b4d19d256939f93013277174d
Add summary value to whole column Have to set TableSettings::Column.summarize_all
[ { "docid": "20add4443b70292583c3b3c6c3338abe", "score": "0.5688336", "text": "def summarize_page_all_value(value)\n @buttons_hash[:summarize_page_all] = value\n\n self\n end", "title": "" } ]
[ { "docid": "d067bd198e6a526f3674732a891355c5", "score": "0.68614405", "text": "def summarize_all(enabled = true, label = nil)\n @column_hash[:summarize_all] = true\n @column_hash[:summarize_all_label] = label unless label.nil?\n self\n end", "title": "" }, { "docid": "26162...
afd6db0bce4e45c2f7f5db783e67b0fc
Takes a proc or lambda and invokes it with the given object as receiver, with any additional arguments or block provided.
[ { "docid": "c0db04293f0db722a76c7cfa9d32a06b", "score": "0.0", "text": "def apply(receiver, proc, *args, **kwargs, &block)\n return receiver.instance_exec(*args, **kwargs, &proc) unless block_given?\n\n method_name =\n Kernel.format(TEMPORARY_METHOD_NAME, Thread.current.object_id)\n\n ...
[ { "docid": "c67b8f7670177f1f306cf42c7e730a74", "score": "0.7426558", "text": "def call(*args, &block)\n to_proc.call(*args, &block)\n end", "title": "" }, { "docid": "ea783b1686157e3cf1a895cae6bf7a72", "score": "0.7268654", "text": "def call_a_proc(&block)\n\tblock.call\nend"...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "8eb266c09eb26b1f259569f96312bc3d", "score": "0.0", "text": "def bot_params\n params.require(:bot).permit(:name, :channel, :default_icon, :permission, :script)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496205", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957069", "text": "def strong_params\n params.require(:request).permit(param_white...
c646765430cd86a1a32b2882372522fd
PATCH/PUT /crewmembers/1 PATCH/PUT /crewmembers/1.json
[ { "docid": "bf8bce96675468408bffff5e9510ade1", "score": "0.6835743", "text": "def update\n respond_to do |format|\n if @crewmember.update(crewmember_params)\n format.html { redirect_to @crewmember, notice: 'Crewmember was successfully updated.' }\n format.json { render :show, statu...
[ { "docid": "93f938b06d670455d9e72faf16678443", "score": "0.65666974", "text": "def update\n # byebug \n respond_to do |format|\n if self.current_member && self.current_member.id == params[:id].to_i\n if @member.update(member_params)\n format.json { render :show, status: :ok, l...
ba66f2e4e4e18d0cf796345afa18c860
Send date, username and score to users own file. This will come in handy later, when a feature is implemented for users to check their own best scores
[ { "docid": "b8f2a050573f9ac90199aed54c6f42d5", "score": "0.7684812", "text": "def send_to_file\n File.open(\"userDetails/#{@@username}.json\", \"a\") do |f|\n f.puts JSON.generate(@new_score)\n end\n end", "title": "" } ]
[ { "docid": "d37020381f2f001e494427c99fda6d18", "score": "0.7421128", "text": "def send_to_leaderboard\n @date = Time.now.strftime(\"%d/%m/%Y\")\n @new_score = Hash.new\n @new_score[\"date\"] = @date\n @new_score[\"username\"] = @@username\n @new_sco...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9b192d13d90e72e46e61f62df7d5546b", "score": "0.0", "text": "def lavorazione_params\n params.require(:lavorazione).permit(:pezzo_id, :codice, :titolo, :descrizione, :prezzo, :sconto)\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...
f24b94577b00558e206de486cc8660fb
Method to print a list and make it look pretty input: steps: 1. iterate through hash 2 print each key and value pair output
[ { "docid": "1f3f6f3959a67a5020ac7e1f63451117", "score": "0.0", "text": "def print_list(my_grocery_list)\n puts \"you bought:\"\nmy_grocery_list.each do |key, value|\n puts \" #{value} #{key}\"\n\nend \nend", "title": "" } ]
[ { "docid": "3cb48b1c8a6604927f40db911f9e1762", "score": "0.84635377", "text": "def pretty_list(hash)\r\n# input: hash \r\n# steps: \r\n\t# Iterate through hash and print string for each key and it's value \r\n\thash.each { |item, quantity|\r\n\t\tputs \"#{item}: #{quantity}\"\r\n\t}\r\n# output: String ...
6b3672c0c51494b2d0c47114d93307e1
lazy approach id[i] => parent of i even if we update a root array we do a lot of work before it's needed odd: video confuses 1st and 2nd positions so it says 9,4 should connect 9 to 4's root! but more importantly that seems inaccurate (particularly if you later wish to reconnect 4 to something ...expecting that it will...
[ { "docid": "c54bccda1050259018e6cdfb4b20b959", "score": "0.5809709", "text": "def union(p, q)\n debug { \"connecting #{q} to #{p}\" }\n #@root[q] = @root[p]\n #debug { \"roots: #{root.inspect}\" }\n @id[root(q)] = root(p)\n debug { \"ids: #{id.inspect}\" }\n true # avoid exposing priva...
[ { "docid": "5b1b0d762f922f272219fc60f316de83", "score": "0.71122694", "text": "def parent_id_vector(id = Fixnum)\n vector = []\n return vector if @by_id_index[id].nil? || @by_id_index[id].parent.nil?\n id = @by_id_index[id].parent.id\n while !id.nil?\n vector.unshift...
dda59a871152bd7c17a2e61e0345e03c
Fill up the last block with nullbytes until it's a multiple of 8.
[ { "docid": "d700535412e0ae48e975c351afb9abdb", "score": "0.54606855", "text": "def nullpad string\n length = string.length + BlockSize - string.length % BlockSize\n string.ljust length, ?\\0\n end", "title": "" } ]
[ { "docid": "707ca3282cec4844f36b089e8dda7049", "score": "0.670565", "text": "def add_empty_bytes(count)\n @offset += count\n end", "title": "" }, { "docid": "09bfce52a1cff0b5a95112e58e1471c8", "score": "0.6205459", "text": "def empty_block\n \"\\0\" * block_size\n end", "...
94469ef22d69320689a80087d7b4013b
DELETE /sensors/1 DELETE /sensors/1.json
[ { "docid": "fad442e279ad4b2b6014cf50bde47c80", "score": "0.73155", "text": "def destroy\n @sensor = Sensor.find(params[:id])\n @sensor.destroy\n\n respond_to do |format|\n format.html { redirect_to sensors_url }\n format.json { head :no_content }\n end\n end", "title": "" } ...
[ { "docid": "d28d0ff0c196d055ef02a8775aeda066", "score": "0.7254817", "text": "def destroy\n @sensor.destroy\n respond_to do |format|\n format.html { redirect_to sensors_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c33ff5acc160330069dc8...
74fd6a7199ffbc9aea0113058d7f9fb4
Gets the userTimezone property value. Optional. The timezone in which the user's device used to generate the activity was located at activity creation time; values supplied as Olson IDs in order to support crossplatform representation.
[ { "docid": "6c195a1277a4607b0bed183524aa9597", "score": "0.76721823", "text": "def user_timezone\n return @user_timezone\n end", "title": "" } ]
[ { "docid": "a1dc8fb6800404834bdcf956b9e11f65", "score": "0.73472935", "text": "def get_user_timezone(user_id)\n user_timezone = USER_TIMEZONE[user_id: user_id]\n return TZInfo::Timezone.get('Etc/UTC') if user_timezone == nil\n\n begin\n user_timezone = user_timezone[:timezone]\n user_...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "2aa2afc3b874547fd31ccfb9d2e39205", "score": "0.0", "text": "def uginuce_params\n params.require(:uginuce).permit(:sheep_id)\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...