Skip to content

Instantly share code, notes, and snippets.

View markahesketh's full-sized avatar
🚀

Mark Hesketh markahesketh

🚀
View GitHub Profile
@markahesketh
markahesketh / gist:7048585
Created October 18, 2013 21:32
chmod 644/755 on OSX
# for files only
find ./ -type f -exec chmod 644 {} +
# for directories only
find ./ -type d -exec chmod 755 {} +
@markahesketh
markahesketh / gist:6090388
Last active June 26, 2022 20:35
LAMP stack on Linode
#!/bin/bash
# ==============================================================================
# Set up LAMP stack on blank Linode
#
# $ nano install.sh
# Copy/paste this script into terminal. Save and exit.
# $ chmod 775 install.sh
# $ ./install.sh
# $ rm install.sh
# ==============================================================================
@markahesketh
markahesketh / gist:6089959
Created July 26, 2013 15:49
Linode recommend the following settings for a 1GB linode:
$ nano /etc/apache2/apache2.conf
<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 30
MaxRequestsPerChild 3000
</IfModule>
function the_excerpt_imagelink($content)
{
global $post;
if(is_home() && strpos($content, 'more-link')){
// Remove all links from images
$content = preg_replace(array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}','{ wp-image-[0-9]*" /></a>}'), array('<img','" />'), $content);
// Add link to post around images.
$content = eregi_replace('(<img [^>]*>)', '<a href="' . get_permalink() . '" rel="bookmark" class="imagelink" title="Permanent Link to ' . $post->post_title . '">' . '\1</a>', $content);
// Image in more goes to blog post
function the_excerpt_imagelink($content)
{
global $post;
// See if the tag exists
$pos=strpos($post->post_content, '<!--more');
// If on the home page, and the tag exists... change the link!
if(is_home() && $pos){
<?php
require '../tmhOAuth.php';
require '../tmhUtilities.php';
$tmhOAuth = new tmhOAuth(array(
'consumer_key' => 'YOUR_CONSUMER_KEY',
'consumer_secret' => 'YOUR_CONSUMER_SECRET',
'user_token' => 'A_USER_TOKEN',
'user_secret' => 'A_USER_SECRET',
));
require 'spec_helper'
describe Product do
before do
@product = Product.new(
name: "Super Duper Necklace",
description: "Brazilian agate necklace with solid brass beads and a lobster clasp fastening. due to the organic nature of agate, each necklace is unique. please expect slight variations from those pictured.",
price: 19.99
)
end
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/data">
<div class="content">
<xsl:apply-templates select="single/entry"/>
</div>
</xsl:template>
<xsl:template match="single/entry">
<?xml version="1.0" encoding="utf-8" ?>
<data>
<params/>
<events />
<single>
<pagination total-entries="1" total-pages="1" entries-per-page="1" current-page="1" />
<section id="1" handle="articles">Articles</section>
<section id="4" handle="pages">Pages</section>
<entry id="10" section-handle="pages">
<title handle="resources">Resources</title>
/**
* Drafts Manager Window
*/
HomepageCMS.window.DraftsManager = function(config) {
config = config || {};
// Load module information etc
this.loadData();
// Create window