Skip to content

Instantly share code, notes, and snippets.

View imghasemi's full-sized avatar
💾

Mo Ghasemi imghasemi

💾
  • Germany
View GitHub Profile
@imghasemi
imghasemi / Grundstoff.md
Created March 12, 2024 12:06 — forked from ElioLopez/Grundstoff.md
Fahrschule, driving license germany, berlin

While driving on the motorway you overtake several vehicles. A vehicle approaches you from behind with indicators and headlights flashing. What should you do?

  • I brake briefly to prompt the vehicle behind to keep its distance
  • I continue driving until I can again pull into the right-hand lane
  • I turn on my hazard lights briefly to urge the vehicle behind to keep its distance

When must you switch on the hazard lights on your vehicle? If my vehicle

  • is being towed
  • experiences a breakdown at a place where the view is obscured
  • is briefly double-parked by me
@imghasemi
imghasemi / braking.md
Created March 12, 2024 11:58 — forked from andrebq/braking.md
Fahrschule

Braking

Standard Braking Distance

  • DE: (Geschwindigkeit / 10) * (Geschwindigkeit / 10)
  • EN: (Speed / 10) * (Speed / 10)

Evasive (Emergency) Braking Distance

  • DE: ((Geschwindigkeit / 10) * (Geschwindigkeit / 10)) / 2
  • EN: ((Speed / 10) * (Speed / 10)) / 2
<?php
/**
* Implements hook_install().
*
* Creates some default entries on this module custom table.
*
* @see hook_install()
*
* @ingroup lotus
*/

Hydration refers to filling an existing object with data. It is not a synonym for serialization.

With respect to the more generic term hydrate Hydrating an object is taking an object that exists in memory, that doesn't yet contain any domain data ("real" data), and then populating it with domain data (such as from a database, from the network, or from a file system).

From Erick Robertson's comments on this answer:

deserialization == instantiation + hydration

@imghasemi
imghasemi / git-stash-untracked-show.md
Created August 27, 2019 08:39
How to show git stash untracked files

REF: https://stackoverflow.com/a/12681856

Untracked files are stored in the third parent of a stash commit. (This isn't actually documented, but is pretty obvious from The commit which introduced the -u feature, 787513..., and the way the rest of the documentation for git-stash phrases things... or just by doing git log --graph stash@{0})

You can view just the "untracked" portion of the stash via:

git show stash@{0}^3
@imghasemi
imghasemi / rename-git-branch.md
Created August 22, 2019 14:27
Rename a git branch locally and remotely

In order to undo changes to the HEAD we can simply run following command:

git reset --hard HEAD~ 

REF: https://stackoverflow.com/a/30986481

A cherry-pick is basically a commit, so if you want to undo it, you just undo the commit.

when I have other local changes Stash your current changes so you can reapply them after resetting the commit.

@imghasemi
imghasemi / drupalStatusMessage.php
Last active August 7, 2019 13:58
Drupal status message with AJAX for Drupal 8
<?php
$response = new AjaxResponse();
$status_messages = array('#type' => 'status_messages');
$messages = \Drupal::service('renderer')->renderRoot($status_messages);
if (!empty($messages)) {
$response->addCommand(new PrependCommand('.your_selector', $messages));
}
return $response;
@imghasemi
imghasemi / apply-git-patch-with-dir.sh
Created August 6, 2019 13:35
apply a patch with git
git apply --verbose --directory=web/modules/select2/ remember-new-tags-after-validation.diff
@imghasemi
imghasemi / git.bash
Last active July 30, 2019 13:40
Remove a file from a Git repository without deleting it from the local filesystem
# good solution described here: https://stackoverflow.com/a/21477287
# This command removes files from the repository based on your .gitignore without deleting them from the local file system :
git rm --cached `git ls-files -i -X .gitignore`