Skip to content

Instantly share code, notes, and snippets.

View snarky's full-sized avatar

Bruno CHIREZ snarky

View GitHub Profile
{
"uid": "<UID>",
"code": "TOTO",
"target": "https://google.Com"
}
@snarky
snarky / empty-matrix.yaml
Created February 23, 2021 10:44
Github actions
on:
pull_request:
jobs:
not-empty-matrix:
runs-on: ubuntu-latest
steps:
- run: true
outputs:
matrix: '["0.0.1", "0.0.2"]'
@snarky
snarky / cmd.sh
Last active November 3, 2015 14:48
GIT TIPS
# Fetch all branches after un git clone single-branch
$ git clone --single-branch <url>
...
$ git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
$ git fetch origin
$ export GIT_SSL_NO_VERIFY=1
$ git config http.postBuffer 524288000
$ git config core.fileMode false
@snarky
snarky / command.sh
Created June 11, 2015 09:10
Mac OS X > Upgrade all applications via brew (+ brew cask)
brew update
brew upgrade --all
brew cleanup
brew cask update
brew cask install --force $(brew cask list)
brew cask cleanup
<?php
/** @var $repository \eZ\Publish\API\Repository\Repository */
$repository = $this->getContainer()->get( 'ezpublish.api.repository' );
$contentService = $repository->getContentService();
$locationService = $repository->getLocationService();
$contentTypeService = $repository->getContentTypeService();
$repository->setCurrentUser( $repository->getUserService()->loadUser( 14 ) );
// fetch the input arguments
$parentLocationId = $input->getArgument( 'parentLocationId' );
@snarky
snarky / ezpublish.yml
Last active August 29, 2015 14:19
eZ Publish stash config (FileSystem, Memcache, Redis)
stash:
caches:
default:
# For eZ Publish Platform versions prior to 5.4/2014.07, use "handlers" instead of "drivers"!
drivers:
- FileSystem
inMemory: true
registerDoctrineAdapter: false
stash:
@snarky
snarky / sample.tpl
Last active November 3, 2015 16:12
eZ Publish 4 : HTML5 figure with caption
<figure class="{if $object_parameters.align}object-{$object_parameters.align}{/if}{if ne($classification|trim,'')} {$classification|wash}{/if}"{if is_set($object_parameters.id)} id="{$object_parameters.id}"{/if}>
<img src="{$object.data_map.image.content[$object_parameters.size].url|ezroot(no)}" width="{$object.data_map.image.content.width}" height="{$object.data_map.image.content.height}" alt="{$object.data_map.image.content.alternative_text}" />
{if and(is_set($object.data_map.caption), $object.data_map.caption.has_content)}
<figcaption>{attribute_view_gui attribute=$object.data_map.caption}</figcaption>
{/if}
</figure>
@snarky
snarky / sample.tpl
Last active November 3, 2015 16:09
eZ Publish 4 : Fetch collection of nodes filtered by current week number
{def
$current_timestamp = currentdate()
$current_year = $current_timestamp|datetime('custom', '%Y')
$current_week = $current_timestamp|datetime('custom', '%W')
$current_week_start = strtotime(concat($current_year, 'W', $current_week))
$current_week_end = strtotime(concat($current_year, 'W', $current_week, '7'))
$nodes = fetch(content, list, hash(
parent_node_id, $node.node_id,
class_filter_type, 'include',
class_filter_array, array('class_identifier'),
@snarky
snarky / gist:1044703
Last active November 3, 2015 16:14
MYSQL : Convert timestampdiff to hours minutes
SELECT CONCAT(duration DIV 3600, 'h', IF(MOD(duration, 3600) / 60 > 0, LPAD(ROUND(MOD(duration, 3600) / 60), 2, '0'), ''));
@snarky
snarky / gist:991092
Last active November 3, 2015 16:17
Twitter timeDiffInWords
<?php
function timeDiffInWords($time)
{
$second = 1;
$minute = $second * 60;
$hour = $minute * 60;
$day = $hour * 24;
$week = $day * 7;