Skip to content

Instantly share code, notes, and snippets.

View swarad07's full-sized avatar
💻
Working from home

Swarad swarad07

💻
Working from home
View GitHub Profile
/* CSS */
@supports (-webkit-appearance: -apple-pay-button) {
.apple-pay-button-with-text {
display: inline-block;
-webkit-appearance: -apple-pay-button;
-apple-pay-button-type: buy;
}
.apple-pay-button-with-text > * {
display: none;
@swarad07
swarad07 / Apple Pay button HTML
Last active August 14, 2019 11:02
For AXL Blog
/* Template for logo only button (height independent). */
/* HTML */
<div class="apple-pay-button apple-pay-button-white"></div>
/* Template for "Buy with" button with height: 32 */
/* HTML */
<div class="apple-pay-button-with-text apple-pay-button-white-with-text">
<span class="text">Buy with</span>
@swarad07
swarad07 / wraith-run.sh
Created February 12, 2019 08:55
wraith-run.sh
#!/bin/bash
set -eo pipefail
# This script configures wraith and runs wraith.
# Fetching Pantheon URL with env:view command.
PANTHEON_ENVIRONMENT=$(terminus env:view --print "$TERMINUS_SITE.$TERMINUS_ENV")
# Pantheon adds a trailing slash, removing it so it works correctly with sed.
PANTHEON_ENVIRONMENT=${PANTHEON_ENVIRONMENT::-1}
@swarad07
swarad07 / directive.js
Created February 5, 2019 11:25
Directive.js from demo page https://www.cssscript.com/demo/touch-enabled-image-zoom-plugin-javascript/ the github repo points to a new version which doesnt work in Chrome mobile on some devices.
// @codingStandardsIgnoreStart
"use strict";
zoom();
function zoom(classNames, settings) {
/**
* IE 11 Compatiblity fix.
*
* IE 11 doesnt support ES6 standard so the function defination line,
* function zoom(classNames = {}, settings = {}) {
@swarad07
swarad07 / layout-debug.js
Last active May 6, 2020 17:30
Layout highlighter
/**
* Open browser console and add paste the below line.
* Outline will be added to all the elements.
*
* Credit for original idea: https://github.com/saki007ster
*/
$$('*').map(A=>A.style.outline=`1px solid hsl(${(A+A).length*9},99%,50%`);
@swarad07
swarad07 / unused-variables.sh
Created October 31, 2018 03:06
Find unused sass variables. Inspired from https://gist.github.com/badsyntax/6193491
#!/usr/bin/env bash
#
# Approach:
# 1. Find variable declaration in the form of "$my-var: anyvalue"
# 2. Loop through found variables and find occurrences of each variable in all sass files
# 3. Filter out vars that occurred only once
# Usage:
# Create a file (e.g. unused-variables.sh) having the below code, place it outside your sass folder.
# Run chmod +x ./unused-variables.sh to give execute permission to your script.
- run:
name: Run wraith
command: 01-wraith-run
- store_artifacts:
path: ./wraith/shots
// ######################################################
// This is an example module provided by Wraith.
// Feel free to amend for your own requirements.
// ######################################################
module.exports = function (phantom, ready) {
// make Wraith wait a bit longer before taking the screenshot
setTimeout(ready, 10000); // you MUST call the ready() callback for Wraith to continue
}
// ######################################################
// This is an example module provided by Wraith.
// Feel free to amend for your own requirements.
// ######################################################
module.exports = function (phantom, ready) {
// make Wraith wait a bit longer before taking the screenshot
setTimeout(ready, 10000); // you MUST call the ready() callback for Wraith to continue
}
@swarad07
swarad07 / wraith-setup.sh
Created May 30, 2018 10:37
wraith setup
$> wraith setup
create configs
create configs/capture.yaml
create configs/history.yaml
create configs/spider.yaml
create javascript
create javascript/cookies_and_headers--casper.js
create javascript/cookies_and_headers--phantom.js
create javascript/disable_javascript--casper.js
create javascript/disable_javascript--phantom.js