Skip to content

Instantly share code, notes, and snippets.

View lawrencetaur's full-sized avatar

Lawrence Taur lawrencetaur

View GitHub Profile
@lfjeff
lfjeff / serve_s3_images_from_own_domain.js
Created June 11, 2018 03:09
Serve S3 images from your own domain using Cloudflare worker
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
/**
* When we receive a request, fetch it from our S3 bucket
*
* For example, a request for:
* https://mydomain.com/images/castle01.jpg
* will be fetched from:
@shopifypartners
shopifypartners / related-products-by-tag-handle.liquid
Last active July 29, 2019 10:25
Code for section which generates related products based on matching handles and tags - https://www.shopify.com/partners/blog/related-products
@inancgumus
inancgumus / xmlToJson.xslt
Created May 16, 2017 10:20
XML to JSON using XSLT
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8"/>
<xsl:template match="/*[node()]">
<xsl:text>{</xsl:text>
<xsl:apply-templates select="." mode="detect" />
<xsl:text>}</xsl:text>
</xsl:template>
body {
color: #212121;
font-family: "Helvetica Neue", "Calibri Light", Roboto, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
letter-spacing: 0.02em;
}
@agu-z
agu-z / setup-firebase.js
Last active November 6, 2016 06:46
Useful script that automates nativescript-plugin-firebase's setup. Add it to your `postinstall` script and enjoy 😉
let fs = require('fs');
module.exports = function() {
let fileContent = fs.readFileSync('./platforms/android/build.gradle').toString();
if (!/(classpath "com.google.gms:google-services:.*")/.test(fileContent)) {
fileContent = fileContent.replace(/(classpath "com.android.tools.build:gradle:.*")/,
'$1\n\t\tclasspath "com.google.gms:google-services:3.0.0"');
}
@gokulkrishh
gokulkrishh / media-query.css
Last active July 6, 2024 19:41
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@jmonterroso
jmonterroso / ios.md
Created April 14, 2015 20:15
Open iOS simulator from terminal

Apple has introduced an interesting tool with Xcode 6!

simctl

simclt allows you to control the simulators running

run xcrun simctl to get the list of available subcommands. Lots of new options to play around.

Now to do what I wanted. Here is the command to launch simulator

Run this in your Mac Terminal (assuming you have the Ionic CLI):
----------------------------------------------------------------
ionic start wkwebviewpolyfilltest
cd wkwebviewpolyfilltest
ionic setup sass
ionic platform add ios
ionic plugin add https://github.com/EddyVerbruggen/cordova-plugin-wkwebview
ionic build
----------------------------------------------------------------
@darryn
darryn / Shopify tag filter groups
Last active August 23, 2023 03:51
Create tag filter groups in Shopify. This snippet is designed to group and separate out collection tags. It requires the tags to share a common value prepended to the tag with an underscore. E.g. to create a separate tag filter group for 'brands', each product will need to be tagged with 'brand_Nike' or 'brand_Reebok'. Some of this is probably l…
{% if template contains 'collection' and collection.all_tags.size > 1 %}
<!-- A recursive loop to catch and filter out the different tag categories -->
{% assign c = 0 %}
{% for t in collection.all_tags %}
{% capture cat %}{{ cat }}{% capture temp_cat %}{% if t contains '_' %}{% assign cat_grp = t | split: '_' %}{{ cat_grp.first }}{% endif %}{% endcapture %}{% unless cat contains temp_cat %}{% if t contains '_' %}{% assign new_cat_grp = t | split: '_' %}{{ new_cat_grp.first }}{% endif %}{% unless forloop.last %}+{% endunless %}{% assign c = c | plus: 1 %}{% endunless %}{% endcapture %}
{% endfor %}
<!-- create array of tag categories -->
{% assign cat_array = cat | split: '+' %}
@nodesocket
nodesocket / bootstrap.flatten.css
Last active April 1, 2021 23:37
Below are simple styles to "flatten" bootstrap. I didn't go through every control and widget that bootstrap offers, only what was required for https://commando.io, so your milage may vary.
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;