Snippets Collections
# install docker

 $ wget -nv -O - https://get.docker.com/ | sh

 # setup dokku apt repository

 $ wget -nv -O - https://packagecloud.io/dokku/dokku/gpgkey | apt-key add -

 $ export SOURCE="https://packagecloud.io/dokku/dokku/ubuntu/"

 $ export OS_ID="$(lsb_release -cs 2>/dev/null || echo "bionic")"

 $ echo "bionic focal" | grep -q "$OS_ID" || OS_ID="bionic"

 $ echo "deb $SOURCE $OS_ID main" | tee /etc/apt/sources.list.d/dokku.list

 $ apt-get update

 # install dokku

 $ apt-get install dokku

 $ dokku plugin:install-dependencies --core # run with root!

 # Configure your server domain via `dokku domains:set-global`

 # and user access (via `dokku ssh-keys:add`) to complete the installation
<script> 
jQuery(document).ready(function($) { 
var delay = 100; setTimeout(function() { 
jQuery('.elementor-tab-title').removeClass('elementor-active');
jQuery('.elementor-tab-content').css('display', 'none'); }, delay); 
}); 
</script>
df['SettlementDate'] = pd.TimedeltaIndex(df['SettlementDate'], unit='d') + dt.datetime(1900,1,1)
// THE HTML/PHP

// Categories Nav START
<? $terms = get_terms( array(
    'taxonomy' => 'category-name', // <-- update this
    'orderby' => 'ID',
  )); 
  if ( $terms && !is_wp_error( $terms ) ){ ?>
   <ul class="CHANGEME-categories-nav">
      <? foreach( $terms as $term ) { ?>
        <li id="cat-<?php echo $term->term_id; ?>">
           <a href="#" class="<?= $term->slug; ?> ajax" data-term-number="<?= $term->term_id; ?>" title="<?= $term->name;?>"><?= $term->name; ?></a>
        </li>
      <? } ?>
   </ul>
<? } ?>
// Categories Nav END
                                       
// Results Container START
<div id="CHANGEME-results-container" class="CHANGEME-filter-result">
   <? // post query
     $query = new WP_Query( array(
        'post_type' => 'post-name', // <-- update this
        'posts_per_page' => -1,
      ) ); 
   if( $query->have_posts() ): while( $query->have_posts()): $query->the_post(); ?>
    
      // POST TEMPLATE HERE
    
   <? endwhile; endif; wp_reset_query(); ?>
</div>                      
// Results Container END

// The onpage JS for the page template
<script>
(function($) {
        'use strict';
        function cat_ajax_get(catID) {
            jQuery.ajax({
                type: 'POST',
                url: raindrop_localize.ajaxurl,
                data: {"action": "filter", cat: catID },
                success: function(response) {
                    jQuery("#CHANGEME-results-container").html(response);
                    return false;
                }
            });
        }
        $( ".CHANGEME-categories-nav a.ajax" ).click(function(e) {
            e.preventDefault();
            $("a.ajax").removeClass("current");
            $(this).addClass("current"); //adds class current to the category menu item being displayed so you can style it with css
            var catnumber = $(this).attr('data-term-number');
            cat_ajax_get(catnumber);
        });

    })(jQuery);
</script>
                                       
// Callback function for functions.php or some other functions specific php file like theme.php
// Aside from the inital add actions and a few other things, the actual query and post template should be the same as what is on the page.
                                       
add_action( 'wp_ajax_nopriv_filter', 'CHANGEME_cat_posts' );
add_action( 'wp_ajax_filter', 'CHANGEME_cat_posts' );
                                       
function CHANGEME_cat_posts () {
    $cat_id = $_POST[ 'cat' ];
    $args = array (
	  'tax_query' => array(
		    array(
		      'taxonomy' => 'category-name', // <-- update this
		      'field' => 'term_id',
		      'terms' => array( $cat_id )
		    )
		  ),
	    'post_type' => 'post-name', // <-- update this
	    'posts_per_page' => -1,
	  );
	global $post;
    $posts = get_posts( $args );
    ob_start ();
    foreach ( $posts as $post ) { 
	    setup_postdata($post); ?>

	    // POST TEMPLATE HERE

   <?php } wp_reset_postdata();
   $response = ob_get_contents();
   ob_end_clean();
   echo $response;
   die(1);
}
const mongoose = require("mongoose");

const validId = (id) => {
  return mongoose.Types.ObjectId.isValid(id);
};

module.exports = validId;
docker ps //List running containers
docker ps --all //List all containers
docker system prune //Remove unused data
docker system prune --all //Remove all unused images not just dangling ones
docker run {IMAGE} //combining 'docker create' & 'docker start'
docker run -d {IMAGE} // Run container in background and print container ID
docker run -p {systemport}:{dockerport} {IMAGE} // Map Port of the OS to the dockerport
docker run -it {IMAGE} //Input output
docker run -it {IMAGE} sh //Run docker container and shell into it
docker exec -it {IMAGE} sh //Shell into running docker container
docker build . //Build docker image with random id 
docker build -t {REPO}/{TAGNAME}. //Build docker image with random id 
docker stop {IMAGE} //Stop container from running

docker-compose up //Execute docker compose
docker-compose up --build // Rebuild Docker container and execute docker compose
docker-compose -d {IMAGE} // Run container in background and print container ID
docker-compose down //Stop container from running
                Container(
                  height: SizeConfig.safeBlockVertical * 24,
                  width: SizeConfig.safeBlockHorizontal * 45,
                  padding: EdgeInsets.only(
                      left: SizeConfig.safeBlockHorizontal * 5,
                      right: SizeConfig.safeBlockHorizontal * 4,
                      bottom: SizeConfig.safeBlockVertical * 2),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      color: Colors.white,
                      gradient: RadialGradient(
                          focalRadius: 100,
                          radius: 1.5,
                          center: Alignment.bottomLeft,
                          colors: [
                            colorStyles["maslowGreen"]!.withOpacity(0.65),
                            colorStyles["maslowGreen"]!.withOpacity(0.65),
                          ],
                          stops: [
                            0.0,
                            1.0
                          ])),
                  child: _collectionName(),
                ),
# WSL2 network port forwarding script v1
#   for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
#   for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
#   written by Daehyuk Ahn, Aug-1-2020

# Display all portproxy information
If ($Args[0] -eq "list") {
    netsh interface portproxy show v4tov4;
    exit;
} 

# If elevation needed, start new process
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
  # Relaunch as an elevated process:
  Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path),"$Args runas" -Verb RunAs
  exit
}

# You should modify '$Ports' for your applications 
$Ports = (22,80,443,8080)

# Check WSL ip address
wsl hostname -I | Set-Variable -Name "WSL"
$found = $WSL -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if (-not $found) {
  echo "WSL2 cannot be found. Terminate script.";
  exit;
}

# Remove and Create NetFireWallRule
Remove-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock';
if ($Args[0] -ne "delete") {
  New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Outbound -LocalPort $Ports -Action Allow -Protocol TCP;
  New-NetFireWallRule -DisplayName 'WSL 2 Firewall Unlock' -Direction Inbound -LocalPort $Ports -Action Allow -Protocol TCP;
}

# Add each port into portproxy
$Addr = "0.0.0.0"
Foreach ($Port in $Ports) {
    iex "netsh interface portproxy delete v4tov4 listenaddress=$Addr listenport=$Port | Out-Null";
    if ($Args[0] -ne "delete") {
        iex "netsh interface portproxy add v4tov4 listenaddress=$Addr listenport=$Port connectaddress=$WSL connectport=$Port | Out-Null";
    }
}

# Display all portproxy information
netsh interface portproxy show v4tov4;

# Give user to chance to see above list when relaunched start
If ($Args[0] -eq "runas" -Or $Args[1] -eq "runas") {
  Write-Host -NoNewLine 'Press any key to close! ';
  $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
}
{
    // Debugger Tool for Firefox has to be installed: https://github.com/firefox-devtools/vscode-firefox-debug
    // And Remote has to be enabled: https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_Desktop#enable_remote_debugging
    "version": "0.2.0",
    "configurations": [
        {
            "type": "firefox",
            "request": "launch",
            "name": "Launch Firefox against localhost",
            "url": "http://localhost:3000",
            "webRoot": "${workspaceFolder}",
            "enableCRAWorkaround": true,
            "reAttach": true,
            "reloadOnAttach": true,
            "reloadOnChange": {
                "watch": "${workspaceFolder}/**/*.ts",
                "ignore": "**/node_modules/**"
            }
        }
    ]
}
const sessionMiddleware = expressSession({
    secret: 'Tecky Academy teaches typescript',
    resave:true,
    saveUninitialized:true,
    cookie:{secure:false}
});

