Skip to content

Instantly share code, notes, and snippets.

View mlbd's full-sized avatar
🏠
Working from home

Mohammad Limon mlbd

🏠
Working from home
View GitHub Profile
/**
* Custom excerpt
*
* @since 1.0
*
* @uses get_queried_object()
*
* @see get_the_ID()
*
# PHP 5.3+ anonymous function
add_action( 'widgets_init', function() {
register_widget( 'Sample_Widget_SO_19246434' );
});
class Sample_Widget_SO_19246434 extends WP_Widget
{
function __construct() {
parent::__construct(
{
"cmd": [
"sass", "--update", "--watch", "$file:${file_path}/../css/${file_base_name}.css", "--sourcemap=none", "--stop-on-error", "--no-cache", "--style", "expanded",
"&",
"sass", "--update", "$file:${file_path}/../css/${file_base_name}.min.css", "--stop-on-error", "--no-cache", "--style", "compressed"
],
"selector": "source.sass, source.scss",
"line_regex": "Line ([0-9]+):",
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text]
@="Edit with &Sublime Text"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"
"MuiVerb"="Edit with Sublime Text"
[HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text\command]
@="C:\\Program Files\\Sublime Text 3\\sublime_text.exe \"%1\""
@mlbd
mlbd / SASS - Both.sublime-build
Created February 22, 2018 09:58 — forked from dropddesigns/SASS - Both.sublime-build
SASS Build script to build both uncompressed and compress CSS files
{
"cmd": [
"sass", "--update", "--watch", "$file:${file_path}/${file_base_name}.css", "--sourcemap=none", "--stop-on-error", "--no-cache", "--style", "expanded",
"&",
"sass", "--update", "$file:${file_path}/${file_base_name}.min.css", "--stop-on-error", "--no-cache", "--style", "compressed"
],
"selector": "source.sass, source.scss",
"line_regex": "Line ([0-9]+):",
@mlbd
mlbd / SublimeOnSaveBuild.sublime-settings
Created February 22, 2018 09:08 — forked from jawinn/SublimeOnSaveBuild.sublime-settings
Regex to ignore SASS / LESS partials (files starting with underscore) from being built by SublimeOnSaveBuild
// UPDATED VERSION
{
"filename_filter": "(/|\\\\|^)(?!_)(\\w+)\\.(css|js|sass|less|scss)$",
"build_on_save": 1
}
// DEFAULT (for reference, in case you need it back)
{
"filename_filter": "\\.(css|js|sass|less|scss)$",
"build_on_save": 1
function widget( $args, $instance ) {
extract( $args );
... //other code
$widget_width = !empty($instance['widget_width']) ? $instance['widget_width'] : "col300";
/* Add the width from $widget_width to the class from the $before widget */
// no 'class' attribute - add one with the value of width
if( strpos($before_widget, 'class') === false ) {
// include closing tag in replace string
$before_widget = str_replace('>', 'class="'. $widget_width . '">', $before_widget);
@mlbd
mlbd / Modify $before_widget from Widget Class
Last active February 14, 2018 08:12
Add different class every second and third in WordPress Widget
/**
* Modify before_widget from Widget Class
*/
if ( !function_exists( 'pixicleaner_filter_dynamic_sidebar_params' ) ) :
function pixicleaner_filter_dynamic_sidebar_params($params){
static $sidebar_widget_count = array();
$sidebar_id = $params[0]["id"];
if ( $sidebar_id == 'pixicleaner_footer_widgets' ) :