Skip to content

Instantly share code, notes, and snippets.

View hasanm95's full-sized avatar

Hasan Mobarak hasanm95

View GitHub Profile
@hasanm95
hasanm95 / work-with-multiple-github-accounts.md
Created August 1, 2023 14:50 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@hasanm95
hasanm95 / Javascript Essential Functions
Created August 20, 2020 05:18
jQuery like functions by vanila javascript
//Is element in viewport
// return boolean
function isInViewport(el) {
const rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
<!-- Headings -->
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
<!-- Italics -->
function rrf_industry_import_files() {
return array(
array(
'import_file_name' => esc_html__('Demo Import', 'rrf-industry'),
'local_import_file' => trailingslashit( get_template_directory() ) . '/inc/demo-data/rrf-industry-demo.xml',
'local_import_widget_file' => trailingslashit( get_template_directory() ) . '/inc/demo-data/rrf-industry-widgets.wie',
'local_import_customizer_file' => trailingslashit( get_template_directory() ) . '/inc/demo-data/rrf-industry-customizer.dat',
'import_notice' => esc_html__( 'After you import this demo, Just set static homepage from settings > reading. Check widgets and menus. You will be done', 'rrf-industry' ),
@hasanm95
hasanm95 / Call css and js in plugin file
Created January 17, 2018 07:03
Call css and js in plugin file
function site_toolkit_files(){
wp_enqueue_style('site-toolkit', plugins_url('/assets/css/site-toolkit.css', __FILE__));
wp_enqueue_style('site-carousel', plugins_url('/assets/css/owl.carousel.css', __FILE__), array(), '2.2.1', 'all');
wp_enqueue_script('site-carousel', plugins_url('/assets/js/owl.carousel.min.js', __FILE__), array('jquery'), '2.2.1', true);
}
add_action('wp_enqueue_scripts', 'site_toolkit_files');
@hasanm95
hasanm95 / Inlclude conditonal JS in wordpress
Created January 17, 2018 06:15
Inlclude conditonal JS in wordpress
function site_scripts() {
wp_enqueue_script( 'html5shiv', '//cdn.jsdelivr.net/html5shiv/3.7.2/html5shiv.js' );
wp_script_add_data( 'html5shiv', 'conditional', 'lt IE 9' );
wp_enqueue_script( 'respond', get_template_directory_uri() . '/assets/js/respond.min.js' );
wp_script_add_data( 'respond', 'conditional', 'lt IE 9' );
}
add_action( 'wp_enqueue_scripts', 'site_scripts' );
@hasanm95
hasanm95 / Include Google font
Created January 2, 2018 15:13
Include google font with codestarframework
// theme options
// set options for google fonts
function industry_rrfonline_theme_options( $options ) {
$options = array(); // remove old options
$options[] = array(
'name' => 'Typography',
'title' => 'Typography',
@hasanm95
hasanm95 / Industry service box 2
Created September 9, 2017 17:52
Industry service box 2
//Kc addon code
kc_add_map(
array(
'industry_servic_box2' => array(
'name' => 'Service Box2',
'description' => __('Use this addon for service box', 'KingComposer'),
'icon' => 'sl-paper-plane',
@hasanm95
hasanm95 / Get codestar metabox data
Created September 8, 2017 10:45
Get codestar metabox data
function industry_slide_shortcode($atts){
extract(shortcode_atts(array(
'title' => '',
),$atts));
$args = array(
'post_type' => 'industry-slide',
'posts_per_page' => '2',
);
@hasanm95
hasanm95 / Codestar metabox
Created September 8, 2017 09:59
Basic Codestar metabox Code
function industry_rrfonline_options( $options ) {
$options = array();
$options[] = array(
"id" => "industry_rrfonline_slide_meta",
"post_type" => "industry-slide",
'title' => 'Slide Options',
'context' => 'normal',