background preloader

Keypress: A Javascript library for capturing input

Keypress: A Javascript library for capturing input
The first thing to do is include the JavaScript file in your page. Once you've got that loaded in, you'll want to start by instantiating a listener: var listener = new window.keypress.Listener(); Once you've done that you can register combos with that listener you've created. The simplest way to do that is using the simple_combo API. It takes a space dilineated string or an array of strings of key names that describe your combo. listener.simple_combo("shift s", function() { console.log("You pressed shift and s"); }); listener.counting_combo("tab space", function(e, count) { console.log("You've pressed this " + count + " times."); }); listener.sequence_combo("up up down down left right left right b a enter", function() { lives = 30; }, true); If you only want to use Keypress for some very simple keyboard shortcuts, that's all you need to know! listener.unregister_combo("shift s"); listener.unregister_many(my_registered_combos); listener.reset();

Master Spy - On Cutscenes news A look at the process we use to implement retro cinematic cutscenes into Master Spy. Master Spy employs Turbo Theater Graphic Technology to blend a cinematic story of intrigue, betrayal, and conspiracy with the heart racing action of the stealth-platforming gameplay. Why Cinematic Cutscenes? As huge fans of anime, manga, and graphic novels, there’s something enticing about the style that mimics a comic brought to life. Inspired by the likes of Ninja Gaiden and Zero Wing (yes, the “All your base” game), we set out to merge storytelling medium and game play experience in this retro-cinematic fashion. The Process We start from the basis of Master Spy’s story script. I then take the parts John has made and make sure they’re ready for implementation. From there, I lay out the cutscene in code as a “list” (which is in actuality a Javascript Object Literal since Master Spy is written in html5/JS) of what should show up on screen and what fancy things should happen with them. In Game

Codeblock.js by Why? Humans learn better when they can play with what they're working with, when they can poke at it and understand what happens to B when you change A. The browser provides a wonderful place where examples can be interactive, and yet most documentation for javascript APIs doesn't make use of these capabilities. Codeblock.js turns example code into editable, runnable code blocks that visitors can poke at and play with to better understand your API. For example, try playing with the parameters in the example below: Output from the example appears here run Using Codeblock.js Codeblock.js is a jQuery plugin that uses the Ace code editor, and therefore requires including both jQuery and Ace. Once the scripts are imported, you can use the $.codeblock call to transform any piece of text into an editable, runnable code sample. The codeblock.js api is very similar to the api of jQuery UI widgets, so if you are familiar with those the syntax should feel natural. Instantiation Methods Events

Tourist Places in Karnataka Introducing smartcrop.js / Image cropping is a common task in many web applications. Usually just cutting out the center of the image works out ok. It's often a compromise and sometimes it fails miserably. Evelyn by AehoHikaruki Can we do better than that? Smartcrop.js is the result of my experiments with content aware image cropping. This library is still in it's infancy but the early results look promising. Source Code: Examples: test suite with over 100 images and test bed to test your own images. Command line interface: 10 Online Coding Contests For Programmers! These sites have their sets of practice problems, practice sessions and competition rounds. Major of the competitions are sponsored by some big shot companies and they also keep a keen eye on the contests, so who knows you might just one lucky person to be selected for a big internship or for a big job. Some of these competitions are held on weekly, monthly or yearly basis where as others have specific dates for competitions. Topcoder TopCoder is indeed the world’s largest competitive software development community where developers from all over the world take part in. The community offers timed programming competitions in various categories like algorithms, testing, design, assembly, SRM, marathon and many others. CodeChef CodeChef is a non-commercial organization operated by DirectI, an Indian software company based in Mumbai, India. Sphere online judge (SPOJ) Sphere online judge is one of the earliest competitions, with support for more than 40 programming languages and compilers.

PSR-2 — Coding Style Guide This guide extends and expands on PSR-1, the basic coding standard. The intent of this guide is to reduce cognitive friction when scanning code from different authors. It does so by enumerating a shared set of rules and expectations about how to format PHP code. The style rules herein are derived from commonalities among the various member projects. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119. Overview Code MUST follow a “coding style guide” PSR [PSR-1]. 1.1. This example encompasses some of the rules below as a quick overview: General 2.1. Code MUST follow all rules outlined in PSR-1. 2.2. All PHP files MUST use the Unix LF (linefeed) line ending. All PHP files MUST end with a single blank line. The closing ? 2.3. There MUST NOT be a hard limit on line length. There MUST NOT be trailing whitespace at the end of non-blank lines. 2.4. 2.5. <? 4.1.

Light Table - a new IDE concept You can now try Light Table out via the Light Table Playground! Light Table's kickstarter has wrapped up! Despite the dramatic shift toward simplification in software interfaces, the world of development tools continues to shrink our workspace with feature after feature in every release. Even with all of these things at our disposal, we're stuck in a world of files and forced organization - why are we still looking all over the place for the things we need when we're coding? Why is everything just static text? Bret Victor hinted at the idea that we can do much better than we are now - we can provide instant feedback, we can show you how your changes affect a system. We can do better, and to that end, let me introduce you to Light Table is based on a very simple idea: we need a real work surface to code on, not just an editor and a project explorer. Light table is based on a few guiding principles: Let's take a look at how these things manifest themselves in Light Table. Docs everywhere

tweenjs/tween.js JQuery Cycle Plugin - Intermediate Demos (Part 2) Rather than have transitions occur on a timer you can choose to have transitions occur in response to a click event. The prev and next options are used to identify the elements which should be the triggers for prev/next transitions. When used in conjuction with timeout = 0 the effect is a manual slideshow. The values for prev and next can be a DOM element or any valid jQuery selection string. You can combine an automatic slideshow (timeout-based) with manual controls by using a non-zero timeout value. The pager option is used for creating full navigation controls. In addition, the navigation element for the active slide is given the class activeSlide so that it can be styled uniquely. The pager in the example above is styled like this: If you need to stop a running slideshow you can pass the string 'stop' to the cycle method. $('#slideshow').cycle('stop'); If you need to pause/resume a running slideshow you can pass the string 'pause' or 'resume' to the cycle method.

AirConsole is a local multiplayer gaming platform where your smartphone is the controller and your monitor is the screen. It's very game developer friendly, and there is a game development competition for it with $5,000 in prize money. : gamedev 7 Steps to a Cheaper Hotel Room Photo There are so many ways to wrangle deals on hotel rooms these days that no matter how great a bargain you find, it’s not uncommon to worry you missed a better one. The most obvious method to suss out savings is to explore the pricing and inventory differences among standard booking sites like and Orbitz. To tame this wild world into submission, I designed a five-step process (with a two-step bonus round) and tested it out by planning an imaginary four-night trip to Paris over Labor Day Weekend. This guide, of course, is for budget travelers. I’m also going to ignore lodging strategies at the other end of the price spectrum — staying with a friend or a member of hospitality exchange sites like Couchsurfing, braving hostel dorm rooms — or alternatives, such as vacation rental companies like Airbnb and Homeaway. But if you’re looking for a decent, well-located room — maybe even one with a little style — this system should come close to finding you the best deal possible.