Skip to content

Instantly share code, notes, and snippets.

Avatar

Joost van Veen joostvanveen

View GitHub Profile
@joostvanveen
joostvanveen / gulpfile.js
Created Aug 9, 2017
Default Accent Interactive Gulpfile for Wordpress
View gulpfile.js
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 Aug 9, 2017
Default Accent Interactive gulp configuration package.json
View 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",
View autoloader.php
<?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 Mar 21, 2017
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/
View enable_magento_api_on_hypernode.rewrites
# 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
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.
View magento_development_settings.sql
-- 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 Feb 22, 2017
nginx rewrite to make Magento REST Api accessible on Byte Hypernode platform. Configuration PHP/fpm - nginx - varnish.
View public.rewrites
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 Sep 16, 2021
Delete all customers and orders from Magento 1*
View delete_customers_and_orders_from_magento.sql
--
-- 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 Jan 20, 2017
Get a user's IP address, also if you are behind a proxy server
View getIp.php
<?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 Jan 6, 2017
Magento .gitignore - ignore all user generated files in /media, /var contents and RELEASE_NOTES.txt
View .gitignore
############ 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 Jun 20, 2021
Get folder sizes on command line, including --max-depth, sorted by folder size desc
View du.sh
# 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