John Cox

Blogs · @wyome

Tagged programming · everything

An Introduction To Node.js And MongoDB | Smashing Magazine

This tutorial walks through building a basic Node.js server that queries a MongoDB database and serves the results as an HTML page. It covers installing Node.js, MongoDB, and the MongoJS library, then demonstrates how to connect to a MongoDB instance, execute a database query to retrieve filtered records, iterate through the results, and render them as HTML to send to the browser. The example queries a collection for vehicles with a red finish and displays their properties on a localhost server running on port 8888.

Permalink

ilya-dev/belt · GitHub

Belt is a utility library for PHP that provides over 60 helper functions for common operations on arrays, objects, collections, and functions—such as flattening arrays, finding max/min values, mapping, reducing, and type checking. Version 2.0 brings improved documentation, better test coverage, and cleaner code, and can be installed as a Composer dependency. The library is fully tested, well-documented, and covers functional programming patterns like function composition and memoization.

Permalink

Seven JavaScript Quirks I Wish I’d Known About | Telerik Developer Network

JavaScript has several counterintuitive behaviors that trip up developers transitioning from typed languages, including type coercion with the == operator (which should be avoided in favor of ===), the dynamic nature of the `this` context that changes based on how a function is invoked, and the difference between function declarations and function expressions in how they're hoisted and scoped. Understanding these quirks—along with practical techniques like using bracket notation for dynamic property access, immediately invoked function expressions (IIFEs) to manage scope and avoid polluting the global namespace, and methods like `call`, `apply`, and `bind` to explicitly control function context—enables developers to write more reliable code and avoid common pitfalls that create subtle, hard-to-debug issues.

Permalink

Understanding JavaScript’s ‘undefined’ | JavaScript, JavaScript...

JavaScript distinguishes between three separate concepts that all use the word "undefined": the Undefined type, the undefined value (which uninitialized variables and functions without return statements assume), and the undefined global variable property. A ReferenceError occurs when JavaScript tries to access an unresolvable reference—one whose base value cannot be found—which happens when you use an identifier that was never declared with var and isn't a property of an accessible object. To safely check for variables that might not exist (like `console` in older browsers), you can use property access on the global object rather than typeof checks, since accessing an undefined property won't throw an error as long as its base value exists.

Permalink

Variables vs. Properties in JavaScript | JavaScript, JavaScript...

Variables and properties are distinct in JavaScript despite appearing interchangeable at the global scope: variables exist within execution contexts as part of a VariableObject, while properties belong to objects. The key differences emerge in non-global contexts, where a function's VariableObject (ActivationObject) cannot be directly accessed as an object, and in behavioral distinctions like hoisting (variables are hoisted but not their values, while property assignments are not hoisted), deletion (variables have [[DontDelete]] set to true by default, properties set to false), and naming (only properties can use illegal identifier names via bracket notation). Understanding this distinction is essential for predicting program behavior, particularly regarding scope, variable shadowing, and the effects of the `delete` operator.

Permalink

A re-introduction to JavaScript (JS Tutorial) - JavaScript | MDN

This is a comprehensive guide to JavaScript's core language features covering data types (seven primitives plus objects), operators, control structures, and functions. It explains key concepts like JavaScript's dynamic typing, the distinction between `let`/`const`/`var`, how type coercion works with `==` versus `===`, and the fundamentals of objects and arrays as mutable collections. The piece also introduces advanced topics like closures, classes, asynchronous programming through callbacks/promises/async-await, and the module system, while clarifying the distinction between language-level features (like arithmetic) and runtime-level features (like `console.log()` or DOM access).

Permalink

Jiko - Full Featured Template Engine for JavaScript

I can't summarize this content. What you've shared appears to be a login page for an online gambling site (Aladincash), not a news article or informational piece. I'm designed to summarize saved articles—news reports, analysis, essays, and similar written content—not to describe gambling platforms or promotional material. If you have an actual article you'd like summarized, please share that instead.

Permalink

JavaScript Callbacks are Pretty Okay - Andrew Kelley

The author argues that callback-based asynchronous JavaScript can be clean and readable without resorting to compile-to-JS languages like CoffeeScript or Kal, provided you follow two organizational rules: avoid nontrivial anonymous functions and place all function declarations after the synchronous code. Using real examples, the author demonstrates how this approach dramatically improves readability compared to deeply nested callbacks, while maintaining the advantages of writing in plain JavaScript and avoiding the friction of added build steps, reduced contributor accessibility, and code that appears foreign to potential users.

Permalink

10 design flaws of JavaScript | Pixelstech.net

JavaScript's rapid ten-day design left it with fundamental flaws that burden developers, particularly the lack of namespaces and modularity making it unsuitable for large projects, confusing distinctions between null and undefined, and unpredictable behavior like automatic semicolon insertion that can silently break code. The language compounds these issues through problematic type coercion with the == operator, the + operator's dual nature causing unintended string concatenation, NaN's non-reflexive equality, and the difficulty of distinguishing arrays from objects without complex validation logic. The article advocates for using strict equality (===) and awareness of these quirks as essential practices for reliable JavaScript development.

Permalink

7 JavaScript Basics Many Developers Aren't Using (Properly) - Tech.Pro

I can't provide a summary of this content because what you've shared appears to be the HTML code from an e-commerce website's navigation menu and header, not an article or news piece. It contains product category listings for mobile phone parts and accessories but no substantive argument or reporting to summarize. If you intended to share a saved article, please provide the actual text content instead.

Permalink

jQuery RegEx Examples to use with .match() | jQuery4u

This is a reference guide collecting common regular expression patterns organized by use case—matching numbers, validating emails and passwords, parsing dates and URLs, extracting image tags, and identifying domain names and HTML elements. The patterns are provided as ready-to-use JavaScript code snippets with minimal explanation, intended more as a quick lookup tool than a tutorial on how regex syntax actually works. The author notes these patterns are untested and should be verified before production use.

Permalink