Tired of concatenating Date.getYear() Date.getMonth(), and Date.getDay() to format todays date in Javascript?
Heres a simple javscript function I use to output the date in YYYY-MM-DD format
Tired of concatenating Date.getYear() Date.getMonth(), and Date.getDay() to format todays date in Javascript?
Heres a simple javscript function I use to output the date in YYYY-MM-DD format
Even if you manage to get wireless/wifi working fine in Ubuntu, one annoying issue (if you have auto login set) will be that the ‘Gnome keyring’ will keep prompting you for a password every time you login or wake from hibernation - so that it could connect to my Wi-Fi network.

The solution is simple but one you shouldn’t have to worry about:
I always forget how to format a number as 2 decimal places in Javascript/jQuery, its extremely simple, just use the unmemorable toFixed() function - refer below is an example
1
| |
If your using a smaller Ubuntu or Debian based distro (lubuntu, solusOS, etc..) you’ll often find that numlock on the keyboard isn’t turned on my default. Just paste the below commands into the commandline and numlock will be on by default.
1 2 3 | |
Looking for a simple way to upload files from your server to Dropbox without doing a full sync?
By using the script from Andrea Fabrizi your easily upload or download individual files to and from Dropbox from the commandline
Download the script from github with wget
wget https://raw.github.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh
Make it executable
chmod +x dropbox_uploader.sh
Run the dropbox_uploader script ./dropbox_uploader.sh and it’ll print out the below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
Open up the url https://www2.dropbox.com/developers/apps in your browser, sign into Dropbox
and click the Create an app button

Fill in the app name as listed by the script, select ‘Core’ and ‘App folder access’ (this will create a folder call /App/MyUploader888 in your Dropbox director. If you want to access all files in your Dropbox select ‘Full Dropbox’

Dropbox will now show you your API details for this app, get the ‘App key’ and paste it into commandline
Then paste in the ‘App secret’ when requested
1 2 3 | |
Select the access level and it’ll provide you with link to verify the app.
https://www2.dropbox.com/1/oauth/authorize?oauth_token=nxxxxxxxxxxxxxxf
Open the link in your browser and Allow the app access
Your now setup to upload/download individual files from the command line to and from Dropdox
To upload a file from your server to Dropdox just run
./dropbox_upload.sh upload myfiles.zip
If you have selected the Full Dropbox access you can sepecify the folder location to upload to
./dropbox_upload.sh upload /some/folder/indropbox.com/myfiles.zip
Other commands available are download which uses the same style as the uppload command, delete,list,info and unlink
Posterous.com is due to shutdown at the end of April 2013. If your after a simple way to backup a Posterous site the below command will download your Posterous site as static html
wget -r -l inf -k -E -p -nc http://yourblog.posterous.com/
The options used are:
-r recursive-l inf infinite depth-k suffix html files with .html-E update the saved files with links to local files-p download page resources-nc don’t redownload urls more than onceThis command won’t download all images (ones hostes on a different CDN) but it will download the majority of your site fine
If your having issues with large PDO query sizes in PHP and getting out of memory issues the solution is to set PDO::MYSQL_ATTR_USE_BUFFERED_QUERY to false
refer below example
1 2 3 4 5 | |
For whatever reason on certain system even small queries can bomb out - just add in this attribute and your queries should now run fine in PDO
If you’ve added files into your GIT repository, then realised you don’t want changes to these files tracked.( ie. log files, cache directories etc. ) adding the tracked files to .gitignore won’t work.
GIT will still track the changes and commit the file if you use the -a parameter.
To untracked file changes use the below command:
git update-index --assume-unchanged <file>
If you wanna start tracking changes again run the following command:
git update-index --no-assume-unchanged <file>
For more info refer the Git manual on this topic
I haven’t been able to find any decent year based jQuery UI date slider examples that have the 2 date ranges pre-populated.
Here’s a simple year based slider that I’m using is a current project
Open up your terminal and execute the below commands, replacing yourdomain.com with the domain name
1 2 3 4 | |
For a wildcard cert enter *.yourdomain.com for Common Name. It’s the 6th option in the dialog. All other options can be left blank for defaults
1 2 3 | |
Enable SSL in Apache and restart
1 2 | |
Then add the SSL settings into each VirtualHost in your Apache configuration files
Note: that if you are planning to run your sub-domain or domains on http(80) aswell asn http(443) then you need to have 2 separate virtualhost entries. 1 for port 80 and 1 for port 443
For the sub-domains you want to use with https add the below options with the 443 into your existing files
1 2 3 4 5 | |
Then reload Apache
1
| |
To test if its working open up https://www.yourdomain.com and check if the certificate works