Snippets Collections
echo "# portfolio-website" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/Abidur43/portfolio-website.git
git push -u origin main
  // Rearrange the admin menu
  function custom_menu_order($menu_ord) {
    if (!$menu_ord) return true;
    return array(
      'index.php', // Dashboard
      'edit.php?post_type=custom_type_one', // Custom type one
      'edit.php?post_type=custom_type_two', // Custom type two
      'edit.php?post_type=custom_type_three', // Custom type three
      'edit.php?post_type=custom_type_four', // Custom type four
      'edit.php?post_type=custom_type_five', // Custom type five
      'separator1', // First separator
      'edit.php?post_type=page', // Pages
      'edit.php', // Posts
      'upload.php', // Media
      'link-manager.php', // Links
      'edit-comments.php', // Comments
      'separator2', // Second separator
      'themes.php', // Appearance
      'plugins.php', // Plugins
      'users.php', // Users
      'tools.php', // Tools
      'options-general.php', // Settings
      'separator-last', // Last separator
    );
  }

  add_filter('custom_menu_order', 'custom_menu_order'); // Activate custom_menu_order
  add_filter('menu_order', 'custom_menu_order');
// Remove Plugin Update Nags
remove_action('load-update-core.php','wp_update_plugins');
add_filter('pre_site_transient_update_plugins','__return_null');
function toTitleCase(str) {
  //store the first letter in firstChar
  let firstChar = str[0] || "";
  //capitalize firstChar
  firstChar = firstChar.toUpperCase();
  //store the remaining characters in a variable otherChars
  let otherChars = "";
  if (str.length > 1) otherChars = str.substring(1, str.length);
  return `${firstChar}${otherChars}`;
  //return a concatenation of firstChar and otherChars
}
def display_img(img):
    fig = plt.figure(figsize=(12,10))
    ax = fig.add_subplot(111)
    ax.imshow(img,cmap='gray')
# create 2d array
np_height = np.array([1, 2, 3])
np_weight = np.array([4, 5, 6])

array_2d = np.array([np_height, np_weight])

# iterate through it
for val in np.nditer(array_2d):
	print(val)
for key, val in my_dict.items():
	print(key, val)
BEGIN
  DBMS_SCHEDULER.CREATE_JOB (
   job_name           =>  'JOB_UPDATE_RATES_FUEL_MONTHLY',
   job_type           =>  'PLSQL_BLOCK',
   job_action         =>  'PR_UPDATE_RATES_FUEL_MONTHLY;',
   start_date         =>   TO_DATE('2022-01-28 01:30:00', 'YYYY-MM-DD HH24:MI:SS'),
   enabled 			  =>   TRUE,
   repeat_interval    =>  'freq=monthly;byhour=01;byminute=30;', 			
   job_class          =>  'DEFAULT_JOB_CLASS',
   comments           =>  'UPDATE RATES FUEL MONTHLY');
END;
/
select * from dei3de.dw_contratto
where dat_insrec > sysdate - 1/24;
# choose seed for reproducability
np.random.seed(123)

# create random float
np.random.rand()

# create random int of dice (between 1 and 6)
np.random.randint(1, 7)
version: '3.7'
services:
  web:
    image: "hapiproject/hapi:latest"
    ports:
      - "8090:8080"
    configs:
      - source: hapi
        target: /data/hapi/application.yaml
    volumes:
      - hapi-data:/data/hapi
    environment:
      SPRING_CONFIG_LOCATION: 'file:///data/hapi/application.yaml'
configs:
  hapi:
     external: true
volumes:
    hapi-data:
        external: true
var codeToBeCopied = document.getElementById('code-snippet').innerText;
    var emptyArea = document.createElement('TEXTAREA');
    emptyArea.innerHTML = codeToBeCopied;
    const parentElement = document.getElementById('post-title');
    parentElement.appendChild(emptyArea);
 
    emptyArea.select();
    document.execCommand('copy');
 
    parentElement.removeChild(emptyArea);
    M.toast({html: 'Code copied to clipboard'})
