18
JAN
16:52

Mitt möte med Twinkies

Sedan många år så har jag varit intresserad av Twinkies. Denna Amerikanska ikon. Denna gula kaka full med tillsattser och olika sötningsmedel. Men eftersom de inte säljs i Sverige och eftersom jag aldrig har besökt USA så hade jag, fram till nyligen, inte fått chansen att pröva denna delikatess.

Jag har försökt få Grays att ta hem dem. Men tydligen är best-före-datumen så kort att när de beställer så är de ofta gamla redan innan de kommer fram. Hur de nu kan stämma då jag alltid har fått höra att kackerlackor och Twinkies är det enda som överlever ett kärnvapenkrig. I Amerikanska filmer har vi fått lära oss att Twinkies finns kvar när världen är full av Zombies. Och filmer ljuger inte!

Men tiderna förändras. Och tack vare Twitter och mitt frenetiska tjat om Twinkies när det uppdagades att Hostess, företaget som tillverkar Twinkies, var på väg att gå i konkurs, kom jag i kontakt med @USAGODIS. Denna fina butik, och konkurrent till Grays, meddelade mig att de skulle få in Twinkies. And my world got a little bit brighter that day. Det fanns hopp.

Jag beställde Twinkies…

Leveransen var snabb. Redan på Måndagen hämtade jag ut mitt paket. Jag var nu redo för Zombie-appocalypten.

Jag måste tyvärr avsluta denna recension på en lite lägre stämma. De är inte så goda som jag hade hoppats på. Det är en lite citronig sockerkaka, med en sorts smörig geggig mitt. Lite kemisk i smaken. De blev lite godare dagen efter när de hade legat i kylen en stund. Tillsammans med ett glas mjölk. Kanske var min hype bara alldeles för stor. Ungefär som i väntan till Episode I. När dessa 10 bitar är slut så kanske jag inte kommer kunna hålla mig utan vill ha mer? Men jag är inte helt säker. Only the future can tell. Mina ytterst noggrant tweakade smaklökar var i vilket fall ganska så besvikna.

Jag vill dock rikta ett tack till USAGODIS. Utan eldstjälar som er så skulle jag kanske aldrig ha fått prova en sådan kulinarisk raritet, som Twinkies, i skydd av mitt trygga hem.

Betyget blir 2 hemlösa katter av 5 möjliga.

Disclaimer: Jag skrev denna recension som svar till @USAGODIS fråga efter en. Men de har inte betalat mig i Twinkies för den. Mina åsikter är helt mina och kan inte köpas… Ännu… *hint, hint* … USAGODIS, ni har min adress…

 
 
Posted by David
1
NOV
21:45

I’ve gone viral!

Idag postade jag en tweet som blev populär. Det är idag som jag har blivit en legend… Euhrm. Typ.
100+ retweets!!1

 
 
Posted by David
24
SEP
18:10

WordPress snippets

I’ve added a page here for some WordPress snippets I’ve created recently. Just for fun. They are small pieces of code where I doesn’t really feel the need to put them into plugins. The plugins feature in WordPress is great. Obviously. But sometimes when you do themes it’s nice to skip the initial fifteen odd plugins that all do one or two, small things. I’ve added the code to my Github repository. I’m a Github newbie. But it’s a lot easier to keep the code there, and make sure it’s updated, instead of posting it on the blog. And you can follow me there as well to see when I post updates… ;)

  • WPSettings — a set of classes to create a WordPress settings page for a Theme or a plugin.
  • WPCustomPostTypeArchive — add archive functionality to custom post types.
  • WPGetLatestTweet — a simple lib to get and cache the latest tweet for a username.
Posted by David
7
JUN
16:37

Umlauts in hash tags in Twitter Tools – part 2

A couple of days ago I wrote about my problems with Å, Ä and Ö in my Twitter import. Read that post first…

Have you read it? No? Ok. I’ll wait a couple of minutes more then…

Done now? Good.

With the help of my co-worker Per I have now a fixed version of Twitter Tools that seams to work 100% with all allowed Twitter tags. The new regexp is as follows:

'/(^|\s)#([\pL\w]+)/u'

I have also remove the double space insert/remove thingy. So the whole thing looks like this:

