Skip to content

Instantly share code, notes, and snippets.

View primedime's full-sized avatar

Roy Jossfolk primedime

View GitHub Profile
@hofmannsven
hofmannsven / README.md
Last active May 3, 2024 15:30
Git CLI Cheatsheet
@albatrocity
albatrocity / git-version-control.markdown
Created September 7, 2011 17:28
Some basic Git instructions for Github for Mac and the command line

Using Git version control for code projects

Creating a new code repo from a local working copy

  1. From the repositories view in the app, drag the project folder to the bottom of the left sidebar.
  2. Hit "Yes" when it asks if you want to create a local git repository
  3. Go to "Changes" view (⌘2)
  4. Select the files that you want to commit their current state to the repository. You can view the changes of the file by clicking on the double up arrow on the file name bar.
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@pento
pento / php-block.js
Last active February 29, 2024 01:31
Converting a shortcode to a block: this method is fast to do, but a mediocre UX. You should only use this as a stopgap until you can implement a full block UI.
// License: GPLv2+
var el = wp.element.createElement,
registerBlockType = wp.blocks.registerBlockType,
ServerSideRender = wp.components.ServerSideRender,
TextControl = wp.components.TextControl,
InspectorControls = wp.editor.InspectorControls;
/*
* Here's where we register the block in JavaScript.
@stuartduff
stuartduff / wc-exclude-product-category-from-shop-page.php
Last active May 6, 2022 00:20
This snippet will exclude all products from any categories which you choose from displaying on the WooCommerce Shop page.
function custom_pre_get_posts_query( $q ) {
$tax_query = (array) $q->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'clothing' ), // Don't display products in the clothing category on the shop page.
'operator' => 'NOT IN'
);
@mikaelz
mikaelz / delete-orphan.sql
Created August 16, 2017 13:59
Delete orphan postmeta and attachment in WordPress database
-- Delete orphan postmeta
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts p ON pm.post_id = p.ID
WHERE p.ID IS NULL
;
-- Delete orphan attachment
DELETE p1
FROM wp_posts p1
@zackkatz
zackkatz / gf-number-field-integers.php
Created June 20, 2019 17:27
Only allow integers (whole numbers, including negative values) in Gravity Forms Number field
<?php
/**
* Force number fields to increment by 1
*/
add_filter( 'gform_field_content', function ( $field_content, $field ) {
if ( 'number' !== $field->type ) {
return $field_content;
}
@rileyelliott
rileyelliott / .env
Created June 11, 2019 15:34
Wordpress DECHO
DEBUG_URL=whatever.test