10,000 Matching Annotations
  1. Mar 2021
    1. Better yet, send them a link to this page to help them understand why and how to make an example app:
    2. If you end up finding and fixing a bug in your code, consider re-reading the documentation and seeing if that behavior of the library is unclear. Consider sending a documentation PR.
    3. If you want the issue fixed as fast as possible, then you should try to help the maintainers as much as possible. Make an example app! Even if it takes extra time for you, it will ultimately lead to your issues getting fixed faster.
    4. Finally: Give a link to the example app to a maintainer (usually through an issue).
    5. An example app is an application that is designed to reproduce a bug or demonstrate an issue.
    6. Before a bug can be fixed, it has to be understood and reproduced. For every issue, a maintainer gets, they have to decipher what was supposed to happen and then spend minutes or hours piecing together their reproduction. Usually, they can’t get it right, so they have to ask for clarification. This back-and-forth process takes lots of energy and wastes everyone’s time. Instead, it’s better to provide an example app from the beginning. At the end of the day, would you rather maintainers spend their time making example apps or fixing issues?
    1. I don't myself understand what's going on, it clearly has something to do with source maps, but may also have to do with other sprockets changes.
    2. sprockets 4 makes Chrome browser identification of SCSS css lines _worse_
    3. But maybe few are still using sprockets at all, for JS or (S)CSS anymore? Hard to say.
    4. But yeah, I'm not sure how you would determine which was the "recommended way" really. I don't see anything in Rails docs saying either way.
    5. But last I have seen comments from DHH, he considered webpack(er) recommended for JS, but Sprockets still the preferred solution for (S)CSS.
    6. I don't really understand what's going on. Clearly source maps have something to do with it -- a source map feature that doesn't handle SCSS very well, apparently.
    7. If I can't do something to change the sprockets 4 debugging experience I am seeing, I am going to probably downgrade back to sprockets 3. I am finding it impossible to develop CSS the ways I am used to.
    8. Is there a PR to... something? sassc-rails? That would make the patch not necessary? (I don't know if there's any good way to monkey-patch that in, I think you have to fork? So some change seems required...) Should the defaults be different somehow? This is very difficult to figure out.
    9. I am not sure this whole ecosystem currently has much maintainers unfortunately. :( Pick your reaction
    10. Is there a PR to... something? sassc-rails?
    11. I'm not sure about all consequences of my change and this is very complex.
    12. I agree about lack of maintenance. It's probably because people use more and more Webpack.
    13. But I can describe a simple reproduction case to demonstrate the developer inconvenience (can provide a sample app if it's helpful).
    1. What is the difference between equation and formula?
    2. I'd say an equation is anything with an equals sign in it; a formula is an equation of the form A= stuffA= stuffA={\rm\ stuff} where AAA does not appear among the stuff on the right side.
    3. I think that over time the distinction is lost. My math teacher, 35 years ago stated "formulas are used in chemistry, in math we have equations". To this day, the word 'formula' in math seems wrong, but I'd accept it's used commonly.
    4. An equation is meant to be solved, that is, there are some unknowns. A formula is meant to be evaluated, that is, you replace all variables in it with values and get the value of the formula.
    5. The key idea is that the equation captures not just the ingredients of the formula, but also the relationship between the different ingredients.
    6. In your case, "mpg = distance/gallons" is best understood as "a formula in the form of an equation", which means that in this instance the two words are interchangeable.
    7. An equation is any expression with an equals sign, so your example is by definition an equation. Equations appear frequently in mathematics because mathematicians love to use equal signs. A formula is a set of instructions for creating a desired result. Non-mathematical examples include such things as chemical formulas (two H and one O make H2O), or the formula for Coca-Cola (which is just a list of ingredients). You can argue that these examples are not equations, in the sense that hydrogen and oxygen are not "equal" to water, yet you can use them to make water.
    1. Using these attributes will show validation errors, or limit what the user can enter into an <input>.
    2. Rails still encourages you to dump all validation errors at the top of a form, which is lulzy in this age of touchy UX
    3. The HTML5 form validation techniques in this post only work on the front end. Someone could turn off JavaScript and still submit jank data to a form with the tightest JS form validation.To be clear, you should still do validation on the server.
    4. With these JavaScript techniques, the display of server validation errors could be a lot simpler if you expect most of your users to have JS enabled. For example, Rails still encourages you to dump all validation errors at the top of a form, which is lulzy in this age of touchy UX. But you could do that minimal thing with server errors, then rely on HTML5 validation to provide a good user experience for the vast majority of your users.
    5. Dave Rupert has a good solution that uses an input's invalid event. Instead of using the :invalid pseudo selector, he adds a CSS class to the input when it becomes invalid. We will extend this approach by removing the CSS class when the element becomes valid again.
    6. The input is required and initially empty, so on page load the input is :invalid and border is red. :( :(The input is :invalid until you type a legit email address, so it is red when typing. :( :(Ok, so the :invalid pseudo selector is kind of useless. Ideally we would not show an error up front or the whole time they are typing, just when they submit something unacceptable.
    1. Last week, I shared how to check if an input is empty with CSS. Today, let’s talk about the same thing, but with JavaScript.
    2. We don’t want to invalidate the input if the user removes all text. They may need a moment to think, but the invalidated state sets off an unnecessary alarm.
    1. The valueAsNumber IDL attribute represents the value of the element, interpreted as a number. On getting, if the valueAsNumber attribute does not apply, as defined for the input element's type attribute's current state, then return a Not-a-Number (NaN) value.
    2. Your expectations are reasonable considering the property name, but
    1. The :empty selector refers only to child nodes, not input values. [value=""] does work; but only for the initial state. This is because a node's value attribute (that CSS sees), is not the same as the node's value property (Changed by the user or DOM javascript, and submitted as form data).
    2. If you would like to make “empty” include values that consist of spaces only, you can add the attribute pattern=.*\S.*.
    3. You can use the :placeholder-shown pseudo class. Technically a placeholder is required, but you can use a space instead.
    4. Semantically this is wrong.
    5. There is (currently) no CSS selector for detecting directly whether an input control has a nonempty value, so we need to do it indirectly, as described above.
    6. Generally, CSS selectors refer to markup or, in some cases, to element properties as set with scripting (client-side JavaScript), rather than user actions. For example, :empty matches element with empty content in markup; all input elements are unavoidably empty in this sense. The selector [value=""] tests whether the element has the value attribute in markup and has the empty string as its value. And :checked and :indeterminate are similar things. They are not affected by actual user input.
    7. The selector [value=""] tests whether the element has the value attribute in markup and has the empty string as its value.
    1. One word for each aspect of this game. Story - N/A.Gameplay - Excellent.Graphics - Minimal.Sound - Splendid.Music - Elegant.Overall - Delightful.
    1. If you plan on using a gamepad with big picture mode I made a config that works perfectly so check it out.
    2. There are myriads of platformers around, it's an oversaturated market, and just like industrial designer Karim Rashid said about there being no excuse by this point to make an uncomfortable chair, there's no excuse by this point to make a boring patformer.
    1. Positively indicate valid input values Let users know a field has been entered correctly. The browser can give us this information through the :valid CSS selector:
    2. it does require some CSS trickery to get everything just right
    3. Assuming wonderful support, this is how the logic would play out…
    4. But there doesn’t appear to be a simple way to test for :placeholder-shown.
    5. You can’t use @supports for selectors, only property/values (e.g. @supports (display: flex))

      first sighting CSS: @supports

    6. We’re not really using placeholder in our demo, but a value of a single space works:
    7. :placeholder-shown is super useful for us here! It’s basically the secret selector for testing if an input currently has a value or not.
    8. You’d think :empty would be it, but it’s not. That’s for matching things like <p></p>… container elements with nothing inside them. Inputs are no-content elements already.
    9. Sub trick!
    10. You don’t need to do any tricky cursor stuff, because it’s all semantically wired up already.
    11. always use real <label for="correct_input"> elements. Just that alone is a UX consideration all too many forms fail on
    12. Placeholders are suggestions for valid input, like putting “Tulsa” in an input labeled “City”.
    13. I’d say if the form is short and an obvious pattern (like sign up or log in), you could use the placeholder visual pattern, but use real labels instead.
    14. If they click the area taken up by the label, it will activate the input. If they click the input, it will activate the input. Both correct.
    15. You can do and impressive amount of form validation with just HTML attributes. You can make the user experience pretty clean and clear with CSS selectors.
    1. When you code in a semantic way, you basically give meaning to the data you're describing.
    2. Usually when people are talking about code being semantically correct, they're referring to the code that accurately describes something.
    3. HTML elements have meaning. "Semantically correct" means that your elements mean what they are supposed to.
    4. Semantically correct usage of elements means that you use them for what they are meant to be used for.
    5. It means that you're calling something what it actually is.
    6. Another example: a list (<ul> or <ol>) should generally be used to group similar items (<li>). You could use a div for the group and a <span> for each item, and style each span to be on a separate line with a bullet point, and it might look the way you want. But "this is a list" conveys more information.
    7. The classic example is that if something is a table, it should contain rows and columns of data. To use that for layout is semantically incorrect - you're saying "this is a table" when it's not.
    8. Browsers can correctly apply your CSS (Cascading Style Sheets), describing how each type of content should look. You can offer alternative styles, or users can use their own; as long as you've labeled your elements semantically, rules like "I want headlines to be huge" will be usable.
    9. Screen readers for the blind can help them fill out a form more easily if the logical sections are broken into fieldsets with one legend for each one. A blind user can hear the legend text and decide, "oh, I can skip this section," just as a sighted user might do by reading it.
    10. Mobile phones can switch to a numeric keyboard when they see a form input of type="tel" (for telephone numbers).
    11. Knowing what your elements are lets browsers use sensible defaults for how they should look and behave. This means you have less customization work to do and are more likely to get consistent results in different browsers.
    12. All of this semantic labeling helps machines parse your content, which helps users.
    13. Fits the ideal behind HTML HTML stands for "HyperText Markup Language"; its purpose is to mark up, or label, your content. The more accurately you mark it up, the better. New elements are being introduced in HTML5 to more accurately label common web page parts, such as headers and footers.
    14. Yes, but honestly, and no offense intended, but I don't see the harm in these type questions, nor why some people are offended when they are asked. If I owed a website, I wouldn't mind it because it just creates more pages that can be indexed. I see it as helping the website. But, I did look and didn't see a simple answer. Again, no offense is intended. I've just never understood the complaints.
    1. The source for all versions is available on GitHub.
    2. My collection (this isn’t all of it) grows at a comical pace.
    3. Having them in a physical form is good for my soul.
    4. This is a non-exhaustive list of other things I love;
    5. Spending an hour digging through bins in a record store is one of my favorite ways to clear my head. And then spend too much money.
    6. Designing and writing code get me money so I can have food so they get a lot of my attention.
    7. I get asked a lot which I want to do more; design or write code? I answer, “yes.”
    8. Being a better designer makes me a better engineer and being a better engineer makes me a better designer.
    9. ;

      :

    10. ;

      :

    11. There are plenty of words and acronyms you can put in front of “Designer”. Product, Web, Graphic, UX, UI, IA, etc. The lines between each are blurry, and the titles go in and out of fashion. Depending on the project and team I’m working alongside, I practice them all to varying degrees. I prefer to call myself; “A Designer.”
    1. This is a huge disadvantage to all web developers. Why can't we at least have the ability to turn validation messages off? Why do we have to re-implement a validation system when you already have one in place, but all we want is the validation aspect and not the built in messaging? By taking away the ability to style elements that CHROME adds to the browser window, it is hurting developers professional appearance. We just want to use Chrome's WONDERFUL validation system with our own error messages. Either let us style them, or let us hide them, but don't make us re-invent the wheel just because you don't want our code to be "browser specific". Writing a new validation system just for Chrome is going to be much more "browser (chrome) specific" code than setting "::-webkit-validation-bubble, ::-webkit-validation-bubble * { display: none; }. This isn't just an annoyance, it's a huge disadvantage to any developer who wants to easily utilize Chrome's built in validation. I usually brag about how wonderful Chrome is, but I'm starting to think it's heading in another direction...

    1. the client form validation is the one I like a lot, because, for example, by adding required attribute to an input, I don’t need to write any additional JavaScript to warn a user, when the user submits a form without filling out the required fields
    2. There are numerous user interface state pseudo-classes. You’ve probably already known :hover, :active etc. According to this W3C Candidate Doc, there are additional pseudo-classes defined, such as :valid, invalid, in-range, out-of-range, required, optional, read-only and read-write.
    1. Website: <input type="url" name="website" required pattern="https?://.+"> Now our input box will only accept text starting with http:// or https:// and at least one additional character
    1. The document.evaluate() method evaluates an XPATH query/expression. So you can pass XPATH expressions there, traverse into the HTML document and locate the desired element.
    2. Array.from(document.querySelectorAll('div')) .find(el => el.textContent === 'SomeText, text continues.');
    1. The TreeWalker API gives you only the #text Nodes, and then you do what you want with them.

      first sighting: TreeWalker 

    2. You could also use the NodeIterator API, but TreeWalker is faster
    3. All those 'modern' and 'super-modern' querySelectorAll("*") need to process all nodes and do string comparisons on every node.
    4. the fastest solution because the main workload is done by the Browser Engine NOT the JavaScript Engine
    5. [...document.querySelectorAll("*")].filter(e => e.childNodes && [...e.childNodes].find(n => n.nodeValue?.match("❤")))
    6. Super modern one-line approach with optional chaining operator
    7. Possibly use Array.prototype.filter.call instead of allocating a new array.
    8. function contains(selector, text) { var elements = document.querySelectorAll(selector); return [].filter.call(elements, function(element){ return RegExp(text).test(element.textContent); }); }
    1. This only works provided each element has a label. It will not work if you put the attribute on the element itself, because <input> elements cannot have :after pseudo elements.
    2. label:after { content: attr(data-invalid); ... }
    3. This question was asked over a year ago, but it's a good question that I recently encountered as well...
    4. var applicationForm = document.getElementById("applicationForm"); if (applicationForm.checkValidity()) { applicationForm.submit(); } else { applicationForm.reportValidity(); }
    1. Does there exist a Unicode new-line, which I could copy-paste? (PLEASE NOTE, I DON'T ASK ABOUT THE CODE, like U+000D or whatever is considered as new line. I want the "copyable" output, like the above space (which I have put above in brackets and can be copied). So, if there is, please paste it in your answer, so I could copy it, like you copy the unicode space above from brackets.
    1. Therefore client side validation should always be treated as a progressive enhancement to the user experience; all forms should be usable even if client side validation is not present.
    2. It's important to remember that even with these new APIs client side validation does not remove the need for server side validation. Malicious users can easily workaround any client side constraints, and, HTTP requests don't have to originate from a browser.
    3. Since you have to have server side validation anyways, if you simply have your server side code return reasonable error messages and display them to the end user you have a built in fallback for browsers that don't support any form of client side validation.
    4. workaround

      -> work around

    5. Validating forms has notoriously been a painful development experience. Implementing client side validation in a user friendly, developer friendly, and accessible way is hard. Before HTML5 there was no means of implementing validation natively; therefore, developers have resorted to a variety of JavaScript based solutions.
    1. I used this in the console to find the file and the line of the error (took it from this answer): JS_PATH = "app/assets/javascripts/**/*.js"; Dir[JS_PATH].each do |file_name| puts "\n#{file_name}" puts Uglifier.compile(File.read(file_name)) end

      Didn't work for me because it was actually a .coffee file.

      So I tried something similar with this:

      main > Dir["*/assets/javascripts/**/*.coffee"].each { |file_name| puts "\n#{file_name}"; Sprockets::CoffeeScriptProcessor.(filename: file_name, data: File.read(file_name), cache: {}); }
      
      app/assets/javascripts/bootstrapped.js.coffee
      NoMethodError: undefined method `config' for nil:NilClass
      from /home/tyler/.gem/ruby/2.7.1/gems/sprockets-4.0.2/lib/sprockets/source_map_utils.rb:40:in `format_source_map'
      

      but it wasn't as trivial to provide the necessary environment that Sprockets wants.

      But that's okay, when better_errors paused on the exception, I just jumped to the

      block in Sprockets::CoffeeScriptProcessor.call
      sprockets (4.0.2) lib/sprockets/coffee_script_processor.rb, line 24
      

      frame and evaluated

      input[:filename]
      

      to figure out which file had failed.

      Obviously this information should be part of the error message itself though!!

    2. I know this is old, but I got the same error and I came here from Google, so in case someone does too, this was my solution:
  2. afarkas.github.io afarkas.github.io
    1. If set to true the UI of all input widgets (number, time, month, date, range) are replaced in all browsers (also in browser, which have implemented these types). This is useful, if you want to style the UI in all browsers.
    2. Webshim is opinionated, that a developer should always solve a problem the HTML5 way.
    3. Webshim is also more than a polyfill, it has become a UI component and widget library. Webshim enables a developer to also enhance HTML5 capable browsers with more highly customizable, extensible and flexible UI components and widgets.

      And now that it's deprecated (presumably due to no longer needing these polyfills), not only do the polyfills go away (no longer maintained), but also these unrelated "extras" that some of us may have been depending on are now going away with no replacement ...

      If those were in a separate package, then there would have been some chance of the "extras" package being updated to work without the base webshims polyfills.

      In particular, I was using $.webshims.addCustomValidityRule which adds something that you can't do in plain HTML5 (that I can tell), so it isn't a polyfill...

    1. Fires an invalid event at the element

      First time I've seen/heard it said that an event is fired at some target. But it sure makes sense, since it matches how "fire" is used in other senses (like shooting a gun).

    1. You can't just use arbitrary pseudo selectors and expect it work. It's like me trying to speak Spanish in Japan and expecting japanese people to understand what I'm saying
    1. We’re doing our part to be more transparent and get data into the hands of patients quicker. Starting October 25, 2020, we’ll be releasing test results, visit notes and summaries immediately. Your provider may take up to three to five days to review your results and contact you to discuss abnormal results. Learn more here.
    1. markdown-it is the result of the decision of the authors who contributed to 99% of the Remarkable code to move to a project with the same authorship but new leadership (Vitaly and Alex). It's not a fork.
    2. var md = require('markdown-it')('commonmark');

      first sighting: require(...)(...)

      How would that work with import? Not as fluidly but...

      import markdownIt from 'markdown-it'
      let md = markdownIt('commonmark')
      
    3. + adds syntax extensions
    4. Configurable syntax! You can add new rules and even replace existing ones.
    5. Community-written plugins and other packages on npm.
    1. Playing it now, I realise that the game isn't necessarily any easier - I'm just more patient.
    1. Posting an issue on the discussion boards for a three year old game, yesterday, I wasn't holding my breath for a reply. Earlier, this morning, a dev. responded, stating they'd look at fixing it, and it was just a few hours before it were sorted!
  3. boardgamegeek.com boardgamegeek.com
    1. Players try to build a village together. As the game goes on each player secretly chooses whether they want to go for a coop victory or a single-player win.
    1. We often are too busy. We spend our days occupied by a multitude of worries. One day, I realized that my time left in this life was getting shorter and shorter. For the first time, I felt regret and wondered, “Where did my time go?”
    1. Try before you buy Here's a link to the game on Tabletopia: Judean Hammer on Tabletopia
    1. // A general key transform method. Pass it a function that accepts the old key and returns // the new key. // // @example // obj = transformKeys(obj, (key) => ( // key.replace(/\b(big)\b/g, 'little') // )) export function transformKeys(source, f) { return Object.entries(source).reduce((o, [key, value]) => { o[f(key) || key] = value return o }, {}) } // Provide an object that maps from old key to new key export function rekeyObject(source, keyMap) { transformKeys(source, key => keyMap[key]) }
    2. function objectMap(source,keyMap) { return Object.entries(keyMap).reduce((o,[key , newKey]) => { o[newKey]=source[key] return o;},{}) }
    3. Here's another plain ES2015/2017 version
    4. You really don't need underscore/lodash for this ... nowadays anyways
    5. I realize the question was asked 9 years ago, but this question is (still) ranked highly in search results and I came across it today
    1. not all answers pass this tests
    2. function isObject(o) { return o instanceof Object && o.constructor === Object; }
    3. An array is from a logical point of view not an object - although JavaScript handles and reports them as such. In practice however, it is not helpful to see them equal, because they are not.
    4. In case you need to verify that object is instance of particular class you have to check constructor with your particular class
    5. Arrays are definitely objects. Not sure why you think objects can't have a length property nor methods like push, Object.create(Array.prototype) is a trivial counterexample of a non-array object which has these. What makes arrays special is that they are exotic objects with a custom [[DefineOwnProperty]] essential internal method, but they are still objects.
    6. arrays are not objects from a logical point of view. I'm speaking about program logic. It is sometimes necessary to check if an array is a "real" array and definitely not an "real" object. That's what Array.isArray() is for. Imagine you have a function which accepts an object or an array of objects.
    7. function isObject (item) { return (typeof item === "object" && !Array.isArray(item) && item !== null); }
    8. What's a primitive?
    9. What's an object (i.e. not a primitive)?
    1. In production, you will never trigger one specific callback or a particular validation, only. Your application will run all code required to create a Song object, for instance. In Trailblazer, this means running the Song::Create operation, and testing that very operation with all its side-effects.
    2. There’s no need to test controllers, models, service objects, etc. in isolation
    3. Run the complete unit with a certain input set, and test the side-effects. This differs to the Rails Way™ testing style, where smaller units of code, such as a specific validation or a callback, are tested in complete isolation. While that might look tempting and clean, it will create a test environment that is not identical to what happens in production.
    4. Integration tests for controllers: These Smoke tests only test the wiring between controller, operation and presentation layer.
    5. Unit tests for operations: They test all edge cases in a nice, fast unit test environment without any HTTP involved.
    1. She asked me if I could create international universal design Shogi set for foreign Shogi fans.
    2. Design SHOGI pieces have been redesigned with new iconography to indicate the piece’s movement.
    3. Redesigning the pieces was very difficult work, because traditional pieces have 4 specialties below.
    4. Shogi is a classic game. I know many people who want to play Shogi, but the Kanji on the pieces makes it too hard to master. I have designed this Shogi with icons so anybody can learn it easily.
    5. If you want to try playing to see how these pieces work in the game, you can playtest it on the Iishogi.org site (https://lishogi.org/).  Last year the Iishogi designer asked me to register the Design SHOGI pieces on their site.  This Iishogi.org is a free to play Shogi website.  I was willing to give them permission to use them.  You are free to play and switch pieces design from the piece variation section.  If you register your ID, then you can play vs the A.I. easily.  You can learn how the Design SHOGI pieces work there.
    1. Why Kickstarter? Where else am I going to get the money to manufacture my game? No seriously, if you have a better place I can get this kind of money, please send me a message and I will do that immediately.
    1. Using ::delegates works exactly like the Forwardable module in Ruby, with one bonus: It creates the accessors in a module, allowing you to override and call super in a user module or class.
    2. Uber::Option implements the pattern of taking an option, such as a proc, instance method name, or static value, and evaluate it at runtime without knowing the option's implementation.
    1. These methods should be used with caution, however, because important business rules and application logic may be kept in callbacks. Bypassing them without understanding the potential implications may lead to invalid data.
    1. Using multiple termini has three magnificent, beautiful advantages.
    2. When nesting an activity with multiple outcomes, you can wire each terminus to a different route.
    3. It is much easier to track what is going on within the activity. Instead of transporting additional state via ctx, you expose the outcome via an additional end event.

      Note: It's only super easy to see what's going on if you have the benefit of a diagram.

    4. You may communicate more than a binary outcome of an activity. For instance, a controller endpoint activity could have end events for success and failure, but also for “not authorized”, or “validation failed”. You’re not limited to a binary setup here.
    5. we head straight into an additional terminus, or end event as it’s called in BPMN

      no