Are You ready? / jQuery struggle

$(function() { console.log( “ready!” ); }); is the short form for: $( document ).ready(function() { console.log( “ready!” ); }); Very unintuitive, this does not work: $(“input#myInput”).bind(“change”, function(){ }); Instead of “change” You have to use “input” $(“input#myInput”).bind(“input”, function(){ });

Inefficient jQuery Selectors

My PyCharm IDE warns me if I use inefficient jQuery selectors: As I am a bit nosy I wanted to know “how” inefficient these selectors are. So I compared the inefficient $(“#items tbody”); with the optimized $(“#items”).find(“tbody”); Here is the test code: window.onload = function () { test(“unoptimized”, function () { for(var i = 0;…

Bringing AJAX to Flask

Flask is a micro web framework which is really fun to use. With the following snippet You have a complete web app working within seconds. from flask import Flask # 1 app = Flask(__name__) # 2 @app.route(‘/’) # 3 def hello_world(): return ‘Hello World!’ if __name__ == ‘__main__’: app.run() #4 All this snippet does is…

Code Kata: Roman Numeral – Part 1

Christmas is over, so we get rid of the Christmas Tree. Today I want to show You another Code Kata: Roman Numerals. The task seems to be quite easy. Write a program which converts a decimal number into a string which contains the equivalent as a roman literal. E.g. convert 1984 into MCMLXXXIV. The requirements…

Code Kata: Christmas Tree

Inspired by a blog post of Dave Thomas I started to implement my technology learning roadmap by writing little code katas. To kill two birds with one stone I first solve a programming puzzle with my lingua franca Python. That helped me to concentrate on solving the algorithmic part of the puzzle because I don’t…