Posts Tagged → javascript
Project Я: A Ruby/HTML5 Visual Novel
As promised, here’s the game I made for the Global Game Jam.
Seeing that I couldn’t think of a quick web-based game matching the theme “Ouroboros”, I just went ahead with a joke I made sometime after the Ruby Rumble:
Sa susunod na Rumble, gagawa ako ng hentai game sa Ruby!
(For the next Rumble, I’ll make a hentai game in Ruby!)
So yeah, that’s how I ended up with a Visual Novel. Unfortunately for the people expecting sexually explicit scenes (which was about a third of the people who saw the game), the “game” I made was more ATLUS/Capcom than Key/Type-Moon.
Anyway, it’s more of a tech demo than a game, with me trying to implement a Cloud-based multi-platform visual novel with psychological themes and non-standard tactical RPG gameplay. Or in non-buzzword speak, an HTML5 adventure game playable over the internet.
Please use fake email addresses so you could view the changes when you change the answers to the initial questions.
–
Some boring technical details:
- Back end is a basic Rails 3.2 + MySQL stack
- Used
vn-canvasas the HTML 5 visual novel engine - Stock VN backgrounds from mao space
I didn’t release the code because of how ridiculously horrible it is. I mean, using GET to update state, WTF?!?
This post by Bryan Bibat is from existence, refactored.
Web Developer Interview Questions
Earlier this week, I had to interview a bunch of applicants for a web developer role. The idea is to filter out those who aren’t really experienced as the job asks for people with at least 6 months of experience. Anyway, below is the test I gave them. I don’t feel like giving something like it again in the future (it’s pretty crappy IMHO) so I think it would be a good idea to share it instead of just throwing it away.Determine whether the statements below are true or false. Be prepared to explain your answer.Answers below the cut. Continue reading →
- A primary key can be composed of multiple columns.
- When you have two tables in a parent-child relationship (i.e. one table has a foreign key referring to the other table) deleting a parent record will delete all child records of that record.
- Escaping special characters is the best way to avoid SQL injection.
- You can undo
UPDATEandDELETEchanges to the database.- The
VARCHARdata type can be used to save space when used overCHAR.- When using an RDBMS, normalization must be done for all tables.
- Indexes speed up database actions.
- Foreign keys are usually indexed.
- Many-to-many relationships are implemented via junction/join tables.
- Some HTML elements have been deprecated in favor of CSS.
- The
<strong>element can be used interchangeably with the<b>element.- Under strict XHTML rules,
<br>is not a valid usage of the line break element.- The
hrefattribute of the anchor element only accepts relative and absolute links.- The
imagetag is a block element.- When a form is submitted, the submitted data is derived from only the
inputelements inside theform.- Multiple elements can have the same
idattribute.- Web servers serve content at port 443.
- A web server can identify if a client has visited the website before.
POSTis idempotent.- A browser redirect can be initiated by a response with an empty body.
- In JavaScript, the
varkeyword is optional when declaring variables so it can be omitted in all cases.- You must specify a function name when declaring JavaScript functions.
- Ajax will prevent you from performing other actions until the Ajax action is completed.
- You are limited to using XML in Ajax.
- You cannot change the values of a class variable.
- Constructors are instance methods.
- Polymorphism refers to the ability to define functions to have different behaviors depending on the passed arguments.
- High cohesion and loose coupling can improve coding speed.
- You can combine the features of two classes via inheritance.
- Encapsulation is primarily used for security reasons.
This post by Bryan Bibat is from existence, refactored.
Rails 3 upgrade part 4: Prototype helpers and Javascript
Rails 3 is embracing the unobtrusive Javascript (or UJS) mantra which is good because it is the right way; at the same time, it is bad because many applications will break when they upgrade to Rails 3. On the other hand, who’s expecting a smooth upgrade anyway
In my test application, I used jrails because I am more interested in jQuery than Prototype. But since jrails doesn’t work with Rails 3, I removed it.
When jrails was removed, I received this error:
undefined method `observe_field' for #<#<Class:0xb6867e58>:0xb6865b6c>
Install Prototype helper plugin
‘observe_field’ is a Prototype helper and Rails 3 removed the the link between its Javascript helpers and Prototype. The goal in Rails 3 is for developers to use their preferred Javascript library. Also note that remote_#{method} helpers have been removed from Rails and moved to Prototype Legacy Helper plugin . To install this plugin, just do:
rails plugin install git://github.com/rails/prototype_legacy_helper
Remove jQuery
Once the prototype_legacy_helper is installed, the missing method is gone but observe_field is not triggering. Removing jQuery fixes this problem.
Now what if you want to use jQuery instead of Prototype? It depends how dependent your application is to Prototype. I have not found a jQuery equivalent for Prototype helper plugin yet so that would be an issue like in my case. Based on this jQuery and Rails 3 tutorial, using the jQuery UJS driver looks very easy.
This post by Greg Moreno is from Greg Moreno.
jQuery to prevent form submission via ENTER
Note to self:
This post by cyx is from pipe :to => /dev/null.

Recent Comments