SELECT cod_trasp FROM EAI_VEICOLI WHERE COD_TRASP IS NOT NULL AND LENGTH(COD_TRASP) = '10';
SELECT INVOICE_NUMBER, COUNT(INVOICE_NUMBER)
FROM OBT_INVOICES
GROUP BY INVOICE_NUMBER
HAVING COUNT(INVOICE_NUMBER) > 1; 
CREATE TABLE New_Table_name AS SELECT * FROM Existing_table_Name; 
add_filter( 'mim_expand_menus', your_function_name );
function your_function_name( $expand, $current_screen ) {
  //ex. enables everywhere except Menus admin page...
  return $expand || empty( $current_screen ) || $current_screen != 'nav-menus';
}
            valid_captcha_preds.extend(current_preds)
df.describe()  # get statistics of df
df.info()
df.dtypes
df.values  # get values of df as numpy array
df.columns  # get all columns

df.index # get index of df
df.set_index('col1')  # can also be applied on multiple columns (use ['col1', 'col2'])
df.reset_index()  # option: drop=True
df.sort_index(level=['col1', 'col2'], ascending=[False, True])  # for multiindex
# then we can slice by indeces:
df.loc[('Pakistan', 'Lahore'):('Russia', 'Moscow')]  # Slice from first tuple to second tuple where Pakistan is first index and Lahore second
df.loc[("a", "b"):("c", "d"), "e":"f"]  # can also slice two ways
# get last 10 rows of data frame
df.iloc[-10:]


df.info()  # get info about missing values
df.shape()  # get nbr of rows and columns
df.sort_values(['col1', 'col2'], ascending=[True, False])  # sort values by col1 (ascending) and col2 (descending)
df['col'].mean()  # .median(), min(), max(), std(), var(), quantile()
# min() also works for dates
df['col1'].cumsum()  # sum of row AND previous row, also .cummax(), cumprod()
# df[["col1", "col2", "col3"]].agg([function1, function2]))

# unique counts
df.drop_duplicates(subset=['col1', 'col2'])
df['col1'].value_counts(sort=True, normalize=True)
df['col1'].unique() 

# get largest 10 values in data frame
df.nlargest(10, "col")
Patch(COL_AppVar;LookUp(COL_AppVar;var_name = "loop_counter");{var_value:0});; //Counter Value zurücksetzten

If(Connection.Connected;
    ForAll(
        DK_Stufen_DB As AS_STUFEN_DB;
        If(
            !IsBlank(
                LookUp(
                    Filter(
                        DK_Stufen_DB_Katalog;'DB_Stufen_DB_Katalog>DK_Profil_Lookup'.DB_Profil_ID = VAR_last_submitted_EditProfile_ID
                    );
                'DB_Stufen_DB_Katalog>DK_Stufen_Lookup'.DB_Stufen_ID = AS_STUFEN_DB.DB_Stufen_ID
                )
            );        
            Patch(DK_Stufen_DB_Katalog;Defaults(DK_Stufen_DB_Katalog);
                {
                    DB_Stufen_Katalog:VAR_last_submitted_EditProfile_NAME & "/" & AS_STUFEN_DB.DB_Stufen_Name;
                    DB_Stufen_Katalog_Option:false;
                    DB_Stufen_Katalog_Order:AS_STUFEN_DB.DB_Stufen_Order;
                    'DB_Stufen_DB_Katalog>DK_Stufen_Lookup':LookUp(DK_Stufen_DB;DB_Stufen_ID = AS_STUFEN_DB.DB_Stufen_ID);
                    'DB_Stufen_DB_Katalog>DK_Profil_Lookup':LookUp(DK_Profil_DB;DB_Profil_ID = VAR_last_submitted_EditProfile_ID)
                }
            );;
            Patch(COL_AppVar;LookUp(COL_AppVar;var_name = "loop_counter");{var_value:LookUp(COL_AppVar;var_name = "loop_counter").var_value + 1})       
        )
    );;

    If( // check if there were any errors when patch was submitted
        !IsEmpty(Errors(DK_Stufen_DB_Katalog));
            Notify(Concat(Errors(DK_Stufen_DB_Katalog);"Es ist ein Fehler aufgetreten: " & Column &": "& Message);NotificationType.Error);    
                If( // CounterVariabel in der AppVar Collection überprüfen
                    LookUp(COL_AppVar;var_name = "loop_counter").var_value > 0;
                    Notify("Es wurden " & LookUp(COL_AppVar;var_name = "loop_counter").var_value & " neue Stufen gefunden und hinzugefügt";NotificationType.Success;5000);
                    Notify("Keine weiteren Stufen gefunden. Das Profil ist bereits auf dem aktuellen Stand";NotificationType.Information;5000)
                )
    );
Notify("Es konnte keine Verbindung zum Server aufgebaut werden. Bitte die Internetverbindung überprüfen";NotificationType.Error;0)   
);;

