create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
$(carousel_selector) | |
.owlCarousel(owlOptions) | |
.on('changed.owl.carousel', function(e) { | |
// Number of items, not counting cloned ones. | |
var count = e.item.count; | |
// When carousel is infinite, | |
// there's a certain offset to the first item. | |
// We'll try to remove it to do our calculations. | |
var offset = Math.floor((count + 1) / 2); | |
// This posittion index includes some offset. |
<?php | |
/** | |
* Implements hook_views_pre_view(). | |
*/ | |
function projectname_views_pre_view(\Drupal\views\ViewExecutable $view, $display_id, array &$args) { | |
// Project - Assets - 'Add' link. | |
if ($view->id() == 'project_assets' && $display_id === 'block_1') { | |
$account = \Drupal::currentUser(); | |
// If we're in a group. | |
if (($group = \Drupal::routeMatch()->getParameter('group')) && |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
Url::fromUri('internal:/')->setAbsolute()->toString() |
<?php | |
public function get($field_name) { | |
if (!isset($this->fields[$field_name][$this->activeLangcode])) { | |
return $this->getTranslatedField($field_name, $this->activeLangcode); | |
} | |
return $this->fields[$field_name][$this->activeLangcode]; | |
} | |
public function &__get($name) { |
export PHP_IDE_CONFIG="serverName={SERVER NAME IN PHP STORM}" | |
export XDEBUG_CONFIG="remote_host=$(echo $SSH_CLIENT | awk '{print $1}') idekey=PHPSTORM" |
<?php | |
$mime = \Drupal::service('file.mime_type.guesser')->guess($uri); |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
<?php | |
$url = $item['content']['field_media_image'][0]['#url']; | |
$media_id = $url->getRouteParameters()['media']; | |
$media = entity_load('media', $media_id); | |
$filefield = $media->field_image_file->referencedEntities(); | |
$entity = current($entity); | |
$uri = $entity->getFileUri(); | |
$url = Url::fromUri(file_create_url($uri))->toString(); |
This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.
Convert .mov/.MP4 to .gif
As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.
This is not limited to developer, anyone has this need can use this method to convert the files.