Updates from March, 2009 Toggle Comment Threads | Keyboard Shortcuts

  • steve918 3:27 pm on March 18, 2009 Permalink | Reply
    Tags: framework, quote   

    Nice Quote 

    “You need a framework? What is this, a framework? You don’t need a framework. They told you you need this. You don’t need this. You need a painting, not a frame.” — Klaus Kinski

    Advertisements
     
  • steve918 1:59 pm on March 18, 2009 Permalink
    Tags:   

    Hacking on the new P2 WP theme 

    I really like the new Prologue theme for WordPress. It looks really clean, supports keyboard shortcuts and it buzzword compliant with the new micro-blogging UI. Unfortunately I’m a bit hard to please. I’m annoyed by the auto-generated titles in RSS feeds and I think displaying useful titles on your blog helps people skim. Lets be realistic no one wants to read all of the crap I spew about.

    So I’ve customized the theme a bit to my tastes so you can read the title of this post and decide to skip over it.

    picture-61

    And I get this nice little box at the top when I’m logged in so that I can type that title without even visiting the admin interface.

    picture-71

     
    • Maurice 7:45 pm on March 29, 2009 Permalink

      I think this addition is awesome and definitely useful when scanning through alot of information. Do you mind providing the code you added to add/display the titles?

    • Ben 2:04 pm on March 30, 2009 Permalink

      Thank god you removed auto titles. It is very clean though!

    • imran 10:27 pm on April 3, 2009 Permalink

      can you share the trick my email is sifarat at gmail.com thanks in advance

    • Anh dep 1:44 am on April 9, 2009 Permalink

      Great hack, can U share it?

    • Ben Greenberg 4:11 pm on April 22, 2009 Permalink

      I would also like to make these hacks to P2 for an internal work site I’m putting together.

    • Atomboy 2:44 pm on April 23, 2009 Permalink

      I would also be very grateful for the code to add a title, please. It just finishes the job off neatly, I think. Thank you very much.

    • Alessandro 4:33 am on April 25, 2009 Permalink

      hi!
      great!
      i was looking for this modify! Can you share this? Can you send me the code? Please!
      Amazing work.
      Ty

      ale

    • Jere 8:29 pm on April 25, 2009 Permalink

      and code?

    • Scot 6:59 am on April 28, 2009 Permalink

      Nice

      I’m looking for a solution that effectively allows you to cross-post to Twitter right from the P2 post-form (enter Twitter credentials, save, go away via ajax). There’s plenty of plugins to allow this, but putting out front would be awesome. Any ideas?

    • Maclord 10:05 am on May 5, 2009 Permalink

      Any way to automatically notify members by e-mail of every upcoming post?

    • ronald redding 12:33 pm on May 11, 2009 Permalink

      excellent idea.

    • Doug 2:57 pm on August 3, 2009 Permalink

      I would also love to know how you did this. This is exactly what many people are asking for. Me too? Can you show us or share it? Thank!

    • anon-amok 5:17 pm on October 11, 2009 Permalink

      come on Steven, stop taunting us 🙂

      anyway, omarvelous.com is working on a version of this and he’s made the code available through github.

    • Ralph 7:55 am on October 17, 2009 Permalink

      Hi Steven,

      I am exactly after what you have done. I spent all day to figure out how visitors can see the box at the top@Hi xxxx whatch up to? when they visit the site. I managed to install Ajax-register and that works fine but annoyingly, I can only see that box and post a new comment when i’m logged in as admin…but when i simulate a normal user registration….the box is not there and users can only reply or leave a comment but can not create a new thread!!! please help what do i need to do? thanks so much in advance.

    • steven 12:41 am on November 26, 2009 Permalink

      Check out p2 version 1.1

  • steve918 11:14 pm on March 17, 2009 Permalink | Reply
    Tags: , jquery,   

    Expandable Textareas in Django 

    I’m probably not the first one to think of this, but when your writing long posts (like this one) it’s nice to have an expandable text area. This little hack makes use of the jQuery Textarea Resizer plugin. You’ll need to download it along with jQuery and put them somewhere in your media directory.

    Make a copy of the base_site.html template in django/contrib/admin/templates/admin/base_site.html and put it in your apps local template path.

    Add the following template block to /admin/base_site.html

    {% block extrahead %}
    
        div.grippie {
            background:#EEEEEE url({{ MEDIA_URL }}js/textarea_resize/grippie.png) no-repeat scroll center 2px;
            border-color:#DDDDDD;
            border-style:solid;
            border-width:0pt 1px 1px;
            cursor:s-resize;
            height:9px;
            overflow:hidden;
            margin-left: 106px;
        }
        textarea {
            display:block;
            margin-bottom:0pt;
            width:95%;
            height: 20%;
        }
    
    
    
    
        $(document).ready(function() {
             $('textarea:not(.processed)').TextAreaResizer();
    	});
    
    {% endblock %}
    

    And now you should have nice expandable text-areas that look like this one:

    Expandable Textarea

     
  • steve918 5:02 pm on March 17, 2009 Permalink | Reply
    Tags:   

    New iPhone 3.0 Icons Check out the stri … 

    New iPhone 3.0 Icons

    Check out the stripy-ness.

    iPhone 3.0 Icons

    Older 2.0 Icons

    20_icons

     
    • CxxC 10:34 am on June 20, 2009 Permalink | Reply

      I never noticed the new icons until I stumbled upon a website listing all the new 3.0 firmware changes. Now that I know these icons have changed, though, I can’t remember what the old ones looked like! Could you please post a pic of the older ones to show the comparison? Thanks!

    • steven 1:16 pm on June 26, 2009 Permalink | Reply

      Updated with older icons for reference.

  • steve918 8:15 am on March 17, 2009 Permalink | Reply
    Tags: , , star-rating   

    Spent some time last night playing with … 

    Spent some time last night playing with star ratings in Django, thanks to Ryan Kanno and Leah Culver’s hard work, because it made my job incredibly easy.

     
  • steve918 6:19 pm on March 16, 2009 Permalink | Reply  

    Under construction 

    I’m working on migrating all of the content onto wordpress.com servers.  Check back again tomorrow.

     
  • steve918 2:54 pm on March 16, 2009 Permalink | Reply
    Tags: p2, safari, theme, wordpres   

    Theme seems a little broken in Safari, w … 

    Theme seems a little broken in Safari, will have to look at it later.

     
  • steve918 12:05 pm on March 16, 2009 Permalink | Reply  

    Touching up the new WordPress theme. It … 

    Touching up the new WordPress theme. It really much cleaner than the old one and it has keyboard shortcuts!

     
  • steve918 4:52 pm on March 9, 2009 Permalink | Reply  

    Testing Email Registration Flows in Django 

    Testing email registration flows is typically a pain. Most of the time I just want to sign up with a test user, get the email link and finish the flow. I also want to be able to automate the whole process without having to write some SMTP code to check some mail box for the email.

    The best way I’ve found to do this is just to write out your emails to some file instead of actually sending them via SMTP when your testing. Below is some code to do just that. I’ve also created a Django management script that will open the last email sent out from your application, find the first link in it and open it in your web browser. Quite handy for following email registration links without logging into your email and clicking on them manually.

    Put this code somewhere like util/__init__.py and add the util app to your INSTALLED_APPS in settings.py. Then instead of using the send_mail function in django.core.mail, use the wrapper we created in util.

    from django.core.mail import send_mail as send_real_mail
    from django.conf import settings
    
    def send_mail(subject, message, sender, to):
        """
        Send email
        """
        if settings.DEBUG:
            send_debug_mail(subject, message, sender, to)
    
        send_real_mail(subject, message, sender, to)
    
    def send_debug_mail(subject, message, sender, to):
        """
        Save outgoing mail to a file for testing
        """
        if not os.path.exists(settings.DEBUG_MAILDIR):
            os.mkdir(settings.DEBUG_MAILDIR)
        fp = open('%s/%s' % (settings.DEBUG_MAILDIR, str(time.time())) , "w")
        fp.writelines([
            'From: %s\n' % sender,
            'To: %s\n' % ", ".join(to),
            'Subject: %s\n\n' % subject,
            message
        ])
        fp.close()
    

    In one of your applications probably util if you followed the directions above, create a folder called management and with in that folder create another called commands. Then paste the code below in /management/commands/email_reg.py. Also don’t forget to add __init__.py files to both the management and command directories.

    # Put this in one of your apps under
    # /management/commands/email_reg.py
    
    from glob import glob
    import webbrowser
    import re
    
    from django.core.management.base import NoArgsCommand
    from django.conf import settings
    
    class Command(NoArgsCommand):
        help = "Follow first link in the latest debug email"
    
        requires_model_validation = False
    
        def handle_noargs(self, **options):
    
            latest = ''
            for x in glob(settings.DEBUG_MAILDIR + '/*'):
                if x > latest:
                    latest = x
    
            f = open(latest).read()
            link = re.search('http:\/\/.*', f).group()
            webbrowser.open_new_tab(link)
    
     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel