Skip to content

Instantly share code, notes, and snippets.

@mhawksey
mhawksey / gist:1442370
Last active February 25, 2024 12:01
Google Apps Script to read JSON and write to sheet
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@chrislkeller
chrislkeller / import_json_appsscript.js
Last active March 25, 2024 19:45
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@tridungpham
tridungpham / new_gist_file.sql
Created December 4, 2013 10:28
Create new admin user in Magento with password "admin"
INSERT INTO admin_user SELECT
NULL `user_id`,
"Dung" `firstname`,
"Pham" `lastname`,
"dungpt@sutunam.com" `email`,
"dungpt.sutunam" `username`,
"9684dfd577831f73890e88fe18ca9072:Hs" `password`,
NOW() `created`,
NULL `modified`,
NULL `logdate`,
@steve-ross
steve-ross / tar_mage_directory.sh
Last active December 24, 2019 10:48
Magento Tar Directory Script
#!/bin/bash
echo "////////////////////////// MAGENTO TAR ////////////////////////////"
date
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
excludefilename="$DIR/exclude_files.txt"
day=$(date +%A)
path=$1
@iAugur
iAugur / Apache Better Blocking with common rules.txt
Last active February 14, 2022 14:28
Apache: Better Blocking with common rules
Following on from other Gists I have posted, this one shows a neat way of using Includes to centralise general blocking rules for Bad Bots, creepy crawlers and irritating IPs
see the full post at http://www.blue-bag.com/blog/apache-better-blocking-common-rules
@peterjaap
peterjaap / .gitignore
Created September 17, 2014 07:41
Magento .gitignore
# General web stuff
/.htaccess
/robots.txt
/sitemap.xml
/*.sql
/google*.html
# Magento stuff
app/etc/local.xml
downloader/.cache
@sco-tt
sco-tt / GA-sort-two-columns.js
Last active August 5, 2022 05:44
This Google Apps Script sorts two columns. Variables can be modified to define what two columns should be sorted, and whether they should be ascending or descending.
/** Build a menu item
From https://developers.google.com/apps-script/guides/menus#menus_for_add-ons_in_google_docs_or_sheets
**/
function onOpen(e) {
var menu = SpreadsheetApp.getUi().createMenu('Sort');
if (e && e.authMode == ScriptApp.AuthMode.NONE) {
// Add a normal menu item (works in all authorization modes).
menu.addItem('Sort Sheet', 'sort');
} else {
# Disallow all crawlers access to certain pages.
# Block Yandex from crawling site
User-agent: Yandex
Disallow: /
# Block Yeti
User-agent: Yeti
Disallow: /
@howyay
howyay / Setting up Postfix on Debian.md
Last active June 23, 2024 15:27
A guide to set up a Postfix + Dovecot IMAP server with complete spf, dkim and dmarc support.

An ultimate guide to Postfix + Dovecot IMAP server with complete SPF, DKIM and DMARC support and additional instructions for a multi-domain setup

In this guide, domain.com will be your root domain and mail.domain.com will be the hostname of your mail server