Profile

Cover photo
Jason McCarrell
Works at Jason's house
Attended University of Windsor
Lives in Montreal, Quebec
103 followers|40,340 views
AboutPostsPhotosYouTube

Stream

Jason McCarrell

Discussion  - 
 
Is it alright to use uncontrolled form inputs for basic forms?
This is a philosophical kinda thing, I'm also looking for a potential better solution that also avoids state OR a justification why it's ok to attach state for each input.

I'm building a basic CMS that submits forms via ajax, but does nothing else.
When the form loads, I set the input values through defaultValue, then when i submit I grab the values through refs.

I have zero state, which feels good, because I have zero interest in what is in the inputs until I submit the form.

Is it alright to ignore the changing state of inputs? Is grabbing the values from refs ok?

EDIT: I'd like to add. I'm considering using this methodology even as my forms get more complex. So perhaps the body has a rich text editor with a live preview. The textarea would now have a state, however I would continue to simply use defaultValue and refs to manage the form submission. Does this sound right?
7 votes  -  votes visible to Public
this is fine
100%
Actually.. (please comment)
0%
1
Jason McCarrell's profile photo
2 comments
 
apparently FormData only comes in multipart format, which apparently feather-mongodb doesn't support in their REST service, then apparently there are no light weight solutions to the lack of form serialization outside of jquery... so i had to build one. But now the code is short simple, and super basic with no state.
Add a comment...

Jason McCarrell

Discussion  - 
 
So a problem I've been discussing with friends and mulling over:

Web Components could be the best way to write front-ends, however IMO ideally all display html and values should be generated by the server so load times are instant (especially on mobile).

How can one write reactive web components, while also serving their initial page generated by the server side?

Somehow have node parse web components and serve them, then have the UI somehow hook those web components after already having rendered the page (with all values in html)?
This is sort of a thought exercise and challenge. I don't think there is a simple solution, but perhaps I'm wrong.
1
Eric Elliott's profile photoJason McCarrell's profile photoJuanma Cañabate's profile photo
16 comments
 
yeah, I forgot about the question at the end regarding to web components. Glad you found it useful!
Add a comment...
 
I just wrote this to satisfy setting autocomplete options for ng tags input and angular module:
  7    $scope.tagOptions = function() {
  8       return {
  9          then: function(fnc) {
 10             return fnc(['green', 'blue', 'red', 'white', 'yellow']);
 11          },
 12       }
 13    };

Is there not an easier way to satisfy a promise requirement?
This is insane. It's a function returning an object with a value of a function with a parameter of a function that must be called with the value I hope to give for the original variable.
2
1
Chris Stead's profile photoJason McCarrell's profile photoRay Fan's profile photo
6 comments
 
What I wrote is disgusting, no doubt =P

The proper way to do it using $q in the LEAST amount of lines would be:
var deferred = $q.defer();
deferred.resolve([1,2,3]);
return deferred.promise;

I can't even do it in one line, because resolve isn't chainable.

This method is better than my hack even if it is a lot more characters, but I still don't understand why their isn't a shorthand, or at the very least, why resolve isn't chainable.

Btw I should mention that I HAVE to use a promise for an angular module I'm using and it isn't simply auto-complete, it's actually the ng-tags-input module.
Add a comment...

Jason McCarrell

Shared publicly  - 
 
Web Developers: Have you ever been making a web app and thought 'fuck, now I gotta build my restful api' Or worst, you're working on someone elses project and they have a restful API, but it's not ready for you.

Well, I've solved this problem for MongoDB. I present Generic REST server:
https://github.com/funkjunky/generic_rest_server

It's a hyper simple node server that you can post/get/put/delete to with the url specifying the collection and it will Insert, find, edit, and delete from the collection according to the data you send to it. No fancy setup, no security, just start testing.
For example, In my contract we've been discussing how to store the information and someone else is supposed to handle that server, but I want to make the forms now, so I just use my generic restful api for now, and switch the url later.
generic_rest_server - A Super generic non-authenticated REST server that will do whatever you want in a mongo database for testing purposes.
1
Add a comment...

Jason McCarrell

commented on a video on YouTube.
Shared publicly  - 
 
As someone who used to be in bronze league I can feel the rage of the protoss in this game. Widow Mines are basically the "win" button in bronze league, until protoss gets thermal lance. Not only does toss need detection, but they also need to keep units at a range, or they insta-die.

I'm saying this only at bronze level. I'm a gold level random and widow mines are simply a nuisance.
1
Atkatsuki85's profile photoJason McCarrell's profile photochebz's profile photo
3 comments
chebz
 
+Atkatsuki85 I am not bronze but I usually just expand to 3rd while playing defensively and out-macro opponent, works pretty well in low leagues..
Add a comment...

Jason McCarrell

commented on a video on YouTube.
Shared publicly  - 
 
Ladder Decay, is an additional hit to your ego, because as a platinum player, I'll play against "silver league" players and lose, because they are actually diamond league players. I'll think "have I really fallen that much?", then I'll play against a real silver league player and destroy them and simply be confused.

