CSS Cheat Sheet

Wed Mar 6, 2013

css wildcards

css goodies from the net

CheckBox
Dust Particles
Loading Effect
Pure css3 dial clock

Allow password authentications on Amazon ec2 instance

Sat Feb 9, 2013

Step 1 - ssh into server


ssh -i ssh_key.pem my_amazon_ec2_instance.url

*This is really not a recommended way to login

Searchable Hash Bang (SEO)

Fri Feb 1, 2013

Having a dynamic website, AJAX is often used and rely on hash bang to act as a http GET to let the site be interactive. Inorder to have your application searchable / crawable, there are couple of rules to follow as suggested by the google specs.

Assuming your too lazy to checkout the specs. In summary the hash bang should be setup this way:

In a typical site, you will notice the url with http GET are written in this format

http://yoursite.com?key1=value1&key2=value2

Now in your hashbang, your will want to transform

http://yoursite.com#value1&value2

into beautiful url

http://yoursite.com#!key1=value1&key2=value2

The difference between VCs and Angels

Sun Jan 27, 2013

Many people I've spoken with were confused in the difference between VC & Angel on who they should seek for investment. Lets take this post to clear up the difference.

Angels are the ones who normally invest a small chunk, roughly 25k USD per angel for 4% of the startup during its idea / early stage. The Angels are the "validation stamp" for your idea in conjunction to play the role of advising, and bring your startup to seed ready. It is also important to note that startups should find Angels who are experts in your startup's area, due to their values and networks are capable to help you penetrate your initial market entry. At this stage, the value of an Angel are more important then the money they put in. Another note Angels normally look for a 10x return.

VCs normally enter when your startup is revenue generating or seed ready, and they will be the one to help your startup to grow up into an adult in a short period of time. When a VC invests, startups will have a new boss, as if they were married to them. VC will always try to run your startup like a business so there are pros and cons with them joining in.

Importance of Early Adopters

Fri Jan 25, 2013

When your startup is in the early stage, early adopters are your up most important customers. Let them use if for free of charge because they will become your key opinion leaders, they will be the ones who will help you break, change and polish your product. Remember to always respect them, understand why they like or dont like about it and have a fast iteration release to show dedication to serve them well.

Why & how to tell a cool story

Fri Jan 25, 2013

When pitching to an investor, you will always want your investor to come out to say "cool" after listening to the pitch. "Cool" is the validation for your idea or product, but you will want to hear that from an investor who is an expert in your field. They are the one who will be your potential to meet for follow up presentations / demos, and may become your future advisor or investor.

Here is a checklist of what your pitch needs:

