Matthew Jackowski sur Twitter : "Currying in JavaScript via @medium by @kevincennis. Currying in JavaScript. Currying in JavaScript I’ve been thinking a lot lately about functional programming, and I thought it might be kind of fun to walk through the process of writing a curry function.
For the uninitiated, currying refers to the process of taking a function with n arguments and transforming it into n functions that each take a single argument. It essentially creates a chain of partially applied functions that eventually resolves with a value. Here’s a basic example of how you’d use it: function volume( l, w, h ) { return l * w * h;} var curried = curry( volume ); curried( 1 )( 2 )( 3 ); // 6 Disclaimer This post assumes basic familiarity with closures and higher-order functions, as well as stuff like Function#apply(). Matthew Jackowski sur Twitter : "Useful Javascript debugging tips you didn’t know via @raygunio. Useful JavaScript debugging tips you didn't know. The Raygun team is made up of a bunch of nerdy folk just like yourself.
Occasionally they write about tools they like and thoughts they have about dev-type topics. This week we’ve got Rick, our longboarding-freediving-Swedish speaking front-end dev talking about ‘things you didn’t know about Javascript debugging’. Knowing your tools can make a major difference when it comes to getting things done.
This is a list of small debugging tips you probably didn’t know but soon won’t live without. In this post, most of the tips are for Chrome inspector even though my favourite tips are for Firefox. Quick find your DOM elements. Mark a dom element in the elements panel and use it in your console. If you mark following items in order’item-4′, ‘item-3′, ‘item-2′, ‘item-1′, ‘item-0′ then you can access the DOM nodes like this in the console. Display object as tables Sometimes it can be a bit messy to view a lot of data with console.log. Will output… Asynchronous Memoization in JavaScript.
In pure functional programming there is a simple rule: if you evaluate (call) a function more than once with the exact same argument values, you’ll keep getting the same return value.
It follows that there is no need to call it more than once, which is super-awesome!! Because it means you can put a caching mechanism in front of the function that keeps a map (hash table, Dictionary, etc.) of all the return values produced so far, each one keyed by the bundle of arguments that produced that return value. Of course it’s only worth doing this if the dictionary lookup is faster than simply re-executing the function itself, and if the same small set of arguments are highly likely to be passed repeatedly. Yawn!! Google JavaScript Style Guide. Quand j'ajoute des librairies au pif a mon class path pour que ca compile. AngularJS vs Ember - Evil Trout's Blog. Recently I got together with some local developers to discuss client side MVC frameworks.
We ended up discussing many of the differences between AngularJS and Ember. Discourse is an Ember application and has been since the first prototype, so I have a lot of experience with it. However, it became clear during the conversation with my peers that there was a lot about AngularJS I didn’t know. There is evidence that AngularJS is beating out Ember in terms of developer mind share: there are more Stack Overflow questions dedicated to AngularJS. AngularJS has more stars and forks on Github. I decided to take some time to seriously investigate AngularJS and see what all the fuss was about. Aware.js. Fastform · jquery plugin. Best practices in javascript / jQuery. Understanding JavaScript Closures and Currying. JS adolescence. Building Super Fast Web Apps with PJAX. The Locker Project. JavaScript Tops Latest Programming Language Popularity Ranking From RedMonk.
Industry analyst firm RedMonk published today its latest quarterly programming language popularity ranking.
JavaScript came out on top, followed closely by Java, PHP, and Python. The rankings are based on data collected from the open source project host GitHub and the programming questions and answer site StackOverflow, a measurement invented by Drew Conway and John Myles White in 2010. As I’ve written elsewhere, it’s difficult to determine the popularity of programming languages, but getting some idea of what developers actually like to use is one of many considerations for companies who need to hire developers. No ranking system is perfect, but the RedMonk system has a nice advantage in that they draw on two separate sources of data that correlate nicely and map out into multiple tiers.
A web app in 10 minutes using Play!
Framework. Dev. Xml. Jsp. Convert a Java OutputStream to an InputStream. If you have ever programmed using Java IO, you will quickly run into a situation in which a class creates data on an OutputStream and you need to send it to another class that expects to read the data from an input stream.
You'll soon be asking the question, "How do I convert an OutputStream to an InputStream? " Nowhere in Java will you find a OutpStreamToInputStreamConverter class. Luckily, there are several ways to go about this. Method 1: Buffer the data using a byte array The easiest method is to buffer the data using a byte array. ByteArrayOutputStream out = new ByteArrayOutputStream(); class1.putDataOnOutputStream(out); class2.processDataFromInputStream( new ByteArrayInputStream(out.toByteArray()) ); That's it! Method 2: Use pipes The problem with the first method is that you must actually have enough memory to buffer the entire amount of data.