• Announcements

    • MannDude

      Current state of vpsBoard   02/04/2017

      Dear vpsBoard members and guests:

      Over the last year or two vpsBoard activity and traffic has dwindled. I have had a change of career and interests, and as such am no longer an active member of the web hosting industry.

      Due to time constraints and new interests I no longer wish to continue to maintain vpsBoard. The web site will remain only as an archive to preserve and showcase some of the great material, guides, and industry news that has been generated by members, some of which I remain in contact to this very day and now regard as personal friends.

      I want to thank all of our members who helped make vpsBoard the fastest growing industry forum. In it's prime it was an active and ripe source of activity, news, guides and just general off-topic banter and fun.

      I wish all members and guests the very best, whether it be with your business or your personal projects.

      -MannDude

Search the Community

Showing results for tags 'node.js'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • vpsBoard
    • Announcements & Contests
    • Industry News
  • Virtual Private Servers
    • General Talk
    • Operating a VPS Business
    • Tutorials and Guides
    • Questions and Answers
  • The Lounge
    • The Pub (Off topic discussion)
    • Coding, Scripting & Programming
    • SBC, ARM, Home Automation
  • Marketplace & Reviews
    • Reviews
    • VPS Offers
    • Other Offers
    • Service Requests

Found 6 results

  1. I've been doing code review and tutoring for Node.js for some time now, and it's been a while since the last promo - so here's a new one! It doesn't really get any cheaper than this anywhere :) I'll keep it short; this is what's on offer: 5 hours of private tutoring, for €150 (ie. €30/hour), or 10 hours of private tutoring, for €250 (ie. €25/hour) During these hours, I will help you out with whatever Node.js-related topics you want to learn about, no matter what it is or how complex it is - whether it's basic Javascript syntax, building a web application, working with asynchronous code, building distributed systems, writing command-line tools, deploying applications in production, or anything else. There's also not a single teaching method - I will adapt to whatever approach works best for you personally. This offer is valid until November 13, but purchased hours don't expire, so you can schedule sessions whenever you want. This offer will also only last for 40 hours in total, across all buyers - after that, the normal price of €40 per hour applies. You can purchase any combination of hours within those limits, of course. The practical bits: Your timezone doesn't matter, as I can accommodate most schedules - just make sure to schedule two or three days in advance. Weekdays preferred, but weekends also possible. The communication method used during tutoring is IRC or XMPP, whichever you prefer. I can help you setting up either of them, if needed. GitHub Gist is used for code sharing, and where necessary, TeamViewer is also an option. Payment terms: You can pay through Bitcoin, PayPal, or SEPA. All payment is upfront (pre-paid), and to be eligible for this offer, you must complete your purchase before November 13. Payments made for this offer are not refundable, whether in full or in part. As my automated booking system isn't done yet, you can book through e-mail ([email protected]), XMPP ([email protected]), IRC (joepie91 on Freenode), or through a PM here on VPSBoard. Keep in mind that my IRC client doesn't always notify me of PMs, so the other methods are usually faster. If you have any questions about the offer, you're always welcome to ask them - whether in this thread, or privately! --- Some honest, unedited reviews from customers:
  2. I've been doing Node.js code review and tutoring for a while now, and I figured I'd try my hand at running a promo. So, for the coming week, I'm offering five hours of Node.js tutoring for only €100 (about $113 at current exchange rates). That's €20 per hour, a 20%-60% discount over my usual rates of €25-€50! :) In these five hours, I'll be getting you up to speed with Node.js - you'll learn all the basics you need to get started with it, and find your way around. The tutoring is one-on-one, so you get 100% of the attention and time, and you can ask any questions you have in the process. This offer is valid until June 24, 2015. What you will be doing and learning We'll go through the basics of Node.js, Express, and Jade. You'll build a very simple 'real-world web application' - for example, a to-do list, a shoutbox, a blog, or anything similarly basic that you might feel like building. By the time we're done, you will have a basic working application, and a good foundation to start building more complex projects. The different topics we'll address: Setting things up (installing Node.js, creating a new project, searching for and installing modules) Javascript and Node.js mechanics (callbacks/async, error handling, promises, creating modules, prototypical inheritance) Express.js (Express.js itself, Jade, common Express.js middleware) Databases (PostgreSQL, Knex) Anything else that might come up while building your small project. Requirements Motivation to learn. A code editor (some good options are Brackets, Geany, Notepad++, etc.) The ability to access GitHub Gist; if you are in China, you may need a proxy. A basic understanding of HTML and Javascript syntax (not strictly required, but without this prior knowledge, we probably won't be able to finish in 5 hours). A basic understanding of how to operate a terminal/commandline. You can use any operating system, but keep in mind that Windows can cause problems with Node.js sometimes - you will need to install Visual Studio, not all Node.js modules might work out of the box, and Windows has some issues with long paths. If you have the ability to work/test on a Linux or OS X system, that's preferable. A database will be provided, you won't have to set up PostgreSQL yourself (although it's advisable to learn this at a later point, of course). Price €100 for 5 hours. If you meet the requirements listed above, it shouldn't take longer than that. Note that this must be paid upfront. You can pay through Bitcoin, PayPal, or SEPA transfer. If you already know the basics of Node.js, you may also use the 5 hours for other Node.js-related tutoring - however, keep in mind that I can't guarantee we'll be entirely finished within those 5 hours. I'm also still available for other work at my usual rate :) Alright, where do I sign up?! Simply send me a PM on here, e-mail me at [email protected], or talk to me on XMPP ([email protected]) or IRC (joepie91 on Freenode)!
  3. After having helped people out in #Node.js on Freenode for a while, I figured out that I actually quite enjoy reviewing code and teaching people, and there aren't really any ethical concerns either. So... I've turned that into paid work :) The 'canonical' page with information about this is here, but below is the same info for easier reading (slightly modified). Specializations Node.js (also previous experience with Python and PHP, but not currently offering code review for those) Application security Actual code readability and maintainability, not just enforcing a style guide Web-based applications primarily - mainly Express-based, but can also review other types of applications Promises, map/reduce/filter, etc. Scraping (from any source) Unusual architectures and experimental technologies Methodology I value readability above strict adherence to a style. I don't enforce style guides, but I will point out even tiny readability issues. I review in stages. Every "stage" is increasingly granular. I'll start with general code style issues, incorrect indentation, etc. - then move on to modularization, and so on, looking at increasingly smaller issues. I will wait with the next stage until you've finished changing the issues found in the previous change - this makes it easier for you to recognize and understand the problems, and easier for me to review and not miss little things. In general, I'm a perfectionist. I'll keep suggesting improvements until there's nothing left to suggest. Where needed, I will write chunks of example code or refactor small parts of your code, to illustrate concepts and patterns. I am very direct. I won't sugarcoat things, and will point out any problems I see. I may come across as hostile, but I'm not - I just want the best possible end result, as effectively as possible. I will always provide rationale for suggestions. No "just because". This is both code review and tutoring, really - I want you to actually understand why a change needs to be made, and will do my best to explain things in a way you understand them. Payment Both fixed-price and hourly rate are an option. Hourly rate generally ranges from 25 to 50 EUR/hr, depending on factors like project complexity, ease of communication and so on. Fixed price: 50% deposit paid up front, other 50% after completion. Price is based on LOC and expected complexity, and will be set in stone after initial agreement - no later changes. Hourly rate: upfront deposit in 10 hour increments - after 10 hours, a deposit for the next 10 hours, and so on. Remaining hours after completion are refunded. Note that time is rounded up per hour, regardless of the actual amount of work performed during that hour. For hourly-rate work, the upfront deposit can be reduced if you're on a particularly tight budget. Of course, if you feel things aren't working out, we can simply stop the review and any remaining hours will be refunded. Contact E-mail: [email protected] XMPP: [email protected] IRC: joepie91 on Freenode (other methods preferred though - it's easy to lose track of PM windows) ... or a PM on here, of course :) Tutoring Perhaps you don't really have any code to review, but just want to learn Node.js or a specific technology. That's also possible! Do note the following things, though: Tutoring is on a hourly basis only. Fixed-price is not a possibility, because I can't reliably predict how long it will take for you to learn something. You must be motivated to learn. You can of course split up the hours any way you like, just make sure to schedule a 'session' at least 2-3 days in advance if you want to be sure of my availability. Doing your own self-directed learning inbetween sessions is perfectly okay. I'd even encourage it. I can also teach and answer miscellaneous questions about any other technologies I'm familiar with, that aren't directly Node.js-related.
  4. Cross-posted from my blog, where the formatting is a lot nicer :) You can reuse, redistribute, remix etc. under the WTFPL/CC0, as usual. Though you should probably get it from my blog, rather than here - it's rather hard to get the formatting right in IPB's editor, unfortunately. Feedback is welcome! ---- This article is meant to be an introduction to functional programming in Javascript - specifically, it will explain the `map`, `filter` and `reduce` methods. While these are natively available in any recent browser and in Node.js, most articles on them are far too technical to understand, while the concept of these functions is actually really simple, and will benefit any developer - even those working on simple scripts. Note that I'll be pretty verbose in this article, to make the concept understandable to developers of any skill level. If you're already familiar with some of the concepts described, you can safely skip over those bits. Similarly, if you're a more advanced developer, and examples alone are enough for you, just skip over the text entirely. I won't address other aspects of functional programming here - these three functions fit well into most workflows on their own. I might explain other concepts in a later post. So let's start with `map`, arguably the most common one in a typical project. So, what is this `map` business, then? Think of `map` as a "for each" loop, that is specifically for transforming values - one input value corresponds to one 'transformed' output value. You may have found yourself writing code that looks something like this: var numbers = [1, 2, 3, 4]; var newNumbers = []; for(var i = 0; i < numbers.length; i++) { newNumbers[i] = numbers[i] * 2; } console.log("The doubled numbers are", newNumbers); // [2, 4, 6, 8] While this code works, it's not very nice. It takes a lot of work to do a pretty simple task - double all the numbers in an array. What if we could simply write our intention of doubling every number in an array? var numbers = [1, 2, 3, 4]; var newNumbers = numbers.map(function(number){ return number * 2; }); console.log("The doubled numbers are", newNumbers); // [2, 4, 6, 8] Suddenly, we don't need a loop anymore, and we don't have to manually add numbers to an array either! We can simply define our intention, and let `map` do the work. This can also be chained easily: var numbers = [1, 2, 3, 4]; var newNumbers = numbers.map(function(number){ return number * 2; }).map(function(number){ return number + 1; }); console.log("The doubled and incremented numbers are", newNumbers); // [3, 5, 7, 9] Every number is now doubled, and has 1 added to it. We don't have to manually manage any arrays - we simply specify functions that do some kind of transformation on a single value. There are a few 'rules' for `map` functions, though. While these are not always strictly enforced, you should keep to them regardless - they make it a lot easier to understand what your code is doing. If you think these rules will get in your way, just keep reading - your questions will be answered. The amount of input elements is equal to the amount of output elements You can't give `map` 4 values, and only receive 3 back. If the 'source array' has an X amount of elements, then the resulting aray will also have X elements. Every output element corresponds to the input element in the same position - they're never shuffled around. Your callbacks shouldn't 'mutate' values What this means, is really just that you shouldn't modify objects or arrays directly from within your callbacks - if the input value is an object or an array, clone it instead, and modify the copy. This way, there's a guarantee that your callback doesn't cause 'side effects' - that is, no matter what happens in your callback, it will only affect the specific value you're working with. This makes it much easier to write reliable code. You can clone an array in Javascript by doing `array.slice(0)`. Note that this is a 'shallow clone' - if the values in the array are themselves arrays or objects, they will still be the same values in both arrays. Shallow-cloning an object is a little more complex. If you're using a CommonJS environment (Node.js, Webpack, Browserify, ...), you can simply use the `xtend` module. Otherwise, using a function like this should suffice: function cloneObject(obj) { var newObj = {}; for (var key in obj) { newObj[key] = obj[key]; } return newObj; } var clonedObject = cloneObject(originalObject); There is an exception to this rule, but we'll get to that later - just assume that this rule always applies, unless told otherwise. Don't cause side-effects! You should never do anything in a `map` call that modifies 'state' elsewhere. For example, while making a HTTP GET request is fine (although not really possible with plain `Array.map`), changing another array outside of the callback is not. Your callback can only modify the new value you're returning from that callback. But... isn't this slow? All those callbacks and the cloning... Don't worry about it. Such operations are actually rather fast in Javascript, especially in V8-based engines like Node.js, and it's extremely unlikely that it'll ever cause performance issues for you. Always write code for readability first, and for performance second - it's much easier to optimize readable code, than it is to make optimized code readable. But what if I only want to transform some of the values? Perhaps your source array has some values that you want to transform, and some values that you just want to throw away entirely. That's not possible with `map` alone, as the number of input values and the number of output values for a `map` call is always equal. Say you want to double the odd numbers, but throw away the even numbers. Your code may look something like this: var numbers = [1, 2, 3, 4]; var newNumbers = []; for(var i = 0; i < numbers.length; i++) { if(i % 2 != 0) { newNumbers[i] = numbers[i] * 2; } } console.log("The doubled numbers are", newNumbers); // [2, 6] This is what it'd look like using `map` and `filter`: var numbers = [1, 2, 3, 4]; var newNumbers = numbers.filter(function(number){ return (number % 2 != 0); }).map(function(number){ return number * 2; }); console.log("The doubled numbers are", newNumbers); // [2, 6] The `filter` callback is subject to the same "don't mutate" and "don't cause side-effects" rules as `map`, but the mechanics are different. The return value from the `filter` callback should be a boolean, indicating whether to include the original value in the result (`true`) or whether to leave it out (`false`). You should not return the value itself, just a boolean - you can't modify the value from within the callback. The return value just decides whether the value will be included in the result, nothing else. Chaining As you might have noticed, you can chain `map` and `filter` calls indefinitely. Each of them just returns an array, and every array has these methods by default, so you can build a jQuery-like chain. There is no limit to how many of these calls you can chain, and it's usually pretty simple to build complex array transformations from just these functions alone. An array goes in, an array comes out, and the callback operates on each value individually. So... what if I just want to combine the values in an array? 'Combining' the values can mean a lot of different things. For example, you might want to sum all the numbers, doubled: var numbers = [1, 2, 3, 4]; var totalNumber = 0; for(var i = 0; i < numbers.length; i++) { totalNumber += numbers[i] * 2; } console.log("The total number is", totalNumber); // 20 But what if we want to do that in a `map`/`filter` chain? Easy enough, with `reduce`: var numbers = [1, 2, 3, 4]; var totalNumber = numbers.map(function(number){ return number * 2; }).reduce(function(total, number){ return total + number; }, 0); console.log("The total number is", totalNumber); // 20 It works like this: The second argument to the function call is considered to be the 'starting value' for the total - this is what you start out with. For each item in the array, it calls the callback, with the total value up to that point, and the item itself. For the first item, the 'total value' is the starting value. You return a new 'total value'. In this case, it's the sum of all previous numbers plus the current number. This return value is used as the 'total value' for the next item. After running out of items, the 'cumulative' total value is returned. Again, the "don't mutate" and "don't cause side-effects" rules apply. Otherwise, it doesn't matter what kind of value you're working with - you could be summing a number, concatenating a string, putting together an object, and so on. Just keep in mind that `reduce` always returns just the 'total value' - unless you've specifically made it an array, it won't be an array like for `map` and `filter`. That means that unless you're explicitly returning an array from it, you can't chain off it any further. But then again, it wouldn't really make sense to run `map` on a number! But what if I want to add items? Like `filter`, but the opposite. If you use Node.js, you may be familiar with transform streams - these are kind of like a `map` callback, but besides letting you 'push' (return) 0 or 1 values, they also let you push multiple values. This can be useful if you are, for example, 'flattening' an array of arrays down to a single array with all the values. While this can't be done with `map` - after all, one input element means one output element - it can be done with `reduce`, despite what the name implies. It's a slightly unusual trick, but you'll occasionally find yourself needing it. Let's say you want to add the even numbers to the resulting array twice, but the odd numbers only once. This is what it could look like: var numbers = [1, 2, 3, 4]; var newNumbers = []; for(var i = 0; i < numbers.length; i++) { var number = numbers[i]; newNumbers.push(number); if(i % 2 == 0) { /* Add it a second time. */ newNumbers.push(number); } } console.log("The final numbers are", newNumbers); // [1, 2, 2, 3, 4, 4] This is how you'd do it with `reduce`: var numbers = [1, 2, 3, 4]; var newNumbers = numbers.reduce(function(newArray, number){ newArray.push(number); if(i % 2 == 0) { /* Add it a second time. */ newArray.push(number); } return newArray; /* This is important! */ }, []); console.log("The final numbers are", newNumbers); // [1, 2, 2, 3, 4, 4] Note how we start out with `[]` as initial value, and just add the value to it one or more times. While this does violate the "no mutation" rule, it's okay in this particular situation - the array object is created explicitly for this `reduce` call, so it can't cause side-effects anywhere else in the code. When you use this trick, don't forget to return the array! It's easy to forget this, and you'll end up with an unexpected output. The `reduce` callback always expects the new total value to be returned, even if that value is an array, and even if it's the same one as before! The same trick also works with objects - however, in that case you'd specify `{}` as starting value, and you'd use property assignment rather than `.push`. Bonus: forEach Perhaps you really do want a 'for each' loop - you're not transforming and returning any values, you just want to cause some kind of side-effect (eg. creating a DOM element). It would be nice if you could chain it at the end of a `map`/`reduce`/`filter` 'pipeline', and indeed you can! This is what your `for` loop might normally look like: var numbers = [1, 2, 3, 4]; for(var i = 0; i < numbers.length; i++) { doSomethingWith(numbers[i]); } And this is what it would look like using `forEach`: var numbers = [1, 2, 3, 4]; numbers.forEach(function(number){ doSomethingWith(number); }); You can do the same for an object, using `Object.keys`: var numbers = {one: 1, two: 2, three: 3, four: 4}; Object.keys(numbers).forEach(function(key){ var value = numbers[key]; doSomethingWith(value); /* For example, key == "one" and value == 1 */ }); You should really always consider using `forEach` instead of a `for` loop . Because `forEach` uses callbacks, it prevents scope problems with asynchronous operations in a loop - that is, you don't have to worry that the value of the `key` variable changes inbetween the start and the completion of your operations. Indexes At some point, you may want to get the index of the current item in the source array - however, I've only demonstrated the use of the value so far. Getting the index of the current element is trivial: it's the second argument for `map`, `filter` and `forEach`, and the third argument for `reduce`. In other words, it comes after the arguments I've shown in the examples so far. If you need a reference to the original array for some reason, that is the argument after that - however, needing this usually means that you're doing something wrong. You should never directly modify the source array from any of these functions, for example. Further reference MDN has further documentation on `map`, `filter`, `reduce`, and `forEach`. Other libraries Some utility libraries like `lodash` and `underscore` offer similar methods, but you almost certainly don't need them. All modern Javascript runtimes and browsers have these functions available natively on array objects. jQuery offers similar methods, but keep in mind that the jQuery equivalents switch around the value and the index - that is, the order of arguments for the callback is `(index, value)`. A more reliable way is to use `this` within your callback where possible - it is always set to the value in jQuery.
  5. I have just updated my tutorial on how to install Ghost blog 0.4.2 on Ubuntu 14.04 (Trusty) or 12.04 (Precise), with Nginx as a reverse proxy and the ModSecurity web application firewall. The following extra topics are also covered (via links to original posts where appropriate): Example nginx.conf with optimizations such as gzip and static file serving Set up HTTPS (SSL) for your blog with a free StartCom certificate Create a customized robots.txt and generate your blog's sitemap via script Add Disqus comments, load them on demand as well as show counts in titles Enable Google Analytics on your site and also track outbound links How to set up DNS records for your blog if you use DigitalOcean Upgrade instructions from Ghost version 0.3.3 (if you followed my older guide) Click here to view my tutorial The instructions had been fully tested on both 32-bit and 64-bit, Ubuntu 14.04 and 12.04 LTS servers. However, there is NO guarantee and use at your own risk. Enjoy!
  6. Anyone else tried out Ghost open sourced node.js blogging platform https://ghost.org/ ? Just started playing with it and like it alot http://ghost.centminmod.com :)