Linux 3.0 freigegeben
Die neue Version des Linuxkernels ist freigegeben.
Git: How to make a diff on your current stash
Imagine you stashed away some code for later use, do some stuff, and.. dawm, you forgot what it exactly was that you stashed. This little command might help, by showing a diff of your current HEAD and the next stash in the queue.
git stash show -u
Hello Etsy-Weltweit erste Kreativkonferenz für nachhaltiges Microbusiness, 18./19.9.
Mit „Hello Etsy – A Summit on Small Business and Sustainability“ möchte Etsy jeden – ob Student, Designer oder Kleinstunternehmer – unterstützen und motivieren, sein eigenes Business zu gründen, Gleichgesinnte zu treffen oder sich einfach inspirieren zu lassen. Insgesamt werden rund 500 Teilnehmer im Berliner E-Werk erwartet. Das internationale Programm setzt sich aus Vorträgen und Workshops erfolgreicher Entrepreneure, Marketing und Social Media Profis sowie Rechts- und Finanzexperten zusammen.
Jquery UI Dialog and multiple Dialogs on one page / Jquery UI Dialog only opens once
When you work with the Jquery UI Dialog Widet, you might come across an issue with the dialog only showing once. This happens because once you initialize the dom element the element that you use for the dialog gets removed from the dome, and stored into the Dialog instance. One of the core Jquery UI developers describes an easy solution for this issue in his blog. But the described way to solve the issue still needs to be patched, when you have multiple dialogs on the page, because from the link that you use to open the dialog, is no easy way to determine which of the already initialized dialogs to open.
What i did below is to give each dialog link an unique id (in this case “dialog_#{someactiverecordobject.id}”, and use it to ‘name’ the dialogs and therefore be able to know which one to open.
$(function() {
var dialogs = {}
$('.dialog').each(function() {
var dialog_id = $(this).prev('.dialog_link').attr('id');
dialogs[dialog_id] = $(this).dialog({autoOpen: false, title: '<b>Details</b>'});
});
$('.event_details_link').click(function() {
dialogs[$(this).attr('id')].dialog('open');
return false;
});
});Find and replace bash script
Sometimes you may have to change all occurrences of a pattern in a whole project.
To do so, you can use the bash, namely the find and sed commands, i.e. find . -type f -exec sed -i s/old/new/g {} + will replace all “old” with “new” strings.
As this is a frequent task, it is convenient to create a script, like replace.sh:
#!/bin/bash
# usage: replace.sh <oldpattern> <newpattern>
# replaces all occurences in files of the current directory and subdirectories
p="s/"$1"/"$2"/g"
find . -type f -exec sed -i "$p" {} +Don’t forget the “” around “$p”! Else the script won’t work when replacing a pattern with white spaces.
Haml Whitespaces and precede
I think many people use haml without knowing about the Haml Helper. You actually should. A common problem with haml is that it automatically adds whitespaces on linebreaks in your haml file, so if you write something like this:
%span
(
= button_to('x', activity_url(r), :method => delete, :title => 'Delete', :class => 'inline-link')
)you will end up with “( x )”.
So what if you don’t want this whitespaces?
Haml Helper come to the rescue with the ‘precede’ and ‘succeed’ methods:
- precede '(' do
- succeed ')' do
= button_to('x', activity_url(r), :method => :delete, :title => 'Delete', :class => 'link')Anyway, there is also the surround helper, which allows you to beautify this piece of code like this:
- surround '(', ')' do
= button_to('x', activity_url(r), :method => :delete, :title => 'Delete', :class => 'link')Good to know…
Html2Haml for Your Emacs
If you’ve ever been annoyed by switching to the command line whenever you need to convert some piece of html to haml, and of course, if you’re using emacs, you might be as happy as i am about this little snippet that allows you to convert html2haml from within your emacs. I’m not quite sure about the authorship, so i won’t copy it over here, so.. please follow this link: http://branch14.org/snippets/haml-ify_within_emacs.html
Basically you have to put the file somewhere without your emacs loadpath, to have the command ‘haml-ify’ available, you will find tutorials covering this.