$tweet = preg_replace_callback(
	'/(^|\s)#([\pL\w]+)/u'
	, create_function(
		'$matches'
		, 'return aktt_hashtag_link($matches[2], \' #\', \'\');'
	)
	, $tweet
);

I’ve made another small change though to the aktt_hashtag_link() function. Which use to look like this:

function aktt_hashtag_link($hashtag, $prefix = '', $suffix = '') {
	return $prefix.'<a href="'.aktt_hashtag_url($hashtag).'" 
	class="aktt_hashtag">'.htmlspecialchars($hashtag).'</a> '.$suffix;
}

See that trailing space after “</a>”, that should be removed. With that extra space the tag “#åsa-nisse” gets a space after “#åsa”, and looks like this: “#åsa -nisse”.

So here is the final look in my Lifestream (red color was added to links for this image only):

Compared to how Twitter does it on their page:

I think that’s a success!? I’m gonna go ahead and send this to Crowd Favorite and see if they can implement it into the plugin.

Edit 2012-08-20 I’ve noticed that there still are some issues with this. I would recommend that you use the Twitter APIs entities to check what should be replaced and where. I’ve done that in the latest update to a small WordPress script that you can see here.

Posted by David
28
MAY
22:52

Umlauts in hash tags in Twitter Tools

I use the plugin Twitter Tools to import tweets into my blog which I put in my “Lifestream” to the right. It works really good, except that it seams to have a problem with Swedish characters like Å, Ä or Ö. I haven’t had the time or the will to try to fix it. But tonight … I did.

So here is the problem:


The tag should be #GöteborgsVarvet.

I started with The Google and found this thread on the WordPress support forum. But I didn’t like the look of it since it just adds to the reg exp character list. I could have just added my missing characters. But what if a Norwegian dude gets Internet and starts using The Twitter. That won’t do.

So I searched some more and came up with this solution. First I changed the reg exp to this:

'/(^|\s)#([\w\pL]{1,})(\W)/u'

It will search for any “word character” using unicode. Which should make it find å, ä, and ö. But also “the other ones”. From other languages. Then it breaks the tag when it finds any non-word character. For example a “-” or a “(” or something like that. This brings it closer to how Twitter does it:


What we see here is that Twitter gets all the strange tags, even with å or ö in them, but it breaks at the dash character.

However, I still had a problem with the reg exp. It couldn’t find tags in a row. If the tweet had three tags in a row it only matched the first and the last. I solved this, ugly, by first changing all white spaces to double white spaces. And after the hash tag match I change them back. So the full code now looks like this:

$tweet = preg_replace("/(\s)/", "  ", $tweet);
$tweet = preg_replace_callback(
	'/(^|\s)#([\w\pL]{1,})(\W)/u'
	, create_function(
		'$matches'
		, 'return aktt_hashtag_link($matches[2], \' #\', \'\');'
	)
	, $tweet
);
$tweet = preg_replace("/(\s\s)/", " ", $tweet);

The only problem left now is that if you have a tag with a dash, it will remove the dash. So instead of “#åsa-nisse” with a link on “åsa”, like Twitter does. It outputs “#åsa nisse” with a link on “åsa”. Like this:


All tags are found, but the dash is missing from “åsa-nisse”.

Now I just hope that the guys over at Crows Favorite sees my e-mail and fixes this in the official release. Hopefully with an even nicer solution.

By the way…

To fix this hack, from home, on a Saturday, I finally bought Coda in the Mac App Store. It’s a bit expensive. I’m using Eclipse at work, which is free and has more features. I really miss the autocomplete features. But for quick hacks on Saturdays, Coda is really nice. Eclipse is bloaty and slow. I hope I can find some good plugins for autocomplete or that Panic can add it. I would love to be able to Switch. Coda feels more like Xcode 4. I would love to be able to do all my work in Xcode 4. But since I code PHP and not Objective-C at work … Well. Let’s give Panic some money by buying Coda and hope for the best! /rant

Time to go and give my Emma some cuddle before she gets totally bored out of her mind. Peace.

Posted by David
6
SEP
11:18

Small Twitter Tools extension to exclude twitter posts in feed

I’ve been using an old and modified version of Twitter Tools on my blog to import my tweets. They are imported as blog posts and then viewed on the Lifestream sidebar. I had to modify it cause the version I downloaded had a bug and a missing feature. It included @-replies, even though I told it in the settings not to. And I wanted to be able to exclude all twitter posts in the feed for any RSS subscribers.

A couple of days ago the old version of Twitter Tools stopped working though. It was missing oAuth. I downloaded the latest version and the bug had been fixed, it ignored @-reply like it where suppose to, but I still couldn’t remove the posts from the feed. (Which I had forgotten all about when my girlfriend asked me why all my tweets where appearing in her NetNewsWire all of a sudden).

This time thought, instead of hacking the plugin to fix my feature, I’ve created a small plugin extension. If you also uses Twitter Tools and wishes to exclude the twitter posts in your feed, you can check it out here or go straight to the download page.

Posted by David
1
JUL
15:58

Update Services in WPMU and WordPress 3 Multisite

I heard that WordPress, for some reason, removes the ability to change the ping sites through the Update Services form under Settings > Writing in the admin area. I dug around a bit, I asked a WordPress developer and I found out that you can add a filter to get it back. It was westi who showed me the way. And said:

@westi: @DMRsweden The best thing to do is to use the add_filter but with priority 11 that way it will run after the default filter and win

So basically this is all the plugin needs to do:

add_filter(‘enable_update_services_configuration’, ‘__return_true’, 11);

But you can check for yourself. Download it here.

Update: It was brought to my attention that the plugin didn’t work as expected. The Update Services form was shown, but the data was never saved. Obviously I thought that I had tested it. But I worked on two different solutions and rather quickly… I guess I worked to quickly. :) Anyway, I found out that I needed a second filter, whitelist_options, to add the ping_sites form to the whitelist when saving the form data.

