background preloader

JavaScript

Facebook Twitter

Sortable. No jQuery. Private Members in JavaScript. Douglas Crockford www.crockford.com JavaScript is the world's most misunderstood programming language. Some believe that it lacks the property of information hiding because objects cannot have private instance variables and methods. But this is a misunderstanding. JavaScript objects can have private members. Objects JavaScript is fundamentally about objects. If a value is a function, we can consider it a method. Objects can be produced by constructors, which are functions which initialize objects. Public The members of an object are all public members. In the constructor This technique is usually used to initialize public instance variables.

Function Container(param) { this.member = param; } So, if we construct a new object var myContainer = new Container('abc'); then myContainer.member contains 'abc'. In the prototype This technique is usually used to add public methods. Container.prototype.stamp = function (string) { return this.member + string; } So, we can invoke the method Private Privileged. Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Too… 8 Handy Tips to Consider When Logging in JSON. Logging in JSON transforms your logs from raw text lines to a database of fields you can search, filter, and analyze. This gives you way more power than you would get with only raw logs. Why Use JSON? JSON makes it easier to search and analyze your data. Say this is a portion of your log file: I want to figure out how many 29 year olds are from San Francisco.

This may look familiar to people who are used to dealing with raw unstructured logs: With the above approach, you’ll end up with log entries that include any text that has “29” in it, including the date for Fred who is only 21 years old. Log management tools like Loggly can automatically parse and analyze JSON data. Tips for Logging in JSON Here are some tips and choices to consider when implementing logging in JSON. Tip #1: Write New Apps With JSON if you’re writing a new application, write JSON logging into it in the beginning. Tip #2: Log Both Errors and Behavior Tip #3: Add Context to Your Logging Statements Getting Started with JSON.

Gabemart/hipku. Gabemart/hipku · GitHub. LokiJS: Fast In-memory Database. Procedural generation - map/world "decorator" algorithms/patterns. Procedural generation - Algorithm for procedureral 2D map with connected paths. Pojo Viz. Sindresorhus/awesome-nodejs · GitHub. p2.js. Game Mechanic Explorer. MegaTextures in WebGL « Various Oddities. Before diving into the code, I’d like to blather on a bit about what MegaTextures are, why they are so awesome, and how they work — at least, how _I_ think they work, which could be totally wrong – I’ll be prefixing everything with ‘my implementation’ and that way you hopefully won’t think this is the only way to do this -_- Disclaimer: this was written in the middle of the night, so excuse me if it’s kind of scatterbrained. It’s kind of a mind dump on megatextures and my implementation, not meant to be a primary reference. Hopefully there are some interesting details in here regardless of what environment you are implementing them in.

‘MegaTexture‘ is a term coined by John Carmack, used in the id Tech 5 engine. Sparse Virtual Textures by Sean Barrett – slides, demo, codeAdvanced Virtual Texture Topics (PDF) from Crytek – lots of good detailsgoogle around I could make a million diagrams, but I won’t, cause I’m lazy and you can look at their stuff ^_^ Pros/Cons ‘Why do this at all?’

Good: Erlang and JavaScript MD5 Digest match. Ragdoll Animator. Box2DJS - Physics Engine for JavaScript. Javascript parallel processing. Steep Parallax Shader | Chandler Prall. David's Blog | Simple C# Web Server. By david1. April 2012 17:28 During my lunchbreak the other day I wondered how hard it would be to write a simple webserver in C#. Surely with all the toys in the .net framework these days it should be pretty easy? So I decided to give it a go and see what happens. The aim was to write a simple class that recieves a delegate to a method which is responsible for the page content, everything else could be taken care of by the class I'm writing. That way the server can serve whatever page(s) you like, but you just need to write a simple method that returns a string with some html in it.

It took me about 30 minutes to get it working. All the work is done on background threads, which will be automatically cleaned up when the program quits. I'm even considering using this code to build a little DALIS aware test server, so that I can run DALIS programs without hosting anything in IIS... even better I could run a couple of them and bounce DALIS programs between them. Parallax Shader for WebGL / ThreeJS | Chandler Prall.