The ladder is uber broken and makes it almost useless if you don't play enough games.
1
Randy Fortier's profile photoJason McCarrell's profile photo
2 comments
 
woah, so weird to see this youtube comment on G+.
But ya, I think they need the decay, but they need to have a limit on it. If I was a platinum player 2 months ago, it shouldn't drop me 3 out of the 5 leagues to bronze. It should drop me down 1 league if it's only been a couple or few months, then 2 leagues if it's been nearly a year.

I think they over-compensated for their update to not let people be demoted during a season. It's fine to not let someone be demoted, because when the next season starts, they will end up in a lower league.
Add a comment...
Have him in circles
103 people
Timothy Jeter's profile photo
tjr reddy's profile photo
Burhanettin Mirzooğlu's profile photo
Priye Spiff's profile photo
Олег Вотяков's profile photo
Jacquelyn Anderson's profile photo
Adrien Gagnon's profile photo
Dragon Slayer's profile photo
Juan Carlos Castillo Castillo's profile photo

Jason McCarrell

Discussion  - 
 
So I recently ranted about bind hell caused by JS this and thought, what if JSX fixed this issue by having 'this' always refer to the current context the function was written in?

It would save 99% of the bind calls in peoples code. Does this exist?

So If I wrote:
myClassMethod: function() {
    foo(function() {
        this.aSecondClassMethod();
    });
},

I wouldn't need to bind(this), because this would already refer to myClass.
1
Rick Jolly's profile photoJason McCarrell's profile photo
2 comments
 
omg... how did I not know about this. Thank you very much :D
Add a comment...

Jason McCarrell

Shared publicly  - 
 
 
UI-Algorithm... very cool insights how things works mathematically #javascript   #design  
1
Add a comment...

Jason McCarrell

Shared publicly  - 
 
Programming: I made a blog article about my Foray into the Client/Server MVC framework Rendr by AirBnB. I believe it may be the future of web application development. It is just a baby right now though.

http://www.jayeh.ca/article/Rendr:%20Shared%20client-server%20code%20without%20proprietary%20pre-compilation%20[sort%20of]
1
Add a comment...
 
I often want to call code after my view has been added to the browser window's DOM and only after. I was considering extending view to have this functionality, but I was wondering why there isn't native support for this? Often I find if I have to hack around something, I may be doing it wrong, so is there a better way to do this?

An example may be to do some fancy js animation on a dom element for some strange reason.
1
Mindaugas Murauskas's profile photoJason McCarrell's profile photo
2 comments
 
ah yes, I keep hearing about marionette... I will take a look.
Add a comment...

Jason McCarrell

commented on a video on YouTube.
Shared publicly  - 
 
Only 0, 1 and 2 drops. Nothing that costs more than 2 allowed.
Or the opposite, only cards that cost 6 or more allowed in the deck.
1
Add a comment...

Jason McCarrell

commented on a video on YouTube.
Shared publicly  - 
 
I didn't know Ryan Reynolds was a developer for Blizzard :o
I also didn't know he grew his hair out super long and grew a massive beard.
1
Add a comment...
People
Have him in circles
103 people
Timothy Jeter's profile photo
tjr reddy's profile photo
Burhanettin Mirzooğlu's profile photo
Priye Spiff's profile photo
Олег Вотяков's profile photo
Jacquelyn Anderson's profile photo
Adrien Gagnon's profile photo
Dragon Slayer's profile photo
Juan Carlos Castillo Castillo's profile photo
Work
Occupation
Fun-employed!
Skills
Making stuff with JS and C++, also talking about stuff.
Employment
  • Jason's house
    Programmy guy, present
    lots and lots of fun stuff made here. Game dev and JS twiddling, weee.
  • University of Windsor
    Computer Science Student, 2012
    work and school... good stuff... lots of frisbee.
  • Azzimov
    Software Developer, 2012 - 2013
    IOS Dev, Backend PHP, parsing and converting GB of XML and JSON data, Frontend JS.
  • Windsor Mold
    Software Developer, 2009 - 2011
    Backend PHP, Frontend JS, Formal Software Design stuff
  • Peterborough Utilities Group
    Application Support Specialist, 2011 - 2012
    Geomedia Webmaps development using PHP. Forced to work on ASP and Crystal Reports. Managed to escape public sector, safely.
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Montreal, Quebec
Previously
Peterborough, Ontario
Story
Tagline
Kind and supporting enough to compensate for my brutal honesty.
Introduction
Love programming, bike everywhere, love rhythm games, love music (everything, but country), obsessed with Japan
Bragging rights
Got lazy university students to do productive volunteering work
Education
  • University of Windsor
    Computer Science, spec. AI, 2006 - 2011
  • Kenner Collegiate Vocational Institute
    2002 - 2006
  • KCVI
    2002 - 2006
Basic Information
Gender
Male
Other names
Funk, Jay, 1x