- your pitch is elevator pitch ready (short and delivers the message within 60 seconds; ie the speed till they say cool)
- in your pitch dont include how it works
- your pitch should include 4 key points

  • incident / problem (include numbers & stats to back it up)
  • how your service / product solves it ( also identify if your solution is scalable & there is nitch and not a want)
  • your target audience
  • clarity and be emotional in how you solve it.

  • a good pitch example will be the one from Beerlab. Here is a link to the pitch video

    Best way to develop a dynamic website

    Thu Dec 20, 2012

    The develop a dynamic website, with all those smooth page transitions similar to gmail. As per design we will use Bootstrap, Bootstrap provides all the css tools you need to setup a quick website.

    Frontend skills you will need
    - javascript
    - html

    Frameworks
    First of all we will start of with a model view controller + observer design patterns to achieve a maintainable site.
    The web frameworks that we will use are
    - backbone js , giving a "structure" to the code
    - require js , setting up javascript dependencies, works like php include
    - mustache , page templates
    - jquery , dom manipulations

    as font icons we can get them for free at fontello, their package includes font-awesome

    Folder Structure

      
            index.html
            css/
            templates/      <=== contains the html templates
            js/views/   <=== responsible for inital html materials and listenes to model changes / actions / events
            js/models/  <=== responsible for data models
            js/controller/  <=== defines the site routes
            blueprints/     <=== contains all the 3rd party library
    
    

    To setup hashbang (similar to gmail) for page manipulations, there is a backbone module - backbone router. Using backbone router we can set up page to change dynamically depending on the hashbang setup. To let your hash bang searchable / crawable, checkout this post.

    You can checkout the Boiler Plate i've setup using this structure for off the shelve deployment.

    Further Readings
    Backbone Router
    - http://backbonetutorials.com/what-is-a-router/

    Backbone + MVC
    - http://backbonetutorials.com/organizing-backbone-using-modules/
    - http://coenraets.org/blog/2011/12/backbone-js-wine-cellar-tutorial-part-1-getting-started/
    - http://blog.andyet.com/2010/oct/29/building-a-single-page-app-with-backbonejs-undersc/
    - http://backbonetutorials.com/what-is-a-model/

    PhoneGap Apps + Load External Url

    Mon Dec 17, 2012

    To enable access to whitelist domain
    http://docs.phonegap.com/en/1.9.0/guide_whitelist_index.md.html

    To open site in app itself
    for Android

    ref: Stack Over Flow

    for iOS
    in AppDelegate.m
    Change

    
      - (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType 
      {
        return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
      }
    
    

    with

      
          - (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
          {
            NSURL *url = [request URL];
            if ([[url scheme] isEqualToString:@"http"] || [[url scheme] isEqualToString:@"https"]) {
              return YES;
            }
            else {
              return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
            }
          }
    
    

    ref: stack over flow

    if to open site in app and open in browser
    in iOS

      
        - (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(    UIWebViewNavigationType)navigationType
        {
          NSURL *url = [request URL];
          if ( ([url fragment] != NULL) && ([[url fragment] rangeOfString:@"phonegap=external"].location != NSNotFound))
          {
            if ([[UIApplication sharedApplication] canOpenURL:url]) {
                [[UIApplication sharedApplication] openURL:url];
                return NO;
            }
        }
        return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
    }
    

    and in the html href include hash #phonegap=external

    ref: reference

    Git Cheat Sheet

    Mon Dec 17, 2012

    
    #Setting up git from scratch
    git init                                             #initialize git
    git remote add < remote_label > < destination >      #adds a new remote destination with a label
    git fetch < remote_label >                           #fetches the head of the repo
    git checkout master                                  #checkouts the master branch

    #Setting up git from another repo git clone < remote_label > < optional_dir_location > #clone a repo with git config ready

    #Branching git branch #list all branches git branch < branch_label > #creates a new local branch with name < branch_label > git branch -d < branch_label > #deletes the local branch with name < branch_label > git push < remote_label> :< branch_label > #deletes remote branch

    #Merging git checkout < branch to be merge >
    git merge < branch_name > #merge recursively and auto commit

    additional info - git merge man page

    #fetch & pulling git pull < remote_label > < branch_label> #it will recursively merge with your repo git fetch < remote_label >

    #Commit git commit -a -m < message > #local commit git commit -amend -m < message > #edit last commit message git push < remote_label > < branch_label > #commits to remote branch

    #Tagging git tag -a < comment > #to remember a specific point git push –tag #pushes tag

    #To delete a tag git tag -d < tag_name > git push origin :< tag_name >

    #if tag name is same as one of your branch name git tag -d < tag_name > git push origin :refs/tag/< tag_name >

    #Logging git log #shows the commit log

    #Untrack a file git rm –cache < file_name > #untracks a file, thus not included in repo

    #Stashing git stash

    #cloning a bare repo for deployment purpose git clone –bare

    additional info git stash man page

    
    #reverting to previous commits  [Advance]
    git checkout < commit_hash >                     #checkout the indicated commit hash
    git checkout -b < branch_label > < commit_hash>  #branches with < branch_label > and checkout to the commit hash
    git reset –hard < commit_hash >                 #destroys the local modification, you will loose the uncommit work
    git revert < commit_hash >                       #reverts to the previous commit

    additional info - git revert man page & stack over flow git revert qa

    
    #splitting a subpath out into a new repo
    git filter-branch –prune-empty –subdirectory-filter lib master
    

    additional info - github:help

    JailBreaking iOS 6.0 / 6.0.1 for A4 Devices

    Sat Dec 15, 2012

    Note :: Only works for A4 devices eg - iPhone 4
    Note :: This is a tethered jailbreak

    1) Upgrade to iOS 6.0 / 6.0.1
    2) Download the newest redsn0w
    3) Download the 6.0 ipsw (the file name should be ~ iPhone3,1_6.0_10A403_Restore.ipsw)
    4) open Redsn0w
    5) click extra
    6) select ipsw -> use the 6.0 ipsw
    --if you dont use this 6.0 ipsw, redsn0w will prompt install error)
    7) hit back
    8) follow on screen instructions for jailbreak
    9) go to extra again -> select ipsw (use the 6.0 ipsw)
    10) just boot

    Slightly modified compare to the reference given (its a bit incomplete)
    ref: http://www.redsn0w.us/2012/11/jailbreak-ios-601-a5-iphone-and-ipod.html

    if cydia does not show up
    11)
    Use the AutoInstall folder: If you don't have iFile on your device, you can use a desktop application such as iExplorer, DiskAid, or Phone Disk to access the device's filesystem and install Cydia. First open the application and navigate to (or create, if necessary) this directory: /var/root/Media/Cydia/AutoInstall - and then download the following file and put it in that directory: http://apt.saurik.com/debs/cydia_1.1.8_iphoneos-arm.deb. Reboot your device with the redsn0w just boot option, and Cydia should be installed.

    ref: http://www.jailbreakqa.com/questions/32462/frequently-asked-questions#116177

    if the repo for apt.saurik.com is empty and missing com.saurik.substrate.safemode (most tweaks depends on this)
    12)
    Download: http://apt.saurik.com/debs/com.saurik.substrate.safemode_0.9.3999_iphoneos-arm.deb
    put it in the AutoInstall folder and reboot using the redsn0w just boot option

    13) open cydia app again, the source should start downloading and substrate safemode should be installed.