Skip to content

Instantly share code, notes, and snippets.

View fredyounan's full-sized avatar

Fred Y fredyounan

  • Montreal, Canada
View GitHub Profile
@fredyounan
fredyounan / display-shopify-vendor-list-with-inactive-vendors.md
Created July 24, 2022 01:45 — forked from rseabrook/display-shopify-vendor-list-with-inactive-vendors.md
Creating a multi-column, alphabetized vendor list in Shopify including inactive vendors

Adding inactive vendors to a multi-column, alphabetized vendor list in Shopify

This extends the multi-column, alphabetized vendor list in Shopify guide.

If all of the vendors you want to include in your vendor directory already have products assigned to them, that guide is simpler. If you want to include arbitrary vendor names that are not linked to any product in your store, this is the guide for you.

Requirements

  • Responsive, multi-column layout
  • Alphabetical order from top-to-bottom and then left-to-right.
@fredyounan
fredyounan / gist:4964e1ab6ade5fbb6c6fa14d66b60c08
Created July 24, 2022 01:37 — forked from rameshanandakrishnan/gist:cea2ae42be7e01ed88f0
Shopify support multiple gift wrapping options - modified Caroline Schnapp's gift wrapper code
<!-- Add a flat charge per order -->
<!-- DO NOT REMOVE THE FOLLOWING COMMENT -->
<!-- (c) Copyright 2014 Caroline Hill. All Rights Reserved. Contact Mlle Caroline Schnapp at mllegeorgesand@gmail.com -->
<!-- DO NOT REMOVE THE ABOVE COMMENT -->
{% if linklists.gift-wrapping.links.size > 0 and linklists.gift-wrapping.links.first.type == 'product_link' %}
<div id="is-a-gift" class="clearfix rte">
{% for variant in linklists.gift-wrapping.links.first.object.variants %}
<p>
@fredyounan
fredyounan / gulp-shopify-theme.js
Created December 16, 2019 15:37 — forked from panoply/gulp-shopify-theme.js
Gulp stream for theme building. The stream relies on a specific directory structure.
//=====================================================//
//## PLUGINS
//=====================================================//
// Gulp plugin setup
var gulp = require('gulp');
// Gulp Plumber for Error control
var plumber = require('gulp-plumber');
@fredyounan
fredyounan / gulpfile.js
Created September 15, 2019 10:30 — forked from tmslnz/gulpfile.js
Complete example gulpfile.js for https://github.com/tmslnz/gulp-shopify-theme
/*
Streamlined Shopify theme development.
NOTE: depends on module gulp-shopify-theme
npm install --save-dev yargs gulp gulp-sass gulp-changed gulp-sourcemaps gulp-autoprefixer gulp-uglify gulp-concat gulp-replace gulp-plumber gulp-babel browser-sync gulp-if del gulp-add-src gulp-rename gulp-yaml gulp-shopify-theme
Highlights:
- https proxying via BrowserSync
@fredyounan
fredyounan / Twilio_notification.php
Created February 4, 2018 19:48 — forked from nrollr/Twilio_notification.php
SMS notification using the Twilio API
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once 'twilio/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your account details via twilio.com/user/account
$sid = "xxxxxxxxxxxxxxxxxx"; //Account Sid
$token = "xxxxxxxxxxxxxxxxxx"; //Auth Token
$client = new Client($sid, $token);
@fredyounan
fredyounan / NPerGroup.php
Created January 8, 2017 03:29 — forked from mrexclamation/NPerGroup.php
Enhanced version of https://softonsofa.com/tweaking-eloquent-relations-how-to-get-n-related-models-per-parent/, tested on hasMany and belongsToMany relationships
<?php
namespace App\Traits;
trait NPerGroup {
/**
* query scope nPerGroup
*
* @return void
*/
@fredyounan
fredyounan / linkify.php
Created October 2, 2016 04:18 — forked from jasny/linkify.php
PHP function to turn all URLs in clickable links
<?php
/**
* Turn all URLs in clickable links.
*
* @param string $value
* @param array $protocols http/https, ftp, mail, twitter
* @param array $attributes
* @param string $mode normal or all
* @return string
*/
@fredyounan
fredyounan / eloquent-join.php
Created September 25, 2016 14:26 — forked from bastiankoetsier/eloquent-join.php
Forces eloquent to join tables instead of eager-loading. useful for filtering & orderin
/**
* @param $query
* @param $relation_name
* @param string $operator
* @param string $type
* @param bool $where
* @return mixed
*/
public function scopeModelJoin($query, $relation_name, $operator = '=', $type = 'left', $where = false)
{
@fredyounan
fredyounan / eloquent-cheatsheet.php
Created September 25, 2016 13:45 — forked from hassansin/eloquent-cheatsheet.php
Laravel 5 Eloquent CheatSheet #laravel #eloquent
Model::
/*Select*/
select('col1','col2')
->select(array('col1','col2'))
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating'))
->addSelect('col3','col4')
->distinct() // distinct select
/*From*/
@fredyounan
fredyounan / Cache.php
Created May 7, 2016 03:58 — forked from dwightwatson/Cache.php
A simple cache middleware for Laravel 5, which won't cache authenticated pages.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Cache\Repository;
class Cache