Skip to main content

Posts

SyntaxHighlighter Fix for Blogger Dynamic View

After moving from old theme to the new Blogger Dynamic View theme, I hade my biggest issue: How to enable my SyntaxHighlighter again? I'd prefer find a solution that reformat ALL my blog posts throughout the years. One solution I found was adding a Javascript snippet to all my posts ( http://kevin-junghans.blogspot.com/2013/01/adding-syntaxhighlighter-to-blogger.html ). But this will require A LOT of work too! So what I did was a bit of nasty yet effective solution: In the head code I already have this code: <!--SYNTAX HIGHLIGHTER BEGINS--> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/> <script src='http://alexgor...

Hijri Date Widget and JSON API

Here is a mini project I've been using for myself and thought it can be useful for someone out there. A simple SVG based date widget + a JSON API for Hijri date. It has two interfaces: widget.php and api.php. With some features to make them a bit customizable. Responsive widget to fit in different sizes. Customizable color for widget. A JSON API for services. Ability to choose computer calculations or official date by Egyptian Dar-Aliftaa. An offset for fine tuning errors. Choise of month name or number. To read more about the the Hijri widget and API, please refer to the docs: ---- (no longer hosted, please refer to the GitHub repository ) ----

PalMap - Get Palestine Back on Google Maps

If you are a user of Google Maps, and you care about Palestine, and you get disgusted by the word "Israel" appearing on the map, here is a solution. PalMap is a javascript library to get Palestine back on Google Maps. It does not require much. Just copy palmap.js file and img/palmap folder, add two lines in your html file, and Palestine is back on Google Maps! PalMap is still in an early stage, aiming to reshape this part of the map and get all the names back to their original ones. For more info about the library, please go to PalMap repository on GitHub: https://github.com/MahmoudAdly/palmap

Installing Multiple Redis Versions on Ubuntu

Sometimes, for testing purpose as example, a developer needs to install and run different versions of Redis Server for different projects. And since I do not like wasting time on haching config files and pid files, this is the easiest way I use to run the desired Redis Server version. It is as simple as downloading, compiling, and running the compiled server: $ wget http://download.redis.io/releases/redis-2.8.9.tar.gz $ tar xzf redis-2.8.9.tar.gz $ cd redis-2.8.9 $ make $ ./redis-server If the version is older, you may not find it on redis.io. So try a URL like: http://redis.googlecode.com/files/redis-1.2.6.tar.gz That's it. Enjoy!

[Qt] Custom QListView delegate with word wrap

Using QListView with a custom item layout has been a very popular demand by many developers. The problem with using  a custom delegate was having some basic features like word wrap depending on the allowed list size. Here is a screenshot from a project prototype I've been working on. The text will wrap around to fit in multiple lines depending on text length and list view width. My custom delegate is about using two important methods: QFontMetrics::boundingRect() and QPainter::drawText() . The first method will return the minimum Rect needed to draw the given text using the given origin and font. The second method draws the given text within the given Rect. Note that the flag Qt::TextWordWrap is given to both methods when called. The code is simple: Get system default font. Process the font to suite your needs. In my case: I have a normal font and another bold one for the header. Create a QFontMetrics instance for each font. Use the QFontMetrics instances to cal...

حصن المسلم لسعيد بن علي بن وهف القحطاني للمبرمجين بصيغة txt

هذا الملف بصيغة txt كان ضمن مشروع شخصي أعمل عليه و وجدت أن الفائدة تعمّ بنشره: كتاب "حصن المسلم من أذكار الكتاب و السنة" لسعيد بن علي بن وهف القحطاني. كل سطر من الملف يساوي دعاءً أو ذكرا من الكتاب. حيث يكون بالصيغة التالية: رقم الفصل|عنوان الفصل|رقم الدعاء|الدعاء مثال: 7|دعاء الخروج من الخلاء|11|"غُفْرانَكَ". و في حال وجود أي خطأ إملائي أو غيره أرجو إخباري لتعديله و إعادة رفعه. التحميل من هنا

Reply Machine: Static XML/JSON replies for application testing

Update : Reply Machine is now Echo : A free online service to create custom JSON/XML/HTML/Plain replies for application testing. As I'm moving forward with small applications for learning purposes, here comes a new web application: Reply Machine. Reply Machine is a free online service to create static XML, JSON, and raw replies for application testing. This service can help in a situation like when I need to create a simple reply that does not deserve to setup a local service, or when I want to integrate my application with a colleague who knows nothing about web development. The idea is simple:  Write the reply you wish to receive Set the reply type (xml, json, raw data) Hit the 'create' button. The output is a link to use in your application for testing There are some advanced options as well: Delay : In case you want to delay the time between your request and server reply. Encryption : If you have sensitive data in your reply, you can save t...

Diamond Reaction: An HTML5 Chain Reaction Game using Crafty JS

I've been away from blogging for a long time. Maybe because I've not been learning code-detailed topics. I've been more like learning the basics in topics I've never tries before (like PHP) and learning some theoretical topics. Anyways, this time I'm trying a new approach to gain more experience. This was I can gain experience from anything I want to learn. So here is my almost-full game implementation of an HTML5 chain reaction game called: Diamond Reaction. Play Diamond Reaction now Let's talk a bit about it: Idea: I wanted to make a game for fun, with the focus on game mechanics. So I started thinking of some ideas that can be fun for a 'mario-lover' like me. Whenever I think of an idea, I search about it and see how frequent I find the same mechanics on the web. Till I arrived at this concept that did not have a big hit before: chain reaction games. Theme: If you look at a game like Angry Birds, you can find the game mechanics are no...

Crafty JS Tutorial (DX Ball / Breakout)

Introduction: This Crafty JS tutorial is part of Alkottab Studio's internship program, to take developers with no previous game development experience in the quickest way to production phase. Prerequisites: Previous development experience. The very basics of HTML/CSS/Javascript. Finishing the first part of the Crafty tutorial on its website. [ How Crafty works ,  Download and Setup ] Section 1: Game description: A ball continuously moving and hitting walls and bricks. Bricks are destroyed and points are collected when hit by the ball. User controls a bat and moves it right and left to prevent the ball from hitting the ground. If the ball hits the ground, a life is lost. Section 2: File Structure: Before starting the tutorial, it is better to explain how the files are arranged: index file : links to JS files, game div, some simple CSS. js directory: Crafty file and game file. assets directory: images and spritesheets used. Section 3: Coding consi...

Facebook Scores API with Koala Gem

Here is a code snippet for a piece of code that I found a lot of people asking about on the web. Since Koala gem does not have an explicit API for Facebook Scores API , some people wonder why it isn't there. Actually, there is a generic call that can do the job just fine: After getting your Koala gem to work: check this URL for more about Creating a Facebook Rails app with Koala gem . Read the set of scores for a user and their friends Facebook Scores API states that: "You can read the set of scores for a user and their friends for your app by issuing an HTTP GET request to /APP_ID/scores with the user access_token for that app." So this can be done with the 'get_object()' method, api = Koala::Facebook::API.new(session[:access_token]) scores = api.get_object(APP_ID + "/scores") Create or update a score for a user: Facebook Scores API states that: "You can post a score for a user by issuing an HTTP POST request to /USER_ID/...