Now I only need a confirmation on that all the sites you add actually gets pinged to … Check out the source code here.

Update 2: @jonasbjork have reported that it seams to work. :)

Posted by David
27
MAY
08:00

Internet – 10 år in the making … by me … sort of.

The Creation of Halflife.nu

Upptäckte i förra veckan att tiden har gått fort. Det är idag 10 år sedan första versionen av Halflife.nu gick live. Sidan som fick mig intresserad av att skapa Internet. Eller i alla fall att skapa Internetsidor…

Click here to read the rest of this post…

Posted by David
12
MAY
09:12

Hört på Sveriges Radios reklambyrå

Jag är ganska så säker på att samtalet på reklambyrån, som är ansvarig för nya Sveriges Radio, gick så här …

“Ok killar. Först slänger vi bort den inarbetade, korta och Twitter/Google/SEO-vänliga domänen sr.se och byter ut den mot en ny och längre. Sedan tror jag vi ska slänga in en logga mitt emellan två ord. Lunch på det?

Eller är det bara jag som läser Sverige Adio?

Klicka här för lite matnyttig läsning om sr.se vs. sverigesradio.se.

Posted by David
5
MAR
09:53

Dödskvällspressen

Jag och min vän och kollega Thomas, aka iThomas, aka @drblau, har noterat att Aftonbladet gärna använder orden “döds” eller “mördar” som prefix på diverse djur eller företelser. De flesta tror nog att detta är för att förstärka artikeln. Men Thomas tror bestämt att detta är en koppling till initiationsriterna som man kan läsa om finns på landets tidningsredaktioner. Eller i Thomas egna ord.

Samtidigt på Aftonbladet: “Den som får in flest döds-ord i sina artiklar får ligga med praktikanten”.

Med detta i bagaget så kan vi nu börja notera när praktikanterna får det kämpigt…

Posted by David
27
MAR
16:30

Step into the life of a Common Squirrel

Twitter name: common_squirrel, Home page: http://en.wikipedia.org/wiki/Squirrel

common-squirrel

Posted by David
5
FEB
21:16

Bloggy till WordPress

För WordPress och Bloggy-användare. Har gjort en liten Bloggy till WordPress-plugin som importerar Bloggy-inläggen till din blogg. Så som jag kör med Twitter här…

Posted by David
16
JAN
10:03

I am “Tweeting”

Ctrl+Alt+Delete
Posted by David
4
NOV
21:54

Geek Poetry

I love NASAs Phoenix Mars Lander twitter … user … thingy … It’s pure geek poetry.

Take care of that beautiful blue marble out there in space, our home planet. I’ll be keeping an eye from here. Space exploration FTW!

I also follow the Mars Rover.

You can follow me! Why anyone would want to …

Posted by David