Skip to content

Instantly share code, notes, and snippets.

View joostvanveen's full-sized avatar

Joost van Veen joostvanveen

View GitHub Profile
@joostvanveen
joostvanveen / gulpfile.js
Created August 9, 2017 11:54
Default Accent Interactive Gulpfile for Wordpress
var gulp = require('gulp'),
sass = require('gulp-sass'),
plumber = require('gulp-plumber'),
livereload = require('gulp-livereload');
/* jshint task would be here */
gulp.task('build-css', function() {
return gulp.src('public_html/content/themes/THEMENAME/assets/styling/sass/*.scss')
.pipe(plumber())
@joostvanveen
joostvanveen / package.json
Created August 9, 2017 11:52
Default Accent Interactive gulp configuration package.json
{
"name": "ROC Mondriaan Techiek & ICT",
"version": "1.0.0",
"description": "Build by Accent interactive",
"main": "content/themes",
"dependencies": {
"gulp": "^3.9.1"
},
"devDependencies": {
"gulp": "^3.9.1",
@joostvanveen
joostvanveen / autoloader.php
Created June 9, 2017 06:37
PSR-0 PHP autoloader
<?php
/**
* PSR-0 autoloader
* @param string $className
*
* @see http://www.php-fig.org/psr/psr-0/
*/
function autoload($className)
{
@joostvanveen
joostvanveen / enable_magento_api_on_hypernode.rewrites
Created March 21, 2017 05:25
Enable Magento 1.* API on Byte Hypernode - nginx rewrite configuration. Typically, you would place this in server.rewrites or public.rewrites. See https://support.hypernode.com/knowledgebase/rewriting-and-redirecting-urls-in-nginx/
# Enable Magento 1.* API on Byte Hypernode
# Rewrite is piped through phpfpm, or the api.php is not run through PHP interpreter.
location /api {
rewrite ^/api/rest /api.php?type=rest last;
location ~ \.php$ {
echo_exec @phpfpm;
}
}
@joostvanveen
joostvanveen / magento_development_settings.sql
Last active May 23, 2017 14:39
A series of MySQL statements to run to prepare your Magento 1.9.* install for running on your development environment; for instance, after downloading a DB from production.
-- A series of MySQL statements to run to prepare your Magento 1.9.* install for running on
-- your development environment; for instance, after downloading a DB from production.
-- Make sure to replace :
-- PREFIX_
-- @base_url
-- @email
-- Variables
SET @base_url = 'http://yourlocalurl.dev/';
@joostvanveen
joostvanveen / public.rewrites
Created February 22, 2017 09:50
nginx rewrite to make Magento REST Api accessible on Byte Hypernode platform. Configuration PHP/fpm - nginx - varnish.
location /api {
rewrite ^/api/rest /api.php?type=rest last;
rewrite ^/api/v2_soap /api.php?type=v2_soap last;
rewrite ^/api/soap /api.php?type=soap last;
location ~ \.php$ {
echo_exec @phpfpm;
}
}
@joostvanveen
joostvanveen / delete_customers_and_orders_from_magento.sql
Last active September 16, 2021 19:07
Delete all customers and orders from Magento 1*
--
-- This query delelets all customers and orders from your
-- Magento 1.* install. Handy, if you have a bloated
-- Magento database and you need to do a bit
-- of cleaning up for use on a local machine.
--
-- Replace PREFIX_ with your current Magento table prefix.
--
-- USE AT OWN RISK. ALWAY BACKUP YOUR DATABASE FIRST.
--
@joostvanveen
joostvanveen / getIp.php
Created January 20, 2017 10:53
Get a user's IP address, also if you are behind a proxy server
<?php
/**
* Return the remote IP address, also if you are behind a proxy server
*/
function getIp()
{
if (isset($_SERVER)) {
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
@joostvanveen
joostvanveen / .gitignore
Last active January 6, 2017 06:17
Magento .gitignore - ignore all user generated files in /media, /var contents and RELEASE_NOTES.txt
############ Project specific rules ###############
# Exclude local.xml
data/web/public/app/etc/local.xml
# Ignore media, except .htaccess (Deny from all) and system files
data/web/public/media/*
!data/web/public/media/.htaccess
!data/web/public/media/customer
data/web/public/media/customer/*
@joostvanveen
joostvanveen / du.sh
Last active March 16, 2023 05:44
Get folder sizes on command line, including --max-depth, sorted by folder size desc
# Get available disk space
df -h
# Get the top 10 biggest folders in the current directory
du -h --max-depth=1 | sort -rh | head -10
# Get the top 10 biggest folders in the current directory and their first child directories
du -h --max-depth=2 | sort -rh | head -10
# Get sizes of all folders in the current directory