Skip to content

Instantly share code, notes, and snippets.

View pije76's full-sized avatar

panjianom pije76

View GitHub Profile
@pije76
pije76 / infinte.scroll.paginator.html.twig
Created June 14, 2017 19:41 — forked from guilu/infinte.scroll.paginator.html.twig
infinte scroll knppaginatorbundle twig
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>infinite scroll</title>
</head>
<body>
{% block body %}
<!-- aqui pones el la plantilla que pinta los resultados de knppaginator -->
@pije76
pije76 / infinite-scroll.js
Created June 13, 2017 21:33 — forked from xocasdashdash/infinite-scroll.js
Simple infinite scrol with jQuery and a Symfony2 backend
is_processing = false;
last_page = false;
function addMoreElements() {
is_processing = true;
$.ajax({
type: "GET",
//FOS Routing
url: Routing.generate('route_name', {page: page}),
success: function(data) {
if (data.html.length > 0) {
@pije76
pije76 / ICS.php
Created June 5, 2017 21:55 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):
@pije76
pije76 / PostController.php
Created June 3, 2017 05:34 — forked from bhaktaraz/PostController.php
Symfony Event Listener to Increase Post View Count
<?php
/**
* Created by PhpStorm.
* User: bhaktaraz
* Date: 8/24/15
* Time: 9:51 AM
*/
namespace BRB\Bundle\PostBundle\Controller;
@pije76
pije76 / Magent_Product_Category_Query.sql
Created May 25, 2017 07:02 — forked from tegansnyder/Magent_Product_Category_Query.sql
Query to retrieve all product ids and the category they belong to in Magento.
SELECT `e`.entity_id, `at_category_id`.`category_id`
FROM `catalog_product_entity` AS `e`
LEFT JOIN `catalog_category_product` AS `at_category_id`
ON (at_category_id.`product_id`=e.entity_id)
@pije76
pije76 / gist:2147d0cc24020a6c555569b254a88f2b
Created May 24, 2017 20:26 — forked from sebsto/gist:9a958ff1c761b8c7c90d
Create IAM User and Attach a Policy using Boto and JSON
import json, boto
# Connect to IAM with boto
iam = boto.connect_iam(ACCESS_KEY, SECRET_KEY)
# Create user
user_response = iam.create_user('aws-user')
# Create Policy
policy = { 'Version' : '2012-10-17'}

Just some notes and references for myself.

  • In bash, you can access your C:\ drive via /mnt/c/
  • ~ = C:\Users\MLM\AppData\Local\lxss\home\mlm and is different from your Windows user directory C:\Users\MLM

How to google things

@pije76
pije76 / functions.php
Last active August 29, 2015 14:06 — forked from buchin/functions.php
function fb_change_search_url_rewrite() {
if ( is_search() && ! empty( $_GET['s'] ) ) {
$keywords = get_query_var( 's' );
list($first_word) = explode(' ', trim($keywords));
wp_redirect( home_url( $first_word ) . urlencode( $keywords ) );
exit();
}
}
add_action( 'template_redirect', 'fb_change_search_url_rewrite' );