• Shortcuts : 'n' next unread feed - 'p' previous unread feed • Styles : 1 2

» Publishers, Monetize your RSS feeds with FeedShow:  More infos  (Show/Hide Ads)


Date: Wednesday, 16 Apr 2014 13:45

Twitter is fun and catchy, but the thing is: once tweeted, gone forever. Found an awesome link last month, shared it with a relevant #hashtag? Good luck finding it now. Your data now lives and dies on Twitter and you have no hand on it.

Four years ago to address this problem I made yet-another-Twitter-to-WordPress plugin, creatively named Ozh' Tweet Archiver.

Two years ago Twitter broke my plugin with their new API, requiring OAuth for every request, including reading public tweets. Fixing it has been since on my todo list but, hey, you know.

Two weeks ago @EHER sent me preliminary code to fix things, just what I needed as a motivation to fix things.

Two days ago I published version 2.0 of my super cool Tweet Archiver plugin. Fixed, dramatically improved, with new features. w00t.

TL;DR: from @ozh to planetozh.com/tweets with WordPress, #yay.

Go get it, install it, you'll love it. Or, as usual, 120% refunded!


(cc) Ozh for planetOzh, 2014. | Permalink | No comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Archive, Plugins, Twitter, WordPress

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Archive, Plugins, Twitter, Wo..."
Comments Send by mail Print  Save  Delicious 
Date: Wednesday, 22 Jan 2014 17:04

There's a recurring debate about WordPress and whether they should keep code compatible with PHP 5.2 or drop it and bump the requirements to a newer PHP version. Hey, I have an opinion on this.

What's wrong with PHP 5.2?

Nothing much, except PHP 5.2 was released in November 2006, and was maintained and developed till January 2011. This means that it's now considered an old release, rusty dusty code that's no longer improved, and should a new vulnerability be discovered in the 5.2 branch, it will remain unfixed.

In short: it's *old*. Any PHP library you'll find these days requires 5.3+.

Old but still everywhere ?

According to W3Techs, 33% of websites running PHP are on 5.2. That's a lot, but wait, there's worse.

According to WordPress, more than 50% of WordPress-powered sites are still on 5.2. Earlier this week @dd32 made a pretty graph showing that PHP 5.2′s share is only slowly decreasing.

So what?

Dropping a platform running half of your user base would be crazy, right? For sure. Except I think the numbers are somewhat skewed.

As you may know, my pet project is a self-hosted URL shortener, YOURLS, which was released in its version 1.7 earlier this month. This new version comes with a phone-home feature to report the same kind of stats that WordPress is aggregating from its users, and particularly what PHP version YOURLS is installed on.

Of course, the YOURLS user base is nowhere near as important in volume as WordPress' market, but I think the average user is similar, so YOURLS figures should be relevant in some way.

What I've learned since the release of YOURLS 1.7 came as a surprise: I was expecting a similar share to what WordPress reports, but it turns out only 10% of YOURLS installs are running on PHP 5.2

yourls_php_version

What did I conclude from all this?

1. Old installs vs new installs

WordPress is old, it's been around for 10 years. The typical WordPress user installed WP 4 or 5 years ago, when 5.2 was still the standard.

YOURLS is much younger, it's been around for 4 years, but the project sort of picked up 3 years ago with YOURLS 1.5, released in November 2010. The typical YOURLS user installed YOURLS 1 year ago, when the default hosting setting on most host was PHP 5.3 or more.

I think that's the key of the skewed numbers : simply too many WordPress installs were around when PHP 5.2 was the default, and those users just did not upgrade their hosting. Well, why would they, it just works fine.

That would be exhibit A : newer users are on 5.3+, older are still on 5.2.

2. Deeper digging: who's running PHP 5.2?

Most host, if not all, still offer 5.2, even if you open an account today, but I could not find any which does not support 5.3+. All the major hosts (Dreamhost, Bluehost, Hostgator, etc…) have 5.3 by default.

And if there is a minor host where PHP 5.2 is the best you can have, then what's the point with signing with a smaller and lesser known company if they cannot provider better services than big ones?

Exhibit B: hosts can give you 5.3+

3. WordPress should lead

And that will be exhibit C: WordPress has the power.

WordPress runs on 20% of all websites in the world. That's huge. Moreover, it apparently has 60% of the CMS market, which is also very impressive.

