Skip to content

Commit d197a6c

Browse files
authored
Blog fix (#12)
* unescaped file * code highlighting cleanup * tool i used to fix wp exporter escapaing * cleanup orcle * css updates and section verbage * link to theme, not site code in gh
1 parent 3c1b5f7 commit d197a6c

81 files changed

Lines changed: 1468 additions & 1366 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/unescape_blog.bash

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#! /bin/bash
2+
3+
4+
DIR=${1:-"src/content/blog"}
5+
for file in ${DIR}/*/index.md; do
6+
path=${file%/*}
7+
echo $path
8+
mv "$file" "${path}/unescaped.md"
9+
while IFS= read line;do
10+
echo "$line"
11+
done < "${path}/unescaped.md" > "$file"
12+
rm "${path}/unescaped.md"
13+
done
14+
15+
16+
#grep -oh "\(https://blog.edwardawebb.com/wp-content/uploads/[A-Za-z0-9/_-]*\.png\)" src/content/blog/keys-putty-cygwin-passwordless-login-ssh-scp.md

src/config.toml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,19 @@ title = "Eddie Webb"
44
theme = "resume"
55
enableGitInfo = true
66

7-
pygmentsCodeFences = true
8-
pygmentsCodeFencesGuessSyntax = true
7+
[markup]
8+
[markup.highlight]
9+
codeFences = true
10+
guessSyntax = true
11+
hl_Lines = ""
12+
lineNoStart = 1
13+
lineNos = false
14+
lineNumbersInTable = true
15+
tabWidth = 4
16+
style = "tango"
17+
18+
19+
920

1021
[taxonomies]
1122
tag = "tags"

src/content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ sitemap:
88

99
Eddie has over a decade of experience enabling agile, CI/CD and DevOps culture in the enterprise. Previously the Director of Enterprise Software Delivery Platforms at a Fortune 100 company, Eddie now leverages his experience influencing culture and technology to help CircleCI customers of all sizes adopt the best technologies and practices along their journey.
1010

11-
This site was generated using [HUGO](https://gohugo.io/) from an [open source theme](https://github.com/eddiewebb/json-resume) via a [CircleCI](https://circleci.com/gh/eddiewebb/json-resume).
11+
This site was generated using [HUGO](https://gohugo.io/) from an [open source theme](https://github.com/eddiewebb/hugo-resume) via a [CircleCI](https://circleci.com/gh/eddiewebb/json-resume).
1212

1313
![CircleCI Status Badge](https://circleci.com/gh/eddiewebb/json-resume.svg?style=svg)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ sitemap:
44
priority : 0.9
55
---
66
This section contains articles migrated from my old Wordpress site. Forgive the formatting please :)
7-
7+
<!--more-->
88
The "featured" articles are those with highest comment count from WP.

src/content/blog/add-rss-feed-cakephp-models/index.md

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -32,54 +32,61 @@ No need to over complicate things here. Imagine you have a standard Model, oh le
3232

3333
#### app/controllers/posts_controller.php -snippet
3434

35-
/\*\*
36-
\* Returns an array of all public posts less than one month old, orderd by date
37-
\*
38-
\* @return unknown
39-
*/
40-
function newsfeed($count=null) {
41-
if(!$count) $count=5;
42-
$this->Post->recursive = 0;
43-
$posts=$this->Post->findAll('is_public = 1
44-
AND is_published = 1
45-
AND Post.date_modified >= now() - INTERVAL 1 MONTH'
46-
,null,'Post.date_modified DESC',$count);
47-
if(isset($this->params\['requested'\])) {
48-
return $posts;
49-
}
50-
$this->set('posts',$posts );
51-
}
52-
35+
```php
36+
<?
37+
/**
38+
* Returns an array of all public posts less than one month old, orderd by date
39+
*
40+
* @return unknown
41+
*/
42+
function newsfeed($count=null) {
43+
if(!$count) $count=5;
44+
$this->Post->recursive = 0;
45+
$posts=$this->Post->findAll('is_public = 1
46+
AND is_published = 1
47+
AND Post.date_modified >= now() - INTERVAL 1 MONTH'
48+
,null,'Post.date_modified DESC',$count);
49+
if(isset($this->params['requested'])) {
50+
return $posts;
51+
}
52+
$this->set('posts',$posts );
53+
}
54+
```
5355
It would be really helpful if CakePHP provided an RSS helper. Zoot alors !  They do!
5456

5557
#### app/controllers/posts_controller.php -snippet
5658

59+
```php
60+
<?
5761
var $helpers = array('Rss');
5862
var $components = array ('RequestHandler');
59-
63+
```
6064
### The XML Generating View
6165

6266
Just like any other view, all we need to do is transform some provided data into a formatted page. This time it will be strict XML without all the html clutter.
6367

6468
#### app/views/posts/rss/newsfeed.ctp
65-
66-
$item\['Post'\]\['title'\],
67-
'link' => array('controller' => 'posts', 'action' => 'view', $item\['Post'\]\['id'\]),
68-
'guid' => array('controller' => 'posts', 'action' => 'view', $item\['Post'\]\['id'\]),
69-
'description' => strip_tags($item\['Post'\]\['body'\]),
70-
'pubDate' => $item\['Post'\]\['date_added'\],
69+
```php
70+
<?
71+
$item['Post']['title'],
72+
'link' => array('controller' => 'posts', 'action' => 'view', $item['Post']['id']),
73+
'guid' => array('controller' => 'posts', 'action' => 'view', $item['Post']['id']),
74+
'description' => strip_tags($item['Post']['body']),
75+
'pubDate' => $item['Post']['date_added'],
7176
);
7277
}
7378

7479
$this->set('items', $rss->items($posts, 'rss_transform'));
7580

7681
$this->set('channelData', $channelData);
77-
?>
7882

83+
```
7984
And of course sticking with format we should want to add an RSS layout.
8085

8186
#### app/views/layouts/rss/default.ctp
8287

88+
```php
89+
<?
8390
header();
8491
$channelData = array('title' => 'Recent News | Digital Business',
8592
'link' => array('controller' => 'posts', 'action' => 'index', 'ext' => 'rss'),
@@ -89,24 +96,25 @@ header();
8996
);
9097
$channel = $rss->channel(array(), $channelData, $items);
9198
echo $rss->document(array(), $channel);
92-
?>
9399

100+
```
94101
### The RSS compliant URL
95102

96103
You only need to add 2 lines to your routes configuration file for CakePHP to catch and handle the url to pint to your RSS feed. You might use feed.rss, I choice live.rss.
97104

98105
#### app/config/routes.php -snippet
99-
100-
/\*\*
101-
\* ...allow rssextensions
102-
\* and send live.rss to the rss feed
106+
```php
107+
<?
108+
/**
109+
* ...allow rssextensions
110+
* and send live.rss to the rss feed
103111
*/
104112
Router::connect('/live', array('controller' => 'posts', 'action' => 'newsfeed'));
105-
// see my posts on sitemaps to use this next line ;)
106-
Router::connect('/sitemap', array('controller' => 'sitemaps', 'action' => 'index'));
113+
// see my posts on sitemaps to use this next line ;)
114+
Router::connect('/sitemap', array('controller' => 'sitemaps', 'action' => 'index'));
107115

108116
Router::parseExtensions('rss','xml');
109-
117+
```
110118
Yes, you'll notice an additional route there for [dynamic sitemaps](https://blog.edwardawebb.com/programming/php-programming/cakephp/generating-dynamic-sitemaps-cakephp), very useful as well. Sweet! Now just visit http://example.com/live.rss, or throw that url in your favorite Feed Reader to see the results.
111119

112120
#### http://example.com/live.rss

src/content/blog/automatically-choose-database-connections-cakephp/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class DATABASE_CONFIG
5858
function __construct ()
5959
{
6060
//check to see if server name is set (thanks Frank)
61-
if(isset($\_SERVER\['SERVER\_NAME'\])){
62-
switch($\_SERVER\['SERVER\_NAME'\]){
61+
if(isset($_SERVER['SERVER_NAME'])){
62+
switch($_SERVER['SERVER_NAME']){
6363
case 'digbiz.localhost':
6464
$this->default = $this->dev;
6565
break;

src/content/blog/automatically-subscribe-users-dreamhost-announce-lists/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ So it goes like this; Your user registers a new account, or sends you a contact
2020

2121
The red boundary denotes new code for the announce submission
2222

23-
Since every cms, site and blog are different, I am unable to provide specifics, but yu should be able to track down the code for your form and find the portion that handles the submission. (Most obviously denoted with $\_POST or $\_GET variable use.)  I will also assume your email field is named 'email' and your name field is two fields; 'firstName', 'lastName';
23+
Since every cms, site and blog are different, I am unable to provide specifics, but yu should be able to track down the code for your form and find the portion that handles the submission. (Most obviously denoted with $_POST or $_GET variable use.)  I will also assume your email field is named 'email' and your name field is two fields; 'firstName', 'lastName';
2424

2525
### Details on the API command
2626

2727
Below is a link to details on the command, needed parameters and possible responses. [Add Subscriber API Command](http://wiki.dreamhost.com/Application_programming_interface#announcement_list-add_subscriber)
2828

2929
### The Announce Submission Code
3030

31-
if(isset($\_POST\['subscribeMe'\]) && $\_POST\['subscribeMe'\] == 1)
31+
if(isset($_POST['subscribeMe']) && $_POST['subscribeMe'] == 1)
3232
{
3333

3434
//get the values we need from form(this should in aprt already be somewhere in the code your editing)
35-
$email=$_POST\['email'\];
36-
$fullName=$\_POST\['firstName'\]." ".$\_POST\['lastName'\];
35+
$email=$_POST['email'];
36+
$fullName=$_POST['firstName']." ".$_POST['lastName'];
3737

3838
//set values we shoudl know, and are constant
3939
$domain="domain of this form";
@@ -45,8 +45,8 @@ if(isset($\_POST\['subscribeMe'\]) && $\_POST\['subscribeMe'\] == 1)
4545

4646

4747
$ch = curl_init('https://api.dreamhost.com/');
48-
curl\_setopt ($ch, CURLOPT\_POST, 1);
49-
curl\_setopt ($ch, CURLOPT\_POSTFIELDS, "key=$apiKey&cmd=announcement\_list-add\_subscriber&listname=$listname&domain=$domain&email=$email&name=$fullName");
48+
curl_setopt ($ch, CURLOPT_POST, 1);
49+
curl_setopt ($ch, CURLOPT_POSTFIELDS, "key=$apiKey&cmd=announcement_list-add_subscriber&listname=$listname&domain=$domain&email=$email&name=$fullName");
5050
$result=curl_exec ($ch);
5151
curl_close ($ch);
5252

0 commit comments

Comments
 (0)