background preloader

Learning Javascript with Object Graphs

Learning Javascript with Object Graphs
HEADS UP! This article was written for an older version of node. More up-to-date information may be available elsewhere. One of the secrets to being a super effective JavaScript developer is to truly understand the semantics of the language. References Everywhere A variable in JavaScript is simply a label that references a value in memory somewhere. Local Variables In the following example, we will create four local variables in the top-level scope and point them to some primitive values: variables.js // Let's create some local variables in the top scopevar name = "Tim Caswell";var age = 28;var isProgrammer = true;var likesJavaScript = true;// Test to see if the two variables reference the same valueisProgrammer === likesJavaScript; Notice that the two boolean variables point to the same value in memory. In the code snippet we checked to see if the two references pointed to the same value using === and the result was true. The outer box represents the outermost closure scope. objects.js

CSS Sprites: Image Slicing’s Kiss of Death Back when video games were still fun (we’re talking about the 8-bit glory days here), graphics were a much simpler matter by necessity. Bitmapped 2-dimensional character data and background scenery was individually drawn, much like today’s resurgent pixel art. Hundreds and later thousands of small graphics called sprites were the building blocks for all things visual in a game. Article Continues Below As game complexity increased, techniques developed to manage the multitude of sprites while keeping game play flowing. And what does this have to do with the web? Everything old is new again, and though the rise of 3D games has made sprite maps obsolete, the concurrent rise of mobile devices with 2D gaming capabilities have brought them back into vogue. Specifically, we’re going to replace old-school image slicing and dicing (and the necessary JavaScript) with a CSS solution. How do CSS Sprites work? Let’s start with the master image itself. On to the HTML. Applying the CSS#applyingcss

Online Python Tutor - Learn programming by visualizing code execution Using the memcached telnet interface This is a short summary of everything important that helps to inspect a running memcached instance. You need to know that memcached requires you to connect to it via telnet. The following post describes the usage of this interface. How To Connect Use "ps -ef" to find out which IP and port was passed when memcached was started and use the same with telnet to connect to memcache. Example: telnet 10.0.0.2 11211 Supported Commands The supported commands (the official ones and some unofficial) are documented in the doc/protocol.txt document. Sadly the syntax description isn't really clear and a simple help command listing the existing commands would be much better. Traffic Statistics You can query the current traffic statistics using the command stats You will get a listing which serves the number of connections, bytes in/out and much more. Example Output: Memory Statistics You can query the current memory statistics using stats slabs Which Keys Are Used? stats items Never Set a Timeout > 30 Days!

The Ultimate Guide to WordPress Multisite We’ve been developing plugins for it since the old days when it was WordPress MU, and we use it to power Edublogs, a huge network of blogs for educators and students. Personally I also use Multisite a lot. I use it to host client websites, to create sites demonstrating techniques I outline in my books and tutorials, and to keep everything in one place. In this guide to Multisite I’m going to show you everything you need to know to get started with Multisite and create your own network of blogs or sites. I’ll cover: What is Multisite and how is it different from regular WordPress? But first, let’s get some terminology straight. Network refers to the entire Multisite network, i.e. your WordPress installationSite refers to one of the blogs or sites created as part of the network. So when I refer to your site, I don’t mean your whole network of sites, but just one of the sites on it. So now we’ve got that sorted, let’s take a look at Multisite! What is Multisite? Uses for Multisite Creating a Site

Get To Know Linux: The /etc/init.d Directory If you use Linux you most likely have heard of the init.d directory. But what exactly does this directory do? It ultimately does one thing but it does that one thing for your entire system, so init.d is very important. The init.d directory contains a number of start/stop scripts for various services on your system. Everything from acpid to x11-common is controlled from this directory. Of course it's not exactly that simple. If you look at the /etc directory you will find directories that are in the form rc#.d (Where # is a number reflects a specific initialization level - from 0 to 6). Now if you are using a distribution like Fedora you might find this directory in /etc/rc.d/init.d. In order to control any of the scripts in init.d manually you have to have root (or sudo) access. /etc/init.d/command OPTION Where command is the actual command to run and OPTION can be one of the following: startstopreloadrestartforce-reload Most often you will use either start, stop, or restart.

Collecting all the cheat sheets Logo design tutorial When a company starts, the image is often one of the things that can impulse the acknowledgment of the business existence around their area of influence. A company’s image primary consists of the logo, the stationery, presentation cards, mail templates and even digital signatures. Once the company starts to gain reconnaissance, other elements are developed, such as the website, social networks and others. On this tutorial we will be focusing our attention on one of the main elements of any company’s image, the logo. 1. It’s not the same to plan a logo idea for a fast food company than a heavy machinery factory, you need to determine your company’s identity in order to create an image that plays along with the whole idea of your business. Color are also strong communicators, a blue logo for example will evocate water, relax, sky or serenity, while a black logo for example will communicate seriousness, some relation with machinery works, petroleum and elegance. 2. 3. 4.

