Skip to content

Instantly share code, notes, and snippets.

View Hendrikv1990's full-sized avatar
💭
I may be slow to respond.

Hendrik Vlaanderen Hendrikv1990

💭
I may be slow to respond.
View GitHub Profile
@Hendrikv1990
Hendrikv1990 / _form.html.haml
Last active June 20, 2017 20:30
rails-cocoon-example ( cocoon gem for nested forms ). It's kind of useful for a lot of forms, and it's not needed to use ajax. Which in my opinion is always a little bit ugly
## with Bootstrap_form_for for lazy peeps
= bootstrap_form_for [:admin, @reservation] do |f|
- if @reservation.errors.any?
#error_explanation
%h2= "#{pluralize(@reservation.errors.count, "error")} prohibited this reservation from being saved:"
%ul
- @reservation.errors.full_messages.each do |message|
%li= message
.col-md-12
@Hendrikv1990
Hendrikv1990 / wp.sh
Created July 26, 2016 13:32 — forked from phlbnks/wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Do you need to setup new MySQL database? (y/n)"
read -e setupmysql
if [ "$setupmysql" == y ] ; then
echo "MySQL Admin User: "
read -e mysqluser
@Hendrikv1990
Hendrikv1990 / gist:2f5d993da992a1a93166
Last active January 18, 2016 17:47
Example for Category Hierarchies
Prefilter by Product Brands:
This is the hierarchy of the search
=Adidas (brand)
==Adidas Original (subbrand)
===Air (subsubbrand)
===Casual
==Adidas Performance
===Running
@Hendrikv1990
Hendrikv1990 / gist:ea0c8265856d705f8473
Created November 23, 2015 10:10
Woocommerce Templates
Templates work as follows in Woocommerce
> Create a php file name it template-calculator
Add the following PHP code, and go to pages, create page, name it calculator. Choose on the right the template (calculator).
All the code written in the template can be used.
<?php
/**
http://www.sitepoint.com/woocommerce-actions-and-filters-manipulate-cart/
https://docs.woothemes.com/wc-apidocs/class-WC_Cart.html
https://docs.woothemes.com/wc-apidocs/package-WooCommerce.Functions.Cart.html
https://gist.github.com/renegadesk/3967956
@Hendrikv1990
Hendrikv1990 / wp.sh
Created November 22, 2015 12:43 — forked from bgallagh3r/wp.sh
Wordpress: Bash Install Script -- Downloads latest WP version, updates wp-config with user supplied DB name, username and password, creates and CHMOD's uploads dir, copies all the files into the root dir you run the script from, then deletes itself!
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
CREATE DATABASE woocommerce;
CREATE USER admin@localhost;
SET PASSWORD FOR admin@localhost= PASSWORD("admin");
GRANT ALL PRIVILEGES ON woocommerce.* TO admin@localhost IDENTIFIED BY 'admin';
FLUSH PRIVILEGES;
http://stackoverflow.com/questions/11951570/mysql-create-user-with-a-variable
ssh-keygen
adduser username
visudo
deluser newuser
cat ~/.ssh/id_rsa.pub
@Hendrikv1990
Hendrikv1990 / gist:1656fbc1ac9ab83e75a1
Created November 21, 2015 12:39
Woocommerce to Normal Shop
Make a woocommerce shop less Woocommerce'ish
https://wordpress.org/plugins/woocommerce-admin-theme-for-shop-manager/
https://wordpress.org/plugins/wp-flatadmin/
https://wordpress.org/plugins/slate-admin-theme/
@Hendrikv1990
Hendrikv1990 / server_configuration.sh
Created November 17, 2015 16:30 — forked from marinoszak/server_configuration.sh
ubuntu 14.04, passenger, apache, rails
#!/bin/bash
# ================================================================== #
# Ubuntu 14.04 web server build shell script
# ================================================================== #
#
# ================================================================== #
#
#
#
# ================================================================== #