18 October 2014

shortly.pw is an open source URL shorten, unshorten and tracker

I'd like to talk about shortly.pw which is an website to allow you not just to shorten your URLs, also to unshorten the URL for any shorten services and a URL click tracker.

Feature (see screenshots below):

  • Easily copy the result link.
  • Track the shorten link in terms of time of clicks and details about each click.
  • Unshorten URLs from other services such as goo.gl, tiny url, etc..
  • API available to use the service from your app (mobile, desktop, website, etc...)
  • you get all the other features with no need to login.



Easily copy the result URL:


 Shortly keeps detailed information about links you shorten. (no login required) 
You can unshorten URLs from any other service (bit.ly, tiny url, goo.gl, etc..)

Also you can use the HTTP API from your application, see: http://api.shortly.pw/apidoc

New features are being added..
Shortly plan: https://trello.com/b/or9dg3Zr/shortly-pw-plan
Shortly source code at Github: https://github.com/MuhammadHewedy/short-url

27 September 2014

Ifelse shortcut

if (testCondition() && executeMe() || executeMeOtherwise());

Origin come from bash, to execute if else on a single line:
[ $# == 0 ]  && echo 'invalid input' || processInput($*)
If no parameters passed, the echo 'Invalid input' else, start processing the input.


02 September 2014

Objective-c delegates

It is a long time I since I stopped working on iPhone and objc.

But some collage is working and we was discussing about objc delegates and what is it and how it is related to categories.

Following is an example illustrate how things going from Categories to Delegates.


// NSObject+TurnLights.h
// a Category on NSObject to allow any subclass to turn on/off lights
@interface NSObject (TurnLights)

-(void) turnLightsOn;
-(void) turnLightsOff;

@end

//Lights.m
// this is the lights class that delegate its work to some object (of type id) to do the on/off instead of itself
@implementation Lights

@synthesize id delegate;

-(void) doLightings{
      [delegate turnLightsOn];
      [delegate turnLightsOff];
}
@end


//MyContorller.m
// is my controller class that decided to be a delegate for the Lights class

#import "NSObject+TurnLights.h"

@implementation MyController

-(void) btnClicked:(id) sender{
      Lights* lights = ...
      [lights setDelegate: self];
}

-(void) turnLightsOn{
      NSLog("turnLightsOn");
}

-(void) turnLightsOff{
      NSLog("turnLightsOff");
}
@end

30 May 2014

continually monitor CPU usage for a command

cmd=[m]oviecrawler;while :; do echo -ne "CPU: `ps aux | grep $cmd | awk '{print $3}'`\\r" ;  sleep 1; done

11 May 2014

Banshee souldcloud integeration

I wanted to play sounds from soundcloud on banshee...

I found source code on githug, I've forked to fit my needs

Project at github
https://github.com/MuhammadHewedy/banshee-soundcloud-extension


10 May 2014

refactor (find and replace in files)

If you want to refactor (find and replace in files) , you could use the following script (on your own)

https://gist.github.com/MuhammadHewedy/dab0116aa288f67d05ba