working on it ...

Filters

Explore Public Snippets

Sort by

Found 176 snippets matching: switcher

    public by simonwalker  1103  0  6  0

    Magento GeoIP Store Switcher Extension | FME

    Magento GeoIP Store Switcher by FME is a geo-targeting extension which detects the visitor’s real-time location and redirects them to a region customized store view. Using this Magento GeoIP store switcher extension, you can create multiple store views, customize their theme, and display relevant products on the front. Allow the visitors to manuall
    // https://www.fmeextensions.com/magento-geo-ip-default-store-view.html        

    public by paulsimmons  776  0  4  0

    WooCommerce Currency Converter Plugin

    If you want to target multiple regions with your web store you must use WooCommerce multi-currency plugin to provide the best user experience to your international clients. WooCommerce currency switcher plugin allows you to add multiple currencies which will allow your customers to view product pricing and checkout in their local currency or to whi
    // Enter here the actual content of the snippet.            

    external by thevtm  149  0  2  0

    CLI workspace switcher for GNOME based on Based on Andy Balaam's workspace-switcher

    CLI workspace switcher for GNOME based on Based on Andy Balaam's workspace-switcher: workspace-switcher
    #!/bin/bash
    # Workspace switcher for GNOME
    # Author: thevtm@github
    #
    # Based on Andy Balaam's workspace-switcher
    # http://www.artificialworlds.net/blog/2011/03/04/switching-workspace-in-gnome-via-the-command-line/
    #
    # REQUIREMENTS:
    #  * wmctrl
    #
    # USAGE:
    # `workspace-switcher Up` to move up
    # `workspace-switcher Down` to move down
    
    
    CMD="$1"
    
    NUM_WORKSPACES=`wmctrl -d | cut -d " " -f 1 | tail -1`
    CURRENT_WS=`wmctrl -d | grep \* | cut -d " " -f 1`
    
    MOVE_UP="-1"
    MOVE_DOWN="+1"
    
    case $CMD in
    
    "Up" )
    	if [[ $CURRENT_WS -eq 0 ]]; then
    	{
    		NEW_WS=$CURRENT_WS
    	}
    	else
    	{
    		NEW_WS=`echo $CURRENT_WS "- 1" | bc`
    	}; fi
    	;;
    
    "Down" )
    	if [[ $CURRENT_WS -eq $NUM_WORKSPACES ]]; then
    	{
    		NEW_WS=$CURRENT_WS
    	}
    	else
    	{
    		NEW_WS=`echo $CURRENT_WS "+ 1" | bc`
    	}; fi
    	;;
    
    * )
    	NEW_WS=$CMD
    
    esac
    
    wmctrl -s $NEW_WS
    
    

    external by gordonbrander  125  0  2  0

    Finite state switcher

    Finite state switcher: states.js
    // Create a finite state switching function.
    // Given a list of states, returns a function that will take a `prev` state
    // and `next` state and will only advance state to `next` if it is one of
    // the defined states.
    const states = (...states) => (prev, next) =>
      states.indexOf(next) !== -1 ? next : prev;
    
    

    external by Alexey Bakulin  125  0  2  0

    Xdebug switcher

    Xdebug switcher: xdebug.sh
    #!/bin/bash
    
    target="/etc/php5/conf.d/20-xdebug.ini"
    source="/etc/php5/mods-available/xdebug.ini"
    
    Blu='\e[0;34m' # blue color
    Red='\e[0;31m' # red color
    Gre='\e[0;32m' # green color
    RCol='\e[0m' # reset color
    
    reload=0
    
    if [ "$1" != "" ] && [ "$1" == "off" ] ; then
      if [ -e $target ] ; then
        echo -e "${Blu}  Remove $target link${RCol}"
        rm $target
        reload=1
      else
        echo -e "${Red}  File $target is not exists${RCol}"
      fi
    else
      if [ ! -e $target ] ; then
        echo -e "${Blu}  Create a link for $source${RCol}"
        ln -s $source $target
        reload=1
      else
        echo -e "${Red}  File $target already exists${RCol}"
      fi
    fi
    
    if [ $reload == "1"  ] ; then
      echo -e "${Gre}  Restart apache server${RCol}"
      service apache2 restart
    fi
    
    exit 0
    
    

    external by Kolya Korobochkin  114  0  2  0

    Simply video gallery switcher

    Simply video gallery switcher: video-galery.js
    var VideoGallery = (function (self, $) {
    
    	self.InsertContainerId = 'youtube-player';
    	self.isInserted = false;
    
    	self.findIds = function (url) {
    		var aVideoRE = new RegExp("[\\?&]{1}v=([a-z\\d-_]{11})",'gi');
    		var aPlaylistRE = new RegExp ("[\\?&]{1}list=([a-z\\d-_]{34})", 'gi');
    
    		var results = {
    			videoId: false,
    			playlistId: false
    		};
    
    		var trying = aPlaylistRE.exec(url);
    
    		if (Array.isArray(trying) && typeof trying[1] === 'string' && trying != '') {
    			results.playlistId = trying[1];
    		}
    
    		trying = false;
    		trying = aVideoRE.exec(url);
    		if (Array.isArray(trying) && typeof trying[1] === 'string' && trying != '') {
    			results.videoId = trying[1];
    		}
    
    		return results;
    	};
    
    	self.setUpAttrs = function (e) {
    		var result = self.findIds(e.currentTarget.href);
    
    		if (result.videoId) {
    			$(e.currentTarget).attr('data-youtube-video-id', result.videoId);
    
    			if (result.playlistId) {
    				$(e.currentTarget).attr('data-youtube-playlist-id', result.playlistId);
    			}
    		}
    		else {
    			$(e.currentTarget).attr('data-youtube-video-id', 'false');
    		}
    	};
    
    	self.insertPlayer = function (currentTarget) {
    
    		var config = {
    			width: 642,
    			height: 482,
    			videoId: $(currentTarget).attr('data-youtube-video-id'),
    			//videoId: videoId,
    			playerVars: {
    				'autoplay': 1
    			}
    		};
    
    		if ($(currentTarget).attr('data-youtube-playlist-id')) {
    			config.playerVars.listType = 'playlist';
    			config.playerVars.list = $(currentTarget).attr('data-youtube-playlist-id');
    		}
    
    		self.player = new YT.Player (self.InsertContainerId, config);
    		self.isInserted = true;
    
    	};
    
    	self.onLinkClick = function (e) {
    		e.preventDefault();
    
    		if (typeof $(e.currentTarget).attr('data-youtube-video-id') !== 'string') {
    			self.setUpAttrs(e);
    		}
    
    		if (self.isInserted) {
    			self.player.destroy();
    		}
    
    		if (typeof $(e.currentTarget).attr('data-youtube-video-id') === 'string' && $(e.currentTarget).attr('data-youtube-video-id') != 'false') {
    			$('.video-gallery-player-place').css ('display', 'block');
    
    			self.insertPlayer(e.currentTarget);
    		}
    		else {
    			$('#' + self.InsertContainerId).html ('Что-то пошло не так.');
    		}
    	};
    
    	return self;
    }(VideoGallery || {}, jQuery));
    
    (function onYouTubeIframeAPIReady ($) {
    	$('.video-gallery .click-to-play').on('click', function (e) {
    		VideoGallery.onLinkClick(e);
    	});
    })(jQuery);
    
    
    

    external by lesander  102  0  2  0

    MAC Address Switcher v1.1.0

    MAC Address Switcher v1.1.0: mac-switch.sh
    #!/bin/bash
    
    # MAC Address Switcher v1.1.0
    # Written by lesander - http://github.com/lesander
    # Licensed under GPLv3
    # Tested on Ubuntu 14.04
    
    # - Set MAC addresses and settings.
    address1=""
    address2=""
    network=""
    networks=$(ls /sys/class/net | tr '\n' '/' | sed '$s/ $/\n/')
    networks=${networks%?}
    
    # - Check if addresses are set.
    if [[ $address1 == "" || $address2 == "" || $network == "" || $1 == "settings" ]]; then
      
      # Determine the case.
      if [ $1 == "settings" ]; then
        echo "[*] MAC Address Switcher - Change Settings"
      else 
        echo "[!] Missing address(es) or network in configuration."
      fi
      
      # Pick a network.
      read -p "[?] Which network would you like to use? [$networks] "
      newnetwork=$REPLY
      
      # Get address1 (current mac).
      current=$(cat /sys/class/net/$newnetwork/address)
      newaddress1=$current
      echo "[*] Your current MAC address for network $newnetwork is $current."
      
      # Ask for address2.
      read -p "[?] Please enter the MAC address you want to switch to / from: "
      newaddress2=$REPLY
      
      # Save to this file.
      sed -i -e '0,/address1="'$address1'"/s//address1="'$newaddress1'"/' ${0}
      sed -i -e '0,/address2="'$address2'"/s//address2="'$newaddress2'"/' ${0}
      sed -i -e '0,/network="'$network'"/s//network="'$newnetwork'"/' ${0}
      echo "[!] Saved addresses and network to file."
      exit
    fi
    
    # - Get current MAC address.
    current=$(cat /sys/class/net/$network/address)
    
    # - Print info.
    echo "[*] MAC Address Switcher v1.1.0"
    echo "[*] Current MAC address for network $network is '$current'."
    
    # - Make sure we're running as root.
    echo "[!] This program needs sudo permissions to alter the system's MAC address."
    sudo -v
    if [ $EUID == "0" ]; then
      echo "[!] Please run this program as sudo." 
      exit 2
    fi
    
    # - Disable the network.
    echo "[*] Disabling network $network."
    sudo ifconfig $network down
    
    # - Switch MAC address.
    if [ $current == $address1 ]; then
      echo "[*] Switching to MAC address 2 $address2."
      sudo ifconfig $network hw ether $address2
    elif [ $current == $address2 ]; then
      echo "[*] Switching to MAC address 1 $address1."
      sudo ifconfig $network hw ether $address1
    else
      echo "[*] Current MAC address is neither of the saved addresses."
    fi
    
    # - Re-enable network.
    echo "[*] Re-enabling network $network."
    sleep 3
    sudo ifconfig $network up
    
    
    

    external by Renier Morales  102  0  2  0

    gowo - Go workspace switcher

    gowo - Go workspace switcher: gowo.sh
    # Usage: gowo my_go_workspace
    # Will set GOPATH and update PATH with the bin dir. Will remove previous GOPATH bin dir from the PATH.
    # Opinionated about the root dir where Go workspaces go. Change if you want.
    
    # Put this in your ~/.bash_profile
    
    export GOPATH=$HOME/Projects/go
    export PATH=$PATH:$GOPATH/bin
    
    function gowo() {
            if [ -n "$GOPATH" ]; then
                    for p in `echo $PATH | sed -e 's/:/ /g'`; do
                            if [ "$p" != "$GOPATH/bin" ]; then
                                    echo -n "$p:" >> $HOME/.paths.tmp
                            fi
                    done
    
                    export PATH=`cat $HOME/.paths.tmp | sed -e 's/:$//'`
                    rm $HOME/.paths.tmp
            fi
    
            if [ -z "$1" ]; then
                    export GOPATH=$HOME/Projects/go # Default
            else
                    export GOPATH=$HOME/Projects/$1
            fi
            export PATH=$PATH:$GOPATH/bin
    }
    
    

    external by Caio Bianchi  91  0  1  0

    Language Switcher Modifier

    Language Switcher Modifier: template.php
    <?php 
    function THEME_links__locale_block(&$variables) {
      foreach($variables['links'] as $language => $langInfo) {
        $variables['links'][$language]['title'] = strtoupper($variables['links'][$language]['language']->language);
        $variables['links'][$language]['html'] = TRUE;
      }
      $content = theme_links($variables);
      return $content;
    }
    
    

    external by ethus3h  80  0  1  0

    Strange Emerald crash when using Static Application Switcher via keyboard shortcut (no strange window titles open?) I can't reproduce this one now.

    Strange Emerald crash when using Static Application Switcher via keyboard shortcut (no strange window titles open?) I can't reproduce this one now.: gistfile1.txt
    Script started on Mon 22 Aug 2016 05:37:18 PM EDT
    ]0;kyan@elegiac:~kyan@elegiac ~ nohup compiz --replace openbox $ emgdb -r eemerald
    GNU gdb (Gentoo 7.10.1 vanilla) 7.10.1
    Copyright (C) 2015 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-pc-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <https://bugs.gentoo.org/>.
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from emerald...Reading symbols from /usr/lib64/debug//usr/bin/emerald.debug...expanding to full symbols...done.
    expanding to full symbols...done.
    (gdb) r
    Starting program: /usr/bin/emerald 
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib64/libthread_db.so.1".
    6b k, 
    79 y, 61 a, 6e n, 40 @, 65 e, 6c l, 65 e, 67 g, 69 i, 61 a, 63 c, 3a :, 7e ~, 20  , ffffffe2 
    
    
    • Public Snippets
    • Channels Snippets