Patch(COL_AppVar;LookUp(COL_AppVar;var_name = "loop_counter");{var_value:0});; //Counter Value zurücksetzten
<style lang="scss">  
  tbody {
     tr:hover {
        background-color: transparent !important;
     }
  }
</style>
df.groupby(['col1'])['col2'].mean()  # or .count(), etc.

# other way for multiple statistics
df.groupby(['col1', 'col2'])[['col3', 'col4']].agg(['min', 'max', 'sum'])

# choose specific columns
df1.groupby('col1').agg({'col2':'count'})

# use filter to count rows
df.groupby('col1').filter(lambda x: len(x) > 1)
#main-header #logo{
filter:invert(1)
}
#main-header.et-fixed-header #logo{
filter:none
}
function insertInBtwn(chars, d1, d2, insertion) {
  //to use splice to insert, you will need 4 things (the array to work on and 3 parameters):
  //  array of characters (chars)
  chars = chars.split("");
  //  the starting index (leftDelimIndex + 1)
  const leftDelimIndex = chars.indexOf(d1);
  const rightDelimIndex = chars.indexOf(d2);
  //  the range to delete (rightDelimIndex - leftDelimIndex - 1)
  //  the thing to insert (insertion)
  chars.splice(
    leftDelimIndex + 1,
    rightDelimIndex - leftDelimIndex - 1,
    insertion
  );
  return chars.join("");
}
<style>
  h4 {
    text-align: center;
  }
  p {
    text-align: justify;
  }
  .links {
    margin-right: 20px;
    text-align: left;
  }
  .fullCard {

    border: 1px solid #ccc;
    border-radius: 5px;
    margin: 10px 5px;
    padding: 4px;
  }
  .cardContent {
    padding: 10px;
  }
</style>
<div class="fullCard">
  <div class="cardContent">
    <div class="cardText">
      <h4>Google</h4>
      <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
    </div>
    <div class="cardLinks">
      <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
      <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
    </div>
  </div>
</div>
  "code-runner.executorMap": {
   "python": "\"$pythonPath\" $fullFileName",
   },
$ git clone --mirror https://bitbucket.org/aiida_team/aiida_core.git
$ cd aiida_core.git
$ git remote set-url --push origin git@github.com:giovannipizzi/aiida_core_test.git
$ git push --mirror
y should be in torch.int64 dtype without one-hot encoding. And CrossEntropyLoss() will auto encoding it with one-hot (while out is the probability distribution of prediction like one-hot format)
/**
 * Удалить/скрыть сообщение в админке апгрейд лицензии crocokoblock, чтобы не стало дороже по ошибке + premmerce
 */
function remove_error_license_nag_from_admin_page() {
    echo
    '<style>
		#adminmenu #toplevel_page_jet-dashboard a[href*="https://account.crocoblock.com/upgrade"], .upgrade-mode, .account, #adminmenu #toplevel_page_jet-dashboard a[href*="admin.php?page=jet-dashboard-license-page&subpage=license-manager"], .my_e_addon_update-actions, .my_e_addon_license_status__valid .my_e_addon_license_closed {
			display: none;
		}
	</style>';
}
add_action('admin_head', 'remove_error_license_nag_from_admin_page');
/**
 * Remove from admin top bar
 */
