16 Matching Annotations
  1. Mar 2023
    1. ```js /! devtools-detect https://github.com/sindresorhus/devtools-detect By Sindre Sorhus MIT License / const devtools = { isOpen: false, orientation: undefined, };

      const threshold = 170;

      const emitEvent = (isOpen, orientation) => { globalThis.dispatchEvent(new globalThis.CustomEvent('devtoolschange', { detail: { isOpen, orientation, }, })); };

      const main = ({ emitEvents = true } = {}) => { const widthThreshold = globalThis.outerWidth - globalThis.innerWidth > threshold; const heightThreshold = globalThis.outerHeight - globalThis.innerHeight > threshold; const orientation = widthThreshold ? 'vertical' : 'horizontal';

      if ( !(heightThreshold && widthThreshold) && ((globalThis.Firebug && globalThis.Firebug.chrome && globalThis.Firebug.chrome.isInitialized) || widthThreshold || heightThreshold) ) { if ((!devtools.isOpen || devtools.orientation !== orientation) && emitEvents) { emitEvent(true, orientation); }

      devtools.isOpen = true;
      devtools.orientation = orientation;
      

      } else { if (devtools.isOpen && emitEvents) { emitEvent(false, undefined); }

      devtools.isOpen = false;
      devtools.orientation = undefined;
      

      } };

      main({ emitEvents: false }); setInterval(main, 500);

      export default devtools; ```

  2. Nov 2022
    1. While there are many great answers regarding the "glyph not found" glyph, that won't help you actually detect it, as the text string in code will still have the character regardless of the font used to render it.
  3. May 2022
    1. let timer; // Timer identifier const waitTime = 500; // Wait time in milliseconds // Search function const search = (text) => { // TODO: Make HTTP Request HERE }; // Listen for `keyup` event const input = document.querySelector('#input-text'); input.addEventListener('keyup', (e) => { const text = e.currentTarget.value; // Clear timer clearTimeout(timer); // Wait for X ms and then process the request timer = setTimeout(() => { search(text); }, waitTime); });

      let timer; // timer identifier const waitTime = 500; // Wait time in milliseconds

      // search function const search = (text) => { // to do: make http request here }

      // Listen for keyup event const input = document.querySelector('#input-text'); input.addEventListener('keyup', (e) => { const text = e.currentTarget.value; // clear timer clearTimeout(timer);

      // Wait for X ms and then process the request timer = setTimeout(() => { search(text); }, waitTime); });

    1. // Get the input box let input = document.getElementById('my-input'); // Init a timeout variable to be used below let timeout = null; // Listen for keystroke events input.addEventListener('keyup', function (e) { // Clear the timeout if it has already been set. // This will prevent the previous task from executing // if it has been less than <MILLISECONDS> clearTimeout(timeout); // Make a new timeout set to go off in 1000ms (1 second) timeout = setTimeout(function () { console.log('Input Value:', textInput.value); }, 1000); });

      let timeout = setTimeout(callback, milliseconds); clearTimeout(timeout);

      document.getElementById("id-name"); object.addEventListener('event-name',callback);

    2. In order to execute an event listener (or any function for that matter) after the user stops typing, we need to know about the two built-in JavaScript methods setTimeout(callback, milliseconds) and clearTimeout(timeout): setTimeout is a JavaScript method that executes a provided function after a specified amount of time (in milliseconds). clearTimeout is a related method that can be used to cancel a timeout that has been queued.

      Step 1. Listen for User Input

      <input type="text" id="my-input" />

      let input = document.querySelector('#my-input'); input.addEventListener('keyup', function (e) { console.log('Value:', input.value); })

      Step2: Debounce Event Handler Function

      let input = document.getElementById('my-input'); let timeout = null;

      input.addEventListener('keyup', function(e) { clearTimeout(timeout);

      timeout = setTimeout(function() { console.llog('Input Value:', textInput.value); }, 1000); })

  4. Jan 2022
  5. Dec 2021
  6. May 2021
  7. Mar 2021
  8. Oct 2020
  9. Sep 2020
    1. When you visit location /one and the server redirects you to location /two, you expect the browser’s address bar to display the redirected URL. However, Turbolinks makes requests using XMLHttpRequest, which transparently follows redirects. There’s no way for Turbolinks to tell whether a request resulted in a redirect without additional cooperation from the server. To work around this problem, send the Turbolinks-Location header in the final response to a visit that was redirected, and Turbolinks will replace the browser’s topmost history entry with the value you provide.
  10. Mar 2019
    1. Language Understanding

      目标是根据一个用户utterance/query 得到其对应的语义slot。slots是预先根据场景定于的。通常来说有两种类型的表示,一个是句子级别的类别,例如用户的意图和utterance的类别。另外一个是单词级别的信息抽取,例如命名实体和槽位填充。

      意图识别是根据一句话来检测用户的意图。 基于深度学习的意图识别: L. Deng, G. Tur, X. He, and D. Hakkani-Tur. Use ofkernel deep convex networks and end-to-end learningfor spoken language understanding. InSpoken Lan-guage Technology Workshop (SLT), 2012 IEEE, pages210–215. IEEE, 2012

      G. Tur, L. Deng, D. Hakkani-T ̈ur, and X. He. Towardsdeeper understanding: Deep convex networks for se-mantic utterance classification. InAcoustics, Speechand Signal Processing (ICASSP), 2012 IEEE Interna-tional Conference on, pages 5045–5048. IEEE, 2012.

      D. Yann, G. Tur, D. Hakkani-Tur, and L. Heck. Zero-shot learning and clustering for semantic utteranceclassification using deep learning. 2014.

      尤其是这个用CNN来抽取query vector进行query分类。 H. B. Hashemi, A. Asiaee, and R. Kraft. Query intentdetection using convolutional neural networks. InIn-ternational Conference on Web Search and Data Min-ing, Workshop on Query Understanding, 2016

      P.-S. Huang, X. He, J. Gao, L. Deng, A. Acero, andL. Heck. Learning deep structured semantic modelsfor web search using clickthrough data. InProceedingsof the 22nd ACM international conference on Confer-ence on information & knowledge management, pages2333–2338. ACM, 2013

      Y. Shen, X. He, J. Gao, L. Deng, and G. Mesnil.Learning semantic representations using convolutionalneural networks for web search. InProceedings of the23rd International Conference on World Wide Web,pages 373–374. ACM, 2014.

  11. Feb 2018
  12. Aug 2015