Skip to content

Instantly share code, notes, and snippets.

@btray77
btray77 / submitscriptexmaple.js
Created March 8, 2023 06:28
Example of how to take a google sheet with names and phone numbers and submits to a form.
function submitForms() {
// Get the active sheet
var sheet = SpreadsheetApp.getActiveSheet();
// Get the data range
var range = sheet.getDataRange();
var values = range.getValues();
// Loop through each row of data
for (var i = 0; i < values.length; i++) {
@btray77
btray77 / gist:b20b041365a29789458ba0061da063bc
Created September 21, 2022 09:27
Random Order String List Sorted
var str = "word1 word2 word3 word4 word5";
var wordList = str.split(" ");
var wordCount = wordList.length;
function permute(wordList, wordCount) {
var results = [];
if (wordCount === 1) {
return wordList;
}
@btray77
btray77 / resize-images.sh
Created July 8, 2016 01:36
Resize images in a folder to a minimum size, keep aspect ratio.
#!/bin/bash
#Edit webroot to meet your needs
IFS=$'\n'
set -e
minimumWidth=1000
minimumHeight=1000
FILES=$(find /webroot/media/catalog/product/ \( -name cache -prune \) -o -name '*' -type f -exec file {} \; | awk -F: '{ if ($2 ~/[Ii]mage|EPS/) print $1}')
@btray77
btray77 / cannotbesoldonebay.txt
Last active March 25, 2016 16:52
Supplements that cannot be sold on eBay or your will have your account suspended.
CTD Sports Noxipro Chrome Fruit Punch 292 g
Ctd Sports Noxipro Fruit Punch 216g 40 Svg
GAT JetFuel Superburn 120 ct
Hi-Tech Pharmaceuticals Lipodrene Yellow 90 tb
High Energy Labs HGH Complete 100 ct
High Energy Labs HGH Complete Raspberry Lemonade 700 g
Human Evolution Core Burner 60 ct
Human Evolution Core Burner Watermelon 30 svg
Labrada Charge Extreme Energy Booster 120 ct
Labrada For Her Fat Burner 60 ct
@btray77
btray77 / -etc-nginx-conf.d-export.conf
Last active January 18, 2016 17:59
This is my current nginx configuration for magento 1.9.2.2.
# configuration file /etc/nginx/conf.d/export.conf:
location ~ /var/export {
satisfy all;
allow 1.2.3.4;
deny all;
auth_basic "Restricted";
auth_basic_user_file .htpasswd;
autoindex off;
}
@btray77
btray77 / README.md
Last active January 16, 2016 04:02
Used make categories active or turn them off depending on if they have products in them in Magento 1.9.2.2 (other versions may work). This should be installed in your webroot/shell folder and run via a cron script as often as you wish it to run. We run it 2 times a day.

Here's an example cron. It runs at 3am/3pm daily. Only if the website is not undergoing maintenance.

0 3,15 * * * ! test -e /var/www/html/maintenance.flag && /usr/bin/php /var/www/html/shell/activeCategories.php

You could use something like this.

0 3,15 * * * /usr/bin/php /var/www/html/shell/activeCategories.php

@btray77
btray77 / add_map.php
Last active August 29, 2015 14:08
Set Map on Magento with LSFS
<?php
/*
(C) 2014 All Rights Reserved. Brad Traynham, MIT Licensed
This file goes in the shell folder of Magento.
*/
ini_set('display_errors', 'On');
ini_set('memory_limit', '512M');
error_reporting(E_ALL);
require_once('abstract.php');
@btray77
btray77 / all_backup.sh
Created August 6, 2014 19:45
dropbox-quick-backup-script
#!/bin/bash
# SOURCE: https://www.magenx.com/server/dropbox-quick-backup-script
# USAGE: chmod +x all_backup.sh
# ./all_backup.sh
MAGENTODB=YOUR_MAGENTO_DB
PASSWORD=YOUR_MAGENTO_DB_PASS
USER=YOUR_MAGENTO_DB_USER
@btray77
btray77 / Observer.php
Last active August 29, 2015 14:04
Magento CRON set Tax Class ID
<?php
// app/code/local/Yourname/Tax/Model/Observer.php
class YourName_Tax_Model_Observer {
public function updateTaxRates(){
$productCollection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('tax_class_id');
foreach ($productCollection as $product) {
$taxClassId = $product->getTaxClassId();
/* adjust body when menu is open */
body.slide-active {
overflow-x: hidden
}
/*first child of #page-content so it doesn't shift around*/
.no-margin-top {
margin-top: 0px!important
}
/*wrap the entire page content but not nav inside this div if not a fixed top, don't add any top padding */
#page-content {