DevDocs — Git / git add Name git-add - Add file contents to the index Synopsis git add [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p] [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]] [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--chmod=(+|-)x] [--] [<pathspec>…​] Description This command updates the index using the current content found in the working tree, to prepare the content staged for the next commit. The "index" holds a snapshot of the content of the working tree, and it is this snapshot that is taken as the contents of the next commit. This command can be performed multiple times before a commit. The git status command can be used to obtain a summary of which files have changes that are staged for the next commit. The git add command will not add ignored files by default. Please see git-commit[1] for alternative ways to add content to a commit. Options <pathspec>…​ Files to add content from. -n --dry-run -v --verbose -f --force

Lessons From A Review Of JavaScript Code - Smashing Coding Advertisement Before we start, I’d like to pose a question: when was the last time you asked someone to review your code? Reviewing code is possibly the single best technique to improve the overall quality of your solutions, and if you’re not actively taking advantage of it, then you’re missing out on identifying bugs and hearing suggestions that could make your code better. None of us write 100% bug-free code all of the time, so don’t feel there’s a stigma attached to seeking help. Some of the most experienced developers in our industry, from framework authors to browser developers, regularly request reviews of their code from others; asking whether something could be tweaked should in no way be considered embarrassing. Reviews are a technique like any other and should be used where possible. Today we’ll look at where to get your code reviewed, how to structure your requests, and what reviewers look for. Introduction Where Can I Get My Code Reviewed? What Should Code Reviews Provide?

CheckIO - online game for Python and JavaScript coders Massive Compilation of Designer Tools Web designers have a wealth of tools available to them, for doing everything from organizing their thoughts about a particular design to debugging the final design. But with so many tools out there, how do you ever determine which ones are really useful and which ones are just going to waste your time? We’ve compiled a massive list of some of the best and most useful tools out there for web designers. Purposely left off the list are common tools most designers are likely already using (like Dreamweaver or Panic’s Coda, Photoshop or GIMP, and similar common software programs that pretty much every designer already has in their toolkit). These are tools that will save you time, make you a more effective designer, simplify or speed up your design process, or otherwise make your life easier. Compilation of Offline Tools Most roundups of useful web design tools only focus on online tools. But there are a couple of very useful tools you can utilize to open up your options when it comes to design.

Un e-mail en HTML responsive multi-clients - Alsacreations L'e-mail (ou newsletter) reste encore aujourd’hui un moyen efficace de transmettre des informations à ses utilisateurs ou clients. En mode texte, aucun problème, c'est un standard interprété sans difficulté. En mode HTML c'est un art ô combien délicat en partie dû au nombre de clients lecteurs d'e-mail sur le marché qui ont des comportements bien différents (encore plus désormais que les navigateurs classiques). Cette disparité de l'interprétation des e-mails au format HTML provient de plusieurs facteurs : Les clients e-mails lourds (Outlook, Thunderbird, Lotus Notes...) ont un fonctionnement radicalement différents des webmails (Gmail, Yahoo Mail, Hotmail, Outlook.com...). Ces mêmes webmails imposent des règles très strictes sur le code HTML et CSS contenu dans les e-mails car les messages sont eux-mêmes affichés dans une structure de page web qui a ses propres styles. Voici quelques astuces et bonnes pratiques pour obtenir des e-mails au rendu proche sur la majorité des programmes.

Dates in PHP and MySQL I see a lot of people on forums and on my training courses asking about the best way (or any way) to manage dates stored in a MySQL database and used in PHP. Three options follow, but first the problem. PHP uses unix timestamps for all its date functionality. MySQL has three date types for use in columns. So the problem is how to work with these two very different date formats – the PHP timestamp integer and the MySQL DATETIME string. One common solution is to store the dates in DATETIME fields and use PHPs date() and strtotime() functions to convert between PHP timestamps and MySQL DATETIMEs. So finally we come to the choice of which to use. However, some queries will be more complicated because your date is not in a date field (e.g. select all users who’s birthday is today) and you may lose out in the long run.

Another variation on the "time ago" PHP function, use MySQL's datetime field type - PHP Programming - Web Development I was recently looking at writing a function to format the comment post times in the ever trendy "time ago" style... such as; Matt posted 6 days 3 hours ago Naturally I first scoured the web for an appropriate existing PHP function, and I came across this one; (dead link). Quite useful and fairly complete, but there were a few things I wanted to change, so I've hacked it up and remixed it here to accept a MySQL datetime field type result and then format the output like mentioned above. If you're using sNews and want to use this for your comments, simply follow these 2 quick steps. Step 1) As always, BACK-UP your snews.php file and work off a copy. Step 2) Now find the function comment, and comment out the existing date format and add the highlighted code like below; while ($r = mysql_fetch_array($result)) { //$date = date($date_format, strtotime($r['time'])); $date = time_ago($r['time']); $commentNum = $offset + $ordinal;

Related: