Category: Howto

Howto add the Slick Slider to Shopify on the Home Page.

So, you’re probably here because you want to implement the slick slider on your Shopify site without using an expensive app, or, enabling it sitewide.

This quick tutorial will get you started with enabling the slick slider on your theme, on just one page (in this case, the home page). We’re only going to load the libraries required, if required, which will keep the other pages nice and fast.

First I would create a backup of your Shopify theme, and then work on it. This way you have a backup should you fuck things up.

** Note – this slider is setup for 150×80 size images. You’re pretty much for sure going to have to edit the CSS anyway, but at the bare minimum you’ll have to change those dimensions if you want different image sizes. We’re using this as a vendor/brand slider so this size is perfect.

  1. First you’re going to want to go here, and download the latest copy of the Slick library.

    http://kenwheeler.github.io/slick/

  2. Now extract the files somewhere.
  3. Now login to your Shopify Store.
  4. Go to Online Store -> Themes -> Edit HTML/CSS
  5. Now you will want to scroll down to Assets.
  6. Click Upload Asset and find your extract files, and upload these one at a time.
    slick.min.js
    slick.css
    slick-theme.css 
    fonts/slick.woff
    fonts/slick.ttf
    fonts/slick.svg
    fonts/slick.eot
  7. Modify slick-theme.css and change the font path (remove ./font/)
    src: url('./fonts/slick.eot');

    Now becomes

    src: url('./slick.eot');
  8. Open up theme.liquid and in the header section (between <head> and </head>) paste the following code
    {% if template == 'index' %}
    {% if settings.home_vendor_carousel_enable %} 
    {{ 'slick.css' | asset_url | stylesheet_tag }}
    {{ 'slick-theme.css' | asset_url | stylesheet_tag }}
    {% endif %}
    {% endif %}
  9. Now scroll down to the bottom, and right before the closing body (</body>) paste the following code
    {% if template == 'index' %}
    {% if settings.home_vendor_carousel_enable %} 
    <!-- <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> -->
    {{ 'slick.min.js' | asset_url | script_tag }}
     <script type="text/javascript">
     $(document).ready(function() {
     $('.autoplay').slick({
     dots: false,
     infinite: true,
     speed: 500,
     slidesToShow: 5,
     slidesToScroll: 1,
     autoplay: true,
     autoplaySpeed: 2000,
     arrows: false,
     variableWidth: true
     });
     });
     </script>
    {% endif %}
    {% endif %}

    ** NOTE – we have the jquery, and jquery migrate library commented out because our theme already has it. If yours does not, you will need to uncomment the two two lines.

  10. Now, scroll up to where you want your slider and paste this code
    {% if settings.home_vendor_carousel_enable %}
    <center><h2>{{ settings.home_vendor_carousel_title }}</h2></center>
    <div class="slider-container">
     <div class="slider autoplay slider-custom">
     {% for i in (1..12) %}
     {% capture vendor %}home_vendor_enable_{{i}}{% endcapture %}
     {% capture vendor_name %}home_vendor_name_{{i}}{% endcapture %}
     {% capture vendor_logo %}vendor_logo_{{i}}.png{% endcapture %}
     {% if settings[vendor] %}
     <div>
     <a href="{{ settings[vendor_name] }}" title="{{ settings[vendor_name] }}">
     {{ vendor_logo | asset_url | img_tag: settings[vendor_name], "replace-2x img-responsive" }}
     </a>
     </div>
     {% endif %}
     {% endfor %}
     </div>
    </div> 
     <hr>
    {% endif %}
  11. Then paste this to the bottom of slick-theme.css, and edit anything you need to.
    .slider-container {
    position: relative;
    margin-top: 10px;
    left: 0;
    height: 100%;
    width:100%;
    }
    
    .slider-custom {
     width: 850px;
     margin-left: auto;
     margin-right: auto;
     display: block;
     height: 80px;
    }
    
    .slick-slide {
     width: 170px;
     padding-left: 10px;
     padding-right: 10px;
    }
  12. Now for the final change. Go back to your shopify admin interface, then to online store -> themes -> customize theme
  13. Scroll down to the config section
  14. Open up your copy of ‘settings_schema.json’
  15. Look for somewhere that makes sense (for us, we chose on the ‘home page’ section) and paste in the following keys / values
    {
     "type": "header",
     "content": "Vendor Logo Carousel"
     },
     {
     "type": "text",
     "id": "home_vendor_carousel_title",
     "label": "Vendor Carousel Title"
     },
     {
     "type": "checkbox",
     "id": "home_vendor_carousel_enable",
     "label": "Enable Vendor Carousel"
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_1",
     "label": "Enable Vendor 1"
     },
     {
     "type": "text",
     "id": "home_vendor_name_1",
     "label": "Vendor link 1"
     },
     {
     "type": "image",
     "id": "vendor_logo_1.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_2",
     "label": "Enable Vendor 2"
     },
     {
     "type": "text",
     "id": "home_vendor_name_2",
     "label": "Vendor link 2"
     },
     {
     "type": "image",
     "id": "vendor_logo_2.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_3",
     "label": "Enable Vendor 3"
     },
     {
     "type": "text",
     "id": "home_vendor_name_3",
     "label": "Vendor link 3"
     },
     {
     "type": "image",
     "id": "vendor_logo_3.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_4",
     "label": "Enable Vendor 4"
     },
     {
     "type": "text",
     "id": "home_vendor_name_4",
     "label": "Vendor link 4"
     },
     {
     "type": "image",
     "id": "vendor_logo_4.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_5",
     "label": "Enable Vendor 5"
     },
     {
     "type": "text",
     "id": "home_vendor_name_5",
     "label": "Vendor link 5"
     },
     {
     "type": "image",
     "id": "vendor_logo_5.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_6",
     "label": "Enable Vendor 6"
     },
     {
     "type": "text",
     "id": "home_vendor_name_6",
     "label": "Vendor link 6"
     },
     {
     "type": "image",
     "id": "vendor_logo_6.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_7",
     "label": "Enable Vendor 7"
     },
     {
     "type": "text",
     "id": "home_vendor_name_7",
     "label": "Vendor link 7"
     },
     {
     "type": "image",
     "id": "vendor_logo_7.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_8",
     "label": "Enable Vendor 8"
     },
     {
     "type": "text",
     "id": "home_vendor_name_8",
     "label": "Vendor link 8"
     },
     {
     "type": "image",
     "id": "vendor_logo_8.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_9",
     "label": "Enable Vendor 9"
     },
     {
     "type": "text",
     "id": "home_vendor_name_9",
     "label": "Vendor link 9"
     },
     {
     "type": "image",
     "id": "vendor_logo_9.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_10",
     "label": "Enable Vendor 10"
     },
     {
     "type": "text",
     "id": "home_vendor_name_10",
     "label": "Vendor link 10"
     },
     {
     "type": "image",
     "id": "vendor_logo_10.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_11",
     "label": "Enable Vendor 11"
     },
     {
     "type": "text",
     "id": "home_vendor_name_11",
     "label": "Vendor link 11"
     },
     {
     "type": "image",
     "id": "vendor_logo_11.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_12",
     "label": "Enable Vendor 12"
     },
     {
     "type": "text",
     "id": "home_vendor_name_12",
     "label": "Vendor link 12"
     },
     {
     "type": "image",
     "id": "vendor_logo_12.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     }
  16. Now save the file.
  17. Now open your customize theme (online store -> themes -> customize theme) and go to where you setup the vendor slider.
  18. Add your images to the slider and the title / etc.
  19. Click save
  20. If you did everything right, you should see the slider now, probably needing some CSS work to position it properly.

Hope this helps someone else looking to add a custom slider to their shopify theme, while not adding it sitewide.

 

Getting NZBHydra Working on MacOS Sierra

This seems to mostly work, but still having some issues keeping it stable. Maybe this will help someone else anyway 🙂

Here’s what I did on Mac OSX Sierra Latest:

first:

# nano ~/Library/LaunchAgents/com.nzbhydra.nzbhydra.plist

put this (change path + username):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
 <dict>
 <key>Label</key>
 <string>com.jackett.jackett</string>
 <key>ProgramArguments</key>
 <array>
 <string>/Users/YOUR_USERNAME/NZB-APPS/nzbhydra/run.sh</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
 <key>KeepAlive</key>
 <false/>
 <key>StandardErrorPath</key>
 <string>/usr/local/var/log/nzbhydra.log</string>
 <key>StandardOutPath</key>
 <string>/usr/local/var/log/nzbhydra.log</string>
 </dict>
</plist>

make this:

# nano /Users/YOUR_USERNAME/NZB-APPS/nzbhydra/run.sh

with this content (change username, and path and IP):

#!/bin/bash
/usr/bin/python /Users/YOUR_USERNAME/NZB-APPS/nzbhydra/nzbhydra.py --logfile /usr/local/var/log/nzbhydra.log --host YOUR_IP_ADD_RESS --nobrowser --daemon

save and exit then:

# chmod +x run.sh

test:

# touch /usr/local/var/log/nzbhydra.log
# tail -f /usr/local/var/log/nzbhydra.log 
# /Users/YOUR_USERNAME/NZB-APPS/nzbhydra/run.sh

you should see output and nzbyhydra should be available at http://YOUR.IP:5075
if it all runs you probably want to make it start on reboot:

launchctl load ~/Library/LaunchAgents/com.jackett.jackett.plist
launchctl start com.jackett.jackett

and here’s how you unload if you need to:

launchctl unload ~/Library/LaunchAgents/com.jackett.jackett.plist

Let me know if this helps you or have a better way by commenting!

Howto: Ricing Mac OS-X with Zsh, Iterm2 Borderless + Padding, TMux and KWM

This past weekend I saw over on /r/unixporn that ricing Mac OSX is a ‘thing’. I used to have a lot of fun doing this on my old linux systems when I was a kid, like Enlightenment, Afterstep, Windowmaker, XFCE, and anything else I could customize to look like something from a cool ‘hacker movie’ or something like that.

Anyway, this got me inspired to change my desktop into something a little cooler looking than standard OSX and here’s the basic premise of everything I did.

First, you’re going to want to install Brew, which is a package management system that’ll let you install additional software on your mac in a nicely controlled and updatable manner.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Now that brew is installed, we can run through the rest of the basic setup to get this going.

What I did first, was change the default shell from Bash over to Zsh, which you can see the differences here if you’re interested

 brew install zsh
 nano /etc/shells
 add
 /usr/local/bin/zsh
 sudo dscl . -create /Users/<YOURUSERNAME> UserShell /usr/local/bin/zsh
 sudo dscl . -create /Users/hugodrax UserShell /usr/local/bin/zsh

now check to make sure it’s set properly

 dscl . -read /Users/$USER UserShell
 or
 echo $SHELL

copy this in to your .zshrc

 HISTFILE=~/.histfile
 HISTSIZE=20000
 SAVEHIST=1000
 setopt notify
 bindkey -e
 zstyle :compinstall filename '/Users/hugodrax/.zshrc'
 autoload -Uz compinit
 compinit
 autoload -U colors && colors
 PS1="%{$fg[cyan]%}%n%{$reset_color%} %{$fg[white]%}%~ %{$reset_color%}%% "
 # ALIASES
 alias ls='ls -G'

Now, let’s install instantly awesome Zsh

 cd ~/Documents/Source/
 git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
 setopt EXTENDED_GLOB
 for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
 ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
 done

then, lets change the prompt

 prompt -l
 prompt -p kylewest
 prompt kylewest

then make it permanant

 nano ~/.zpreztorc

and change

 zstyle ':prezto:module:prompt' theme 'sorin'

to

 zstyle ':prezto:module:prompt' theme 'kylewest'

also, scroll to the second to last line and uncomment the iterm2 integration in the same file, then exit and save. Now, you should be able to start up Iterm2 and you’re running Zsh in there instead of bash.

Now, lets install tmux, a wonderful GNU Screen replacement

git clone https://github.com/tony/tmux-config.git ~/.tmux
ln -s ~/.tmux/.tmux.conf ~/.tmux.conf
cd ~/.tmux
git submodule init
git submodule update
cd ~/.tmux/vendor/tmux-mem-cpu-load
cmake .
make
sudo make install
cd ~
git clone https://github.com/powerline/fonts.git fonts
cd ~/fonts 
pip install --user powerline-status
cd ..
git clone https://github.com/kovidgoyal/powerline-daemon.git pld
cd ~/pld 
gcc -O3 powerline-client.c -o powerline-client
chmod +x powerline-daemon
powerline-daemon
sudo cp powerline-client powerline-daemon /usr/local/bin
sudo apt-get install powerline
then add this to tmux.conf
nano ~/.tmux.conf

if-shell 'test -f ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf' 'source-file ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf'
Then change your font in ITerm2 to be a -powerline font and all should look nice.

So, next we’re going to want to install a customized version of Iterm2 to accommodating padding , and borderless which looks much cooler 🙂

So in our terminal we’ll go

 cd ~/Documents/
 mkdir Source && cd Source
 git clone https://github.com/jaredculp/iterm2-borderless-padding.git iterm2-borderless-padding
 cd iterm2-borderless-padding
 ./install.sh 20 20
 mv ./iTerm2/build/Development/iTerm2.app /Applications/

Now, re-open Iterm2 and you’ll have a zsh shell with colorized ls output, running in a borderless window with 20 pixels padding on all edges. Don’t forget to change your font to one of the -powerline fonts, and try out tmux too!

Then, we’ll install KWM which is a nice tiling window manager.

 brew install koekeishiya/kwm/kwm
 mkdir -p ~/.kwm
 cp /usr/local/Cellar/kwm/3.0.7/kwmrc ~/.kwm/kwmrc
 brew services start koekeishiya/kwm/kwm

now you can reboot, and you should be good to go.

After rebooting, you’ll probably want to modify your KWMrc file to your liking, here’s a good starting point.

Here’s a screenshot since they’re cool and stuff [some of it is obfuscated fyi];

ss