$ git checkout web-123-my-branch # make sure you're on the right branch
$ git fetch # update remote refs
$ git rebase origin/master # perform the rebase onto the current state of master
# for each conflict, edit file, resolve conflicts, git add -u <file>, git rebase --continue
$ git push -f origin web-123-my-branch # overwrite remote branch with newly rebase branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$field_collection_item = field_collection_item_load($id); | |
$item_wrapper = entity_metadata_wrapper('field_collection_item', $field_collection_item); | |
// this results in an error if the field_contrib_headshot field is empty | |
$headshot = $item_wrapper->field_contributor->field_contrib_headshot->value(); | |
Solution: | |
// EntityStructureWrapper implements the __isset() function according the principe of Overloading. | |
$headshot = array(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find last commit for the deleted file | |
git rev-list -n 1 HEAD -- $path | |
# Checkout the commit before the the delete happened | |
git checkout $commit^ -- $path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* A tabledrag example - without theming the whole form. | |
*/ | |
/** | |
* Implements hook_menu(). | |
*/ |
Vá até o seu repositório e execute
git config core.filemode false
The examples here contain some hard-coded IDs. These are all examples. In your real code, you should already have the node IDs, file IDs, etc. in a variable.
Load a node by NID:
$nid = 123; // example value
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
$node = $node_storage->load($nid);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
This function saved my life. | |
found on: http://www.sitepoint.com/forums//showthread.php?t=438748 | |
by: crvandyke | |
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?! | |
*/ | |
$array = json_decode(json_encode($object), true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// download.js v4.21, by dandavis; 2008-2018. [MIT] see http://danml.com/download.html for tests/usage | |
// v1 landed a FF+Chrome compatible way of downloading strings to local un-named files, upgraded to use a hidden frame and optional mime | |
// v2 added named files via a[download], msSaveBlob, IE (10+) support, and window.URL support for larger+faster saves than dataURLs | |
// v3 added dataURL and Blob Input, bind-toggle arity, and legacy dataURL fallback was improved with force-download mime and base64 support. 3.1 improved safari handling. | |
// v4 adds AMD/UMD, commonJS, and plain browser support | |
// v4.1 adds url download capability via solo URL argument (same domain/CORS only) | |
// v4.2 adds semantic variable names, long (over 2MB) dataURL support, and hidden by default temp anchors | |
// https://github.com/rndme/download | |
export default function download (data, strFileName, strMimeType) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL="http://stackoverflow.com/" | |
# store the whole response with the status at the and | |
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL) | |
# extract the body | |
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g') | |
# extract the status | |
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$") | |
ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint" | |
if [[ "$STAGED_FILES" = "" ]]; then | |
exit 0 | |
fi | |
PASS=true |
OlderNewer