Skip to content

Instantly share code, notes, and snippets.

View tzkmx's full-sized avatar
🎉
estrenando repositorios privados

Jesus Franco tzkmx

🎉
estrenando repositorios privados
View GitHub Profile
@tzkmx
tzkmx / grommet_hello_world.html
Created May 31, 2016 23:05 — forked from grommetux/grommet_hello_world.html
Grommet Hello World app
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400italic,400,700' rel='stylesheet' type='text/css'>
<link href='http://grommet.io/assets/latest/css/grommet.min.css' rel='stylesheet' type='text/css'>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.2/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
@tzkmx
tzkmx / insert-posts.php
Created June 16, 2016 23:53
WordPress: Insert a post into WordPress from an external script
<?php
// Load WordPress
require_once 'path/to/www/wp-load.php';
require_once ABSPATH . '/wp-admin/includes/taxonomy.php';
// Set the timezone so times are calculated correctly
date_default_timezone_set('Europe/London');
// Create post
@tzkmx
tzkmx / ThemeClass.php
Created July 25, 2016 18:06
Towards a more testable WordPress. The main idea is simple. Instead of piling everything into a theme's functions.php file, create a class to hold all the theme's functions. Then, using dependency injection, add the WordPress facade and inside the ThemeClass make all calls to the facade instead of the global WP functions. This allow us to use Mo…
<?php
/**
* This is a straightforward example of what a ThemeClass may look like. It contains all the
* expected initialization, and wp_enqueue_script calls.
*/
class ThemeClass
{
protected $wp;
protected $themeDirectory;
@tzkmx
tzkmx / 1fix-switch-theme-on-certain-pages.php
Created September 28, 2016 01:14 — forked from yoren/1fix-switch-theme-on-certain-pages.php
WordPress tiny plugin - Switch theme on certain pages
<?php
/**
* @package One_Fix_Switch_Theme
* @version 1.0
*/
/*
Plugin Name: One Fix Switch Theme
Plugin URI: https://www.1fix.io
Description: Switch theme on certain pages.
Author: Yoren Chang
@tzkmx
tzkmx / jail.local
Created February 3, 2017 20:35 — forked from Nihisil/jail.local
Send notifications to the Slack from fail2ban
...
action_with_slack_notification = %(banaction)s[name=%(__name__)s, port="%(port)$
slack[name=%(__name__)s]
action = %(action_with_slack_notification)s
...
@tzkmx
tzkmx / Lazy Load FB Like
Created February 18, 2017 00:02 — forked from giacomopaita/Lazy Load FB Like
Lazy Load Facebook Like Box
$('.tab a').on('click', function(){
if ($(this).html() == 'FACEBOOK' && typeof xx == 'undefined') {
// DUMMY VARIABLE TO CALL THE FUNCTION ONLY THE FIRST TIME THE USER CLICKS THE TAB:
xx = 1;
(function(d, s, id) {
var js;
var fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
@tzkmx
tzkmx / .babelrc
Last active August 14, 2017 20:34 — forked from developit/testing-stateful-components.js
test stateful components with chai
{
"presets": ["env"],
"plugins": [
["transform-react-jsx", { "pragma":"h" }]
]
}
@tzkmx
tzkmx / envvar@.service
Last active January 26, 2018 02:39 — forked from nickjacob/systemd-prblm.service
execute arbitrary bash code/variable substitution in systemd units
[Unit]
Description=Demo variable passing inside oneshot service
[Service]
Type=oneshot
ExecStartPre=/bin/bash -c 'systemctl set-environment DATE_%i=`date +%%T`'
ExecStart=/bin/bash -c 'systemctl show-environment'
ExecStop=/bin/bash -c 'systemctl set-environment DATE_%i'
@tzkmx
tzkmx / plugin-filter.php
Last active July 11, 2020 14:25 — forked from carlodaniele/plugin-filter.php
A Must-use plugin to filter active plugins in on a per-page basis.
<?php
add_filter( 'option_active_plugins', 'test_blacklist_unneeded_plugins', 40 );
function test_blacklist_unneeded_plugins( $plugins ) {
// We don't apply blacklisting to logged in users to prevent plugin deactivation
if( isset( $_SERVER['HTTP_COOKIE'] ) && is_user_logged_muplugin() ) {
return $plugins;
}
@tzkmx
tzkmx / js_template.html
Created January 20, 2018 02:56 — forked from jshaw/js_template.html
example javascript templates using underscore.js templating
<!--Example JS template-->
<script type="text/template" id="PastCommunityTemplate">
<img class="pvs-cmy-img" src="<%= thumbnail %>" alt="<%= name %>">
<h3 class="pvs-cmy-title"><%= name %></h3>
<h4 class="pvs-cmy-city">City: <%= city %></h4>
<p class="pvs-cmy-description"><%= summary %></p>
</script>