Skip to content

Instantly share code, notes, and snippets.

View elvismdev's full-sized avatar
🇨🇺

Elvis Morales elvismdev

🇨🇺
View GitHub Profile
@tournasdim
tournasdim / Bootstrap.php
Last active December 6, 2017 06:40
#Doctrine Doctrine 2 One-To-Many, Bidirectional example . Replacing "Simple Annotation Reader" by "Extended Annotation Reader) . Notions are now defined by "@Orm\xxx" instead of "@xxx" .
<?php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
//use Doctrine\ORM\Mapping\Driver\AnnotationDriver ;
//use Doctrine\Common\Annotations\AnnotationReader ;
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../config/config.php';
@spivurno
spivurno / gw-gravity-forms-multi-form-export.php
Last active November 8, 2017 21:58
DEPRECATED: Gravity Wiz // Gravity Forms // Multi-form Entry Exporter
<?php
/**
* Gravity Wiz // Gravity Forms // Multi-form Entry Exporter
*
* Allows you create a custom entry export containing fields from multiple forms. The custom export
* is then displayed in the "Form" drop down menu in a "Multi-form Export" option group.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
@claudiosanches
claudiosanches / functions.php
Created June 8, 2014 21:44
WooCommerce - Change the product loop add to cart button text per product type
<?php
function custom_woocommerce_product_add_to_cart_text( $text, $product ) {
switch ( $product->product_type ) {
case 'simple':
return __( 'Texto para produto simples' );
break;
case 'variable':
return __( 'Texto para produto variável' );
break;
case 'grouped':
@calendee
calendee / app.scss
Last active December 6, 2018 14:16 — forked from malixsys/app.scss
form i.icon.error {
color: $assertive;
}
form input + i.icon.error {
display: none;
margin-left: 8px;
}
form.ng-submitted input.ng-invalid + i.icon.error {
@pommiegranit
pommiegranit / base.twig
Last active May 31, 2021 18:50
Timber + Twig Examples
{% import 'twig/macros.twig' as macros %}
{{ function( 'get_header' ) }}
<div id="primary" class="content-area">
<div id="main" class="site-main" role="main">
{% block content %}{% endblock %}
</div><!-- #main -->
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@srikat
srikat / functions.php
Last active March 20, 2017 15:08
How to add Beautiful Pro’s mobile responsive menu in other Genesis themes. http://sridharkatakam.com/add-beautiful-pros-mobile-responsive-menu-genesis-themes/
// Enqueue scripts and styles
add_action( 'wp_enqueue_scripts', 'custom_scripts_styles_mobile_responsive' );
function custom_scripts_styles_mobile_responsive() {
wp_enqueue_script( 'beautiful-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_style( 'dashicons' );
}
@richardtape
richardtape / subdir-loader.php
Created August 23, 2014 01:35
Allow WordPress-MU plugins to be loaded automatically from a sub directory
<?php
/**
* Plugin Name: MU plugins subdirectory loader
* Plugin URI: http://code.ctlt.ubc.ca
* Description: Enables the loading of plugins sitting in mu-plugins (as folders)
* Version: 0.1
* Author: iamfriendly, CTLT
* Author URI: http://ubc.ca/
*
@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active September 23, 2025 16:12
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active October 17, 2025 00:50
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from a URL address.
*
* @param string $url The URL address.
* @param int|null $parent_post_id The parent post ID (Optional).
* @return int|false The attachment ID on success. False on failure.
*/
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) {