Skip to content

Instantly share code, notes, and snippets.

View joelalejandro's full-sized avatar
🏳️‍🌈

Joel Alejandro Villarreal Bertoldi joelalejandro

🏳️‍🌈
View GitHub Profile
<?php
namespace Eurofrits\Theme\Controllers;
use Compage\Component\Controller;
class IndexController extends Controller {
public function __construct($theme) {
parent::__construct($theme, "Index");
<?php
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );
@joelalejandro
joelalejandro / initializers_errorificador.js
Last active August 29, 2015 14:25
Ember Errorificador
import errorificador from '../utils/errorificador';
export function initialize(/* container, application */) {
var swalError = { swalError: errorificador };
Ember.Controller.reopen(swalError);
Ember.Route.reopen(swalError);
Ember.Component.reopen(swalError);
}
export default {
@joelalejandro
joelalejandro / replicable-without-fragments.js
Last active August 29, 2015 14:26
Ember Data model replication
/**
* @package ReplicableMixin
* @author Joel A. Villarreal Bertoldi
* @version 0.0.1
* @license MIT
*
* Allows replicating a model with relationships to the database.
*
* Usage:
*
@joelalejandro
joelalejandro / basic-popover.html
Last active July 13, 2016 15:38
A basic Bootstrap Popover implementation.
<!-- Somewhere in the page -->
<a href="#"
data-toggle="popover"
data-content="Fill out the required data to deploy your app. Don't forget to increment the version number.">
What do I do here?
</a>
<!-- Somewhere in the end of the page -->
<script>
$('[data-toggle="popover"]').popover();
<!-- Somewhere in the page -->
<a href="#popover-tip-1" data-toggle="popover">What do I do here?</a>
<!-- Somewhere else in the page -->
<div id="popover-tip-1">
<h3>Version number?</h3>
<p><i>Nueva</i> expects you to use <a href="http://semver.org">semantic versioning</a>.</p>
<p>Some valid examples:
<ul>
<li>0.0.1</li>
<!-- Caja de búsqueda -->
<input type="search" placeholder="Buscar..." data-target="tabla-resultado">
<!-- Tabla de resultados -->
<table id="tabla-resultado">
<!-- muchos <TR> con filas -->
</table>
<!-- Script de búsqueda -->
<script>
import Twit from 'twit';
import Config from 'config';
import Pace from 'pace';
import fs from 'fs';
// Sets the Twitter API configuration.
const T = new Twit(Config.get('twitter'));
const tweets = [];
// Defines language and sample size.
[
{
"created_at": "Wed Oct 12 01:23:20 +0000 2016",
"id": 786014356379230200,
"id_str": "786014356379230208",
"text": "RT @serafinolivera2: Me la paso idiota en mi casa",
"source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
function compose(tweets = this.tweets, verses = this.settings.poem_rules.verse_count) {
let blockA = [], blockB = [], poem = [];
let i = 0;
let processed = 0;
let authors = [];
let titleBlocks = [];
while (processed < verses) {
const tweet = tweets[i];