Git add not working for folder with .git folder

Also you might get something like
fatal: Pathspec ‘some.file.name.goes.here’ is in submodule ‘some/folder/name’
Also you might notice, if you commit and pushed, only some skeleton of the of the folder structure without the actual files would be committed.

The root of the problem is the folder you are trying to add is tracked under git itself.
This would confuse git and would rather leave it up to you.

the fix
First go ahead and remove the .git folder in the new directory

sudo rm -rf /path/to/new/folder/.git

Then clear the cache from git memory of the new folder

git rm -r --cache /path/to/new/folder

Then when you do the

git status

you will see all the new files being listed and you can commit that.

, , , ,

Leave a comment

Mac Numbers document to Excel

Starting to play with the numbers app that comes with my mac, and after doing my spreadsheet, pretty much the same as excel so far, i want to share it and the standard being xls file, I figured how to do that.
Go to file and select the export to => Excel. 

The rest is history after that.. I like how neat the number app is so far, I will try to see how it is flexing its muscles over the giant excel as I have a lot to do on that..

By the way, I have been a great fan of apaches open office just check it out.

 

, , , , , ,

Leave a comment

Along came php_sapi_name

Wanted to know who is calling your php script?
Wanted to handle differently when the script is called from command line
check if request comes from webserver??..
interface vs the WebServer( apache, nginx..)
Then use php_sapi_name

yeah this sapi thing – Server API is a bit bad boy. You might want to check a manual value comparison before deploying it your server as the sapi return type might be different for different settings say b/n manual script vs cronjob vs webserver.

Also having additional check with $_SERVER and $_ENV variables is also a good one for better guarantee. Like some parameters of the $_SERVER would only be set when called from web server like ‘REQUEST_METHOD’

if (!empty($_SERVER['REQUEST_METHOD'])) {
    echo "hey baby web server, wssup";
} else {
    echo "umm.. are you cron? manual? who the heck???";
}

Also using the sapi name

$sapi_id = php_sapi_name();
if (stristr($sapi_id, 'cli')) {
    echo "hello command line interface";
}

Since the above would be a bit more conditional it would be advised if used along with existence of like $_SERVER[‘REQEST_METHOD’]

YEAH..

, , ,

Leave a comment

Check if curl is loaded as module in php

Ok, here is another tip.
You want to check if curl is loaded or not?
1. You can check by using phpinfo();
Just create a single phpinfo.php file and in it add

phpinfo();

Then load this on your browser and see if you can sniff curl here

2. if ( in_array(‘curl’, get_loaded_extensions()) ){
echo “yeah”;
} else {
echo “nah”;
}

Enjoy

, ,

Leave a comment

Get your filezilla password from your mac

Screen Shot 2016-03-29 at 4.59.26 AMYeah, filezilla would put the passwords along with your username and other info in the ~/.filezilla folder. You can grab and use it. In the meantime, if your computer is accessed by others, also know that they can access your FTP information from there.

, , , , , ,

Leave a comment

Adding an app to Launchpad in Mac

Hey, did you end up having an app that won’t be added to the launchpad, aka applications on mac? The example could be Filezilla. When you download and try to launch it by double clicking it will start but you might not get it on the applications folder and you won’t see it in the lauchpad.

The fix? it is way easier that you think. Just copy the app you want to be added, say the Filezilla, and just paste it in the Applications folder. You can access the applications folder by directly going to Finder.

Enjoy!

Leave a comment

Git diff with filemode changes

Here we go, you changed the file locally say the mode from 644 to 775 or something and when you do the git status you will see the file permissions being changed and laid there – I know, it sucks..

Here is the good news, you can tell git not to worry about the file mode changes through

git config core.fileMode false

This should take care of the problem you are having.

~~enJoy~~

Leave a comment

Hooking Facebook App to Existing FB Business Manager

I was working some minor Facebook reporting which require setting up a Facebook App and hooking it to existing Business manager and it looks there is no direct instruction that I found so here you go…

First thing first, you would need a developer account from https://developers.facebook.com/ – go and get it, it is free.

Then Go ahead and create a Facebook App there – a minimum you need is a facebook page and thats it.
Then from the dashboard you will get the app_id and secret. This is very important for you to keep it as secret as well. From this, you will get yet another important key called Access Token.

Now you have a Facebook App that you will use it to acquire a lot of information for the business manager you have. You can get lots of User related data, analytics, sales, spending and more..

Now head to https://business.facebook.com/ and select your business manager if you have more than one.
On the left of the menu, you will see Claim Assets and from there select App
You will be asked to insert App Id and it will be a matter of following the instruction after that.
Now you have integrated your app to the existing business manager. Which means, your app now has an access to the data under your business manager through different APIs.

EnJoy

, , , ,

Leave a comment

Composer could not be installed b/c of php.ini setting

trying to install composer on your server and got something like
Some settings on your machine make Composer unable to work properly.

Make sure that you fix the issues listed below and run this script again:
And specifically for suhosin.executor.include.whitelist = phar?

Then the fix is to modify php.ini on the fly while you are passing the installer

sudo curl -sS https://getcomposer.org/installer | php -d suhosin.executor.include.whitelist=phar

That should take care of modifying the php.ini on the fly without you updating the config and re-bouncing the server.

,

Leave a comment

Run Mongo as a service – detaching from terminal

You might start mongo demon as

mongod

but, as you close the terminal this will terminate your session.

So, to start it as a service so that it would continue running

mongod --fork --logpath /path/to/log/file

You can specify the log file as you wish

, ,

Leave a comment

Design a site like this with WordPress.com
Get started