Author Archives: SnipBot

(JavaScript) Augment Storage Prototype with getObject, setObject

Provides getter/setter functionality for objects in local storage. Utilizes JSON.stringify and JSON.parse.

Posted in JavaScript | Tagged , , , , , , , | Leave a comment

(C#) C# LINQ & Extension method continued

Also extended C# LINQ and Extension method (simple) to include the last (MAX) Date Created property, added a new Folder class (model) with properties and included them in a List. Also, amended the LINQ statement to get the MAX(Date Created) .

Posted in C# | Tagged , , , , , | Leave a comment

(Java) Operational System Validator

Check which operating system the program is running. The program explains itself.

Posted in Java | Tagged , , , , , | Leave a comment

(PHP) PHP Miles to Latitude and Miles to Longitude Converter

There are tons of functions out there to calculate the distance between two points, but what if you know one point and want to calculate the latitude (“vertical”) or longitude (“horizontal”) equivalent of a fixed distance, in miles? An example application would be in generating a minimum & maximum latitude and longitude bounding box around [...]

Posted in PHP | Tagged , , , , | Leave a comment

(Java) Java inheritance example

This example demonstrates advanced object-oriented concepts including inheritance, getters/setters, method overloading and reflection.

Posted in Java | Tagged , , , , , , | Leave a comment

(Java) Java data structures example

This example demonstrates intermediate object-oriented programming concepts including Data Structures, Linked Lists and how method overriding works. In addition, it demonstrates how to document code properly, with ample comments and proper Javadocs which can generate corresponding code API docs.

Posted in Java | Tagged , , , , , | Leave a comment

(JavaScript) JavaScript Factory Pattern

The Factory Pattern suggests defining an interface for creating an object where you allow the subclasses to decide which class to instantiate. This pattern handles the problem by defining a completely separate method for the creation of objects and which sub-classes are able to override so they can specify the ‘type’ of factory product that [...]

Posted in JavaScript | Tagged , , , , , | Leave a comment

(JavaScript) JavaScript Basic Decorator Pattern

In this section we’re going to explore the decorator – a structural design pattern that promotes code reuse and is a flexible alternative to subclassing. This pattern is also useful for modifying existing systems where you may wish to add additional features to objects without the need to change the underlying code that uses them. [...]

Posted in JavaScript | Tagged , , , , , , | Leave a comment

(JavaScript) JavaScript Mediator Pattern

In software engineering, a mediator is a behavioral design pattern that allows us to expose a unified interface through which the different parts of a system may communicate. If it appears a system may have too many direct relationships between modules (colleagues), it may be time to have a central point of control that modules [...]

Posted in JavaScript | Tagged , , , , , , | Leave a comment

(JavaScript) JavaScript Command Pattern

The Command pattern aims to encapsulate method invocation, requests or operations into a single object and gives you the ability to both parameterize and pass method calls around that can be executed at your discretion. In addition, it enables you to decouple objects invoking the action from the objects which implement them, giving you a [...]

Posted in JavaScript | Tagged , , , , , | Leave a comment