git rev-list -n 1 HEAD -- <file_path>
Which will give you the commit hash and then
git checkout <deleting_commit>^ -- <file_path>
Or you can do it in one command using a variable for the filepath
Assuming you are using bash, setup an environment var:
export gitfile=<file_path> and then
git checkout $(git rev-list -n 1 HEAD -- "$gitfile")^ -- "$gitfile"
You can use
echo $gitfile
To make sure that the variable was set correctly.
For other shells you would use it's own mechanism like
setenv
etc...
Hope this helps!
To ease life of the Android developers who use action bar and tackle the problem of fragmentation between the older devices and the newer devices the following library might be very useful:
github.com/JakeWharton/ActionBarSherlock
The library will automatically use the native ActionBar implementation on Android 4.0 or later. For previous versions which do not include ActionBar, a custom action bar implementation based on the sources of Ice Cream Sandwich will automatically be wrapped around the layout. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
P.S. The official Github Android client uses this library.
2015-03-07 UPDATE: Google has released an actionbar component in their compatibility library a while ago. You should be using this now.
If you were in need of Git hosting and you did not like Github for some reason (I am personally not that crazy about them). You can get free Git hosting at Bitbucket. Not only they give you a free hosting of personal repositories but they also provide a nice wiki and a bug tracking. These are the same guys who develop Jira – a widely used bug tracking system. Although the bug tracking that you get with BitBucket repository is pretty basic, it is enough for most small to medium projects.
But the goodies do not stop here. They offer unlimited accounts for educational purposes and otherwise very reasonably priced accounts.
Oh and actually they offer both HG (Mercurial) or Git hosting through the same interface/website/account :)
Check them out!
When you (re)open a project in PHPStorm, it will ask you whether you want to open it in a new window or current. If you choose new window it will open another instance of PHPStorm and open there your project, if you choose otherwise it will replace the curent workspace with the new project. There is also a checkbox saying don't ask me again and then this will be the usual setting from now on. Now what if you did something and then you regret. It took me some time to find out how to change this. Here it is. It's quite simple actually and I would probably found it faster if I didn't google for it but just would use some common sense and find it myself (which I eventually had to reserve to since googling did not help)
It's basically Settings->General->Confirm window to open project in
As it turns out, it is extremely easy to add gestures to your Windows Phone app. All you need to do is add a reference to the Silverlight Toolkit
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
Then add the following code to any UI element (button, textbox etc...) that you want the gesture to be applied to and implement the listeners in your .cs file
<toolkit:gestureservice.gesturelistener>
<toolkit:GestureListener
DoubleTap="GestureListenerDoubleTap"
Hold="GestureListenerHold"/>
</toolkit:gestureservice.gesturelistener>
Last step is the implementation of the listeners:
private void GestureListenerDoubleTap(object sender, GestureEventArgs e)
{
MessageBox.Show("Double tap gesture");
}
and
private void GestureListenerHold(object sender, GestureEventArgs e)
{
MessageBox.Show("Hold gesture");
}
</center>
That's how to determine theme accent color on Windows Phone 7
// Determine the accent color.
Color currentAccentColorHex =
(Color)Application.Current.Resources["PhoneAccentColor"];
switch (currentAccentColorHex.ToString())
{
case "#FF1BA1E2": currentAccentColor = "blue"; break;
case "#FFA05000": currentAccentColor = "brown"; break;
case "#FF339933": currentAccentColor = "green"; break;
case "#FFE671B8": currentAccentColor = "pink"; break;
case "#FFA200FF": currentAccentColor = "purple"; break;
case "#FFE51400": currentAccentColor = "red"; break;
case "#FF00ABA9": currentAccentColor = "teal (viridian)"; break;
// Lime changed to #FFA2C139 in Windows Phone OS 7.1.
case "#FF8CBF26":
case "#FFA2C139": currentAccentColor = "lime"; break;
// Magenta changed to # FFD80073 in Windows Phone OS 7.1.
case "#FFFF0097":
case "#FFD80073": currentAccentColor = "magenta"; break;
// #FFF9609 (previously orange) is named mango in Windows Phone OS 7.1.
case "#FFF09609": currentAccentColor = "mango (orange)"; break;
// Mobile operator or hardware manufacturer color
default: currentAccentColor = "custom eleventh color"; break;
}
// Determine the visibility of the dark background.
Visibility darkBackgroundVisibility =
(Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"];
// Write the theme background value.
if (darkBackgroundVisibility == Visibility.Visible)
{
textBlock1.Text = "background = dark";
}
else
{
textBlock1.Text = "background = light";
}
An interesting podcast from the CEO of Joyent who is the largest user of Node and the current employer of the creator of Node.
The discussion revolved around what Node is good for and what it was not designed to do and why people who say that Node doesn't work for them are just not using it right. The rule of thumb - use the right tool for the job still remains right in software industry and will probably do so for a foreseeable future.
Ever wondered how you can type on your Wp7 simulator using your keyboard?
Here's a list of useful keyboard shortcuts for the WP7 emulator which includes the answer to the above question.
Key | Description |
F1 | Use F1 key on the keyboard instead of back button on the phone |
F2 | Use the key F2 on the keyboard for the Windows key in the Windows Phone 7 |
Pageup | Enables the keyboard in the emulator when the focus is on the textbox |
PageDown | Disables the keyboard in the emulator |
F3 | To open the Bing Search |
F7 | To Activate the Physical Camera |
F9 | Increase the Volume |
F10 | Decrease the volume |