TheMiddleManz

- friends
207 link karma
562 comment karma
send messageredditor for
what's this?

TROPHY CASE


  • Verified Email

JS Beginner, why is this breaking the program? by AlienRaperin javascript

[–]TheMiddleManz 1 point2 points ago

lol, for some reason I didn't make the connection that you actually wanted to log the boolean, sorry :D

JS Beginner, why is this breaking the program? by AlienRaperin javascript

[–]TheMiddleManz 3 points4 points ago

The problem is the do loop will loop forever, this hangs the app.

Javascript runs in 1 thread, only 1 thing can be run at a time. If some other code wants to run it just get queued up to be run later when the current running code is finished. So on mouse over this starts looping forever, constantly reseting the styles. The mouse out code will never run because it is waiting for the loop to finish, and it never will.

Start thinking events, you have 2 events here: when the mouse goes over the element and when the mouse leaves. So when they hover the image you want to start animating the button, when they are done hovering you want to stop the animation.

When each event is fired it runs some code, that code calls other functions and functions may call functions, but eventually those will all finish and everything that needed to run will be done. Now another queued up chunk of code can be run. Each chunk of code like that (functions calling functions) is called a call stack.

For better performance browsers only update the webpage once after each callstack, so while animating we need to draw 1 frame and wait.

To do that you can use setTimeout, setTimeout just takes a function and a time in milliseconds and runs that function later in its own stack. So we can pretty much replace your do loop with a recursive setTimeout 0

Here is a working solution, let me know if you understand. http://jsfiddle.net/MXb3j/2/ Since the image moves out of the way it triggers a mouseout and stop, so you get the effect of pushing it in a circle.

Render loops in javascript (w/ canvas) by nspyroin javascript

[–]TheMiddleManz 7 points8 points ago

+1 Use this nice shim from our pal Paul Irish to use RAF but fall back to a set interval: http://paulirish.com/2011/requestanimationframe-for-smart-animating/

So the kids and I had some fun artistically organizing the DVDs... This is the result. [x-post from r/dvdcollection] by DVDJunkyin pics

[–]TheMiddleManz 1 point2 points ago

This will be useful next time you are looking for a movie to watch based in its case color.

A distro with vanilla gnome 3 (as opposed to Cinnamon in Mint 13) - Ubuntu GNOME Shell Remix by TheMiddleManzin linux

[–]TheMiddleManz[S] 2 points3 points ago

True that, I really like 2 features Ubuntu adds: PPAs (or at least their popularity) and the restricted drivers manager.

This is why Ubuntu or linux distros are not ready for end users - "No such partition" error after simple installation of Ubuntu Precise 12.04 by thinkingpersonin linux

[–]TheMiddleManz 4 points5 points ago

This post does not change the fact that this is a problem either, it doesn't help it at all, this is why I downvoted.

So I just got my head cut open by a falling first aid kit. Whats the most ironic thing that has happened to you? by DivorceCakein AskReddit

[–]TheMiddleManz 0 points1 point ago

A friend of a friend once gave me some cigars, later he let me stay in his cabin that his father built, I accidentally left one of the lit cigars in the cabin and it burned down.

Why are you procrastinating right now? by catbucketin AskReddit

[–]TheMiddleManz 0 points1 point ago

Well shit

Why are you procrastinating right now? by catbucketin AskReddit

[–]TheMiddleManz 0 points1 point ago

I'll do it just after I post a comment on this post.

Backbone.statefulEvents: define event callbacks that get called based on application state by _anksin javascript

[–]TheMiddleManz 0 points1 point ago

For the way we use backbone that would be more weird. Although I assumed this allowed multiple states and 'getState' would return an object with keys of statenames and booleans of if they are currently active. If that was true we could probably just return 'this' and it could check for booleans.

Backbone.statefulEvents: define event callbacks that get called based on application state by _anksin javascript

[–]TheMiddleManz 0 points1 point ago

Cool. I can see where it would be useful and I will keep it in mind for next time that comes up.

My only criticism is the mandatory 'getState' function. We end up storing the state as just booleans or so on the view itself.

Disabled, but looking for work! by Nilorein SaltLakeCity

[–]TheMiddleManz 1 point2 points ago

Ever thought about programming? A good programmer can make good money sitting on their computer at home as long as they can get the work done in a timely manner.

everyday... by DudeWithaguitarin fffffffuuuuuuuuuuuu

[–]TheMiddleManz -1 points0 points ago

Don't worry, things will get better. Perhaps try doing a hobby or starting a project. I was pretty depressed for a while until recently I started a project that I am constantly thinking about or working on.

Hey Reddit! I finished my 2nd EP. Here it is. (Tis free!) by roboctopusin chiptunes

[–]TheMiddleManz 1 point2 points ago

Good stuff, thanks!

Tangled is free for a limited time in association with Daily App Dream! by Rudy69in IndieGaming

[–]TheMiddleManz 1 point2 points ago

You need to stop spam-posting this. It's a nice game, post it in a few relevant subreddits once and move on.

Underscore.js replacement claiming 8x performance by maloney7in javascript

[–]TheMiddleManz 4 points5 points ago

Also AMD compatible!

Braid- Steam/Wine, Desura or direct buy? by Char_Barin linux_gaming

[–]TheMiddleManz 4 points5 points ago

Desura has been really nice for me. It's nice to have all your games in 1 place. There are some free games on there so you should download the client and some free games to try it out.

For those that have built somewhat large'ish single page apps with any JavaScript MV* framework - memory management? by magenta_placentain javascript

[–]TheMiddleManz 0 points1 point ago

Cool, quick question on that, is the "name" attribute global? If so, is there a good way to have a setup that has 1 poll per instantiated class?

I just finished my first album. Its about 40% chiptune. by Gigglesplatin chiptunes

[–]TheMiddleManz 1 point2 points ago

I like your style sir. Why doesn't it let me pick a price? This is worth more than free to me.

Where is the critizism of RequireJS? by snugglin javascript

[–]TheMiddleManz 1 point2 points ago

We have been using requirejs for a while, for our mid-size projects the disadvantages are:

and advantages for us have been:

  • modular reusable pieces of code, even across projects
  • loading templates
  • amazing and simple building of our files via r.js (combines and minifies js files and templates)
  • easy compilation of coffeescript
  • deferring loading of a few things, mainly when there is a button with a complicated popup or something behind it, we defer that until it is clicked. And with r.js you can make a build of everything for the initial load to load your app in 2 requests, then build for each deferred piece so 1 request for each of those

For those that have built somewhat large'ish single page apps with any JavaScript MV* framework - memory management? by magenta_placentain javascript

[–]TheMiddleManz 4 points5 points ago

We have never run into memory issues, the issues we have had are with zombie setIntervals and event listeners, and too many elements in the DOM.

How to structure a large scale web app? by vortex2k10in javascript

[–]TheMiddleManz 0 points1 point ago

False. The language itself only has a few small differences but some of them are very important:

  1. the arguments object is actually sane so you can add prefixes for

box-shadow: 0 0 5px black and box-shadow: 0 0 5px black, 0 1px 0 red inset

with the same function/mixin

  1. you can nest within mixins, pretty powerful http://learnboost.github.com/stylus/docs/mixins.html (scroll down halfway)

  2. you can iterate http://learnboost.github.com/stylus/docs/iteration.html

  3. it has a kickass 'standard' library ala nib

(and more)

but the main reason I recommended it with node is because the two work together so much better. Mainly it comes with an express middleware compiler and doesn't crash the server when your css has errors.

Please don't be so quick to judge.

view more: next