Skip to content

Instantly share code, notes, and snippets.

View faizanayubi's full-sized avatar

Faizan Ayubi faizanayubi

View GitHub Profile
<?php
/**
* Photograph
*
* @package Main
* @subpackage Basic
* @author Faizan Ayubi
*/
class Photograph extends DatabaseObject {
protected static $table_name = "photographs";
@faizanayubi
faizanayubi / SocialAPI
Created May 9, 2015 14:24
Social APIs
StumbleUpon
http://www.stumbleupon.com/services/1.01/badge.getinfo?url=http://swiftintern.com
Pinterest
http://widgets.pinterest.com/v1/urls/count.json?source=6&url=http://swiftintern.com
http://api.pinterest.com/v1/urls/count.json?callback%20&url=http://google.com
Delicious
http://feeds.delicious.com/v2/json/urlinfo/data?url=http://swiftintern.com
@faizanayubi
faizanayubi / word.php
Created May 10, 2015 09:11
Creating Word Document with PHP
<?php
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=document_name.doc");
echo "<html>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Windows-1252\">";
echo "<body>";
echo "<h1>My first document</h1>";
echo "</body>";
echo "</html>";
@faizanayubi
faizanayubi / NetworkCall
Created July 22, 2015 13:15
Network Call Android
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
// Will contain the raw JSON response as a string.
String forecastJsonStr = null;
try {
// Construct the URL for the OpenWeatherMap query
@faizanayubi
faizanayubi / shift_server.txt
Last active February 23, 2016 07:03
Shift a server
1. tar a file
tar -cf folder.tar folder/
2. Backup database
mysqldump -uroot -p database_name > dumpfilename.sql
3. transfer files to server
wget -m --ftp-user=cloudstuffs --ftp-password=pass123 ftp://ftp.cloudstuffs.com/public_html.tar
or
scp [email protected]:/home/vijay/webackups/milan/www.tar /var/www/
@faizanayubi
faizanayubi / commands.txt
Last active February 13, 2016 18:12
Common Ubuntu Commands
Change folder permissions and ownership
sudo chown -R username:group directory
remove all files and folder
rm -rf foldername
move contents of one foldr to another
mv -v public_html/* /home/mannan/web/viraltabloid.in/public_html/
tar a file
@faizanayubi
faizanayubi / mysql.txt
Created September 6, 2015 11:38
Popular MySQL Script
Search insert and update
INSERT INTO table (id, name, age) VALUES(1, "A", 19) ON DUPLICATE KEY UPDATE
name=VALUES(name), age=VALUES(age)
@faizanayubi
faizanayubi / .htaccess
Last active December 2, 2015 14:25
Optimizing Website Speed and Caching
<IfModule pagespeed_module>
ModPagespeed on
# using commands,filters etc
</IfModule>
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</ifModule>
# BEGIN Expire headers
@faizanayubi
faizanayubi / mysql.txt
Last active September 8, 2015 10:21
Important MySQL Terminal Commands
Backup database
mysqldump -uroot -p database_name > dumpfilename.sql
Restore database
mysql -uroot -p database_name < dumpfilename.sql
Checks database for error
mysqlcheck chris_wordpress
Auto repair databases
@faizanayubi
faizanayubi / Vesta
Created October 8, 2015 10:15
Vesta Common Commands
1. change domain owner
v-change-domain-owner DOMAIN USER [IP]