Skip to content

Instantly share code, notes, and snippets.

View panoply's full-sized avatar
🥛
Rich in the hood

ΝΙΚΟΛΑΣ panoply

🥛
Rich in the hood
View GitHub Profile
@panoply
panoply / form.html
Created April 21, 2018 22:34
Mailchimp Subscription
<form action="http://brixtol.us13.list-manage.com/subscribe/post-json?">
<input type="hidden" name="COUNTRY" value="SE" id="mce-COUNTRY">
<input type="text" name="NAME" placeholder="Name" id="mce-NAME">
<input type="email" name="EMAIL" placeholder="Email Address" id="mce-EMAIL">
<button type="submit" name="subscribe" id="mc-embedded-subscribe">
Submit
</button>
<div id="response"></div>
</form>
@panoply
panoply / photoswipe.js
Created May 26, 2018 07:35
Photoswipe.js ES6 Implementation
import PhotoSwipe from 'photoswipe';
import PhotoSwipeUI_Default from 'photoswipe/dist/photoswipe-ui-default';
export default (selector) => {
const parseThumbnailElements = (element) => {
let items = [];
const thumbs = element.parentNode.querySelectorAll('figure');
@panoply
panoply / money.js
Created June 21, 2018 07:28
Shopify Currency Exchange
/**
* Currency Converter
* Used by Locale component for currency exchange rates.
*/
/* Modules */
import fx from "money";
import accounting from "accounting";
import symbol from 'currency-symbol-map';
import store from 'store/dist/store.modern';
@panoply
panoply / search.es6
Last active February 18, 2020 15:03
Shopify Search Filter using Mithril
/* Modules */
import m from 'mithril'
import url from 'urljs'
export default () => {
const products = document.querySelector('#product-collection')
const results = document.querySelector('#search-collection')
const items = data => {
return [
/* toggleGrid (body) {
const toggle = body.querySelector('#filter-grid')
const collection = body.querySelector('#collection-products')
const products = collection.querySelectorAll('.col-6')
toggle.onclick = event => {
return {
small: () => {
products.forEach(el => {
@panoply
panoply / scripts.js
Last active October 25, 2018 10:11
Rollup / Gulp configuration
/* PLUGINS */
import rollupStream from 'rollup-stream'
import buffer from 'vinyl-buffer'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import includePaths from 'rollup-plugin-includepaths'
import buble from 'rollup-plugin-buble'
import { uglify } from 'rollup-plugin-uglify'
import uglifyEs from 'rollup-plugin-uglify-es'
import fileSize from 'rollup-plugin-filesize'
@panoply
panoply / readme.md
Last active November 19, 2018 05:52
Cloudflare Client Side GeoIP

Cloudflare GeoIP (Client Side)

Cloudflare geolocates your visitors and add their country code to your header. If you only have client side access you cannot access this header value but you can query the /cdn-cgi/trace and grab the visitors country code. This code snippet is using the m.request API which is apart of the Mithril.js framework Core API but this will also work with a basic vanilla XHR request.

Live Example

[Flems](https://flems.io/#0=N4IgzgpgNhDGAuEAmIBcIDmED2BLADgHQBWYIANCAGa4xmoDaoAdgIYC2EaIhAFvOygUQsbM0TjuIAL7kWHLuix4ipYaPERJ6DWHgACAOI4C+gLz7gAHWb79opBFT7mAVyhRyNu1ngBhbEdnAAoASnMAPn12QgAnCABHVwg9YOtbO31XWKhnAHJ+eHwwVAB6UqoYdjBCXGxS2CRmAFpYDFxS+FjWWAg8rwy7R0hY3FYoXAAvJ30kVnhWSNn51kIwfAn4YLyrGzzQ731pUMJ4Xi1g4LmF8LMo9Mz7MT19ADdx5PNlhcJ2VnxLhNmBBblEgRA1htcFs8mZ9gdBk9mC8HBAvu8oMlCDQoIhYoDcMDQfpwQwAAwAXXMZgseSg2Fg+0OdmMKkIqK+qPJFIYAEYqQBCGn6PIADVFeX0ADIpU9HNy+RTDscbNIbDYYuxsK5xFcGa5OOJCAAjQIAT3IlkOYkJ0OcrIIh

@panoply
panoply / content_for_header.liquid
Created December 17, 2018 08:01
Minify Shopify content_for_header
{%- capture content_for_header -%}
{{ content_for_header | replace: ' ', '' | strip_newlines }}
{%- endcapture -%}
@panoply
panoply / error.log
Created January 17, 2019 16:45 — forked from kevinfiol/error.log
react/rollup/buble
λ yarn run start
yarn run v1.12.3
$ rollup -c -w --environment DEV
rollup v1.1.0
bundles ./src/index.js → public\app.js...
[!] (commonjs plugin) SyntaxError: Unexpected token (2821:19) in C:\.dev\js\.react\dota\node_modules\react-dom\cjs\react-dom.development.js
node_modules\react-dom\cjs\react-dom.development.js (2821:19)
2819: // on the client side because the browsers are inconsistent. Instead we call focus().
2820: 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
2821: // Microdata
@panoply
panoply / settings.js
Last active March 3, 2019 12:45
VS Code Settings
{
//
// # EDITOR - VSCODE CONFIGURATION
// # Global settings for VS Code editor
"editor.matchBrackets": false,
"editor.renderWhitespace": "all",
"editor.fontFamily": "Courier New",
"editor.fontSize": 17.75,
"editor.lineHeight": 22.5,
"editor.fontWeight": "500",