function wps_admin_bar() {
    global $wp_admin_bar;
	
    $wp_admin_bar->remove_node('rank-math');
	$wp_admin_bar->remove_node('wp-rocket');
}
add_action( 'wp_before_admin_bar_render', 'wps_admin_bar' );
/**
 * load child CSS
 */
function child_theme_styles() {
	wp_enqueue_style( 'child-css', get_stylesheet_uri());
	wp_enqueue_style( 'normalize', get_stylesheet_directory_uri() .'/normalize.css' );
}

add_action( 'wp_enqueue_scripts', 'child_theme_styles' );
/**
 * подключить child jQuery скрипт
 */
add_action( 'wp_enqueue_scripts', 'add_my_script' );
function add_my_script() {
    wp_register_script(
       'mastaklance-script', 
       get_stylesheet_directory_uri() . '/js/mastaklance.js', 
       array('jquery') 
    );

    wp_enqueue_script('mastaklance-script');
}
/**
 * Unload default Hello theme styles
 */
add_filter( 'hello_elementor_enqueue_style', '__return_false', 1 );
add_filter( 'hello_elementor_enqueue_theme_style', '__return_false', 1 );
/**
 * disable autoupdate
 */
// включить автоматические обновления тем
add_filter( 'auto_update_theme', '__return_true' );
// включить автоматические обновления переводов
add_filter( 'auto_update_translation', '__return_true' );
// отключить емайл-уведомления об установке новых версий
apply_filters( 'auto_core_update_send_email', '__return_false' );

// отключить автоматические обновления плагинов
add_filter( 'auto_update_plugin', '__return_false' );

// Отключить обновления всем, кроме администратора
function disable_updates() {
    global $wp_version;
    return (object) array( 'last_checked' => time(), 'version_checked' => $wp_version, );
}
 
add_action( 'init', function () {
    if ( ! current_user_can( 'administrator' ) ) {
        add_filter( 'pre_site_transient_update_core', 'disable_updates' );     // Disable WordPress core updates
        add_filter( 'pre_site_transient_update_plugins', 'disable_updates' );  // Disable WordPress plugin updates
        add_filter( 'pre_site_transient_update_themes', 'disable_updates' );   // Disable WordPress theme updates
    }
} );



or v2 > Script Organizer > Admin Only

/* ************************************ WP Auto Update disable ************************************* */
/**
 * disable autoupdate
 */
define( 'WP_AUTO_UPDATE_CORE', false );
add_filter( 'auto_update_plugin', '__return_false' );
add_filter( 'auto_update_theme', '__return_false' );

// disable to all except admin user
function restrict_excerpt_to_administrators() {
    if ( ! current_user_can( 'administrator' ) ) {
        remove_post_type_support( 'post', 'excerpt' );
    }
}
add_action( 'admin_init', 'restrict_excerpt_to_administrators' );

function disable_excerpt() {
    return '';
}
add_filter( 'excerpt_length', 'disable_excerpt' );
/**
 * disable image sizes
 */
function ml_disable_image_sizes($sizes) {
	
	unset($sizes['thumbnail']);    // disable thumbnail size
	unset($sizes['medium']);       // disable medium size
	unset($sizes['large']);        // disable large size
	unset($sizes['medium_large']); // disable medium-large size
	unset($sizes['1536x1536']);    // disable 2x medium-large size
	unset($sizes['2048x2048']);    // disable 2x large size
	return $sizes;
}
add_action('intermediate_image_sizes_advanced', 'ml_disable_image_sizes');

/**
 * Woocommerce archive "Properly size images" in mobile 
 */
function set_max_srcset_width( $max_width ) {
    if ( class_exists( 'WooCommerce' ) && ( is_product_category() || is_shop() ) ) {
        $max_width = 180;
    } else {
        $max_width = 768;
    }
    return $max_width;
}
add_filter( 'max_srcset_image_width', 'set_max_srcset_width' );


/**
 * disable scaled image size
 */
add_filter('big_image_size_threshold', '__return_false');

