Skip to content

Instantly share code, notes, and snippets.

View anytizer's full-sized avatar

Bimal Poudel anytizer

View GitHub Profile
@anytizer
anytizer / web-contents.php
Created November 30, 2013 11:46
scrap web contents
<?php
/**
* Retrieves a web content from given URL
* @todo Apply best scapper method among curl, post, file_get_contents, url fopen
* @see methods used in API engines as well
*/
private function web_contents($url = '')
{
$options = array(
'http'=>array(
@anytizer
anytizer / web-contents-curl.php
Last active December 29, 2015 19:29
Web contents via CURL call
<?php
/**
* Opens an URL with POST parameter and keeps quiet. Useful to post the data.
* @todo Make sure curl is initialized on the server, otherwise, the sytem may not perform
* @todo Handle $parameters if it is a multi dimentional array
*/
function web_contents($url='http://', $parameters_associative=array(), $fetch_data=false)
{
$fetch_data = ($fetch_data===true);
@anytizer
anytizer / facebook-links.txt
Last active December 30, 2015 14:09
Facebook PDF file for linking muli-location business into parent-child pages
@anytizer
anytizer / mysql-backup-database.bat
Last active December 31, 2015 01:09
Backup a MySQL databases in 4 different ways. 1. Full database backup (contains everything you need to restore the database) 2. Database structure only backup (includes VIEWs as well) 3. Data only backup - contains INSERT statements only 4. Routines only backup (stored procedures, user defined functions)
@echo off
SET HOSTNAME=localhost
SET USERNAME=root
SET PASSWORD=password
SET DATABASE=database
REM Backup everything
mysqldump --routines -h%HOSTNAME% -u%USERNAME% -p%PASSWORD% %DATABASE% > %DATABASE%-all.dmp
@anytizer
anytizer / phpmailer-gmail-configuration.php
Last active January 9, 2018 08:43
If you want to use gmail smtp server to compose emails to send your emails, use the below code snippet to configure your PHPMailer. Each emails you send will be available in your GMail's sent folder.
<?php
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->Host = 'smtp.gmail.com';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
@anytizer
anytizer / portable-mysql-backup.sh
Created December 15, 2013 10:51
Remove DEFINER=`USER`@`HOST` from mysql dump files
http://xplus3.net/2013/10/10/remove-definer-clause-mysqldump/
mysqldump > non-portable.dmp
$ sed -E 's/DEFINER=`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' non-portable.dmp > portable.dmp
http://dbperf.wordpress.com/2010/04/12/removing-definer-from-mysql-dump/
perl -p -i.bak -e "s/DEFINER=\`\w.*\`@\`\d[0-3].*[0-3]\`//g" portable.dmp
@anytizer
anytizer / mysql-configuration.ini
Created December 15, 2013 20:04
MySQL enable log mode (global) way
SET GLOBAL log_output = 'FILE';
SET GLOBAL general_log_file='/tmp/mysql_general.log';
SET GLOBAL general_log = 1;
@anytizer
anytizer / staffing-software.txt
Created December 18, 2013 18:14
Staffing software - features and benefits
How to review and choose staffing software
http://www.tempworks.com/staffing-software-checklist.php
eempacat
http://www.bond-us.com/Bond_eEmpACT_Staffing_Software_Business_Benefits.php
Talent Management
http://www.workday.com/applications/human_capital_management/talent_management.php
check digits
http://www.augustana.ab.ca/~mohrj/algorithms/checkdigit.html
Check Digit Algorithm
https://wiki.openmrs.org/display/docs/Check+Digit+Algorithm
http://www.codeproject.com/Articles/16540/Error-Detection-Based-on-Check-Digit-Schemes
Damm algorithm
http://en.wikipedia.org/wiki/Damm_algorithm
@anytizer
anytizer / css-debug.css
Created December 25, 2013 08:31
CSS Debugging by borders coloring of the tags
http://yysource.com/2011/03/debugging-with-css-outline-all-elements/
* { outline: 2px dotted red }
* * { outline: 2px dotted green }
* * * { outline: 2px dotted orange }
* * * * { outline: 2px dotted blue }
* * * * * { outline: 1px solid red }
* * * * * * { outline: 1px solid green }
* * * * * * * { outline: 1px solid orange }
* * * * * * * * { outline: 1px solid blue }