Skip to content

Instantly share code, notes, and snippets.

🗿
fill the bl___

nusu

🗿
fill the bl___
Block or report user

Report or block nusu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattdesl
mattdesl / about.md
Last active Feb 19, 2019
optimizing & de-duplicating geometry in GLTF files
View about.md

optimize GLTF file

This optimizes a GLTF file that was exported by blender (or similar) by de-duplicating buffer views (i.e. chunks of bytes) that are equal and removing redundant accessors.

For example, 100 cubes of different scales/materials/rotations/etc should all end up using a single BufferGeometry in ThreeJS, which isn't the case with current GLTF exporters in Blender and parsers for ThreeJS.

In scenes with a lot of instancing, it can dramatically reduce total file size as well as render performance. In one test scene:

Before: 4.8MB file size, 832 THREE.Geometry instances across 832 THREE.Mesh objects
After: 661KB file size, 13 THREE.Geometry instances across 832 THREE.Mesh objects

@tanmay27vats
tanmay27vats / shopify-variant-filters.txt
Created Mar 9, 2017
Showing Shopify product's variants (Size / Length / Color) as filters on collection page.
View shopify-variant-filters.txt
/*****
Here, I am assuming that you have already assigned all variants as tags of a product. Because Shopify filter does not work with variant options.
And, if you assigns all variants as tags you can not differentiate them from tags.
Here I code that is working for 2 filters Size & Length (with mulitple options. ie mulitple sizes, multiple lengths, etc
*****/
<div class="filters-toolbar">
<div class="filters-toolbar__item size-filter">
{% assign variant_sizes = "" %}
{% assign variant_lengths = "" %}
@hallettj
hallettj / Makefile
Last active Mar 4, 2019
Makefile for transpiling with Babel & Flow in a Node app, or in a client- or server-side shared library
View Makefile
# Makefile for transpiling with Babel in a Node app, or in a client- or
# server-side shared library.
.PHONY: all clean
# Install `babel-cli` in a project to get the transpiler.
babel := node_modules/.bin/babel
# Identify modules to be transpiled by recursively searching the `src/`
# directory.
View _quickview.scss.liquid
#quick-view {
display: flex;
height: 100%;
justify-content: flex-end;
flex-wrap: wrap;
position: relative;
-ms-overflow-style: -ms-autohiding-scrollbar;
.qv-product-images {
width: 60%;
height: auto;
@eladnava
eladnava / mongodb-s3-backup.sh
Last active Jun 6, 2019
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
View mongodb-s3-backup.sh
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@carolineschnapp
carolineschnapp / multiple images for a variant.md
Created Mar 31, 2016
"Grouped variant images". Solution good for all themes, no change to markup required.
View multiple images for a variant.md

What to do

  1. Use the alt text to associate the additional images - besides the variant image - to the option value. Example: say you have 3 images that show the Blue variants, then a) associate the first image as variant image to all Blue variants, and b) set the alt text of the 2 additional images to 'Blue'.
  2. Copy+paste the code found in the product.liquid snippet below at the bottom of your product.liquid template.

How that works, essentially

Only the images associated to the currently selected variant are shown. Other images are hidden.

What to expect, the specifics

@mtigdemir
mtigdemir / turkce_ulke_kodlari.html
Created Jul 21, 2015
Türkçe ülke Kodları HTML (IS0 3166-1)
View turkce_ulke_kodlari.html
<select>
<option value="AF">Afganistan</option>
<option value="DE">Almanya</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AG">Antigua ve Barbuda</option>
<option value="AR">Arjantin</option>
<option value="AL">Arnavutluk</option>
<option value="AW">Aruba</option>
<option value="AU">Avustralya</option>
@DanWebb
DanWebb / imgURL.js
Last active Mar 20, 2019
Specify a size for a Shopify image asset url. Equivalent to the liquid image size filter: `{{ image | img_url: "medium" }}`
View imgURL.js
String.prototype.imgURL = function(size) {
// remove any current image size then add the new image size
return this
.replace(/_(pico|icon|thumb|small|compact|medium|large|grande|original|1024x1024|2048x2048|master)+\./g, '.')
.replace(/\.jpg|\.png|\.gif|\.jpeg/g, function(match) {
return '_'+size+match;
})
;
};
@max-mykhailenko
max-mykhailenko / # Sublime Emmet JSX Reactjs.md
Last active May 26, 2019
Sublime text 3. Enable Emmet in JSX files with Sublime React plugin
View # Sublime Emmet JSX Reactjs.md

This is no longer needed as Emmet supports JSX - you just need to turn it all on. Did a quick tutorial: http://wesbos.com/emmet-react-jsx-sublime/

Thanks, @wesbos

Problem

  • Using emmet in jsx files
  • Emmet expands text when js autocomplete needed
@clsource
clsource / 401-response.php
Created Jul 30, 2014
Helper for Creating REST Web Services with ProcessWire
View 401-response.php
<?php
/*
* 401 Response
*
* Sends a 401 Response Unauthorized
*
* @author Camilo Castro
*
* @date 29/07/2014
You can’t perform that action at this time.