Skip to content

Instantly share code, notes, and snippets.

Mandi Wise mandiwise

Block or report user

Report or block mandiwise

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jonathansick
jonathansick / query.graphql
Last active Aug 9, 2019
GitHub GraphQL repo commit history query
View query.graphql
{
repository(name: "sickvim", owner: "jonathansick") {
ref(qualifiedName: "master") {
target {
... on Commit {
id
history(first: 5) {
pageInfo {
hasNextPage
}
@scottopolis
scottopolis / wp-api-user-meta.php
Last active Aug 18, 2019
Add user meta to the WP-API
View wp-api-user-meta.php
<?php
/* Adds all user meta to the /wp-json/wp/v2/user/[id] endpoint */
function sb_user_meta( $data, $field_name, $request ) {
if( $data['id'] ){
$user_meta = get_user_meta( $data['id'] );
}
if ( !$user_meta ) {
return new WP_Error( 'No user meta found', 'No user meta found', array( 'status' => 404 ) );
}
View postgres cheatsheet.md

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@sgnl
sgnl / postgres-brew.md
Last active Sep 11, 2019
Installing Postgres via Brew (OSX) (outdated see top most note)
View postgres-brew.md

Outdated note: the process is a lot easier now: after you brew install postgresql you can initialize or stop the daemon with these commands: brew services start postgresql or brew services stop postgresql.

new out put may look like

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
@dannyockilson
dannyockilson / gist:52a444195f0df873cc1c
Created Mar 13, 2015
Simple Angular Service for WordPress
View gist:52a444195f0df873cc1c
'use strict';
angular.module('wordpress', [])
.service( 'wpService',
function($http, $q){
var url = 'http://allin.local/wp-json/';
return({
View gist:f60fb50838edabd49159
add_filter( 'the_content', function( $content ) {
$response = wp_remote_get( 'http://ben.lobaugh.net/wp-json/posts' );
if( '200' == wp_remote_retrieve_response_code( $response ) ) {
$posts = json_decode( wp_remote_retrieve_body( $response ) );
foreach( $posts AS $p ) {
echo $p->title->rendered . "<br/>";
@budparr
budparr / jekyll-collections-prev-next.html
Created Dec 9, 2014
Previous Next Links for Jekyll Collections
View jekyll-collections-prev-next.html
{% capture the_collection %}{{page.collection}}{% endcapture %}
{% if page.collection %}
{% assign document = site[the_collection] %}
{% endif %}
<h1>TITLE: {{ page.title }}</h1>
{% for links in document %}
{% if links.title == page.title %}
{% unless forloop.first %}
{% assign prevurl = prev.url %}
{% endunless %}
@spivurno
spivurno / gw-disable-html5-validation.php
Last active Mar 30, 2016
Gravity Wiz // Disable HTML5 Validation on Gravity Forms
View gw-disable-html5-validation.php
<?php
/**
* Gravity Wiz // Disable HTML5 Validation on Gravity Forms
* http://gravitywiz.com/disable-html5-validation-on-gravity-forms/
*/
add_filter( 'gform_form_tag', 'add_no_validate_attribute_to_form_tag' );
function add_no_validate_attribute_to_form_tag( $form_tag ) {
return str_replace( '>', ' novalidate="novalidate">', $form_tag );
}
@justintadlock
justintadlock / register-post-type.php
Last active Sep 3, 2019
Help file when registering post types.
View register-post-type.php
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@crondeau
crondeau / chilpages-looping.php
Last active Nov 2, 2018
I used this code to loop through child pages of a custom post type called work. Each Work piece had a title, featured image and pdf. The child pages, describe the details of the project or work piece and display as an accordion. So basically what we have is an accordion within an accordion.
View chilpages-looping.php
<?php
// loop through the sub-pages of your custom post type
$childpages = new WP_Query( array(
'post_type' => 'work',
'post_parent' => $this_page,
'posts_per_page' => 100,
'orderby' => 'menu_order'
));
while ( $childpages->have_posts() ) : $childpages->the_post(); ?>
You can’t perform that action at this time.