Writing Sane JavaScript Functions

Writing Sane JavaScript Functions
Meet Reggie Reggie writes JavaScript all day. He sits in his cubical, has his VSCode editor opened up all the time and likes to write big, long, ugly functions with his VSCode editor. Let’s take a look at one of Reggie’s famed functions. const params = { tool: true, multi: 'some string', } async function updateFlurb (data) { const res = await request.post('http://www.example.com', data) return res.body } async function doItAll (data, opts, useDefaults) { const newDate = data.

Essential Skills Every Kickass Developer Should Possess

That’s right. You want to take your skills from beginner, bypassing intermediate, and land on advanced. You may have just started coding a year or two ago, but you’re determined to be the best developer on your team. It’s going to take hard work, no getting around that, but we like hard work. You’re going to feel dumb at times, no problem, you’ve fully embraced that feeling dumb means you’re learning and that’s the name of the game.

Leveraging Reflux (flux) with React like a pro

#Leveraging Reflux (flux) with React like a pro My latest project for a well known clothing retailer has involved writing a React based web app. It has a staggering amount of data that needs to update different parts of the app. To accomplish this, we are using React (of course) and Reflux. So you’ve heard React is the new hotness that all the cool developers are adding to their resume.

NG-Form To The Rescue

A project I’m currently work on (for a very popular apparel company) is employing AngularJS for their site. I’ve created some directives to handle collecting addresses for billing and shipping. Reusable directives with their own isolate scope. To add more awesome to the mix, I’m using ngMessage to show various error messages with the form. This all works great, but the problem was showing the error messages correctly when there are two forms on the page.

Deploy Web App with Grunt Compiled Assets to Heroku

The conundrum is how do you deploy a web app to Heroku that needs to be compiled without including compiled files in your source? Maybe you have some SASS that needs to be compiled into CSS. Maybe you want to minify your JavaScript, or cache bust with some appended hash tags. In any case you want to run some tasks on your code to produce your distribution or build.

Essential Node.js Development Concepts, part1

Every project tends toward insanity, it’s your job to Keep it Sane, Stupid. This is the first in a multipart series on Node.js concepts that I consider to be essential to writing sane web apps. You already know how to Node and now it’s time to get serious about building apps. The problem you’ll run into every growing project is complexity. These concepts will help you keep things sane.

Using GulpJS, Browserify, and Watch for AngularJS Development

That’s quite a mouth full, but in a nutshell we just want to develop AngularJS and have [Gulp]() watch our files and recompile them when they change. var gulp = require('gulp'), _ = require('lodash'), fs = require('fs'), nodemon = require('gulp-nodemon'), ini = require('ini'), config = ini.parse(fs.readFileSync('./.env', 'utf-8')), concat = require('gulp-concat'), uglify = require('gulp-uglify'), htmlMin = require('gulp-minify-html'), browserify = require('gulp-browserify'), clean = require('gulp-clean'), watch = require('gulp-watch'), ngHtml2Js = require('gulp-ng-html2js'); gulp.task('default', function(){ // Update process.

JavaScript Casting Tricks

Here I want to go through some casting tricks that can be used for better data manipulation. Booleans Build in Boolean() The easiest way is to use the builtin Boolean() method. Boolean('true'); // true Boolean(1); // true Boolean('false'); // true !!!!GOTCHA!!!!! Boolean(0); // false // Careful Boolean([]); // true Double Negative This will cast anything as either true or false, there are of course a few quirks that may not be obvious.

Some really good parts about JavaScript

Most people who only know some jQuery and little JavaScript in the browser scratch their head and wonder how this lame language can be run on a server, or better yet, how most of your front end can be run on this messed up language. JavaScript hits the nail on head Functions as first class citizens. So what does this mean? Functions can be embedded inside other functions var outer = function embedded() { var inside = function() { var deep = 'variable inside a function, inside a function'; }; } Notice how outer has a function inside it called inside, and inside the inside function is a variable deep?

Getting Titanium CurrentWindow To Work Under CommonJS

Appcelerator is a moving target, developed and changing pretty fast. The old way was using the **url: ** property of a window to open up a new screen with a javascript screen. Old and Busted var window = Ti.UI.createWindow({ url: 'screen.js' }); Another Old Way Then came the Tweetanium structure, while a solid way to set up, it’s not the route Appcelerator is recommending anymore. See my post for more information on the Tweetanium Setup