Skip to content

Instantly share code, notes, and snippets.

View brojask's full-sized avatar

Hello World! Here's brojask

View GitHub Profile
--
-- La ciencia está en:
--
-- * Agregar un campo en la tabla de tipo tsvector (1), en este caso se llama tsv,
-- podría ponérsele cualquier nombre.
-- * Agregar un índice GIN (2)
-- * Crear un trigger que cuando se inserte o actualice una tupla se actualice la
-- columna tsv (nuestro tsvector)
--
-- 1. http://www.postgresql.org/docs/9.1/static/datatype-textsearch.html
@brojask
brojask / Single Page Wordpress
Created September 7, 2015 16:18
Single Page for Wordpress Theme
<?php
get_header();
?>
<div id="container">
<a name="top"></a>
<?php
$args = array(
'sort_order' => 'ASC',
'sort_column' => 'menu_order', //post_title
'hierarchical' => 1,
@brojask
brojask / gist:dd261598db3ea01a2415
Last active September 9, 2015 17:31
WP Single Page
<?php
#First step: Sync the navigation and each page sections
# functions.php
class description_walker extends Walker_Nav_Menu{
function start_el(&$output, $item, $depth, $args){
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
@brojask
brojask / Best Single Page Wordpress
Created September 17, 2015 05:15
Best Single Page Wordpress
#Ref: http://qnimate.com/creating-a-one-page-wordpress-theme/
#Create a Template file for Home Page
<?php /* Template Name: Single Page Theme Page */ ?>
#Programmatically Creating and Setting Home Page
<?php
if(get_page_by_title("Home") == null)
{
@brojask
brojask / gist:57b96e62cf40c9a7d65f
Created October 27, 2015 15:53 — forked from liamcurry/gist:2597326
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@brojask
brojask / gulpfile.js
Created October 27, 2015 18:02 — forked from samuelhorn/gulpfile.js
My gulpfile for new projects
/*******************************************************************************
1. DEPENDENCIES
*******************************************************************************/
var gulp = require('gulp'); // gulp core
sass = require('gulp-sass'), // sass compiler
uglify = require('gulp-uglify'), // uglifies the js
jshint = require('gulp-jshint'), // check if js is ok
rename = require("gulp-rename"); // rename files
concat = require('gulp-concat'), // concatinate js
@brojask
brojask / auto_suggest.md
Created November 6, 2015 23:07
Typeahead.js & Laravel
  • view/index.blade.php
{{ Form::open(['url' => '/profile', 'method' => 'get']) }}
	{{ Form::text('user', null, ['id'=>'users']) }}
	{{ Form::submit('GO') }}
{{ Form::close() }}
  • routes.php
Route::get('/', 'SearchController@index');
@brojask
brojask / wordpress_custom_post_gallery.php
Created December 15, 2015 03:57 — forked from alexdunae/wordpress_custom_post_gallery.php
Display a custom post type's media library inline on the WordPress edit page screen
<?php
define('MY_POST_TYPE', 'my');
define('MY_POST_SLUG', 'gallery');
function my_register_post_type () {
$args = array (
'label' => 'Gallery',
'supports' => array( 'title', 'excerpt' ),
'register_meta_box_cb' => 'my_meta_box_cb',
@brojask
brojask / post-listing-shortcode.php
Created December 24, 2015 00:29
Shortcode to List Posts With Multiple Parameters
<?php
/*
Plugin Name: WPTutsPlus Post-listing shortcode
Plugin URI: http://rachelmccollin.co.uk
Description: This plugin provides a shortcode to list posts, with parameters. It also registers a couple of post types and tacxonomies to work with.
Version: 1.0
Author: Rachel McCollin
Author URI: http://rachelmccollin.co.uk
License: GPLv2
*/
@brojask
brojask / multiple-custom-post-types.php
Created January 13, 2016 20:53
MULTIPLE CUSTOM POST TYPE
<?php
// ADDING CUSTOM POST TYPE
add_action('init', 'all_custom_post_types');
function all_custom_post_types() {
$types = array(
// News and Events