Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View webarthur's full-sized avatar
✌️

Arthur Ronconi webarthur

✌️
View GitHub Profile
@webarthur
webarthur / wp-extend.blade.php
Last active December 21, 2018 05:50
Extending Blade template engine for WordPress
<?php
require_once dirname(__FILE__).'/lib/class.blade.php';
Blade::extend(function($value) {
$value = preg_replace('/(\s*)@wphead(\s*)/', '$1<?php wp_head() ?>$2', $value);
$value = preg_replace('/(\s*)@wpposts(\s*)/', '$1<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>$2', $value);
$value = preg_replace('/(\s*)@wpquery(\s*\(.*\))/', '$1<?php $q = new WP_Query$2; if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); ?> ', $value);
$value = preg_replace('/(\s*)@wpempty(\s*)/', '$1<?php endwhile; ?><?php else: ?>$2', $value);
@webarthur
webarthur / class.blade.php
Created September 18, 2015 13:06
PHP Blade template engine class
<?php
#namespace Laravel;
# Use: Blade::compile_all( $from_dir, $to_dir );
# visit: http://araujo.cc
# original class from http://cutlasswp.com
class Blade {
@webarthur
webarthur / sass.sh
Created September 18, 2015 13:14
How to use SASS / SCSS + PHP
# install ruby and gem
sudo apt-get install ruby gem
# install sass / scss
sudo gem install sass
# compile sass scripts
sass --watch scss/style.sass:css/style.css
# or compile scss scripts
@webarthur
webarthur / install-nodejs-gulp.sh
Created September 20, 2015 23:25
Installing NodeJS + Gulp to work with Apache/PHP env
# install NodeJS + npm
sudo apt-get install nodejs
# symbolic link for node
sudo ln -s /usr/bin/nodejs /usr/bin/node
# install gulp
sudo npm install --global gulp gulp-utils
# install nice plugins
# download installer
composer global require "laravel/installer=~1.1"
#setting up path
export PATH="~/.composer/vendor/bin:$PATH"
# change dir where to install
cd /var/www/html/
# download and installing
# system installation
sudo npm install -g bower
# laravel installation
bower init
# configure to laravel
# create .bowerrc file
# write:
# add this to your composer.json :
"laravelcollective/html": "~5.0"
# then update composer:
composer update
# then add providers in config/app.php
'Collective\Html\HtmlServiceProvider',
# and finally add two aliases in the same file:
bower install --save PolymerElements/iron-elements
bower install --save PolymerElements/paper-elements
bower install --save PolymerElements/gold-elements
bower install --save PolymerElements/neon-elements
bower install --save PolymerElements/platinum-elements
bower install --save GoogleWebComponents/google-web-components
@webarthur
webarthur / wp.composer.json
Created October 21, 2015 16:44
Easy way to install WordPress and plugins with Composer
{
"repositories": [
{
"type": "composer",
"url": "http://wpackagist.org"
}
],
"require": {
"php": ">=5.4",
"johnpbloch/wordpress": "*"
@webarthur
webarthur / filetypes.Coffeescript.conf
Created October 26, 2015 17:35
CoffeeScript for Geany
# From: https://github.com/czepol/geany-coffeescript-config/issues/2
# Save it in ~/.config/geany/filedefs/filetypes.Coffeescript.conf
# Add at Tools -> Config files -> filetypes_extensions.conf
# Coffeescript=*.coffee;*.coffeescript;*.cs;
[settings]
lexer_filetype=Javascript
tag_parser=Javascript