app.use(sessionMiddleware);

io.use((socket,next)=>{
    let req = socket.request as express.Request
    let res = req.res as express.Response
    sessionMiddleware(req, res, next as express.NextFunction
});
//...
io.on('connection', function (socket) {
    // You can set any values you want to session here.
    const req = socket.request as express.Request;
    req.session['key'] = 'XXX';
    // There is no auto save for session.
    socket.request.session.save();

    // You can also send data using socket.emit() although it is not very useful
    socket.emit('any-key','values');
    socket.on("disconnect",()=>{
        //... rest of the code
    })
});
User::chunk(100, function ($users) {
  foreach ($users as $user) {
    $some_value = ($user->some_field > 0) ? 1 : 0;
    // might be more logic here
    $user->update(['some_other_field' => $some_value]);
  }
});
flutter build web --web-renderer canvaskit --release
flutter build web --web-renderer html --release
flutter build web --release (auto)
trigger AccountTrigger on Account (before insert) {

      if(Trigger.isInsert && Trigger.isBefore) {

        
        List<Account> myList = new List<Account>();

        for(Account acct : Trigger.new){
          if(acct.name == 'My Test Account'){
           acct.AnnualRevenue = 0;
           myList.add(acct);
          }
        }

        if(myList.size() >= 0){
          insert myList;
        }
      }   
}
// prevents hackers from getting your username by using ?author=1 at the end of your domain url 
// ==============================================================================
add_action('template_redirect', computec_template_redirect);
function computec_template_redirect() {
    if (is_author()) {
        wp_redirect( home_url() ); exit;
    }
}
Normal Version: 
echo 'nice12343game' | sed -n 's/nice\(.*\)game/\1/p'

Jenkins Version:
sed -n 's/.*exited with code \\(.*\\)/\\1/p' stdout
//Array of strings
var names = ["John", "Paul" , "Erica"];

//Arrays of number
var numbers = [1,2,3];
AlertDialog.Builder builder = new AlertDialog.Builder(context);
...
...
AlertDialog dialog = builder.create();

ColorDrawable back = new ColorDrawable(Color.TRANSPARENT);
InsetDrawable inset = new InsetDrawable(back, 20);
dialog.getWindow().setBackgroundDrawable(inset);

dialog.show();
# ----- Skip Status checks -----
# For all repos
git config --global --add oh-my-zsh.hide-status 1
# For current repo
git config --add oh-my-zsh.hide-status 1

# ----- Skip dirty checks -----
# For all repos
git config --global --add oh-my-zsh.hide-dirty 1
# For current repo
git config --add oh-my-zsh.hide-dirty 1
more: https://gist.github.com/endolith/157796

ಠ_ಠ
( ͡° ͜ʖ ͡°)
¯\_(ツ)_/¯
(╯°□°)╯︵ ┻━┻ 

http://www.fileformat.info/convert/text/upside-down.htm

ಠ_ಠ [disapprove]
Ծ_Ծ [disapprove]
ಠ~ಠ [hrm…]
ఠ_ఠ [o rly?]
ಠ_ರೃ [dignified]
ಠ_ృ [dignified]
ಠ╭╮ಠ [frown]
◔_◔ [rolling eyes]
𝄇⥀.⥀𝄆 [rolling eyes]
⊙_ʘ [crazy/wonky]
◴_◶ [herp derp]
◕ ◡ ◕ [smile]
(๏̯͡๏﴿ [sad]
(͡๏̯͡๏) [sad]
◔̯◔ [sad]
⊙︿⊙ [sad]
◕︵◕ [sad]
●︵• [sad]
◉︵◉ [really sad]
ಡ_ಡ [misty eyes]
ಥ_ಥ [crying]
ಢ_ಢ [crying]
ಢ_ಥ [heavily distraught]
⊙﹏⊙ [embarrassed]
( ゚o゚) [surprised]
⋋_⋌ [frustrated]
〴⋋_⋌〵[angry]
ಠ益ಠ [rage]
ヽ(`Д´)ノ [raging] ‎(ノ≥∇≤)ノ [raging]
(︶ε︶メ) [deep breaths]
˚▱˚ [gasp]
⊙▂⊙ [gasp]
⊙▃⊙ [bigger gasp]
(ΘεΘ;) [nervous]
(゚ヮ゚) [happy]
〓D [happy]
(´ー`) [content]
(´▽`) [haha]
(゚*゚) [pucker]
(。・_・。) [blush]
♥╭╮♥ [lovesick]
≖◡ಎ≖ [devious]
(///_ಥ) [injured]
(≥_<) [black eye]
ʕʘ‿ʘʔ [doofy]
:-þ [silly]
:^Þ
¯\_(ツ)_/¯ [lol i dunno]
ヘ(◕。◕ヘ) [ballin]
๏_๏ [stare]
◉_◉
ਉ_ਉ [tired]
☼_☼ [bulging|bloodshot]
♨_♨ [CAN’T UNSEE] ☯‿☯ [peace]
(゚ー゚) [cool]
(• ε •) [sheepish]
(`・ω・´)
¬_¬ [glare]
ಸ_ಸ
ↁ_ↁ
ಆ_ಆ
ಊ_ಊ
ಹ_ಹ
ㅎ_ㅎ
【•】_【•】[woah]
(ு८ு_ .:)
(づ。◕‿‿◕。)づ [hug]
(/◔ ◡ ◔)/ [hug]
٩(̾●̮̮̃̾•̃̾)۶ [celebrate]
\(• ◡ •)/ [celebrate]
\( ゚◡゚)/ [celebrate]
⊂(◉‿◉)つ [wave]
ح˚௰˚づ [wave]
╚(•⌂•)╝ [stop]
☜-(ΘLΘ)-☞ [which way?]
☜。◕‿◕。☞
(✌゚∀゚)☞ [point and laugh]
щ(゚Д゚щ) [Dear god why‽]
ლ(ಠ_ಠ ლ) [settle down]
◖|◔◡◉|◗ [HURR DURR]
( ‘-’)人(゚_゚ ) [high-five]
( _)=mm=(^_^ ) [brofist]
(>'o’)> ♥ <('o’<)
⎝⏠⏝⏠⎠ [content]
( ´_⊃`)[content]
(Ō_ƆŎ) [eyebrow raised]
≖_≖ [I see what you did there…]
\|  ̄ヘ ̄|/ [praise me]
̿’ ̿’\̵͇̿̿\з=(•̪●)=ε/̵͇̿̿/’̿’̿ [big guns]
< ('o'<) ( '-’ ) (>‘o’)> v( ‘.’ )v < (' .' )> < ('.'<) ( '.’ ) (>‘.’)> v( ‘.’ )v < (' .' )> [dancing]
♪┏(・o・)┛♪┗ ( ・o・) ┓♪┏ ( ) ┛♪┗ (・o・ ) ┓♪┏(・o・)┛♪ [singing/dancing]
Ƹ̵̡Ӝ̵̨̄Ʒ [butterfly]
/╲/\╭ºoꍘoº╮/\╱\ [spider]
(* ・(エ)・ *) [pedobear?]
(\/) (°,,°) (\/) [WOOPwoopwoopwoopwoop]
⊛ठ̯⊛ [bicycle… face?]
ತಟತ [buttface]
’;‘ [scream]
/:€ [Myth busted!]
˚⌇˚ [squirm]
ಈ_ಈ [eyes tied shut] (wat?)
ⓧ_ⓧ [x]
⨂_⨂ [x]
✖_✖ [x]
×̯× [x]
‹•.•›
•ﺑ• [oooh]
(० ्०)
ôヮô
¢‿¢
!⑈ˆ~ˆ!⑈
•(⌚_⌚)• [late]
(▰˘◡˘▰)
۹ↁﮌↁ
乂◜◬◝乂
ತ_ಎತ
ಠﭛಠ [goatee]
⏠⏝⏠
⇎_⇎
흫_흫
句_句
໖_໖
༺‿༻
ಠ , ಥ
१✌◡✌५
१|˚–˚|५
โ๏௰๏ใ ื
◜㍕◝
◷_௰◴
◎ܫ◎
(˚ㄥ_˚)
(˚இ˚)
ộ_ộ
◘_◘ 
◙‿◙
δﺡό
⊂•⊃_⊂•⊃
ح˚ᆺ˚ว
❂‿❂ 
❐‿❑
☾˙❀‿❀˙☽ 
(ΘL_Θ)
●¿_●
《〠_〠》 [f*ck yeah]
حᇂﮌᇂ) [f*ck yeah]
ಠ︵ಠ凸 [f* u]
┌∩┐(>_<)┌∩┐ [f* u]
‹^› ‹(•¿•)› ‹^› [f* u]
✄————- [scissors]
╰▄︻▄╯ [YEAAAAAAHHH]
▄︻┻┳═一 [rifle]
(̅_̅_̅_̅(̅_̅_̅_̅_̅_̅_̅̅_̅()ڪے [cigarette]
( ̲̅:̲̅:̲̅:̲̅[̲̅ ̲̅]̲̅:̲̅:̲̅:̲̅) [band-aid]
ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡̡̡̡ [house]
lıllı ((((|̲̅̅●̲̅̅|̲̅̅=̲̅̅|̲̅̅●̲̅̅|)))) ıllı [boombox]
┣▇▇▇═── [needle]
┣▇▇▇═─────────── [*whimper]
╰☆╮ [spinning killblade]
ϟ [Potter]
ಠ_ಠ
<!-- use enctype -->
<form  action="/route" method="POST" enctype="multipart/form-data">
function App() {
  const [checked, setChecked] = useState(false);
  const toggleChecked = () => setChecked(value => !value);
  return (
    <input
      type="checkbox"
      checked={checked}
      onChange={toggleChecked}
    />
  );
}
Function Ping(strip)
Dim objshell, boolcode
Set objshell = CreateObject("Wscript.Shell")
boolcode = objshell.Run("ping -n 1 -w 1000 " & strip, 0, True)
If boolcode = 0 Then
    Ping = True
Else
    Ping = False
End If
End Function
Sub PingSystem()
Dim strip As String
Dim strPhoneNumber As String
Dim strMessage As String
Dim strPostData As String
Dim IE As Object

strPhoneNumber = Sheets("DATA").Cells(2, 1).Value

For introw = 2 To ActiveSheet.Cells(65536, 2).End(xlUp).Row
    strip = ActiveSheet.Cells(introw, 2).Value
    If Ping(strip) = True Then
        ActiveSheet.Cells(introw, 3).Interior.ColorIndex = 0
        ActiveSheet.Cells(introw, 3).Font.Color = RGB(0, 0, 0)
        ActiveSheet.Cells(introw, 3).Value = "Online"
        Application.Wait (Now + TimeValue("0:00:01"))
        ActiveSheet.Cells(introw, 3).Font.Color = RGB(0, 200, 0)
        
'Send Whatsapp Message
        strMessage = "Ping " & ActiveSheet.Cells(introw, 1).Value & " " & ActiveSheet.Cells(introw, 2).Value & " is Online"
        
'IE.navigate "whatsapp://send?phone=phone_number&text=your_message"
        strPostData = "whatsapp://send?phone=" & strPhoneNumber & "&text=" & strMessage
        Set IE = CreateObject("InternetExplorer.Application")
        IE.navigate strPostData
        Application.Wait Now() + TimeSerial(0, 0, 3)
        SendKeys "~"

        Set IE = Nothing
        
    Else
        ActiveSheet.Cells(introw, 3).Interior.ColorIndex = 0
        ActiveSheet.Cells(introw, 3).Font.Color = RGB(200, 0, 0)
        ActiveSheet.Cells(introw, 3).Value = "Offline"
        Application.Wait (Now + TimeValue("0:00:01"))
        ActiveSheet.Cells(introw, 3).Interior.ColorIndex = 6
        
'Send Whatsapp Message
        strMessage = "Ping " & ActiveSheet.Cells(introw, 1).Value & " " & ActiveSheet.Cells(introw, 2).Value & " is Offline"
        
'IE.navigate "whatsapp://send?phone=phone_number&text=your_message"
        strPostData = "whatsapp://send?phone=" & strPhoneNumber & "&text=" & strMessage
        Set IE = CreateObject("InternetExplorer.Application")
        IE.navigate strPostData
        Application.Wait Now() + TimeSerial(0, 0, 3)
        SendKeys "~"
        Set IE = Nothing
    End If
Next
End Sub
pivot_longer(
  data,
  cols,
  names_to = "name",
  names_prefix = NULL,
  names_sep = NULL,
  names_pattern = NULL,
  names_ptypes = list(),
  names_transform = list(),
  names_repair = "check_unique",
  values_to = "value",
  values_drop_na = FALSE,
  values_ptypes = list(),
  values_transform = list(),
  ...
)
{#await promise}
	<!-- promise is pending -->
	<p>waiting for the promise to resolve...</p>
{:then value}
	<!-- promise was fulfilled -->
	<p>The value is {value}</p>
{:catch error}
	<!-- promise was rejected -->
	<p>Something went wrong: {error.message}</p>
{/await}
<?php
function support_init() {
  $labels = array(
    'name'          => _x('Support', 'post type general name', 'engine'),
    'menu_name'     => _x('Support', 'admin menu', 'engine'),
  );

  $args = array(
    'labels'             => $labels,
    'public'             => true, //false for disable single page and permalink
    'publicly_queryable' => true, //false for disable single page and permalink
    'has_archive'        => false, // true for create archive page
    'show_ui'            => true,
    'show_in_menu'       => true,
    'query_var'          => true,
    'rewrite'            => array('slug' => 'support', 'with_front'=> false),
    //'with_front'=> false for ignore wordpress permalink settings in post url (if we want diffrent permalink structure than regular blog)
    'capability_type'    => 'post', // page, post
    'hierarchical'       => false,
    'menu_position'      => 5,
    'menu_icon'          => 'dashicons-admin-tools',
    'supports'           => array('title', 'editor', 'thumbnail', 'author', 'revisions' 'excerpt', 'comments'),
  );
  register_post_type('support', $args);
}
add_action('init', 'support_init');


/* REGISTER TAXONOMY */
function support_taxonomies() {
	$labels = array(
		'name' => _x('Categories', '', 'engine'),
		'singular_name' => _x('Categories', '', 'engine'),
		'menu_name' => __('Categories', 'engine'),
	);
	$args = array(
		'hierarchical' => true,
		'labels' => $labels,
		'show_ui' => true,
		'show_admin_column' => true,
		'query_var' => true,
		'rewrite' => array('slug' => 'support_cat', 'with_front'=> false),
      	//'with_front'=> false for ignore wordpress permalink pettings in category url
	);
	register_taxonomy('support_cat', 'support', $args);
}
add_action('init', 'support_taxonomies', 0);


/* OPTIONAL: CUSTOM TAXONOMY SLUG URL */
// show category name for CPT in single post url

function support_taxonomy_slug_link( $post_link, $id = 0 ){
    $post = get_post($id);
    if ( is_object( $post ) ){
        $terms = wp_get_object_terms( $post->ID, 'support_cat' );
        if( $terms ){
            return str_replace( '%support_cat%' , $terms[0]->slug , $post_link );
        }
    }
    return $post_link;
}
add_filter( 'post_type_link', 'support_taxonomy_slug_link', 1, 3 );

// then change rewrite in function support_init() for this and will show /support/category_name/post_name
'rewrite' => array('slug' => 'support/%support_cat%'),
# load packages
require(FactoMineR)
require(ggplot2)
# load data tea
data(tea)
# select these columns
newtea = tea[, c("Tea", "How", "how", "sugar", "where", "always")]
# take a look
head(newtea)


# number of categories per variable
cats = apply(newtea, 2, function(x) nlevels(as.factor(x)))
cats

# apply MCA
mca1 = MCA(newtea, graph = FALSE)

# table of eigenvalues
mca1$eig


# data frames for ggplot
mca1_vars_df = data.frame(mca1$var$coord, Variable = rep(names(cats), 
                                                         cats))
mca1_obs_df = data.frame(mca1$ind$coord)

# plot of variable categories
ggplot(data = mca1_vars_df,
       aes(x = Dim.1, y = Dim.2, label = rownames(mca1_vars_df))) + 
  geom_hline(yintercept = 0, colour = "gray70") + geom_vline(xintercept = 0, 
                                              colour = "gray70") +
  geom_text(aes(colour = Variable)) + 
  ggtitle("MCA plot of variables using R package FactoMineR")


# XXX ---------------------------------------------------------------------

Base_acm <- Base %>% select(P1_1, P3_1, P3_2, P3_3)
Base_acm$P1_1 <- as.factor(Base_acm$P1_1)
Base_acm$P3_1 <- as.factor(Base_acm$P3_1)
Base_acm$P3_2 <- as.factor(Base_acm$P3_2)
Base_acm$P3_3 <- as.factor(Base_acm$P3_3)

cats=apply(Base_acm, 2, function(x) nlevels(as.factor(x)))

mca2 = MCA(Base_acm, graph = FALSE)

# data frames for ggplot
mca2_vars_df = data.frame(mca2$var$coord, Variable = rep(names(cats), 
                                                         cats))
mca2_obs_df = data.frame(mca2$ind$coord)

# plot of variable categories
ggplot(data = mca2_vars_df,
       aes(x = Dim.1, y = Dim.2, label = rownames(mca2_vars_df))) + 
  geom_hline(yintercept = 0, colour = "gray70") + geom_vline(xintercept = 0, 
                                                        colour = "gray70") +
  geom_text(aes(colour = Variable)) + 
  ggtitle("MCA plot of variables using R package FactoMineR")

factoextra::fviz_screeplot(mca2, addlabels = TRUE, ylim = c(0, 45))
function cw_custom_checkbox_fields( $checkout ) {
        echo '<div class="cw_custom_class"><h3>'.__('אישור דיוור: ').'</h3>';
        woocommerce_form_field( 'custom_checkbox', array(
            'type'          => 'checkbox',
            'label'         => __('אני מאשר\ת את הדיוור.'),
            'required'  => false,
        ), $checkout->get_value( 'custom_checkbox' ));
        echo '</div>';
    }
//*****---  Remove Eicons:  ---*****
//==========================
add_action( 'wp_enqueue_scripts', 'remove_default_stylesheet', 20 ); 
function remove_default_stylesheet() { 
	wp_deregister_style( 'elementor-icons' ); 
}
//******--- Remove Font Awesome ---*****
//===============================
add_action( 'elementor/frontend/after_register_styles',function() {
	foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
		wp_deregister_style( 'elementor-icons-fa-' . $style );
	}
}, 20 );
qs = df['Quarter'].str.replace(r'(Q\d) (\d+)', r'\2-\1')
qs

0    1996-Q3
1    1996-Q4
2    1997-Q1
Name: Quarter, dtype: object

df['date'] = pd.PeriodIndex(qs, freq='Q').to_timestamp()
df

   Quarter       date
0  Q3 1996 1996-07-01
1  Q4 1996 1996-10-01
2  Q1 1997 1997-01-01
///LIBRARIES & SPECIFIC PARAMETERS
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
#include <U8g2lib.h>

Adafruit_PWMServoDriver servo = Adafruit_PWMServoDriver(0x40);  //ServoMotor Driver Controller I2C Address
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); //OLED Constructor

//- - - - VARIABLES & METHODS - - - -//

#define jky 13              //Joystick button pin
#define emgPin A0           //EMG signal pin
#define emgThreshold 500    //EMG signal detection threshold   

/*----OLED Display & Driver----*/
void u8g2_prepare(void) {
  u8g2.setFontMode(1);              //Enable Transparent Font
  u8g2.setFont(u8g2_font_6x13_tf);  //Set font Width: 6px / Height: 13px
  u8g2.setFontRefHeightExtendedText();    
  u8g2.setFontPosTop();             //Origin Position of Text
  u8g2.setFontDirection(0);         //Font direction 0º
}
//Custom Drawn Symbols
static const unsigned char back[] U8X8_PROGMEM  = {
  0x04, 0x06, 0x7F, 0x86, 0x84, 0x60, };

/*---- Servo Driver Variables ----*/
#define Freq (uint8_t) 50     //Servo working frequency

#define posMin 102
#define posMax 512

//Finger Number Assignation for Servo Control
#define thumb (uint8_t) 0
#define index (uint8_t) 1
#define middle (uint8_t) 2 
#define ring (uint8_t) 3
#define pinky (uint8_t) 4
#define wrist (uint8_t) 5

//Method to map servo position from pulses to degrees
void setServo(uint8_t n_servo, uint8_t angulo){
  int duty;
  duty=map(angulo, 0, 180, posMin, posMax);
  servo.setPWM(n_servo, 0, duty);
}

//Method for EMG signal detection and actuation
void emg(void (*pointer)()){
  if((analogRead(A0))>emgThreshold){
    pointer();    
  }
  else{
    openHand();
  }
}

/*---- Hand Movements Methods ----*/
void closeHand(void){
    setServo(thumb,170);
    setServo(index,170);
    setServo(middle,175);
    setServo(ring,151);
    setServo(pinky,161);
    setServo(wrist,180);
}
void openHand(void){
    setServo(thumb,13);
    setServo(index,10 );
    setServo(middle,13);
    setServo(ring,13);
    setServo(pinky,13);
    setServo(wrist,180);
}
void rock_servo(void){
    setServo(thumb,170);
    setServo(index,13);
    setServo(middle,175);
    setServo(ring,151);
    setServo(pinky,13);
    setServo(wrist,180);
}
void ronaldinho_servo(){
    setServo(thumb,13);
    setServo(index,156);
    setServo(middle,145);
    setServo(ring,151);
    setServo(pinky,13);
    while(analogRead(A0)>emgThreshold){
      setServo(wrist,150);
      delay(400);
      setServo(wrist,180);
      delay(500);
    }
}
void point_servo(void){
    setServo(thumb,170);
    setServo(index,13);
    setServo(middle,145);
    setServo(ring,151);
    setServo(pinky,161);
    setServo(wrist,180);
}
void thumbsUp_servo(void){
    setServo(thumb,13);
    setServo(index,156);
    setServo(middle,145);
    setServo(ring,151);
    setServo(pinky,161);
    setServo(wrist,180);
}

/*---- Joystick Button----*/
#define jkyX A1
#define jkyY A2

uint8_t swbtn_state=0;    // Memory Storage Byte
bool btn_val=0;           // Current state of the button
bool btn_oldVal=1;        // Previous state of the button  

//Joystick Button Method
void btn_Jky(uint8_t x){
  btn_val=digitalRead(jky);   // read pin button
  if (btn_val == LOW && btn_oldVal == HIGH){
      swbtn_state=x;    
      delay(10);   
  }
  btn_oldVal=btn_val;
}

/*- *- *- *- - MENU SYSTEM - -* -* -* -*/
uint8_t M1 = 0; //Memory variable to determine menu state
uint8_t F1 = 0; //Memory variable to determine menu state
uint8_t C1 = 0; //Memory variable to determine menu state

//Mode_options
#define openClose (uint8_t) 1
#define figures (uint8_t)   2
#define custom  (uint8_t)   3

//Figures_options
#define rock (uint8_t)       1
#define ronaldinho (uint8_t) 2
#define point (uint8_t)      3
#define thumbUp (uint8_t)    4
#define goBackF1 (uint8_t)   5

//Custom_options
#define thumb (uint8_t)    1
#define index (uint8_t)    2
#define middle (uint8_t)   3
#define ring (uint8_t)     4
#define pinky (uint8_t)    5
#define wrist (uint8_t)    6
#define goBackC1 (uint8_t) 7

/*---- 1.MODES Menu Methods / All Menu Systems ----*/
/*-- Read Joystic M1 Method --*/
void jkyM1(void){
  if (analogRead(jkyX)<=341 && analogRead(jkyY)>=1010){
    M1 = openClose;
  }
  else if (analogRead(jkyX)>=342 && analogRead(jkyX)<=682 && analogRead(jkyY)>=990){
    M1 = figures;
  }
  else if (analogRead(jkyX)>=683 && analogRead(jkyX)<=1023 && analogRead(jkyY)>=980){
    M1 = custom;
  } 
}

/*---- Modes Screen Methods ----*/
void M1_openClose(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(32, 45, "OPEN/CLOSE");
  
  u8g2.drawBox(8,0,31,31);   //Selected box
  u8g2.drawStr(21,9, "1");   //Selected string
  
  u8g2.drawFrame(47,0,31,31);
  u8g2.drawStr(60,9, "2");
  
  u8g2.drawFrame(86,0,31,31);
  u8g2.drawStr(99,9, "3");
  
  u8g2.sendBuffer();
}
void M1_openClose_in(){
  emg(closeHand); 
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(32, 16, "Squeeze to");
  u8g2.drawStr(32, 32, "CLOSE HAND");
  
  u8g2.sendBuffer();
}
void M1_figures(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(42, 45, "FIGURES");
  
  u8g2.drawFrame(8,0,31,31);   
  u8g2.drawStr(21,9, "1");
  
  u8g2.drawBox(47,0,31,31);   //Selected box
  u8g2.drawStr(60,9, "2");    //Selected string
  
  u8g2.drawFrame(86,0,31,31);
  u8g2.drawStr(99,9, "3");
  
  u8g2.sendBuffer();
}
void M1_custom(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(19, 45, "CUSTOM MOVEMENT");
  
  u8g2.drawFrame(8,0,31,31);   
  u8g2.drawStr(21,9, "1");
  
  u8g2.drawFrame(47,0,31,31);   
  u8g2.drawStr(60,9, "2");
  
  u8g2.drawBox(86,0,31,31);   //Selected box
  u8g2.drawStr(99,9, "3");    //Selected string
  
  u8g2.sendBuffer();
}

//MAIN MENU SYSTEM(MODES) METHOD
void modes_M1(){  
  switch (M1){
    case openClose:
      if(swbtn_state==1){
        M1_openClose_in();
        btn_Jky(0);
      }
      else{
        jkyM1();
        openHand();
        M1_openClose();
        btn_Jky(1);
      }
      break;

    case figures:
      if(swbtn_state==2 || swbtn_state==3){
        figures_F1();
      }
      else{
        jkyM1();
        openHand();
        M1_figures();
        btn_Jky(2);
      }
      break;

    case custom:
      if(swbtn_state==4 || swbtn_state==5){
        custom_C1();
      }
      else{
        jkyM1();
        openHand();
        M1_custom();
        btn_Jky(4);
      }
      break;
  }
}

/*---- 2.FIGURES Menu Methods ----*/
/*-- Read Joystic F1 Method --*/
void jkyF1(void){
  if (analogRead(jkyX)<=150 && analogRead(jkyY)>=1022){
    F1 = rock;
  }
  else if (analogRead(jkyX)>=151 && analogRead(jkyX)<=540 && analogRead(jkyY)>=1022){
    F1 = ronaldinho;
  }
  else if (analogRead(jkyX)>=541 && analogRead(jkyX)<=767 && analogRead(jkyY)>=1022){
    F1 = point;
  }
  else if (analogRead(jkyX)>=768 && analogRead(jkyX)<=1023 && analogRead(jkyY)>=1022){
    F1 = thumbUp;
  }
  else if (analogRead(jkyX)>=400 && analogRead(jkyX)<=1023 && analogRead(jkyY)<=400){
    F1 = goBackF1;
  } 
}

/*---- Figures Screen Methods ----*/
void F1_rock(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(32, 32, "ROCK'N ROLL");
  
  u8g2.drawBox(11,0,17,17);   //Selected box
  u8g2.drawStr(17,2, "1");    //Selected string 
  
  u8g2.drawFrame(39,0,17,17);
  u8g2.drawStr(45,2, "2");
  
  u8g2.drawFrame(67,0,17,17);
  u8g2.drawStr(73,2, "3");
  
  u8g2.drawFrame(95,0,17,17);
  u8g2.drawStr(101,2, "4");

  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();

}
void F1_rock_in(void){
  emg(rock_servo);
  btn_Jky(2);
  u8g2.clearBuffer();
  
  u8g2.drawStr(32, 16, "Squeeze to");
  u8g2.drawStr(32, 32, "ROCK'N ROLL");
  
  u8g2.sendBuffer();
}
void F1_ronaldinho(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(34, 32, "RONALDINHO");
  
  u8g2.drawFrame(11,0,17,17);
  u8g2.drawStr(17,2, "1");
  
  u8g2.drawBox(39,0,17,17);   //Selected box
  u8g2.drawStr(45,2, "2");    //Selected string
  
  u8g2.drawFrame(67,0,17,17);
  u8g2.drawStr(73,2, "3");
  
  u8g2.drawFrame(95,0,17,17);
  u8g2.drawStr(101,2, "4");

  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();
}
void F1_ronaldinho_in(void){
  emg(ronaldinho_servo);
  btn_Jky(2);
  u8g2.clearBuffer();
  
  u8g2.drawStr(32, 32, "RONALDINHO!");
  
  u8g2.sendBuffer();
}
void F1_point(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(49, 32, "POINT");
  
  u8g2.drawFrame(11,0,17,17);
  u8g2.drawStr(17,2, "1");
  
  u8g2.drawFrame(39,0,17,17);     
  u8g2.drawStr(45,2, "2");
  
  u8g2.drawBox(67,0,17,17);   //Selected box
  u8g2.drawStr(73,2, "3");    //Selected string
  
  u8g2.drawFrame(95,0,17,17);
  u8g2.drawStr(101,2, "4");

  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();
}
void F1_point_in(void){
  emg(point_servo);
  btn_Jky(2);
  u8g2.clearBuffer();
  
  u8g2.drawStr(32, 16, "Squeeze to");
  u8g2.drawStr(49, 32, "POINT");
  
  u8g2.sendBuffer();
}
void F1_thumbUp(){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(39, 32, "THUMBS UP");
  
  u8g2.drawFrame(11,0,17,17);
  u8g2.drawStr(17,2, "1");
  
  u8g2.drawFrame(39,0,17,17);     
  u8g2.drawStr(45,2, "2");
  
  u8g2.drawFrame(67,0,17,17);     
  u8g2.drawStr(73,2, "3");
  
  u8g2.drawBox(95,0,17,17);     //Selected box
  u8g2.drawStr(101,2, "4");     //Selected string
  
  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();
}
void F1_thumbUp_in(void){
  emg(thumbsUp_servo);
  btn_Jky(2);
  u8g2.clearBuffer();
  
  u8g2.drawStr(20, 16, "Squeeze to give");
  u8g2.drawStr(32, 30, "a THUMBS UP");
  
  u8g2.sendBuffer();
}
void F1_goBack(void){
  btn_Jky(0);  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(42, 32, "GO BACK");
  
  u8g2.drawFrame(11,0,17,17);
  u8g2.drawStr(17,2, "1");
  
  u8g2.drawFrame(39,0,17,17);     
  u8g2.drawStr(45,2, "2");
  
  u8g2.drawFrame(67,0,17,17);     
  u8g2.drawStr(73,2, "3");
  
  u8g2.drawFrame(95,0,17,17);
  u8g2.drawStr(101,2, "4");    

  u8g2.drawBox(115,51,12,10);   //Selected box
  
  u8g2.setDrawColor(0);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();
}

//MAIN FIGURES METHOD
void figures_F1(){
  switch (F1){
    case rock:
      if(swbtn_state==3){ //s'ha de canviar!!
        F1_rock_in();
      }
      else{
        btn_Jky(3);
        jkyF1();
        F1_rock();  //print on display F1_rock
      }
      break;
    
    case ronaldinho: 
      if(swbtn_state==3){ //s'ha de canviar!!
        F1_ronaldinho_in(); 
      }
      else{
        btn_Jky(3);
        jkyF1();
        F1_ronaldinho(); //print on display F1_ronaldinho
      }
      break;
    
    case point:
      if(swbtn_state==3){ //s'ha de canviar!!
        F1_point_in(); 
      }
      else{
        btn_Jky(3);
        jkyF1();
        F1_point(); //print on display F1_ronaldinho
      }
      break;

     case thumbUp:
      if(swbtn_state==3){ //s'ha de canviar!!
        F1_thumbUp_in(); 
      }
      else{
        btn_Jky(3);
        jkyF1();
        F1_thumbUp(); //print on display F1_ronaldinho
      }
      break;

     case goBackF1:
        jkyF1();
        F1_goBack(); //print on display F1_ronaldinho
      break;
  }
}

/*---- 3.CUSTOM Menu Methods ----*/
/*-- Read Joystic C1 Method --*/
void jkyC1(void){
  if (analogRead(jkyX)<=170 && analogRead(jkyY)>=1023){
    C1 = thumb;
  }
  else if (analogRead(jkyX)>=171 && analogRead(jkyX)<=341 && analogRead(jkyY)>=1023){
    C1 = index;
  }
  else if (analogRead(jkyX)>=342 && analogRead(jkyX)<=511 && analogRead(jkyY)>=1023){
    C1 = middle;
  }
  else if (analogRead(jkyX)>=512 && analogRead(jkyX)<=682 && analogRead(jkyY)>=1023){
    C1 = ring;
  }
  else if (analogRead(jkyX)>=683 && analogRead(jkyX)<=853 && analogRead(jkyY)>=1023){
    C1 = pinky;
  }
  else if (analogRead(jkyX)>=854 && analogRead(jkyX)<=1023 && analogRead(jkyY)>=1023){
    C1 = wrist;
  }
  else if (analogRead(jkyX)>=512 && analogRead(jkyX)<=1023 && analogRead(jkyY)<=450){
    C1 = goBackC1;
  }
}
/*-- Movement State for Individual Fingers Method --*/
uint8_t movement=0;
void jky_servo_movement(void){
    if(analogRead(jkyY)>=600){
        movement=1;
    }
    else if(analogRead(jkyY)<=400){
        movement=2;
    }
    else if(analogRead(jkyY)>=401 && analogRead(jkyY)<=599){
        movement=0;
    }
}

/*---- Custom Screen Methods ----*/
void C1_thumb(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(49, 32, "THUMB");
  
  u8g2.drawBox(2,0,17,17);   //Selected box
  u8g2.drawStr(8,2, "1");    //Selected string
  
  u8g2.drawFrame(23,0,17,17);
  u8g2.drawStr(29,2, "2");
  
  u8g2.drawFrame(44,0,17,17);
  u8g2.drawStr(50,2, "3");
  
  u8g2.drawFrame(65,0,17,17);
  u8g2.drawStr(71,2, "4");

  u8g2.drawFrame(86,0,17,17);
  u8g2.drawStr(92,2, "5");

  u8g2.drawFrame(107,0,17,17);
  u8g2.drawStr(113,2, "6");

  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();
}

#define thumbMin 13
#define thumbMax 170
uint8_t thumb_angle=13;
uint8_t thumb_percentage=0;

void C1_thumb_in(void){
    jky_servo_movement();
    btn_Jky(4);
    if(movement==1 && thumb_angle<thumbMax){
        thumb_angle++;
    }
    else if(movement==2 && thumb_angle>thumbMin){
        thumb_angle--;
    }
    setServo(0,thumb_angle);
    thumb_percentage=map(thumb_angle, thumbMin, thumbMax, 0, 100);
    String percentage = String(thumb_percentage);
  
    u8g2.clearBuffer();
    u8g2.setDrawColor(2);
  
    u8g2.drawStr(16, 0, "Adjust Position");

    u8g2.drawStr(12,24, "Thumb:");
    u8g2.drawStr(64,24, percentage.c_str());   //map variable for %
    u8g2.drawStr(82,24, "%");
    
    u8g2.drawFrame(12,40,102,17);
    u8g2.drawBox(13,41,thumb_percentage,15);   //x is percentage of map
    
    u8g2.sendBuffer();
  
}
void C1_index(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(49, 32, "INDEX");
  
  u8g2.drawFrame(2,0,17,17);   
  u8g2.drawStr(8,2, "1");
  
  u8g2.drawBox(23,0,17,17);   //Selected box
  u8g2.drawStr(29,2, "2");     //Selected string
  
  u8g2.drawFrame(44,0,17,17);
  u8g2.drawStr(50,2, "3");
  
  u8g2.drawFrame(65,0,17,17);
  u8g2.drawStr(71,2, "4");

  u8g2.drawFrame(86,0,17,17);
  u8g2.drawStr(92,2, "5");

  u8g2.drawFrame(107,0,17,17);
  u8g2.drawStr(113,2, "6");

  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);

  u8g2.sendBuffer();
}

#define indexMin 10
#define indexMax 170
uint8_t index_angle=10;
uint8_t index_percentage=0;

void C1_index_in(){
  jky_servo_movement();
  btn_Jky(4);
  if(movement==1 && index_angle<indexMax){
      index_angle++;
  }
  else if(movement==2 && index_angle>indexMin){
      index_angle--;
  }
  setServo(1,index_angle);
  index_percentage=map(index_angle, indexMin, indexMax, 0, 100);
  String percentage = String(index_percentage);
  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(16, 0, "Adjust Position");

  u8g2.drawStr(12,24, "Index:");
  u8g2.drawStr(64,24, percentage.c_str());   //map variable for %
  u8g2.drawStr(82,24, "%");
    
  u8g2.drawFrame(12,40,102,17);
  u8g2.drawBox(13,41,index_percentage,15);   //x is percentage of map
    
  u8g2.sendBuffer();
}
void C1_middle(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(47, 32, "MIDDLE");
  
  u8g2.drawFrame(2,0,17,17);   
  u8g2.drawStr(8,2, "1");
  
  u8g2.drawFrame(23,0,17,17);   
  u8g2.drawStr(29,2, "2");
  
  u8g2.drawBox(44,0,17,17);   //Selected box
  u8g2.drawStr(50,2, "3");    //Selected string
  
  u8g2.drawFrame(65,0,17,17);
  u8g2.drawStr(71,2, "4");

  u8g2.drawFrame(86,0,17,17);
  u8g2.drawStr(92,2, "5");

  u8g2.drawFrame(107,0,17,17);
  u8g2.drawStr(113,2, "6");

  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();
}

#define middleMin 13
#define middleMax 175
uint8_t middle_angle=13;
uint8_t middle_percentage=0;

void C1_middle_in(void){
  jky_servo_movement();
  btn_Jky(4);
  if(movement==1 && middle_angle<middleMax){
      middle_angle++;
  }
  else if(movement==2 && middle_angle>middleMin){
      middle_angle--;
  }
  setServo(2,middle_angle);
  middle_percentage=map(middle_angle, middleMin, middleMax, 0, 100);
  String percentage = String(middle_percentage);
  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(16, 0, "Adjust Position");

  u8g2.drawStr(12,24, "Middle:");
  u8g2.drawStr(64,24, percentage.c_str());   //map variable for %
  u8g2.drawStr(82,24, "%");
    
  u8g2.drawFrame(12,40,102,17);
  u8g2.drawBox(13,41,middle_percentage,15);   //x is percentage of map
    
  u8g2.sendBuffer();
}
void C1_ring(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(52, 32, "RING");
  
  u8g2.drawFrame(2,0,17,17);   
  u8g2.drawStr(8,2, "1");
  
  u8g2.drawFrame(23,0,17,17);   
  u8g2.drawStr(29,2, "2");
  
  u8g2.drawFrame(44,0,17,17);
  u8g2.drawStr(50,2, "3");
  
  u8g2.drawBox(65,0,17,17);   //Selected box
  u8g2.drawStr(71,2, "4");    //Selected string
  
  u8g2.drawFrame(86,0,17,17);
  u8g2.drawStr(92,2, "5");

  u8g2.drawFrame(107,0,17,17);
  u8g2.drawStr(113,2, "6");

  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();
}

#define ringMin 13
#define ringMax 151
uint8_t ring_angle=13;
uint8_t ring_percentage=0;

void C1_ring_in(void){
  jky_servo_movement();
  btn_Jky(4);
  if(movement==1 && ring_angle<ringMax){
      ring_angle++;
  }
  else if(movement==2 && ring_angle>ringMin){
      ring_angle--;
  }
  setServo(3,ring_angle);
  ring_percentage=map(ring_angle, ringMin, ringMax, 0, 100);
  String percentage = String(ring_percentage);
  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(16, 0, "Adjust Position");

  u8g2.drawStr(12,24, "Ring:");
  u8g2.drawStr(64,24, percentage.c_str());   //map variable for %
  u8g2.drawStr(82,24, "%");
    
  u8g2.drawFrame(12,40,102,17);
  u8g2.drawBox(13,41,ring_percentage,15);   //x is percentage of map
    
  u8g2.sendBuffer();
}
void C1_pinky(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(49, 32, "PINKY");
  
  u8g2.drawFrame(2,0,17,17);   
  u8g2.drawStr(8,2, "1");
  
  u8g2.drawFrame(23,0,17,17);   
  u8g2.drawStr(29,2, "2");
  
  u8g2.drawFrame(44,0,17,17);   
  u8g2.drawStr(50,2, "3");
  
  u8g2.drawFrame(65,0,17,17);
  u8g2.drawStr(71,2, "4");

  u8g2.drawBox(86,0,17,17);   //Selected box
  u8g2.drawStr(92,2, "5");    //Selected string

  u8g2.drawFrame(107,0,17,17);
  u8g2.drawStr(113,2, "6");

  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();
}

#define pinkyMin 13
#define pinkyMax 161
uint8_t pinky_angle=13;
uint8_t pinky_percentage=0;

void C1_pinky_in(void){
  jky_servo_movement();
  btn_Jky(4);
  if(movement==1 && pinky_angle<pinkyMax){
      pinky_angle++;
  }
  else if(movement==2 && pinky_angle>pinkyMin){
      pinky_angle--;
  }
  setServo(4,pinky_angle);
  pinky_percentage=map(pinky_angle, pinkyMin, pinkyMax, 0, 100);
  String percentage = String(pinky_percentage);
  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(16, 0, "Adjust Position");

  u8g2.drawStr(12,24, "Pinky:");
  u8g2.drawStr(64,24, percentage.c_str());   //map variable for %
  u8g2.drawStr(82,24, "%");
    
  u8g2.drawFrame(12,40,102,17);
  u8g2.drawBox(13,41,middle_percentage,15);   //x is percentage of map
    
  u8g2.sendBuffer();
}
void C1_wrist(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(49, 32, "WRIST");
  
  u8g2.drawFrame(2,0,17,17);   
  u8g2.drawStr(8,2, "1");
  
  u8g2.drawFrame(23,0,17,17);   
  u8g2.drawStr(29,2, "2");
  
  u8g2.drawFrame(44,0,17,17);   
  u8g2.drawStr(50,2, "3");
  
  u8g2.drawFrame(65,0,17,17);
  u8g2.drawStr(71,2, "4");

  u8g2.drawFrame(86,0,17,17);
  u8g2.drawStr(92,2, "5");

  u8g2.drawBox(107,0,17,17);    //Selected box
  u8g2.drawStr(113,2, "6");     //Selected string

  u8g2.drawFrame(115,51,12,10);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  
  u8g2.sendBuffer();
}

#define wristMin 180
#define wristMax 150
uint8_t wrist_angle=180;
uint8_t wrist_percentage=0;

void C1_wrist_in(void){
  jky_servo_movement();
  btn_Jky(4);
  if(movement==1 && wrist_angle>wristMax){
      wrist_angle--;
  }
  else if(movement==2 && wrist_angle<wristMin){
      wrist_angle++;
  }
  setServo(5,wrist_angle);
  wrist_percentage=map(wrist_angle, wristMin, wristMax, 0, 100);
  String percentage = String(wrist_percentage);
  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(16, 0, "Adjust Position");

  u8g2.drawStr(12,24, "Wrist:");
  u8g2.drawStr(64,24, percentage.c_str());   //map variable for %
  u8g2.drawStr(82,24, "%");
    
  u8g2.drawFrame(12,40,102,17);
  u8g2.drawBox(13,41,wrist_percentage,15);   //x is percentage of map
    
  u8g2.sendBuffer();
}
void C1_goBack(void){  
  u8g2.clearBuffer();
  u8g2.setDrawColor(2);
  
  u8g2.drawStr(43, 32, "GO BACK");
  
  u8g2.drawFrame(2,0,17,17);   
  u8g2.drawStr(8,2, "1");
  
  u8g2.drawFrame(23,0,17,17);   
  u8g2.drawStr(29,2, "2");
  
  u8g2.drawFrame(44,0,17,17);   
  u8g2.drawStr(50,2, "3");
  
  u8g2.drawFrame(65,0,17,17);
  u8g2.drawStr(71,2, "4");

  u8g2.drawFrame(86,0,17,17);
  u8g2.drawStr(92,2, "5");

  u8g2.drawFrame(107,0,17,17);
  u8g2.drawStr(113,2, "6");
  
  u8g2.drawBox(115,51,12,10);   //Selected box
  
  u8g2.setDrawColor(0);
  u8g2.drawXBMP(117, 53, 8, 6, back);
  u8g2.sendBuffer();
}

//MAIN CUSTOM METHOD
void custom_C1(void){
  switch(C1){
    case thumb:
      if(swbtn_state==5){
        jky_servo_movement();
        C1_thumb_in();
      }
      else{
        btn_Jky(5);
        jkyC1();
        C1_thumb();  //print on display F1_rock
      }
      break;
    
    case index:
      if(swbtn_state==5){ //s'ha de canviar!!
        C1_index_in();
      }
      else{
        btn_Jky(5);
        jkyC1();
        C1_index();  //print on display F1_rock
      }
      break;
    
    case middle:
      if(swbtn_state==5){ //s'ha de canviar!!
        C1_middle_in();
      }
      else{
        btn_Jky(5);
        jkyC1();
        C1_middle();  //print on display F1_rock
      }
      break;

    case ring:
      if(swbtn_state==5){ //s'ha de canviar!!
        C1_ring_in();
      }
      else{
        btn_Jky(5);
        jkyC1();
        C1_ring();  //print on display F1_rock
      }
      break;
    
    case pinky:
      if(swbtn_state==5){ //s'ha de canviar!!
        C1_pinky_in();
      }
      else{
        btn_Jky(5);
        jkyC1();
        C1_pinky();  //print on display F1_rock
      }
      break;

    case wrist:
      if(swbtn_state==5){ //s'ha de canviar!!
        C1_wrist_in();
      }
      else{
        btn_Jky(5);
        jkyC1();
        C1_wrist();  //print on display F1_rock
      }
      break;

    case goBackC1:
        btn_Jky(0);
        jkyC1();
        C1_goBack();  //print on display F1_rock
      break;
  }
}

void setup(){
  u8g2.begin();
  u8g2_prepare();
  servo.begin();
  servo.setPWMFreq(Freq);
  pinMode(jky, INPUT_PULLUP);
  F1=rock;
  C1=thumb;
  M1=openClose;
  swbtn_state=0;
}

void loop(){ 
  modes_M1();
}
/***** Shorten Post/Page link  *****/
//============================
add_filter( 'get_shortlink', function ( $shortlink ) {
    return $shortlink;
});
function search_by_sku( $search, &$query_vars ) {
    global $wpdb;
    if(isset($query_vars->query['s']) && !empty($query_vars->query['s'])){
        $args = array(
            'posts_per_page'  => -1,
            'post_type'       => 'product',
            'meta_query' => array(
                array(
                    'key' => '_sku',
                    'value' => $query_vars->query['s'],
                    'compare' => 'LIKE'
                )
            )
        );
        $posts = get_posts($args);
        if(empty($posts)) return $search;
        $get_post_ids = array();
        foreach($posts as $post){
            $get_post_ids[] = $post->ID;
        }
        if(sizeof( $get_post_ids ) > 0 ) {
                $search = str_replace( 'AND (((', "AND ((({$wpdb->posts}.ID IN (" . implode( ',', $get_post_ids ) . ")) OR (", $search);
        }
    }
    return $search;
    
}
    add_filter( 'posts_search', 'search_by_sku', 999, 2 );
cssbuttons/index.html
​ ​<p>​
​   ​<input​ class=​"button"​ type=​"button"​ value=​"A Button!"​​>​
​   ​<a​ class=​"button"​ href=​"http://pragprog.com"​​>​A Link!​</a>​
​ ​</p>​
db.customers.updateMany({},
  [{ $set : { m : {$arrayElemAt:[{ $split: ["$customerName", " "] },0]}} }],

);
#!/bin/bash
# Bash Menu Script Example

PS3='Please enter your choice: '
options=("Option 1" "Option 2" "Option 3" "Quit")
select opt in "${options[@]}"
do
    case $opt in
        "Option 1")
            echo "you chose choice 1"
            ;;
        "Option 2")
            echo "you chose choice 2"
            ;;
        "Option 3")
            echo "you chose choice $REPLY which is $opt"
            ;;
        "Quit")
            break
            ;;
        *) echo "invalid option $REPLY";;
    esac
done
<script src="https://platform.linkedin.com/badges/js/profile.js" async defer type="text/javascript"></script>
<div class="linkedin-wrapper"><div class="linkedin-header"><div class="v2-h2-subhead grey">Navštívte naše profily</div></div><div class="buttons-div cms"><div class="div-block-39">
<script src="https://platform.linkedin.com/badges/js/profile.js" async defer type="text/javascript"></script>
<div class="badge-base LI-profile-badge" data-locale="en_US" data-size="medium" data-theme="light" data-type="VERTICAL" data-vanity="tomaslodnan" data-version="v1"><a class="badge-base__link LI-simple-link" href="https://sk.linkedin.com/in/tomaslodnan?trk=profile-badge">Tomas Lodnan</a></div>
<div class="badge-base LI-profile-badge" data-locale="en_US" data-size="medium" data-theme="light" data-type="VERTICAL" data-vanity="regulipeter" data-version="v1"><a class="badge-base__link LI-simple-link" href="https://sk.linkedin.com/in/regulipeter?trk=profile-badge">Peter Reguli</a></div>
<div class="badge-base LI-profile-badge" data-locale="cs_CZ" data-size="medium" data-theme="light" data-type="VERTICAL" data-vanity="martin-durny-a1b16066" data-version="v1"><a class="badge-base__link LI-simple-link" href="https://sk.linkedin.com/in/martin-durny-a1b16066?trk=profile-badge">Martin Durny</a></div>
</div></div>
var object1; //JSON object

for (const [key, value] of Object.entries(object1)) {
  console.log(`${key}: ${value}`);
}
#!/usr/bin/env python
import subprocess
from multiprocessing import Pool
import os

src = "/home/student-03-474f458f89e0/data/prod"
dest = "/home/student-03-474f458f89e0/data/prod_backup"

def run_sync(file):
    print(os.path.join(dest,file))
    subprocess.call(["rsync", "-arq", os.path.join(src,file), os.path.join(dest,file)])

if __name__ == "__main__":
    files = os.listdir(src)
    p = Pool(len(files))
    p.map(run_sync, files)
new GlideQuery('sys_user')
    .select('company$DISPLAY')
    .forEach(function (user) {
        gs.info(user.company$DISPLAY);
    });

// ACME North America
// ServiceNow
// ...
import pandas as pd

sheets_dict = pd.read_excel('Book1.xlsx', sheetname=None)

full_table = pd.DataFrame()
for name, sheet in sheets_dict.items():
    sheet['sheet'] = name
    sheet = sheet.rename(columns=lambda x: x.split('\n')[-1])
    full_table = full_table.append(sheet)

full_table.reset_index(inplace=True, drop=True)

print full_table
javascript:(d=>{var css=`:root{background-color:#f1f1f1;filter:invert(1) hue-rotate(180deg)}img:not([src*=".svg"]),picture,video{filter: invert(1) hue-rotate(180deg)}`,style,id="dark-mode",ee=d.getElementById(id);if(null!=ee)ee.parentNode.removeChild(ee);else {style = d.createElement('style');style.type="text/css";style.id=id;if(style.styleSheet)style.styleSheet.cssText=css;else style.appendChild(d.createTextNode(css));(d.head||d.querySelector('head')).appendChild(style)}})(document)
var <- "mpg"
#Doesn't work
mtcars$var
#These both work, but note that what they return is different
# the first is a vector, the second is a data.frame
mtcars[[var]]
mtcars[var]
php artisan cache:clear
chmod -R 777 storage/
composer dump-autoload
star

Mon Nov 08 2021 17:37:30 GMT+0000 (UTC) https://dokku.com/

@pirate

star

Thu Oct 07 2021 04:46:38 GMT+0000 (UTC)

@rook12 #javascript

star

Fri Oct 01 2021 11:30:05 GMT+0000 (UTC)

@alexactivate #docker

star

Fri Sep 24 2021 02:03:52 GMT+0000 (UTC)

@viewsource #dart

star

Thu Sep 02 2021 14:15:48 GMT+0000 (UTC)

@jolo #setting #vscode

star

Tue Aug 03 2021 04:26:08 GMT+0000 (UTC) https://laraveldaily.com/process-big-db-table-with-chunk-method/

@mvieira

star

Mon Jul 26 2021 06:46:40 GMT+0000 (UTC) https://flutter.dev/docs/development/tools/web-renderers

@vahid

star

Thu Jul 22 2021 06:18:03 GMT+0000 (UTC) https://codepen.io/bchiang7/pen/ZEboePJ?editors

@davidTheNerdy #toggletheme

star

Sun Jul 18 2021 19:18:06 GMT+0000 (UTC)

@vincentko89 #bash #shell

star

Fri Jul 09 2021 17:21:31 GMT+0000 (UTC)

@buildadev

star

Sun Jul 04 2021 12:00:39 GMT+0000 (UTC) https://github.com/Temidtech/Flutter-Cheat-Sheet/blob/master/README.md

@putrandasky #dart #flutter

star

Sat Jul 03 2021 08:25:15 GMT+0000 (UTC) https://stackoverflow.com/questions/6153489/how-to-set-margins-to-a-custom-dialog

@swalia

star

Wed Jun 16 2021 13:49:40 GMT+0000 (UTC) http://wrttn.me/30dbfd/

@hisam #unicode #emoticons #dongers

star

Wed Jun 09 2021 14:45:35 GMT+0000 (UTC) https://stackoverflow.com/questions/40359800/how-to-toggle-boolean-state-of-react-component

@MattMoniz #react.js #javascript #checkboxtoggle

star

Tue Jun 08 2021 16:03:17 GMT+0000 (UTC)

@onlinecesaref #vba

star

Tue Jun 01 2021 16:13:07 GMT+0000 (UTC) https://tidyr.tidyverse.org/reference/pivot_longer.html

@rezaeir

star

Thu May 27 2021 18:39:49 GMT+0000 (UTC) https://svelte.dev/

@omargnagy

star

Tue May 25 2021 09:27:30 GMT+0000 (UTC)

@Sikor

star

Thu May 20 2021 21:04:33 GMT+0000 (UTC)

@TomasG #r

star

Wed May 12 2021 22:37:16 GMT+0000 (UTC)

@Alz #php #wordpress #elementor

star

Tue May 11 2021 15:02:51 GMT+0000 (UTC) https://stackoverflow.com/questions/53898482/clean-way-to-convert-quarterly-periods-to-datetime-in-pandas

@arielvol

star

Sat May 08 2021 17:17:06 GMT+0000 (UTC)

@yourHand #c++

star

Fri May 07 2021 18:34:23 GMT+0000 (UTC)

@Alz #php #wordpress

star

Fri May 07 2021 18:25:16 GMT+0000 (UTC)

@Alz #php #wordpress #woocomerce

star

Tue May 04 2021 15:40:32 GMT+0000 (UTC) https://medium.com/pragmatic-programmers/styling-buttons-and-links-ed4e8c354369

@randomize_first #css

star

Fri Apr 30 2021 16:49:28 GMT+0000 (UTC) https://blog.logrocket.com/learn-these-keyboard-shortcuts-to-become-a-vs-code-ninja/#:~:text=Selecting%20code&text=The%20alt%20%2B%20shift%20%2B%20left%20%2F,of%20code%20based%20on%20scope.

@mvieira

star

Sat Apr 24 2021 21:00:41 GMT+0000 (UTC) https://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script

@LavenPillay #bash

star

Fri Apr 23 2021 04:05:01 GMT+0000 (UTC) https://stackoverflow.com/questions/41256626/pandas-typeerror-float-argument-must-be-a-string-or-a-number/66155172#66155172?newreg

@wsullivan98 #python

star

Wed Apr 14 2021 10:04:23 GMT+0000 (UTC)

@GoodRequest.

star

Wed Apr 07 2021 03:30:04 GMT+0000 (UTC) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries

@Tephlon #javascript

star

Thu Mar 18 2021 19:56:16 GMT+0000 (UTC) https://developer.servicenow.com/blog.do?p=/post/glidequery-p5/

@dorian #servicenow

star

Wed Mar 17 2021 10:50:04 GMT+0000 (UTC) https://stackoverflow.com/questions/44549110/python-loop-through-excel-sheets-place-into-one-df

@arielvol #python

star

Sat Mar 13 2021 17:40:37 GMT+0000 (UTC) https://gist.github.com/lweiss01/7a6c60843b64236b018e7398fb0d5f40#file-darkmodeswitcher-js

@lisa #javascript #js #bookmarklet #css

star

Thu Mar 11 2021 14:57:05 GMT+0000 (UTC) https://stackoverflow.com/questions/18222286/dynamically-select-data-frame-columns-using-and-a-character-value

@stephenb30 #r

star

Tue Mar 09 2021 14:34:57 GMT+0000 (UTC) https://stackoverflow.com/questions/36460874/laravel-5-errorexception-failed-to-open-stream-permission-denied

@hassanms #laravel

star

Wed Mar 03 2021 19:37:38 GMT+0000 (UTC) https://laravelarticle.com/laravel-barcode-tutorial

@fadas

Save snippets that work with our extensions

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