/**
 * disable other image sizes
 */
function ml_disable_other_image_sizes() {
	
	remove_image_size('post-thumbnail'); // disable images added via set_post_thumbnail_size() 
	remove_image_size('another-size');   // disable any other added image sizes
	
}
add_action('init', 'ml_disable_other_image_sizes');

/**
 * disable background auto regeneration
 */
add_filter( 'woocommerce_background_image_regeneration', '__return_false' );
/**
 * Remove google fonts from Elementor
 */
add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );

/**
 * Remove Font Awesome from Elementor
 */
add_action( 'elementor/frontend/after_register_styles',function() {
	foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
		wp_deregister_style( 'elementor-icons-fa-' . $style );
	}
}, 20 );

/**
 * Remove Eicons from Elementor
 */
add_action( 'wp_enqueue_scripts', 'js_remove_default_stylesheet', 20 );
function js_remove_default_stylesheet() {
  
  // Don't remove it in the backend
  if ( is_admin() || current_user_can( 'manage_options' ) ) {
        return;
  }
	wp_deregister_style( 'elementor-icons' );
}
/**
 * disable lazy loading in WordPress 5.5+
 */
add_filter( 'wp_lazy_loading_enabled', '__return_false' );
star

Mon Jan 03 2022 16:32:33 GMT+0000 (Coordinated Universal Time) https://github.com

@Abidur_Rahman43

star

Mon Jan 03 2022 17:07:06 GMT+0000 (Coordinated Universal Time) https://github.com/damonbauer/npm-build-boilerplate

@erinksmith

star

Mon Jan 03 2022 17:53:51 GMT+0000 (Coordinated Universal Time) https://www.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/

@erinksmith

star

Mon Jan 03 2022 17:59:16 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/why-npm-scripts/

@erinksmith

star

Mon Jan 03 2022 18:54:49 GMT+0000 (Coordinated Universal Time) https://github.com/GoogleChrome/web-vitals

@erinksmith

star

Mon Jan 03 2022 19:00:09 GMT+0000 (Coordinated Universal Time) https://web.dev/vitals/

@erinksmith

star

Mon Jan 03 2022 19:05:58 GMT+0000 (Coordinated Universal Time) https://developers.google.com/web/tools/chrome-user-experience-report

@erinksmith

star

Mon Jan 03 2022 19:08:05 GMT+0000 (Coordinated Universal Time) https://css-tricks.com/aspect-ratio-boxes/

@erinksmith

star

Mon Jan 03 2022 19:08:17 GMT+0000 (Coordinated Universal Time) https://web.dev/optimize-cls/

@erinksmith

star

Mon Jan 03 2022 20:24:04 GMT+0000 (Coordinated Universal Time) https://wordpress.stackexchange.com/questions/1216/changing-the-order-of-admin-menu-sections/1222#1222

@trinitybranding

star

Mon Jan 03 2022 21:32:28 GMT+0000 (Coordinated Universal Time)

@shadowtek

star

Mon Jan 03 2022 22:03:27 GMT+0000 (Coordinated Universal Time) https://web.dev/fast/

@erinksmith

star

Mon Jan 03 2022 22:24:51 GMT+0000 (Coordinated Universal Time) https://web.dev/codelab-preload-web-fonts/

@erinksmith

star

Mon Jan 03 2022 22:25:25 GMT+0000 (Coordinated Universal Time) https://web.dev/codelab-avoid-invisible-text/

@erinksmith

star

Tue Jan 04 2022 06:37:19 GMT+0000 (Coordinated Universal Time)

@shadow337

star

Tue Jan 04 2022 07:19:15 GMT+0000 (Coordinated Universal Time) http://localhost:8888/notebooks/CV/02-Image-Processing/Untitled.ipynb

@sinhhungf

star

Tue Jan 04 2022 08:34:39 GMT+0000 (Coordinated Universal Time)

@ahoeweler

star

Tue Jan 04 2022 08:37:40 GMT+0000 (Coordinated Universal Time)

@ahoeweler

star

Tue Jan 04 2022 09:17:23 GMT+0000 (Coordinated Universal Time)