Few organizations in the world have the power to say "we're moving to a newer version of PHP" and have a global impact ; WordPress is one of them.

With such an influence, WordPress should even go a step further and pro-actively announce end of support for PHP version and follow PHP's 3 year release process, instead of simply watching user adoption. PHP 5.3 will be maintained till July 2014, PHP 5.4 will be maintained till March 2015: I think WordPress should announce the same minimal requirement changes.

TL;DR

The day WordPress says "we require PHP 5.3″, the whole web which is still running 5.2 switches to 5.3. Simple as that.


(cc) Ozh for planetOzh, 2014. | Permalink | 14 comments | Add to del.icio.us | splogmenotplz
Read more posts tagged with: 5.2, PHP, Stats, WordPress

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, 5.2, PHP, Stats, WordPress"
Comments Send by mail Print  Save  Delicious 
Date: Monday, 13 Jan 2014 14:15

I've always had a fascination for Github timeline graphs since they released it. It's simple and pretty and potentially meaningful (and fits nicely on a geek tshirt). Yes, it may say things about you.

The following is an attempt at decrypting what a few actual Github timelines say, or might say, or don't say at all, after a thorough and thoughtful psychosocial analysis that guarantees an accuracy of roughly 2% in the best case ;)

I'm a student

audreyr

"I love this thing, but unfortunately I haven't got much time for it except during summer holiday and a couple days during holiday season. Also, I wish I could spend more time on this!"

I have too much time on my hands

contributions

"Oh my, I love that tool I love that site I love that timeline graph I have to make something witty with it. Also, I suck at pixel art."

I'm a reliable guy

nathanrice

"Github is not my primary dev platform. This said, I have a few projects hosted there, and they're all maintained. Also, count on me to monitor open issues and answer them in a timely manner."

I'm a nerd. No, wait. I'm THE nerd

sferik

"It's already 10am and I haven't committed anything, I'm starting to feel fuzzy inside, I should get back to work. Also, my command line Twitter client t is pretty neat"

I'm an annoying noob

noob

"Hi! I've just created an account here on Github to open an issue that's obvious but I can't be arsed to search or read the wiki first. Also, I need to install Facebook on my Mom's computer, how do I do that?"

I'm a professional. 9-17, Mon-Fri

weierophinney

"I use Github at work, but week-ends are not for work, they're family time. Also, Boss, please, I had only one week off during July and another for Halloween, I need holidays!"

I'm new and I'm hooked

julycoding

"Hi there! I'm new here and what can I say, I *love* it here! Woohoo! Also, I'm super enthusiastic!"

I'm handsome, sympathetic and smart

ozh

"During July I take a month away from computers, no need to bother opening issues here. Also, YOURLS 1.7 is just out, did you update?"


(cc) Ozh for planetOzh, 2014. | Permalink | One comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Ahah, Github, graph

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Ahah, Github, graph"
Comments Send by mail Print  Save  Delicious 
Date: Tuesday, 04 Jun 2013 16:41

I really like how Github displays your yearly code contributions, in that 52×7 green dot matrix. It's cute, informative, and has become iconic enough that any nerd knows what it refers to.

contributions

I like it so I funcoded a script that will deliver a message after 365 days of running — fun, but kinda slow, right?

So, I made something more interactive and instantly fun, something you can play with: I'm delighted to introduce contribution.io, a site to "Generate Github-like contribution graph" and print them on a t-shirt (or just save them as a PNG for whatever use you'll like)

It's neat with short messages that fit the grid, works best with capital letters but hey, experiment:

at_ozh

hello-world

I've had great fun coding that site, especially the server side PHP script that generates the matrix from the letter input. It was also my first experiment using Bootstrap and I must say it's pretty neat for the design-impaired people like myself.

The t-shirt printing is powered by Zazzle: their API is decently documented and I've bought a couple of shirts from them in the past and have been pleased by the quality. I ordered myself a tshirt with "@ozh", can't wait to show it off at work :>

Go ahead, play with contribution.io and make some cool contrib graph. You'll be the coolest looking nerd on the beach this summer :)


(cc) Ozh for planetOzh, 2013. | Permalink | No comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Github, My Life, tshirt

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Github, My Life, tshirt"
Comments Send by mail Print  Save  Delicious 
Date: Saturday, 25 May 2013 17:51

As of writing, the 26 WordPress plugins I have hosted on wordpress.org have been downloaded one million times.

1M

Of course this is mostly due to my most popular plugin, Admin Drop Down Menu, which has been downloaded more than 700,000 times over the last 6 years, but this is a cool mark anyway.

Is there something like a millionaire club? :)


(cc) Ozh for planetOzh, 2013. | Permalink | One comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Ego, My Life, Plugins, WordPress

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Ego, My Life, Plugins, WordPr..."
Comments Send by mail Print  Save  Delicious 
Date: Tuesday, 07 May 2013 07:30

A quick ping today by Jeff Chandler reminded me that nine years ago this blog started running on WordPress. Time flies when you're worry-free :)

So, before everyone celebrates WordPress' 10 years birthday, I'll blow a few candles first: happy 9th birthday planetOzh :)


(cc) Ozh for planetOzh, 2013. | Permalink | 2 comments | Add to del.icio.us | splogmenotplz
Read more posts tagged with: My Life, planetOzh, WordPress

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, My Life, planetOzh, WordPress"
Comments Send by mail Print  Save  Delicious 
Date: Wednesday, 24 Apr 2013 16:51

As you might know, YOURLS development is now hosted on Github. It's now easy to download the current development snapshot, since Github provides an archive/master.zip.

But not so long ago, YOURLS dev was hosted on Google Code, where there is no such convenient way to download the current SVN trunk as a .zip archive. To generate "nightly builds", I wrote this little script:

  1. #!/bin/bash
  2. # Simple bash script to generate YOURLS nightly builds
  3.  
  4. # Export in a year-month-day directory
  5. PWD="/home/ozh/yourls.org/nightly-builds"
  6. BUILD=$(date +%Y-%m-%d)
  7. svn -q export http://yourls.googlecode.com/svn/trunk/ $PWD/$BUILD
  8.  
  9. # Make package and remove dir
  10. cd $PWD
  11. zip -r -q yourls-$BUILD.zip $BUILD
  12. rm -rf $BUILD
  13.  
  14. # Remove old (>7 days) builds
  15. find $PWD/*zip -mtime +7 -exec rm {} \;

Now you just need to add the script to your cron jobs and call it every night.


(cc) Ozh for planetOzh, 2013. | Permalink | No comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Bash, Code, YOURLS

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Bash, Code, YOURLS"
Comments Send by mail Print  Save  Delicious 
Date: Friday, 29 Mar 2013 17:39

As soon as YOURLS 1.6 ships, I'll move the project development from Google to Github (why? long story short: read this). So, I wrote down a little todo list to make sure the transition is as smooth as possible for everyone, which is:

On Github

  • Move in issues and tickets from Google. I wrote a tool for this
  • Move in wiki documents from Google. There are a few tools around, like wikiconvert.py, but in worst case scenario doing it by hand is an option.
  • Neatly organize the wiki on Github with a home page, sidebar, header and footer. Everything is explained in this article.
  • Make a custom CONTRIBUTING.md with a few guidelines (aka RTFM). This one is a very comprehensive start.
  • Create labels for issues: I was thinking bug, enhancement, duplicate, invalid, wontfix, RTFM, PEBKAC, worksforme, possiblewithaplugin.
  • Tag older commits in Git to recreate the same download list as in the original project
  • Maybe clarify the dev and branch strategy, such as in Zenphoto-Development-Process

On Google

Simply mention that the project has moved: modify issues, frontpage and wiki with the adminTabs feature at http://code.google.com/p/YOUR-PROJECT/adminTabs. Example.

Misc downloads

The inability on Github to host files other than your source code bugs me. In YOURLS there are a couple extra files that are available for download, or images used in the wiki documents.

So far the idea I've come up with is: create a branch named downloads and commit those little files there.

And?

Am I missing something? Any idea welcome :)


(cc) Ozh for planetOzh, 2013. | Permalink | 3 comments | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Checklist, Github, Google, YOURLS

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Checklist, Github, Google, YO..."
Comments Send by mail Print  Save  Delicious 
Date: Monday, 18 Mar 2013 17:20

The fine folks from WPMU DEV are running a cool giveaway for 1 annual membership, a $219 value.

Who ? Win what?

WPMU DEV is a WordPress community that features premium WordPress 24-7 support, plugins, and themes. Members get unlimited access to WPMU DEV plugins and themes, as well as constant access to our talented team of developers. One lucky contestant will earn a one year membership ($219) to all this goodness.

To know more about WPMU DEV you can also check their WordPress.org profile, their blog WPMU.org or one of their most popular plugins, MarketPress.

If you need to know one thing about them: their authors dress like super heroes and read awesome books ;)

Contest rules

That'll be simple:

  1. Create a free account at http://premium.wpmudev.org/join/#signup (real name & real email recommended, obviously)
  2. Leave a comment right here on this post on planetOzh (using the same name and email, obviously, and mentioning your WPMU DEV username)

That's it. Feel free not to leave a boring comment (like, introduce yourself, your favorite PHP function or your best coding moment maybe?) but that's just bonus to make the web a more interesting place.

Nope, no cheesy tweet to spam all over the internet, although one mentioning @ozh and @wpmudev will be greatly appreciated :)

By next Friday 18pm GMT I'll have my kid to draw a random comment number and I'll announce the winner on Twitter.

Good luck everyone!


(cc) Ozh for planetOzh, 2013. | Permalink | 11 comments | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Giveaway, WordPress

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Giveaway, WordPress"
Comments Send by mail Print  Save  Delicious 
Date: Thursday, 07 Feb 2013 15:52

Here is a story about a guy who tried to speak a language he didn't know. Like Twilight, there are several chapters in that story, but don't worry, it's not about sissy hormone troubled teenagers trying to grasp the meaning of life.

(...)
Read the rest of I don't speak Parseltongue, but I speak PHP (380 words)


(cc) Ozh for planetOzh, 2013. | Permalink | No comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Github, Google, Harry Potter, PHP

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Github, Google, Harry Potter,..."
Comments Send by mail Print  Save  Delicious 
New Face   New window
Date: Sunday, 13 Jan 2013 18:03

I have a new face! Move your mouse over me to see, hoo, look, no more glasses! At the end of 2012 I decided I had enough of wearing glasses and went for some laser eye surgery, pew pew. Before: short sighted to the point I would not recognise someone 50 centimeters away when not wearing my glasses. Now: I feel like an eagle with infinite vision!

I've been wearing glasses since the age of 13 and I can tell you It's awesome. New places to discover! Like, at the swimming pool or inside the shower! :) But the best side effect is that, whenever I just remember that I don't need glasses anymore, it brings a big smile on my face and I'm all cheered up for the next minutes :)

My last "new face" was in 2006. Time to change all the gravatars and stuff again!


(cc) Ozh for planetOzh, 2013. | Permalink | 3 comments | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Glasses, My Life

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Glasses, My Life"
Comments Send by mail Print  Save  Delicious 
Date: Wednesday, 02 Jan 2013 00:54

Open Source Do you know that logo? It's the logo of the Open Source Initiative, a non-profit formed to advocate for the benefits of open source, and de facto, the logo for open source stuff in general.

Personally, I rarely see that logo used anywhere, which is a shame. For the sake of promoting Open Source, and because I like that logo (sort of an open lock, see?), I think it would be great if that logo was much more common that it is today.

Anyway, the other day I stumbled upon the Green Lantern logo and the similarities with the Open Source logo immediately occurred to me. I thought it would be fun to make a mashup of the two, which I did. But then, why stop? So, during the last few days, I've been having some Photoshop fun and made, so far, ten Open Source Super Hero logos. Can you name them all?

shirts

They're all available as nifty Open Source Super Heroes tshirts from Redbubble, an tshirt company responsible for a large share of my wardrobe and provider of awesomeness (seriously, can you handle that coolness?)

Feedback, criticism and suggestions for other Super Heroes welcome!


(cc) Ozh for planetOzh, 2013. | Permalink | One comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: My Life, super heroes, tshirt

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, My Life, super heroes, tshirt"
Comments Send by mail Print  Save  Delicious 
Date: Thursday, 20 Dec 2012 16:07

I was having a look at my Profile page on WordPress.org and wondered how many downloads all my plugins had. Start Menu, Accessories, Calculat.. HEY? What am I doing here?

Bookmarklet Fun

The following Javascript snippet will do the job for you:

javascript
< view plain text >
  1. (function () {
  2.     var total = 0,
  3.         count = 0;
  4.     jQuery('p.downloads').each(function (i, e) {
  5.         count++;
  6.         total += parseInt(jQuery(e).text().replace(/,/g, ''));
  7.     });
  8.     total = total.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  9.     alert(count + " plugins and " + total + " downloads");
  10. })();

Which makes that bookmarklet: Plugin Count. Drag to your bookmarks or right click and bookmark it, head to your wp.org profile page and trigger the bookmarklet!

plugincount

More Bragginess: Tweet It!

Yeah, a humble alert box won't make the world and your Mom proud of you, right? Tweet Plugin Count!

FYI

Bookmarklets are fun. Two tools will help you:

Have fun!


(cc) Ozh for planetOzh, 2012. | Permalink | One comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Bookmarklet, Code, Javascript, Plugins, WordPress

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Bookmarklet, Code, Javascript..."
Comments Send by mail Print  Save  Delicious 
Date: Wednesday, 19 Dec 2012 18:10

I wrote a simple WordPress plugin to address a simple problem: every 2 weeks, on every computer I'm working on, I have to login again to my blogs and, oh the annoyance, click the "Remember Me" checkbox because by blogs can't remember to remember me.

remember

Longer auth cookie expiration (one year instead of 2 weeks) and always checked checkbox: that's Always Remember Me.


(cc) Ozh for planetOzh, 2012. | Permalink | No comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Plugins, WordPress

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Plugins, WordPress"
Comments Send by mail Print  Save  Delicious 
Date: Friday, 30 Nov 2012 20:08

I said the other day that I wanted Git t-shirts, because when I like something, I want t-shirts of it. I couldn't find any. So I made some: Git t-shirts

The Git logo by Jason Long has a very permissive license (CC BY) that allows practically anything as long as the author's name is mentionned. And to be extra sure, I also asked him and he confirmed :)

I've ordered numerous shirts from Redbubble and I really like them: tshirt quality and lastability (?) are excellent, there are plenty of awesome designs to chose from, and it's dead easy to upload your own. Ditto.

I've set the Redbubble commission to a low percentage to keep the t-shirt as affordable as possible (I don't give a flying damn about making dollars of money from this, I primarily made that for myself). What are you waiting for? I'm sure a Git t-shirt would look nifty on your Christmas wish-list! :)


(cc) Ozh for planetOzh, 2012. | Permalink | No comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Git, My Life, tshirt

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Git, My Life, tshirt"
Comments Send by mail Print  Save  Delicious 
Date: Tuesday, 27 Nov 2012 16:00

I think I've set up a pretty efficient Git environment on Windows and, as promised in a previous post about my Git initiatic journey, I'm sharing it, hoping it'll be useful to someone. Another quite lengthy post I'm afraid, feel free to grab a cup of something before you start reading.

(...)
Read the rest of Efficient Git Setup on Windows (1,857 words)


(cc) Ozh for planetOzh, 2012. | Permalink | No comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Git, tricks, Windows

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Git, tricks, Windows"
Comments Send by mail Print  Save  Delicious 
Date: Wednesday, 21 Nov 2012 20:24

I've been speaking lately with folks from Spamhaus about anti spam measure in YOURLS and a YOURLS plugin for this. Currently the #1 result in Google for "spamhaus PHP" is a post on Lockergnome which gets it totally wrong and provides a script that does not work, so here is a PHP script that does work.

This script checks a URL (its domain part, in fact) against the 3 major black lists: Spamhaus, SURBL and URIBL.

The script:

  1. /**
  2.  * Check a URL against the 3 major blacklists
  3.  *
  4.  * @param string $url The URL to check
  5.  * @return mixed true if blacklisted, false if not blacklisted, 'malformed' if URL looks weird
  6.  */
  7. function ozh_is_blacklisted( $url ) {
  8.  
  9.     $parsed = parse_url( $url );
  10.  
  11.     if( !isset( $parsed['host'] ) )
  12.         return 'malformed';
  13.        
  14.     // Remove www. from domain (but not from www.com)
  15.     $parsed['host'] = preg_replace( '/^www\.(.+\.)/i', '$1', $parsed['host'] );
  16.  
  17.     // The 3 major blacklists
  18.     $blacklists = array(
  19.         'zen.spamhaus.org',
  20.         'multi.surbl.org',
  21.         'black.uribl.com',
  22.     );
  23.    
  24.     // Check against each black list, exit if blacklisted
  25.     foreach( $blacklists as $blacklist ) {
  26.         $domain = $parsed['host'] . '.' . $blacklist;
  27.         $record = dns_get_record( $domain );
  28.        
  29.         if( count( $record ) > 0 )
  30.             return true;
  31.     }
  32.    
  33.     // All clear, probably not spam
  34.     return false;
  35. }

Usage:

  1. if( ozh_is_blacklisted( $url ) ) {
  2.     // do something brutal (eg die() your script, yell at user, etc...)
  3. }
  4.  
  5. // all is fine *for today*, do your regular stuff.
  6. // This said, it'd be nice to recheck every couple of days

Feel free to steal.


(cc) Ozh for planetOzh, 2012. | Permalink | 9 comments | Add to del.icio.us | splogmenotplz
Read more posts tagged with: blacklist, Code, PHP, Spam

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, blacklist, Code, PHP, Spam"
Comments Send by mail Print  Save  Delicious 
Date: Monday, 12 Nov 2012 23:22

I'm a SVN user.

Nowadays, all the cool kids have a Github account where they host stuff and use Git as their primary Source Control tool, and prefer it over the usual SVN you've probably got to use.

I'm not a cool kid and for the last few years (since WordPress started the plugin repository using SVN I think — more or less 8 years ago), I've been happily using SVN. You know SVN, right? Easy to use and to understand, right? Does the job simply, right? So, why switch, right?

I'm regularly pestered to move YOURLS from Google Code to Github, to which I responded more or less that I was happy with SVN and I didn't want to spend time learning a new complicated tool. Because, Git is complicated, right?

But I wanted to be a cool kid anyway, so I gave Git a few looks and tries.

(...)
Read the rest of So, I've Tried Git. And it's… (2,175 words)


(cc) Ozh for planetOzh, 2012. | Permalink | 22 comments | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Git, Github, My Life, SVN

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Git, Github, My Life, SVN"
Comments Send by mail Print  Save  Delicious 
Date: Saturday, 20 Oct 2012 16:50

There's a really nice post that's getting shared all over the intarnets right now, showcasing useful keyboard tricks in various editors, but I thought it missed Notepad++ which does support most of those tricks out of the box.

I decided to list a few quick keyboard tricks in Notepad++ I use daily, and there are really a few cool ones.

Delete whole words

Delete previous word: Control + Backspace
Delete next word: Control + Delete

Actually I think that works in any Windows application since it works right here in my WordPress Write interface.

More power: you can delete from carret to start of line or to end of line adding Shift in the combo:

Delete to start of line: Control + Shift + Backspace
Delete to end of line: Control + Shift + Delete

Duplicate or delete current line

Duplicate current line: Control + D
Delete current line: Control + L

I use the first one pretty often, especially when wanting to test something slightly different: duplicate line, comment first one out and slightly alter second one. Which goes along really well with next trick:

Comment or uncomment one or several lines

Comment or uncomment: Control + Q

That one toggles a leading // in current line or for a line selection. You can also add "stream comments" (ie /* stuff */) with the following key combo:

Add stream comment: Shift + Control + Q

Move that line

Switch current and previous line: Control + T
Move whole line to another place: Shift + Control + Up or Shift + Control + Down

The totally cool stuff is, that second trick works with a multiple line selection. This works great to move an entire small function or CSS declaration.

Column Editing

I've always thought that one was insane :) Pretty usefull if you want to edit several lines of a file where the same text is repeated, such as a CSS file.

Column selection: Alt + Left Click

Where does that code block starts or end? Find matching brace

Go to matching brace : Control + B

Of course the highlighting helps but when the block is taller than your screen, it's not enough. That one is one of my favorites, it makes navigation in if then else or function blocks really easy.

Automatic indentation

Select several lines and move them to the right (indent) or to the left (unindent? outdent?) in a blink

Indent several lines: Tab
Unindent several lines: Shift + Tab

Scroll through the document without using your mouse

Scroll without changing carret position: Control + Up or Control + Down

More !

That's just a few quick and useful keyboard tricks I use all the time, but there are a lot more. Notepad++ has also a gazillion plugins to do just anything you'd think of. The ones I use all the time are Function List (displays a function list in the sidebar, very handy to quickly navigate) and Finger Text, one of the many snippet plugins available.


(cc) Ozh for planetOzh, 2012. | Permalink | 7 comments | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Notepad, text editor, tricks

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Notepad, text editor, tricks"
Comments Send by mail Print  Save  Delicious 
Date: Wednesday, 17 Oct 2012 19:52

Ho haï, blog, long time no see! :)

I was checking stuff on various URL shorteners and noticed is.gd has one interesting feature: you can generate short URLs that are "pronounceable" (no "vgfhgt"). This is a great little touch: a random but pronounceable word will be more memorable and the probability for typos is reduced, which makes it a killer feature for random generated passwords for example.

Generating pronounceable random words isn't difficult :

  • start by a vowel or a consonant
  • alternate and add letters till proper word length

Simple, but this generates words that are too simple maybe: 'abuco', 'misolo', 'xulanipo', etc... Natural words also use a few consecutive consonant combinations as well as vowel combos ('cheepo', 'bergam', ...)

I ended up with this simple piece of code that gives more natural words:

PHP:
  1. <?php
  2. /**
  3. * Generate random pronounceable words
  4. *
  5. * @param int $length Word length
  6. * @return string Random word
  7. */
  8. function random_pronounceable_word( $length = 6 ) {
  9.    
  10.     // consonant sounds
  11.     $cons = array(
  12.         // single consonants. Beware of Q, it's often awkward in words
  13.         'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm',
  14.         'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'z',
  15.         // possible combinations excluding those which cannot start a word
  16.         'pt', 'gl', 'gr', 'ch', 'ph', 'ps', 'sh', 'st', 'th', 'wh',
  17.     );
  18.    
  19.     // consonant combinations that cannot start a word
  20.     $cons_cant_start = array(
  21.         'ck', 'cm',
  22.         'dr', 'ds',
  23.         'ft',
  24.         'gh', 'gn',
  25.         'kr', 'ks',
  26.         'ls', 'lt', 'lr',
  27.         'mp', 'mt', 'ms',
  28.         'ng', 'ns',
  29.         'rd', 'rg', 'rs', 'rt',
  30.         'ss',
  31.         'ts', 'tch',
  32.     );
  33.    
  34.     // wovels
  35.     $vows = array(
  36.         // single vowels
  37.         'a', 'e', 'i', 'o', 'u', 'y',
  38.         // vowel combinations your language allows
  39.         'ee', 'oa', 'oo',
  40.     );
  41.    
  42.     // start by vowel or consonant ?
  43.     $current = ( mt_rand( 0, 1 ) == '0' ? 'cons' : 'vows' );
  44.    
  45.     $word = '';
  46.        
  47.     while( strlen( $word ) <$length ) {
  48.    
  49.         // After first letter, use all consonant combos
  50.         if( strlen( $word ) == 2 )
  51.             $cons = array_merge( $cons, $cons_cant_start );
  52.  
  53.          // random sign from either $cons or $vows
  54.         $rnd = ${$current}[ mt_rand( 0, count( ${$current} ) -1 ) ];
  55.        
  56.         // check if random sign fits in word length
  57.         if( strlen( $word . $rnd ) <= $length ) {
  58.             $word .= $rnd;
  59.             // alternate sounds
  60.             $current = ( $current == 'cons' ? 'vows' : 'cons' );
  61.         }
  62.     }
  63.    
  64.     return $word;
  65. }
  66.  
  67. ?>

(bleh, just noticed the fuckingfancy curled quoted are back in code blocks. pastebin for cut'n'paste code)

Play with the demo: random pronounceable words.

Nothing elaborated enough to help you create an alien language for your next sci-fi movie, but I'm rather pleased with the random words it creates. It's also easy to implement this in another language: modify the group of consecutive vowels and consonants to match what exists in your language.


(cc) Ozh for planetOzh, 2012. | Permalink | No comment | Add to del.icio.us | splogmenotplz
Read more posts tagged with: Code, password, PHP, random

Feed enhanced by Better Feed from Ozh

Author: "Ozh" Tags: "Published, Code, password, PHP, random"
Comments Send by mail Print  Save  Delicious 
Next page
» You can also retrieve older items : Read
» © All content and copyrights belong to their respective authors.«
» © FeedShow - Online RSS Feeds Reader