Alessandro Melandri

Remove .DS_Store Files From A Git Repository

19 Oct 2014 • Permalink

Remove existing files from the repository:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

Add the line .DS_Store to the file .gitignore, which can be found at the top level of your repository (or created if it isn’t there already). Then

git add .gitignore
git commit -m '.DS_Store banished!'

Removing orphaned users from a SQLServer database

18 Oct 2014 • Permalink

If you are using SQLServer probably you had to restore a database from a backup and got stuck with an orphaned user that was no more associated with a login.

Microsoft provides a stored procedure to remove this orphaned user:

exec sp_revokedbaccess 'Orphaned_User_Name'

You could get an error because the user still owns a schema. To find out which schema is bound with the user you can use this query

SELECT name FROM  sys.schemas WHERE principal_id = USER_ID('Orphaned_User_Name')

And then drop the orphaned user from the schema

ALTER AUTHORIZATION ON SCHEMA::SchemaName TO dbo
GO
DROP USER Orphaned_User_Name

Welcome to iPhone 6, friend

06 Oct 2014 • Permalink

We have spent countless hours engineering the thinnest, most powerful smartphone in the world onto which you will now put a case. We have burned untold person-years, an innumerable number of lifetimes screaming at assembly line workers to achieve perfect tolerances for you to cover with a phone glove.

One of the most satisfying industrial design elements of the iPhone 6 is the curved glass, over which your thumb will never glide once you fit upon it a furrowed hunk of dead cow.

Synchronize Sublime Text packages on multiple computers

02 Jan 2014 • Permalink

Finally a way to synchronize Sublime packages beetween my home iMac and my work ThinkPad.

Manage posts excerpt in Jekyll

24 Nov 2013 • Permalink

Jekyll has a built in excerpt feature, but I wanted more control on how excerpt is generated and displayed, so googling around I found two nice posts that explain how to manage it and display a “Read on” button that links to the article page.

This is how it works:

  • Check if the post contains the excerpt separator
  • If the separator is found, split the post content in an array, print the first element and a link to the full article
  • If there isn’t a separator just display the post content

This is how I modified my index.html page.

{% if post.content contains '<!--more-->' %}
	
	{{ post.content | split:'<!--more-->' | first }}
	
	<p><a href="{{ post.url }}">Continue reading</a></p>

{% else %}

	{{ post.content }}
	
{% endif %}

Custom notifications for a specific status change in Jira

20 Nov 2013 • Permalink

The default Jira notification scheme sometimes might look like a spam bot, especially if you have a lot of users actively using it, so for one of our project we decided to create an empty notification scheme and add just one notification for a specific status change.

Jira doesn’t have a built in notification for specific status changes but fortunately adding a new one is quite easy.

Continue reading

Update table with data from another table using SQL

19 Nov 2013 • Permalink

A simple but useful SQL snippet that lets you update a table using data from another table

UPDATE
     Table1 
SET
     Table1.col1 = Table2.col1,
     Table1.col2 = Table2.col2 
FROM
     Table1 
INNER JOIN     
     Table2 
ON     
     Table1.id = Table2.id

Custom Jekyll filter for tags

12 Nov 2013 • Permalink

This is a simple Jekyll filter that I wrote in order to use Bootstrap’s label objects to display post tags.
It’s based on the original array\_to\_sentence\_string filter, part of the Jekyll core.

Just put it in your _plugins folder and use it in your layout:

module Jekyll
  module CustomTagFilter
    def tag_array(array)
      connector = ","
      case array.length
        when 0
          ""
        when 1
          "<span class=\"label label-default\">#{ array[0].to_s}</span>"
        else
          "<span class=\"label label-default\">#{array.join('</span> <span class="label label-default">')}</span>"
      end
    end
  end
end

Liquid::Template.register_filter(Jekyll::CustomTagFilter)

Usage

<span class="posttags">{ { page.tags | tag_array } } </span>

Result

Tags: <span class="label label-default">Tech</span> <span class="label label-default">Jekyll</span> <span class="label label-default">Bootstrap</span>

About this blog theme

12 May 2013 • Permalink

I keep receiving requests about the theme used on my blog and a lot of people are asking me to release it as I did with DarkStripes.

I’m not going to publish the source code anytime soon, because I’d like to keep the look of my blog “unique”.

I promised to write a tutorial on how to customize the default Octopress theme to get a look similar to my blog, but I couldn’t find enough spare time.
The new born baby and a relocation are draining my energies so, please, be patient and if you are in a hurry remember that Firebug and Chrome web inspector are your good friends.

Ettore

07 Mar 2013 • Permalink

Ettore by Alessandro Melandri (amelandri)) on 500px.com