Skip to content

Instantly share code, notes, and snippets.

View jamesspittal's full-sized avatar

James Spittal jamesspittal

View GitHub Profile
@LoyEgor
LoyEgor / gulpfile.js
Last active March 13, 2023 17:22
best image compression settings (gulp-imagemin)
// install
// npm i gulp-cache gulp-imagemin imagemin-pngquant imagemin-zopfli imagemin-mozjpeg imagemin-giflossy -f
// node node_modules/jpegtran-bin/lib/install.js
// node node_modules/gifsicle/lib/install.js
// node node_modules/zopflipng-bin/lib/install.js
// node node_modules/mozjpeg/lib/install.js
// node node_modules/giflossy/lib/install.js
// node node_modules/pngquant-bin/lib/install.js
@cspenn
cspenn / TagSpider.py
Last active May 27, 2020 08:38
GA/GTM Tag Checker in Python and Scrapy
# -*- coding: utf-8 -*-
# Copyright Christopher S. Penn, 2016 | cspenn.com | @cspenn
# This software is licensed under the GNU General Public License, version 3.0.
# Absolutely no warranty or support is provided.
# Run at your own risk.
import scrapy
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
@tomfuertes
tomfuertes / log-exps.bookmark.js
Last active May 10, 2017 15:33
link and log exp's
(function() {
var $ = optimizely.$;
$.each(optimizely.allExperiments, function(id, experiment) {
var data = {
name: experiment.name
};
if (experiment.enabled) data['enabled'] = true;
console.group(data);
if (experiment.variation_ids) $.each(
experiment.variation_ids,
// Optimizely JavaScript API
// http://developers.optimizely.com/javascript/
// To opt a visitor out of Optimizely tracking
// http://www.example.com/page.html?optimizely_opt_out=true
// 1. API Function Calls
// http://developers.optimizely.com/javascript/#api-function-calls-2
@davidnknight
davidnknight / Gulpfile
Last active June 19, 2021 03:23
A well structured gulpfile that performs CSS, JS, image and PHP tasks with an abstract config.
Specifically, this gruntfile will perform the following.
- CSS:
-- Compile SCSS
-- Add vendor prefixes for the last 10 browser versions
- JS:
-- Run scripts through jshint to detect errors and potential problems in code.
-- Compile scripts to your destination folder in their original state. Use these in development environments as they'll be easier to debug with as their code doesn't exist on 1 line, nor is it obfuscated.
-- Minify and concatenate scripts into one all.min.js. Uglify will also obfuscate code if you set mangle to true, leave as false if using AngularJS.
(function getABTest() {
var abTestName = '',
abTestVariation = '',
abTest = 'No test',
abTestExperiments = optimizely.allExperiments[Object.keys(optimizely.variationMap)];
if (abTestExperiments) {
abTestVariation = Object.keys(optimizely.variationNamesMap).map(function(el) { return optimizely.variationNamesMap[el]; })[0];
abTestName = abTestExperiments.name;
abTest = abTestName + ': ' + abTestVariation;
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@mcls
mcls / osx_setup.md
Last active October 9, 2023 08:23 — forked from jpantuso/osx_lion_rail_setup.md
Setup mac for ruby dev
@edsu
edsu / bots.py
Created June 23, 2011 20:16
see what your bot traffic is like
#!/usr/bin/env python
"""
Hack to look for user agent strings in typical Apache style log and
count up the number of requests by bots vs non-bots. The list of bot
user agents comes from http://www.user-agents.org/ but has had some
agents added to it, since the user-agents.org list is pretty out of date, e.g.
no Bing?!
"""