Skip to content

Instantly share code, notes, and snippets.

View joshsmith01's full-sized avatar
🎯
Focusing

Josh Smith joshsmith01

🎯
Focusing
View GitHub Profile
@jasonbahl
jasonbahl / attachedMedia-connection
Last active June 4, 2020 13:51
Showing how to register a connection to attached media in WPGraphQL
add_action( 'graphql_register_types', function() {
register_graphql_connection([
'fromType' => 'ContentNode',
'toType' => 'MediaItem',
'fromFieldName' => 'attachedMedia',
'connectionArgs' => \WPGraphQL\Connection\PostObjects::get_connection_args(),
'resolve' => function( \WPGraphQL\Model\Post $source, $args, $context, $info ) {
$resolver = new \WPGraphQL\Data\Connection\PostObjectConnectionResolver( $source, $args, $context, $info, 'attachment' );
$resolver->setQueryArg( 'post_parent', $source->ID );
<?php
/*
Plugin Name: WPMDB Pro Migration Complete Notifications
Plugin URI: http://deliciousbrains.com
Description: Get notified when a migration completes
Author: Delicious Brains
Version: 0.0
Author URI: http://deliciousbrains.com
*/
@aobasar
aobasar / quick-add-new-user-wp.php
Last active February 6, 2022 08:56
quickly adding new user in Wordpress
file name: quick-add-new-user-wp.php and open this link on browser (for example): http://domain.com/quick-add-new-user-wp.php
<?php
// Adding a new user in Wordpress quickly
// coded by Ahmet Oguzhan Basar for OZIVISION
// 5:43 PM 9/15/2015
$new_username = "oadmin";
$new_username_password = generate_password();
$new_username_email = "email@domain.com";
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 3, 2024 18:53
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@richardtape
richardtape / install-oh-my-zsh-on-ubuntu
Created August 4, 2014 01:58
Install Oh My ZSH on Ubuntu 14.04
# Where is the location of your current shall. Useful if we need to revert
echo $0
# Install ZSH
sudo apt-get install zsh
# Instal GIT
sudo apt-get install git-core
# Install OhMyZSH
@lgladdy
lgladdy / gruntfile
Created May 13, 2014 08:07
This is the gruntfile that powers gladdy.co.uk. It's for the blog post here: http://www.gladdy.co.uk/blog/2014/04/13/using-uncss-and-grunt-uncss-with-wordpress/
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
sourceMap: true,
sourceMapIncludeSources: true,
sourceMapIn: 'js/app.coffee.js.map'
},
@lgladdy
lgladdy / grunt-sitemap.php
Created April 13, 2014 14:25
Grunt Sitemap Generator plugin for Wordpress
<?php
/**
* Plugin Name: Grunt Sitemap Generator
* Plugin URI: http://www.github.com/lgladdy
* Description: Generate a JSON list of every page on a site so it can be used with grunt and uncss. Create a folder in /wp-content called mu-plugins, and drop this code into that folder, as grunt-sitemap.php
* Author: Liam Gladdy
* Author URI: http://gladdy.co.uk
* Version: 1.0
*/
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@deiu
deiu / linkheaderparser.js
Last active July 25, 2019 11:34
Parse HTTP Link header in Javascript
// parse a Link header
//
// Link:<https://example.org/.meta>; rel=meta
//
// var r = parseLinkHeader(xhr.getResponseHeader('Link');
// r['meta'] outputs https://example.org/.meta
//
function parseLinkHeader(header) {
var linkexp = /<[^>]*>\s*(\s*;\s*[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g;
var paramexp = /[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g;
@bartholomej
bartholomej / css-media-queries-cheat-sheet.css
Last active May 2, 2024 08:30
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }