Skip to content

Instantly share code, notes, and snippets.

View brojask's full-sized avatar

Hello World! Here's brojask

View GitHub Profile
@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 / 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: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 / 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,
--
-- 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