Skip to content

Instantly share code, notes, and snippets.

@keyurshah
keyurshah / deploy.php
Created April 15, 2019 05:19 — forked from AugustMiller/deploy.php
Boilerplate Deployer config for a Craft 3 project https://deployer.org
<?php
namespace Deployer;
require 'recipe/composer.php';
// Project name
set('application', 'my-project');
// Project repository
set('repository', '[email protected]:organization/repo.git');
@keyurshah
keyurshah / tailwind.config.js
Created March 29, 2019 17:51
Tailwind configuration for rapid prototyping of custom designs
/*
Tailwind - The Utility-First CSS Framework
A project by Adam Wathan (@adamwathan), Jonathan Reinink (@reinink),
David Hemphill (@davidhemphill) and Steve Schoger (@steveschoger).
Welcome to the Tailwind config file. This is where you can customize
Tailwind specifically for your project. Don't be intimidated by the
length of this file. It's really just a big JavaScript object and
@keyurshah
keyurshah / vimeo-download.py
Created December 28, 2018 15:57 — forked from alexeygrigorev/vimeo-download.py
Downloading segmented video from vimeo
import requests
import base64
from tqdm import tqdm
master_json_url = 'https://178skyfiregce-a.akamaihd.net/exp=1474107106~acl=%2F142089577%2F%2A~hmac=0d9becc441fc5385462d53bf59cf019c0184690862f49b414e9a2f1c5bafbe0d/142089577/video/426274424,426274425,426274423,426274422/master.json?base64_init=1'
base_url = master_json_url[:master_json_url.rfind('/', 0, -26) + 1]
resp = requests.get(master_json_url)
content = resp.json()
// Override Settings
var bcSfFilterSettings = {
general: {
limit: 60,
showDisplay: false,
activeScrollToTop: false,
loadProductFirst: true,
sortingList: ['manual', 'price-ascending', 'price-descending', 'title-ascending', 'title-descending', 'published-descending', 'published-ascending', 'sale-descending'],
removePrefixFromSwatchFile: false,
swatchStyle: 'square-grid'
@keyurshah
keyurshah / Pull-and-Sync-Data-Between-Google-Doc-Spreadsheet-and-MySQL.gs
Created March 7, 2018 12:06
You can pull data from MySQL database to Google doc spreadsheet auto with just click of a button or scheduled time. This is great use for retrieving data in spreadsheet format.
// MySQL to Google Spreadsheet By Pradeep Bheron
// Support and contact at pradeepbheron.com
function myMySQLFetchData() {
var conn = Jdbc.getConnection('jdbc:mysql://127.0.0.1:3306/employee_db', 'username', 'pass'); // Change it as per your database credentials
var stmt = conn.createStatement();
var start = new Date(); // Get script starting time
@keyurshah
keyurshah / 1-add-middleware.php
Created February 15, 2018 19:40 — forked from adamwathan/1-add-macros.php
Multiformat Endpoints in Laravel
<?php
namespace App\Http\Middleware;
class CaptureRequestExtension
{
public function handle($request, $next)
{
if ($request->route()->parameter('_extension') !== null) {
$request->attributes->set('_extension', substr($request->route()->parameter('_extension'), 1));
@keyurshah
keyurshah / gist:651f6f411c43faf2d99843e3d7d701db
Created January 2, 2018 11:01 — forked from NathanPJF/gist:251d85aee0a917e12bba
[Collection loop] Check odd/even
{% for product in collection.products %}
{% comment %}
{% capture remainder %}{{forloop.index | modulo: 2}}{% endcapture %}
{% if remainder == '0' %}
{% assign is_even = true %}
{% else %}
{% assign is_even = false %}
{% endif %}
@keyurshah
keyurshah / IAM
Created November 29, 2017 11:41 — forked from kellyselden/IAM
Only run EC2 instances during work hours
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt123456789",
"Effect": "Allow",
"Action": [
"ec2:StartInstances",
"ec2:StopInstances",
"ec2:DescribeInstances"
@keyurshah
keyurshah / webpack.mix.js
Created November 21, 2017 03:39 — forked from reinink/webpack.mix.js
Using Purgecss with Tailwind and Laravel Mix
let cssImport = require('postcss-import')
let cssNext = require('postcss-cssnext')
let glob = require('glob-all')
let mix = require('laravel-mix')
let purgeCss = require('purgecss-webpack-plugin')
let tailwind = require('tailwindcss')
mix.js('resources/assets/js/app.js', 'public/js')
.postCss('resources/assets/css/app.css', 'public/css/app.css', [
cssImport(),
@keyurshah
keyurshah / mixin.pug
Created October 15, 2017 14:48 — forked from BroFox86/macro.html
[Responsive image] html5 responsive image mixin #pug #mixin #html5
- src = "" // !
mixin respImage
- var src1 = src.replace(/(\.[\w\d_-]+)$/i, "@medium$1") + " " + size + "w"
- var src2 = src.replace(/(\.[\w\d_-]+)$/i, "@large$1") + " " + size * 1.5 + "w"
- var src3 = src.replace(/(\.[\w\d_-]+)$/i, "@huge$1") + " " + size * 2 + "w"
img(class = imgClass
srcset = src1 + ", " + src2 + ", " + src3
sizes = sizes