@broulet

star

Tue Jan 04 2022 09:18:35 GMT+0000 (Coordinated Universal Time)

@broulet

star

Tue Jan 04 2022 10:02:22 GMT+0000 (Coordinated Universal Time)

@ahoeweler

star

Tue Jan 04 2022 11:10:32 GMT+0000 (Coordinated Universal Time) https://github.com/hapifhir/hapi-fhir-jpaserver-starter

@venu9l

star

Tue Jan 04 2022 11:17:57 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/copy-text-to-clipboard-with-line-breaks/5c2917f164936a00141e1c03

@BrunoCookie

star

Tue Jan 04 2022 11:36:28 GMT+0000 (Coordinated Universal Time)

@broulet

star

Tue Jan 04 2022 11:37:13 GMT+0000 (Coordinated Universal Time)

@broulet

star

Tue Jan 04 2022 11:37:47 GMT+0000 (Coordinated Universal Time)

@broulet

star

Tue Jan 04 2022 11:43:26 GMT+0000 (Coordinated Universal Time)

@broulet

star

Tue Jan 04 2022 12:18:31 GMT+0000 (Coordinated Universal Time) https://wordpress.org/plugins/menu-in-menu/

@trinitybranding

star

Tue Jan 04 2022 12:54:56 GMT+0000 (Coordinated Universal Time) https://github.com/abhishekkrthakur/captcha-recognition-pytorch/blob/5f9dacd7d8f3a4594a137526abf629c27fe52c8d/train.py

@yazansayed

star

Tue Jan 04 2022 13:03:09 GMT+0000 (Coordinated Universal Time)

@ahoeweler

star

Tue Jan 04 2022 13:17:33 GMT+0000 (Coordinated Universal Time)

@NyanCat

star

Tue Jan 04 2022 15:37:44 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/60487217/how-to-disable-the-hover-effect-of-vuetify-data-tables

@arielvol

star

Tue Jan 04 2022 15:54:50 GMT+0000 (Coordinated Universal Time)

@ahoeweler

star

Tue Jan 04 2022 17:36:21 GMT+0000 (Coordinated Universal Time)

@hermann

star

Tue Jan 04 2022 17:56:03 GMT+0000 (Coordinated Universal Time)

@shadow337

star

Tue Jan 04 2022 20:47:21 GMT+0000 (Coordinated Universal Time)

@kariri

star

Tue Jan 04 2022 20:48:11 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/news/create-react-app-npm-scripts-explained/

@erinksmith

star

Wed Jan 05 2022 00:51:03 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/50966876/vs-code-code-runner-doesnt-work-with-virtualenvs

star

Wed Jan 05 2022 04:57:00 GMT+0000 (Coordinated Universal Time) https://ourcodeworld.com/articles/read/505/how-to-disable-autocompletion-and-intellisense-in-microsoft-visual-studio-code

star

Wed Jan 05 2022 06:58:54 GMT+0000 (Coordinated Universal Time) https://gist.github.com/lsloan/ce704da0d62ce3808dbc12e5a37ba8fc

@pirate

star

Wed Jan 05 2022 07:49:37 GMT+0000 (Coordinated Universal Time)

@mastaklance

star

Wed Jan 05 2022 07:51:07 GMT+0000 (Coordinated Universal Time)

@mastaklance

star

Wed Jan 05 2022 07:51:46 GMT+0000 (Coordinated Universal Time)

@mastaklance

star

Wed Jan 05 2022 07:53:16 GMT+0000 (Coordinated Universal Time)

@mastaklance

star

Wed Jan 05 2022 07:54:41 GMT+0000 (Coordinated Universal Time)

@mastaklance

star

Wed Jan 05 2022 07:56:52 GMT+0000 (Coordinated Universal Time)

@mastaklance

star

Wed Jan 05 2022 07:59:06 GMT+0000 (Coordinated Universal Time)

@mastaklance

star

Wed Jan 05 2022 08:00:00 GMT+0000 (Coordinated Universal Time)

@mastaklance

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension