Skip to content

Instantly share code, notes, and snippets.

View adriancbo's full-sized avatar
🎯
Focusing

Adrian Carballo adriancbo

🎯
Focusing
View GitHub Profile
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
function wp_api_encode_acf($data,$post,$context){
$data['meta'] = array_merge($data['meta'],get_fields($post['ID']));
return $data;
}
if( function_exists('get_fields') ){
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3);
}
@adriancbo
adriancbo / functions.php
Created September 1, 2014 21:33 — forked from rileypaulsen/functions.php
Add Advanced Custom Fields Fields to the WP REST API - Awesome!
function wp_api_encode_acf($data,$post,$context){
$data['meta'] = array_merge($data['meta'],get_fields($post['ID']));
return $data;
}
if( function_exists('get_fields') ){
add_filter('json_prepare_post', 'wp_api_encode_acf', 10, 3);
}
function getWatchers(root) {
root = angular.element(root || document.documentElement);
var watcherCount = 0;
function getElemWatchers(element) {
var isolateWatchers = getWatchersFromScope(element.data().$isolateScope);
var scopeWatchers = getWatchersFromScope(element.data().$scope);
var watchers = scopeWatchers.concat(isolateWatchers);
angular.forEach(element.children(), function (childElement) {
watchers = watchers.concat(getElemWatchers(angular.element(childElement)));
@adriancbo
adriancbo / dropzone-directive.js
Created October 13, 2015 01:44 — forked from compact/dropzone-directive.js
AngularJS directive for Dropzone.js
/**
* An AngularJS directive for Dropzone.js, http://www.dropzonejs.com/
*
* Usage:
*
* <div ng-app="app" ng-controller="SomeCtrl">
* <button dropzone="dropzoneConfig">
* Drag and drop files here or click to upload
* </button>
* </div>
@adriancbo
adriancbo / 00_input.conf
Created January 7, 2016 22:02 — forked from steveash/00_input.conf
ELK configuration for aggregating cassandra and spark logs
input {
lumberjack {
# The port to listen on
port => 5043
# The paths to your ssl cert and key
ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder/logstash-forwarder.crt"
ssl_key => "/etc/pki/tls/private/logstash-forwarder/logstash-forwarder.key"
# default type, but this will already be set by logstash-forwarder anyways
@adriancbo
adriancbo / four-byte-emojis.json
Created January 16, 2016 16:31 — forked from watson/four-byte-emojis.json
Emoji's sorted by byte-size
[
"😁",
"😂",
"😃",
"😄",
"😅",
"😆",
"😉",
"😊",
"😋",
@adriancbo
adriancbo / 1:middleware.json
Created February 29, 2016 01:02 — forked from pulkitsinghal/01_chat.md
Bunyan Loopback logging
{
"initial:before": {
"loopback#context": {
"params": { "enableHttpContext": true }
},
"loopback#token": {},
"loopback#favicon": {
"params": "$!../client/images/govright-favicon.ico"
},
"./middleware/logging": {},
@adriancbo
adriancbo / gist:9bc9b4d1181924cabc6f
Created March 23, 2016 11:00 — forked from kyledrake/gist:d7457a46a03d7408da31
Creating a self-signed SSL certificate, and then verifying it on another Linux machine
# Procedure is for Ubuntu 14.04 LTS.
# Using these guides:
# http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
# https://turboflash.wordpress.com/2009/06/23/curl-adding-installing-trusting-new-self-signed-certificate/
# https://jamielinux.com/articles/2013/08/act-as-your-own-certificate-authority/
# Generate the root (GIVE IT A PASSWORD IF YOU'RE NOT AUTOMATING SIGNING!):
openssl genrsa -aes256 -out ca.key 2048
openssl req -new -x509 -days 7300 -key ca.key -sha256 -extensions v3_ca -out ca.crt
@adriancbo
adriancbo / aws-ec2-redis-cli.md
Created May 18, 2016 04:22 — forked from todgru/aws-ec2-redis-cli.md
AWS redis-cli on EC2