GIT Simple Cheat sheet

This is a list of commands I infrequently use and constantly have to look up again.
Well let’s safe some precious time.

GIT Patching

Create patch from a specific commit hash/revision

 Test patch

 Apply patch

100% Anonymous Pastebin Service

Pastebins are great tools to quickly share code snippets with colleges or someone who is trying to help you online. However, as always, do we really trust these services with our code/data? I know, I don’t, which is why I created a 100% anonymous pastebin service for myself – and you, if you are in need of one.

The service does…

  • irreversibly delete pastes after 24 hours .

The service does not…

  • store any of your details like IP or browser agent.
  • include external libraries that could leak information to third parties.
  • store apache access log files.

http://pastebin.andreas.glaser.me

Have fun with it!

 

 

Linux “alias” for resumable scp process

Let me say that: “You’re gonna love this one!”

Edit your bashrc.

Append following lines at the end of the file.

Reload your bash environment definitions.

Now enjoy your new little helper.

Symfony2 – Two separate forms in one controller

After spending some time working with Symfony 2, I had to figure out how to manage two separate forms in one controller. This does sound like a trivial issue but due to the nature of Symfony’s documentation it isn’t always easy to find an answer. So here you go: Two forms, one controller!

Enjoy!

PHP – Check if string is valid JSON

Edit: 2015-11-27 – Removed unnecessary checks + Performance improvements.
Edit: 2014-07-02 – Added further check to cover various cases.

Edit: 2014-06-30 – Added string check.

Today I have a little snippet for you, that can check if a string is valid JSON.

PHP Array – Insert item before/after array index

If you ever find yourself in the need of a way to insert array items before or after a specific array index, this is your solution. Enjoy!

 Usage

 

Apache mod_rewrite force https/ssl

Here is a mod_rewrite snipped that you can place in your .htaccess file, to force visitors to use https instead of http.

Have fun!