Skip to content

Instantly share code, notes, and snippets.

@samba
samba / shopify.datalayer.html
Last active April 25, 2024 07:52
Shopify DataLayer Checkout
{% if first_time_accessed %}
<script>
(function(dataLayer){
var customer_type = ({{customer.orders_count}} > 1) ? 'repeatcustomer' : 'newcustomer';
var discounts = "{{ order.discounts | map: 'code' | join: ',' | upcase}}";
function strip(text){
return text.replace(/\s+/, ' ').replace(/^\s+/, '').replace(/\s+$/, '');
}
@xvorenda
xvorenda / transmission-remote-magnet.sh
Last active February 21, 2017 21:13 — forked from sbisbee/transmission-remote-magnet.bash
Quick and easy way of making Chrome send bittorrent magnet links to a remote Transmission instance using its API on OSX 10.11.1 using built-in tools.

Quick and easy way of making Chrome send bittorrent magnet links to a remote Transmission instance using its API on OSX, with PHP, Javascript, and OSX's built-in Apache.

Chrome does not handle default protocol applications without a little encouragement. But we're about to take care of that (see Step 6).

Steps:

  1. Install the shell script transmission-remote-magnet: cp ~/src/transmission-remote-magnet.sh /usr/local/bin/transmission-remote-magnet

  2. Install the php file, which is required for link handling to work, and will likely require sudo: sudo cp ~/src/trm.php /Library/WebServer/Documents/

@jonathantneal
jonathantneal / README.md
Last active March 19, 2024 23:31
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@maephisto
maephisto / Javascript ISO country code to country name conversion
Last active November 3, 2023 21:05
ISO 3166-1 alpha-2 country code to country name conversion with a simple Javascript implementation, an array and a function.
var isoCountries = {
'AF' : 'Afghanistan',
'AX' : 'Aland Islands',
'AL' : 'Albania',
'DZ' : 'Algeria',
'AS' : 'American Samoa',
'AD' : 'Andorra',
'AO' : 'Angola',
'AI' : 'Anguilla',
'AQ' : 'Antarctica',
@larrybotha
larrybotha / _px-and-rem.scss
Last active April 9, 2018 16:50
Sass mixin - rems with px fallback
// This mixin outputs a property with rem units and a px fallback.
// Values passed without units are used as multipliers for the final
// rem and px values, all other units are output without modification.
// $base-font-size represents the root value of the document font-size
// in pixels.
//
// i.e. html { font-size: 100%;} // -> 16px
// Usage:
// @include px-and-rem([property], [multiplier | explicit value] [, ...]);
@nijikokun
nijikokun / Retinafy.md
Created July 24, 2012 01:42
Retinafy your site, a free book

Retinafy Your Site / Device

By Nijiko Yonskai

=====

I made a book, its one page.

Table Of Contents