Updates from June, 2012 Toggle Comment Threads | Keyboard Shortcuts

  • Pablo 9:49 PM on 29 June 2012 Permalink | Reply  

    weightxreps.net UPDATED 

    I just uploaded the new version of the site, new design, and re-coded internally. More packed this time.

    I still have to add a few things and there will probably jump bugs in the next few days, hopefully the user’s feedback will help me solve them fast.

    http://weightxreps.net

    Advertisements
     
  • Pablo 9:56 PM on 27 June 2012 Permalink | Reply  

    Apache VirtualHost 

    Just writing this up for a friend:

    1) Add the “hook” in C:\WINDOWS\system32\drivers\etc\hosts   “127.0.0.1 http://www.your-hook.com

    2) Define the desired host in Apache’s config located in C:\xampp\apache\conf\extra\httpd-vhosts.conf like so:

    NameVirtualHost *:80 #localhost
    <VirtualHost *:80> 
     DocumentRoot "C:/xampp/htdocs" 
     ServerName localhost:80 
    </VirtualHost> 
    <VirtualHost *:80> 
     DocumentRoot "C:/xampp/htdocs/your-hooked-site" 
     ServerName www.your-hook.com
    </VirtualHost>

    3) Restart Apache and type “http://www.your-hook.com” on your browser’s address bar. That’s it.

     
  • Pablo 12:55 PM on 12 June 2012 Permalink | Reply  

    Firefox + Raphael + mouse event = offsetX undefined 

    Long story short, to get the mouseX position from a raphale’s element inside a mouse event, use this (because offsetX will be undefined…)

    var posX = event.offsetX || event.layerX;

    that will try to use offsetX or fallback to layerX (which will be defined in Firefox)

     
    • nielsekr 5:11 PM on 17 September 2012 Permalink | Reply

      how about event.pageX?

  • Pablo 1:15 PM on 1 June 2012 Permalink | Reply  

    CodeMirror: Gotcha! 

    Now i know why in the documentation they say to always use RegExp with the “^” sign at the start of each match.

    Today i got an issue which at first i thought it was a CodeMirror’s bug. But then i realized i was missing this symbol in part of my RegExps.

    How this error was detected? I was seeing keywords from my custom highlighter being marked with the wrong colors. For example, i had one that made all the numbers display with blue color. But when playing a rround with the typing on the editor, i noticed that sometimes a letter would be displayed as blue, why? THis is why…

    Example to reproduce the “gotcha”:

    Line example: “Hello, testing 12345 numbers and testing.”

    Custom mode’s rules example: HIghlight “Hello” strings with red and Numbers with blue.

    At the start of the parsing CodeMirror would take that first line of text and pass it to my custommode, resulting in the “Hello” being tokenized and highlighted in red (because in that regexp i did typed the ^ symbol). So now the parser takes the next chunk of text and pass it to my parser. The new token/stream is now:

    , testing 12345 numbers and testing.

    With this token, my custom mode will match my Number matching regexp:

    /\d+/

    Because i forgotted to start the regexp with ^ (start of line symbol) the regexp would find “12345” in the token.  “12345” is 5 characters long. So when you do this:

    var match = stream.match(/\d+/);

    The parser will change the length of the current token from it’s start to 5 characters long, resulting in this:

    , testing 123 numbers and testing.

    So the next token now would be:

    ting 12345 numbers and testing.

    And so on, the bug would generate a very weird looking result. This is because the regexp should match always fromthe start of the token itself, which is always chunk of text starting at “^”

    So, using this would work as espected:

    /^\d+/

     

    Hello, testing 12345 numbers and testing.

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel