Updates from July, 2013 Toggle Comment Threads | Keyboard Shortcuts

  • Peter Mahoney 3:08 pm on July 8, 2013
    Tags: gwibber, , twitter API,   

    Gwibber and the new Twitter API 

    I noticed Gwibber, my social networking app for Ubuntu, stopped updating my Twitter status after the API was updated. Basically, it was broken.

    And as of yet, it’s not been patched.

    Here’s a fix I used to get Ubuntu updating my Twitter account again.

    pkill gwibber
    sudo gedit "/usr/share/gwibber/plugins/twitter/__init__.py"

    Then search and replace “api.twitter.com/1” to “api.twitter.com/1.1”


    For the sake of honesty, I’ll admit I didn’t find this fix myself, I found it here.

    Permalink | Reply
  • Peter Mahoney 2:42 pm on February 19, 2013
    Tags: hashtagnerdy, hastags, linking to twitter with hashtags, ,   

    Make a “Share on Twitter” link with URL and Hashtags 

    This is a little coding trick I get asked about quite a bit.

    The link you have to make to share something to Twitter is quite simple:

    http://twitter.com/share?text=text goes here

    But getting a URL and hastag in there is a different matter. To be honest most developers do know how to include the URL, but hashtags have proved more elusive!

    http://twitter.com/share?text=text goes here&url=http://url goes here&hashtags=hashtag1,hashtag2,hashtag3

    Here’s an example to try out:

    http://twitter.com/share?text=Here's an awesome tip!&url=http://petermahoney.net/make-a-share-on-twitter-link-with-url-and-hashtags/&hashtags=peter,is,awesome

    And that’s it!

    Permalink | Reply
  • Peter Mahoney 3:00 pm on February 13, 2013
    Tags: #fridayfreebie, , files, , header, html5, , , template, top.php, website template   

    Website code template 

    This is for my fellow developers out there.

    I have a small series of files I copy and paste whenever I’m about to start a new project, they have default templates for various files I use a lot. Like a header, footer, index page, blank stylesheet, and something called “top.php” that I use to open sessions and connect to databases.

    There are also some of my standard folders pre-made too (with the correct server permissions) like “img” (images) and “upl” (uploads).

    This was going to be last week’s #fridayfreebie, but here it is on a Wednesday instead.

    This particular version is the one I use most commonly, and it’s set up for:

    • PHP
    • MySQL
    • HTML5
    • CSS (any version!)
    • and ideally a unix/linux based server, because it references the top level of the site as being “/”.

    I’ve zipped it up to share! Feel free to do whatever you want with it—although there is a lot of Peter Mahoney specific stuff in there, so you might want to take that out. Unless of course you like giving me credit for your work. 🙂

    HTML5 website template (.zip)

    Permalink | Reply
  • Peter Mahoney 7:17 pm on December 9, 2012
    Tags: comic, humour, tags, web development, xkcd   

    How do you annoy a web developer? 

    This is the briefest of posts, because the content is entirely thanks to the wonderful xkcd comic, and it’s pretty damn nerdy.

    First person in the comments to exclaim that they get it, and can give some sort of rationale, gets a prize.

    How do you annoy a web developer, xkcd, tags

    via xkcd: Tags.

    Permalink | Reply
    • Gabriel Dayan 9:51 am on December 10, 2012

      The SPAN element has very similar properties to the DIV element, in that it changes the style of the text it encloses. But without any style attributes, the SPAN element won’t change the enclosed items at all.

      The primary difference between the SPAN and DIV elements is that SPAN doesn’t do any formatting of it’s own. The DIV element includes a paragraph break. The SPAN element simply tells the browser to apply the style rules to whatever is within the SPAN.

      To open a DIV tag without closing it but instead to close a SPAN tag that was never opened creates an interesting conundrum for the browser, resulting in unpredictable and possibly inconsistent layout behavior. It vis the coding equivalent of “The following statement is true. The preceding statement is false.”

      Permalink | Reply
      • Peter Mahoney 10:19 am on December 10, 2012

        Gabriel, that is a much more complete answer than I was expecting!

        Email me your address to peter@petermahoney.net, I’ve got something coming your way.

        Permalink | Reply
  • Peter Mahoney 1:18 pm on October 30, 2012
    Tags: , , , , , web server   

    Speeding up your site 

    There is a slew of methods to speed your site up–which is not only the polite thing to do for your guests–but helps with Speed Engine Optimisation (SEO) too. Google in particular looks at how quickly your site loads when deciding how to rank your site.

    Now, if you’re familiar with web servers then everythign you need to know is written below. If not, this is the sort of thing you want to have an expert do for you; a faster site is too good an opportunity to pass up.

    Browser caching is a process whereby we’re able to reduce the number of HTTP requests the server needs to process, which reduced page load times. Your server tells the visitor’s browser not to look for certain filkes everytime–usually the file that don’t change often anyway.

    Edit your .htaccess file for your site, and include this code:

    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 2 days"

    Restart your web server, and you’re done!

    Cache that, baby.

    Permalink | Reply
  • Peter Mahoney 7:22 pm on September 17, 2012
    Tags: donate, , paypal   

    Donate monthly via Paypal, and HTML 

    BINGO! This is just what I needed tonight. I was starting to create a PHP solution that would enable me to set up monthly donations (rather than a subscription) to Paypal.

    But then I thought, “Paypal must have a more elegant solution for this, and if not more elegant, than certainly simpler”.

    And while they didn’t, a quick Google search revealed someone else had. In HTML.

    Monthly Donations Button | PayPal.

    Permalink | Reply
  • Peter Mahoney 3:44 pm on August 31, 2012
    Tags: documentation, , , ,   

    Create custom RSS feeds in WordPress 

    I couldn’t quite work out how best to do create a custom RSS feed in WordPress.

    My task seemed simple enough, to make an RSS feed of news articles from popular news sources…but the RSS feed needed to link back to the original source, NOT the article in WordPress.

    Writing the PHP script to generate the RSS was simple, but the final step was getting WordPress to serve that feed.

    Here’s the documentation I used, in addition to a custom field:

    Create custom RSS feeds in WordPress | Tips4PHP.

    Permalink | Reply
  • Peter Mahoney 5:04 pm on June 11, 2012
    Tags: ,   

    New Twitter logo in pure CSS 

    This is why I love CSS. Now, it will only work in newer browsers, but does look awesome.

    Roll over it and you’ll see how they made this, with a variety of CSS circles.

    You can of course also view the code by right hand clicking and viewing source. This is what I love about the web, something that makes us really say WOW, in just a hundred odd lines of code.

    Permalink | Reply
  • Peter Mahoney 5:44 pm on May 22, 2012
    Tags: align, , vertical   

    Double-tagging, or CSS vertical align 

    I’ve tried several ways of doing this, and wanted to post what I’ve found to be the best. And based on testing, it’s also the most cross-browser compliant solution.

    The issue is (seemingly) simple. How do you use the equivalent of valign=”middle” in CSS? With tables this was pretty simple. But we’ve all moved on from tables for layout. I hope.

    While CSS (including CSS3) does have a vertical-align, you can’t use it in the same way for you text-align for example. You can’t simply tell it that all text within a container should sit halfway down the div.

    The way I’ve found most useful is to double-tag. That is, to use a parent div, and then a child within it.

    Here’s the code to show what I mean:

    #content1 {
    #content2 {
    And then when writing the HTML:
    <div id="content1">
    <div id="content2">
    This text will sit halfway down the div, regardless of whether I have one line of text, or three.

    In essence the first div says “Go on, act like I’m a table”.  And then second continues, “And let’s just say I’m a table cell. Because cells *can* have vertical-align assigned to them!”


    Permalink | Reply
compose new post
next post/next comment
previous post/previous comment
show/hide comments
go to top
go to login
show/hide help
shift + esc