Skip to content

Instantly share code, notes, and snippets.

View germanny's full-sized avatar

Jen G germanny

View GitHub Profile

Contract Killer 3

Revised date: 07/11/2012

Between us [company name] and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@ericrasch
ericrasch / RegEx Snippets.md
Last active October 6, 2019 12:37
RegEx Snippets

RegEx Snippets


Extract URLs

Find all links

Works pretty well in capturing the full URL when using this in a search (like in Sublime Text 2). (https?|ftps?)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/?

@mixin retina($ratio: 1.5) {
$dpi: $ratio * 96;
$opera-ratio: $ratio * 100;
@media only screen and (-webkit-min-device-pixel-ratio: #{$ratio}),
only screen and ( -o-min-device-pixel-ratio: '#{$opera-ratio}/100'),
only screen and ( min-resolution: #{$dpi}dpi),
only screen and ( min-resolution: #{$ratio}dppx) {
@content;
}
@ericclemmons
ericclemmons / functions.php
Last active June 23, 2023 01:47
Auto-activate WordPress Plugins
<?php
// Add to: path/to/wp-content/wp-themes/your-theme/functions.php
/**
* Activate required plugins
*/
include_once ( ABSPATH . 'wp-admin/includes/plugin.php' );
@ericrasch
ericrasch / robots.txt
Last active July 4, 2017 03:52
Robots.txt files for sites with WordPress.
User-agent: *
# Changing the /feed back to include the trailing slash since it otherwise blocks URLs like http://www.thesimpledollar.com/feeding-my-sweet-tooth-without-breaking-my-belly-or-breaking-the-bank/
Disallow: /feed/
Disallow: /cgi-bin
Disallow: /wp-admin
Disallow: /wp-content/cache
Disallow: /wp-includes
Disallow: /trackback
Disallow: /xmlrpc.php
@ericrasch
ericrasch / Collapsable Content functions.php
Last active July 4, 2017 03:55
Create collapsable content sections using WordPress' the_content().
/* =BEGIN: Add Class to first Paragraph in WordPress the_content();
Source: http://wordpress.stackexchange.com/a/51682/28826
---------------------------------------------------------------------------------------------------- */
function first_paragraph($content){
// Finding the 1st p tag and adding a class.
$content = preg_replace('%<p([^>]+)?>%', '<p$1 class="intro">', $content, 1);
// Finding the 1st closing p tag and adding a div tag to the rest of the content so we can separate it.
$content = preg_replace('%</p>%', '</p> <div id="collapsable-content">', $content, 1);

Solid Base .htaccess

Creating a solid base for your .htaccess file. Currently includes RewriteBase, Security (against indexes, files, etc.), and Expires Headers (caching, performance).

  • The URL REWRITES would go at the top of the file.
  • The SECURITY and the WEB PERFORMANCE can go towards the bottom... before and WordPress or WP Super Cache items.
  • UPDATE 2013-08-21: Added code for forcing either non-www or www. on URLs. Also added the MultiViews option.
  • UPDATE 2013-08-23: Added specific code for wp-config.php
  • UPDATE 2013-10-04: Increased favicon expire time.
  • UPDATE 2014-02-05: Removed the Force URL rewrites since there's more than one option.
@ericrasch
ericrasch / is_child.php
Last active October 29, 2019 16:18
WordPress conditional function to check if a page is a parent/child/ancestor. In other words, if the page is within a tree of another page, show the code. Other code I've seen either only work with IDs, only check if it's a child, or detect all subpages (even outside of the direct tree).
/* =BEGIN: Check If Page Is Child
Source: http://bavotasan.com/2011/is_child-conditional-function-for-wordpress/
---------------------------------------------------------------------------------------------------- */
function is_child( $page_id_or_slug ) { // $page_id_or_slug = The ID of the page we're looking for pages underneath
global $post; // load details about this page
if ( !is_numeric( $page_id_or_slug ) ) { // Used this code to change a slug to an ID, but had to change is_int to is_numeric for it to work.
$page = get_page_by_path( $page_id_or_slug );
$page_id_or_slug = $page->ID;
}
@imathis
imathis / tweetbot-mute-regex.md
Created June 27, 2012 19:45
Tweetbot can use regular expressions to mute tweets in your timeline and mentions.

Hashtag abuse

Three or more hashtags.

#[^#]+#[^#]+#

Long hashtags (15+ characters): #hashtagpunchline

@jimmynotjim
jimmynotjim / readme
Created May 25, 2012 00:47
jQuery script to equalize the sidebar and content of a page
Simple jQuery script to set a sidebar to always span the height of a page. Required when the sidebar has a background, borders, or shadows. #main is the container for both the sidebar and content and can be replaced w/ any other element. It's important to use min-height, in case your sidebar has moving/changing elements that could resize it larger than the main content (or just happens to be larger than the main content).