Skip to content

Instantly share code, notes, and snippets.

View asifsaho's full-sized avatar
💙

Asif Nawaz asifsaho

💙
View GitHub Profile
@asifsaho
asifsaho / TypeScriptCheatSheet.ts
Created February 15, 2022 09:33
Typescript Cheatsheet
// Map Object Type
const objMap: Record<string, string> = {
alu: 'mula',
};
@asifsaho
asifsaho / interview.js
Created February 15, 2022 08:51
JS interview question
console.log(add(5, 7)) // 12
console.log(add(5)(7)) // 12
console.log(add(3)(7)) // 10
function greet(greeting, punctuation) {
return greeting + ' ' + this.user + punctuation;
}
@asifsaho
asifsaho / mockComponent.ts
Created February 14, 2022 17:17
Mock React component with jest
jest.mock('./embed-code/embed-code', () => {
return {
__esModule: true,
default: () => {
return <div>Embed component goes here</div>;
},
};
});
@asifsaho
asifsaho / mysql-backup_restore.md
Last active June 22, 2020 20:06 — forked from milon/mysql-backup_restore.md
Mysql: Backup and Restore

#Mysql: Backup and Restore

Mysql Backup and restore through command line.

Backup

mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
mysqldump -u root -p --all-databases > alldb.sql

$('form.claim-details input, form select, form textarea').each(function () {
this.backup = this.value;
});
$('form.claim-details').on('change keyup', 'input,select,textarea', function () {
if (this.value !== this.backup) {
this.backup = this.value;
this.form.isDirty = true;
//$(this).addClass('field-dirty');
//$(this.form).addClass('form-dirty');
//console.log('form is dirty');
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
<?php
$to = 'asif.saho@gmail.com';
$subject = 'Email Template Testing';
$headers = "From: " . "alu@mula.com" . "\r\n";
$headers .= "Reply-To: ". "alu@mula.com" . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
@asifsaho
asifsaho / WP:bootstrap-paginations.php
Created September 25, 2015 16:20
WP:bootstrap paginations
function custom_pagination() {
global $wp_query;
$big = 999999999; // need an unlikely integer
$pages = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'prev_next' => false,
'type' => 'array',
@asifsaho
asifsaho / Facebook Share Image
Created July 10, 2015 11:44
Facebook show a random image in a share, it grabbed from the link automatically, to make the thumbnail specific you need those meta property
<meta property="og:title" content="Red Vector Design | Designing Experiences" />
<meta property="og:url" content="http://redvectordesign.com" />
<meta property="og:image" content="http://redvectordesign.com/demo/wp-content/uploads/2015/06/fb.jpg" />